News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_Arnaud

CPCTelera : CPC+ Sprite Hardware

Started by Arnaud, 11:32, 28 July 19

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Arnaud

Hello,
here a little demo of the implementation of the CPC+ Sprite Hardware in CPCTelera.

I'm now working to make the code as comprehensible as possible (asm and example) before release it (here and on a Github CPCTelera branch).


On the screnshot 22 colors are used in mode 1  :D
Hardware Sprites are really easy to use and can be mixed on screen with "classical" software Sprites in the same time.

Arnaud

For more detailled informations on HW Sprites : http://www.chibiakumas.com/z80/platform4.php#LessonP32

Repository : https://github.com/Arnaud6128/cpctelera/tree/cpcplus_asic

XeNoMoRPH


https://vimeo.com/350579592
Awesome Smooth sprites !!!  :o :o :o ,
I have captured it on video
your amstrad news source in spanish language : https://auamstrad.es

Arnaud

Great to make this video  ;D

Honestly, the CPC+ makes all the work.


asertus

#3
It's a pity this sprite support was not in the original 464, or at least in the 6128, the MSX2 were done those things quite well..

TotO

#4
The shame is that PLUS sprites requires to copy data (byte) instead of updating address pointers.
The MSX had poor sprites (1 bit, 4 per raster line) and not descent screen scrolling at all.

By the way, the CPC was more close to a PC than a MSX/Coleco into its design and had been better to have blitting functions to do what we want with our imaginations, instead to be limited by a fixed sprite system that conditions the types of games, demo, ... you can program with them.
"You make one mistake in your life and the internet will never let you live it down" (Keith Goodyer)

zhulien

I wonder if then, if a small genlock circuit can be made with hardware sprites external to the CPC RAM, but genlocked into the display before output to the screen?  Maybe not just sprints, but copper functions and perhaps even display lists.

TotO

Quote from: zhulien on 10:28, 29 July 19
I wonder if then, if a small genlock circuit can be made with hardware sprites external to the CPC RAM, but genlocked into the display before output to the screen?  Maybe not just sprints, but copper functions and perhaps even display lists.
Sure. Or best, a Graffiti like display system.
"You make one mistake in your life and the internet will never let you live it down" (Keith Goodyer)

zhulien

Quote from: TotO on 11:38, 29 July 19
Sure. Or best, a Graffiti like display system.


That is actually a good idea for a future CPC generation, but in a way so that existing CPC owners can buy a CPC-Graffiti as an option

norecess464

Quote from: TotO on 21:07, 28 July 19
The shame is that PLUS sprites requires to copy data (byte) instead of updating address pointers.

Actually, it's not that bad! Updating a sprite the lame way (cf. without using advanced techniques) using 256 LDIs takes 256*5 NOPs = 1280 NOPs, which represents 6.4% of available CPU time for 1 frame (19968 NOPs).

Tip: If you have let's say 4 sprites to update, and if your game design allows it, then use 4 frames to update 1 sprite (instead of 1 frame updating 4 sprites).
My personal website: https://norecess.cpcscene.net
My current project is Sonic GX, a remake of Sonic the Hedgehog for the awesome Amstrad GX-4000 game console!

TotO

Sure, the limitations are always the best challenges to produce some clever codes. We love "CPC" for that.
"You make one mistake in your life and the internet will never let you live it down" (Keith Goodyer)

andycadley

Yeah, it's really only awkward from a multiplexing point of view, because you can't easily re-use a sprite unless the image is the same as a previous one. Or unless they are far enough apart and your timing pretty good.

Arnaud

#11
Update :
- All my functions are nearly finished and commented and i have added "Raster lines interrupt" feature, now there are 34 colors for Mode 1  :D
- Finally my demo became a little game, we have to escape from the Asteroid Field (my five years old son really like it ;))

Arnaud

Ast

@Arnaud : you'll have to find a tittle now   :P
_____________________

Ast/iMP4CT. "By the power of Grayskull, i've the power"

http://amstradplus.forumforever.com/index.php
http://impdos.wikidot.com/
http://impdraw.wikidot.com/

All friends are welcome !

Arnaud

#13
Hi,
here the CPCtelera project (v1.5) for CPC+ Sprite Hardware :
- Game demo in cpcplus/src
- Asic functions in cpcplus/src/asic

And tested on real CPC Plus.

All remarks are welcome  :)

Next step is to send to a branch in Github/cpctelera

[attach=1,msg177248]

Arnaud

Hi,
the repository fork from cpctelera/cpcplus_asic is online :
https://github.com/Arnaud6128/cpctelera/tree/cpcplus_asic

You can directly download a version of cpctelera including asic functions and the game example.

The raster interrupt lines has been reviewed and optimized and by @ronaldo.


norecess464

@Arnaud
I quickly looked at the implementation.
In file cpct_asicSetPalColour.asm, cpct_asicSetSpritePalColor.asm and the likes, I suggest to replace ld   hl, #ASIC_PALETTE_COLOUR by ld   h, #ASIC_PALETTE_COLOUR >> 8 (or equivalent based on SDCC syntax)
My personal website: https://norecess.cpcscene.net
My current project is Sonic GX, a remake of Sonic the Hedgehog for the awesome Amstrad GX-4000 game console!

norecess464

@Arnold
also, for cpct_asicSafeInterruptHandlerHook:   di       ;; Disable interrupts you don't need the DI instruction, interrupts are already deactivated when triggered
My personal website: https://norecess.cpcscene.net
My current project is Sonic GX, a remake of Sonic the Hedgehog for the awesome Amstrad GX-4000 game console!

norecess464

@Arnold
you can replace ld  a, #00                     ;; Reset CRTC default interrupt at 300hz by xor a
My personal website: https://norecess.cpcscene.net
My current project is Sonic GX, a remake of Sonic the Hedgehog for the awesome Amstrad GX-4000 game console!

norecess464

(I like the way CPCTelera is documented, good stuff !)
My personal website: https://norecess.cpcscene.net
My current project is Sonic GX, a remake of Sonic the Hedgehog for the awesome Amstrad GX-4000 game console!

Arnaud

#19
Hi @norecess,
thanks for review.

Quote from: norecess on 18:06, 27 August 19
ld   h, #ASIC_PALETTE_COLOUR >> 8
#ASIC_PALETTE_COLOUR = #6400 = #0x1900
ld h, #ASIC_PALETTE_COLOUR >> 8 = ld h, #0x19

but L should be set to 0x00.

Quote from: norecess on 18:10, 27 August 19
cpct_asicSafeInterruptHandlerHook:   di       ;; Disable interrupts you don't need the DI instruction, interrupts are already deactivated when triggered
Ok and interrupts have to be reenabled at the end.
This modification may be also applied to cpct_setInterruptHandler. What do you think about this @ronaldo ?

Quote from: norecess on 18:13, 27 August 19
you can replace ld  a, #00                     ;; Reset CRTC default interrupt at 300hz by xor a
Of course  ;)

Quote from: norecess on 18:14, 27 August 19
(I like the way CPCTelera is documented, good stuff !)
This is the hard work of @ronaldo  :D

MacDeath

#20
Just discovered that nice little demo...

Very good.
Seems the AmstradPLUS is now getting awoken and its true potential starts to show.

very imperfect machine, that's what makes it interesting, and it is still some sort of CPC anyway.
surely with some blitter it would have been a great proper 8bit Atari STe and one of the kickassest 8bit around... perhaps some additionnal character attributes system could have been great as well.  :o

Just imagine : character attribute system, you can choose between 16 palettes and chose mode per character...  8)

but yeah this wasn't, good sport though...

Powered by SMFPacks Menu Editor Mod