Login
Back to forumSee the full topicGo to last reply

Posted By

Luca
on 2021-05-22
02:38:53
 Re: Software Sprites

You can download the sprites'source code of the game directly from the game's related page Pets Rescue, there's a .zip file with sources and demos.

Basically, the software sprites routine has a core routine made of a sequence of LDA AND ORA STA cycles, and analysing that a bit closer, there are some duties to perform before, and some better choices made of illegal opcodes and few other smart decisions about that wink
In general, you have to:
- restore background from the previous frame:
sprow23	ldy #$52 	; restore background
lda s2char9
sta (origin2),y
dey
lda s2char8
sta (origin2),y
dey
lda s2char7
sta (origin2),y
sprow22 ldy #$2a
lda s2char6
...

- choose next anomation frame and point to all the needed chars;
- look for the new location where to print the new chars and store the untouched background chars;
- do the magic using that same background, where to overlap the portion of the sprites chosen by the needed Y-shifting:
...
seekch1 lda charset,x
and (sp_and),y
ora (sp_ora),y
sta spriteset,x
...


Certainly, this is just one, of the different ways you can perform a software sprite (in chars in this case), reductions optimization and improvements can differ.

This is one frame of the 4-frame stars moving over and behind a 5x5 scroller which I coded for Smells Like Happy Birthday demo, in this worksheet you can locate three sets: the original graphics, the AND mask, the ORA with transparency: the first has evident use, the second is used to have the right "hole" into the background portion, the third uses the background color ($00) in order to ORA the rest of the graphics without involving the whole char box and differs from the previous one in a way that you can have in any condition a "contour" of the sprite coloured like background color, which is the "mask" of the sprite if you like to have one (I didn't, in that demo).





Back to top


Copyright © Plus/4 World Team, 2001-2024