SetSpritePosY:; Set sprite Y position; d0 (b) - Sprite ID; d1 (w) - Y coord; d2 (bb) - Sprite dimensions (width/height in subsprites); d3 (w) - Sprite height (pixels); d4 (b) - Y flipped; a1 ---- - Subsprite dimensions array; Correct Y coord for flippingcmp.b#0x0,d4beq.s@NoFlipYadd.wd3,d1; Flipped, working from bottom to top@NoFlipY:; Backup heightmove.wd1,d5; Loop columnsclr.ld3move.wd2,d3lsr.w#0x8,d3; Num cols to bottom bytesub.w#0x1,d3; -1 for loop counter@ColLp:; Reset heightmove.wd5,d1; Loop rowsclr.ld6move.wd2,d6and.w#0xFF,d6; Num rows in bottom bytesub.w#0x1,d6; -1 for loop counter@RowLp:; If flipped, pre-decrement Y poscmp.b#0x0,d4beq.s@NoPreDecmove.w(a1)+,d7; Get subsprite width/height from dimensions arrayandi.w#0xFF,d7; Get heightmulu#0x8,d7; To pixelssub.wd7,d1; Working bottom to top, sub height@NoPreDec:; Write X positionclr.ld7; Clear d7move.bd0,d7; Move sprite ID to d7mulu.w#SizeSpriteDesc,d7; Sprite array offset, Y in first byteswapd7; Move to upper wordor.l#vdp_write_sprite_table,d7; Add to sprite attr tablemove.ld7,vdp_control; Set dest addressmove.wd1,vdp_data; Move Y pos to data portaddq.w#0x1,d0; Next subsprite ID; If not flipped, post-increment Y poscmp.b#0x0,d4bne.s@NoPostIncmove.w(a1)+,d7; Get subsprite width/height from dimensions arrayandi.w#0xFF,d7; Get heightmulu#0x8,d7; To pixelsadd.wd7,d1; Working top to bottom, add height@NoPostInc:dbrad6,@RowLpdbrad3,@ColLprts
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.