sima
New Member
Posts: 2
|
Post by sima on Jan 3, 2009 12:22:08 GMT -5
Hello
I would be interested in hearing about the way sprite drawing routines were coded for ZX Spectrum.
Any tricks or tips about masking, rotating or mirroring of sprites (or other)?
Were there different routines for drawing different sized sprites?
|
|
|
Post by Paulie on Jan 8, 2009 16:49:13 GMT -5
I suppose the most common way was to interleave the sprite and mask data, and then point the stack at the graphic. A single POP would retrieve both mask and data; ld a, (hl) pop de and d or e ld (hl), a inc l
You would have that repeated for each sprite width and then self modify the jump in address and Y line loop branch to the point you needed for your sprite width.
For speed you would have the sprites pre-shifted in X so you only needed to plot on byte boundaries and for mirroring you would either store them x flipped (big memory footprint) or take the data byte and mask and look up the flipped equivalent in a 256 byte table (although this was much slower!) before drawing.
|
|
|
Post by Bill Harbison on Jan 9, 2009 4:27:01 GMT -5
Now look what you've done Sima, you've set him off now... I suppose the most common way was to interleave the sprite and mask data, and then point the stack at the graphic. A single POP would retrieve both mask and data; ld a, (hl) pop de and d or e ld (hl), a inc l You would have that repeated for each sprite width and then self modify the jump in address and Y line loop branch to the point you needed for your sprite width. For speed you would have the sprites pre-shifted in X so you only needed to plot on byte boundaries and for mirroring you would either store them x flipped (big memory footprint) or take the data byte and mask and look up the flipped equivalent in a 256 byte table (although this was much slower!) before drawing.
|
|
|
Post by Paulie on Jan 9, 2009 15:52:05 GMT -5
Now, now William don't make me mention those "Big Feast" trees
|
|
|
Post by Bill Harbison on Jan 14, 2009 17:33:45 GMT -5
Damn you!
|
|