Author Topic: CPCTelera : CPC+ Sprite Hardware  (Read 1582 times)

0 Members and 1 Guest are viewing this topic.

Offline Arnaud

  • Supporter
  • 6128 Plus
  • *
  • Posts: 546
  • Country: fr
  • Liked: 456
  • Likes Given: 883
CPCTelera : CPC+ Sprite Hardware
« on: 13:32, 28 July 19 »
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
« Last Edit: 11:08, 27 August 19 by Arnaud »

Offline XeNoMoRPH

  • 6128 Plus
  • ******
  • Posts: 540
  • Country: es
  • " ... in space no one , can hear you scream ... "
  • Liked: 1077
  • Likes Given: 933
Re: CPCTelera : CPC+ Sprite Hardware
« Reply #1 on: 16:45, 28 July 19 »

https://vimeo.com/350579592
Awesome Smooth sprites !!!  :o :o :o ,
I have captured it on video

Offline Arnaud

  • Supporter
  • 6128 Plus
  • *
  • Posts: 546
  • Country: fr
  • Liked: 456
  • Likes Given: 883
Re: CPCTelera : CPC+ Sprite Hardware
« Reply #2 on: 17:02, 28 July 19 »
Great to make this video  ;D

Honestly, the CPC+ makes all the work.


Offline asertus

  • CPC664
  • ***
  • Posts: 73
  • Country: es
  • Liked: 58
  • Likes Given: 206
Re: CPCTelera : CPC+ Sprite Hardware
« Reply #3 on: 22:08, 28 July 19 »
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..
« Last Edit: 10:08, 29 July 19 by asertus »

Offline TotO

  • 6128 Plus
  • ******
  • Posts: 3.469
  • Country: fr
    • ?area=showdonations;u=4
  • Liked: 2636
  • Likes Given: 1565
Re: CPCTelera : CPC+ Sprite Hardware
« Reply #4 on: 23:07, 28 July 19 »
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.
« Last Edit: 23:12, 28 July 19 by TotO »
"You make one mistake in your life and the internet will never let you live it down" (Keith Goodyer)

Offline zhulien

  • 464 Plus
  • *****
  • Posts: 434
  • Country: au
    • 8bitology
  • Liked: 195
  • Likes Given: 121
Re: CPCTelera : CPC+ Sprite Hardware
« Reply #5 on: 12: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.

Offline TotO

  • 6128 Plus
  • ******
  • Posts: 3.469
  • Country: fr
    • ?area=showdonations;u=4
  • Liked: 2636
  • Likes Given: 1565
Re: CPCTelera : CPC+ Sprite Hardware
« Reply #6 on: 13:38, 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)

Offline zhulien

  • 464 Plus
  • *****
  • Posts: 434
  • Country: au
    • 8bitology
  • Liked: 195
  • Likes Given: 121
Re: CPCTelera : CPC+ Sprite Hardware
« Reply #7 on: 18:45, 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

Offline norecess

  • CPC664
  • ***
  • Posts: 98
  • Country: ca
  • Liked: 254
  • Likes Given: 87
Re: CPCTelera : CPC+ Sprite Hardware
« Reply #8 on: 23:07, 04 August 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).

Offline TotO

  • 6128 Plus
  • ******
  • Posts: 3.469
  • Country: fr
    • ?area=showdonations;u=4
  • Liked: 2636
  • Likes Given: 1565
Re: CPCTelera : CPC+ Sprite Hardware
« Reply #9 on: 01:49, 05 August 19 »
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)

Offline andycadley

  • Supporter
  • 6128 Plus
  • *
  • Posts: 853
  • Liked: 409
  • Likes Given: 72
Re: CPCTelera : CPC+ Sprite Hardware
« Reply #10 on: 11:14, 05 August 19 »
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.

Offline Arnaud

  • Supporter
  • 6128 Plus
  • *
  • Posts: 546
  • Country: fr
  • Liked: 456
  • Likes Given: 883
Re: CPCTelera : CPC+ Sprite Hardware
« Reply #11 on: 21:08, 16 August 19 »
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
« Last Edit: 11:07, 27 August 19 by Arnaud »

Offline Ast

  • 6128 Plus
  • ******
  • Posts: 1.017
  • Country: fr
    • Amstrad cpc Website of Ast/iMPACT
  • Liked: 807
  • Likes Given: 689
Re: CPCTelera : CPC+ Sprite Hardware
« Reply #12 on: 22:35, 16 August 19 »
@Arnaud : you'll have to find a tittle now   :P
_____________________

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


Amstrad Plus French Forum

All friends are welcomed !

Offline Arnaud

  • Supporter
  • 6128 Plus
  • *
  • Posts: 546
  • Country: fr
  • Liked: 456
  • Likes Given: 883
Re: CPCTelera : CPC+ Sprite Hardware
« Reply #13 on: 17:12, 17 August 19 »
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

* cpcplus_src.zip
(84.96 kB - downloaded 27 times)
« Last Edit: 11:43, 18 August 19 by Arnaud »

Offline Arnaud

  • Supporter
  • 6128 Plus
  • *
  • Posts: 546
  • Country: fr
  • Liked: 456
  • Likes Given: 883
Re: CPCTelera : CPC+ Sprite Hardware
« Reply #14 on: 11:04, 27 August 19 »
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.


Offline norecess

  • CPC664
  • ***
  • Posts: 98
  • Country: ca
  • Liked: 254
  • Likes Given: 87
Re: CPCTelera : CPC+ Sprite Hardware
« Reply #15 on: 20:06, 27 August 19 »
@Arnaud
I quickly looked at the implementation.
In file cpct_asicSetPalColour.asm, cpct_asicSetSpritePalColor.asm and the likes, I suggest to replace
Code: [Select]
ld   hl, #ASIC_PALETTE_COLOUR by
Code: [Select]
ld   h, #ASIC_PALETTE_COLOUR >> 8 (or equivalent based on SDCC syntax)

Offline norecess

  • CPC664
  • ***
  • Posts: 98
  • Country: ca
  • Liked: 254
  • Likes Given: 87
Re: CPCTelera : CPC+ Sprite Hardware
« Reply #16 on: 20:10, 27 August 19 »
@Arnold
also, for
Code: [Select]
cpct_asicSafeInterruptHandlerHook:   di       ;; Disable interrupts you don't need the DI instruction, interrupts are already deactivated when triggered

Offline norecess

  • CPC664
  • ***
  • Posts: 98
  • Country: ca
  • Liked: 254
  • Likes Given: 87
Re: CPCTelera : CPC+ Sprite Hardware
« Reply #17 on: 20:13, 27 August 19 »
@Arnold
you can replace
Code: [Select]
ld  a, #00                     ;; Reset CRTC default interrupt at 300hz by
Code: [Select]
xor a

Offline norecess

  • CPC664
  • ***
  • Posts: 98
  • Country: ca
  • Liked: 254
  • Likes Given: 87
Re: CPCTelera : CPC+ Sprite Hardware
« Reply #18 on: 20:14, 27 August 19 »
(I like the way CPCTelera is documented, good stuff !)

Offline Arnaud

  • Supporter
  • 6128 Plus
  • *
  • Posts: 546
  • Country: fr
  • Liked: 456
  • Likes Given: 883
Re: CPCTelera : CPC+ Sprite Hardware
« Reply #19 on: 20:55, 27 August 19 »
Hi @norecess,
thanks for review.

Code: [Select]
ld   h, #ASIC_PALETTE_COLOUR >> 8
Code: [Select]
#ASIC_PALETTE_COLOUR = #6400 = #0x1900
ld h, #ASIC_PALETTE_COLOUR >> 8 = ld h, #0x19
but L should be set to 0x00.

Code: [Select]
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 ?

you can replace
Code: [Select]
ld  a, #00                     ;; Reset CRTC default interrupt at 300hz by
Code: [Select]
xor a
Of course  ;)

(I like the way CPCTelera is documented, good stuff !)
This is the hard work of @ronaldo  :D
« Last Edit: 20:57, 27 August 19 by Arnaud »

Offline MacDeath

  • Chaotic post writer and mock-up specialist
  • Supporter
  • 6128 Plus
  • *
  • Posts: 4.054
  • Country: fr
  • Liked: 1142
  • Likes Given: 638
Re: CPCTelera : CPC+ Sprite Hardware
« Reply #20 on: 02:09, 16 November 19 »
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...
« Last Edit: 02:13, 16 November 19 by MacDeath »