; add the selection table to the sprite list move.w #selectionarrow_start_position_y, d0 ; Y coord (+ 128) move.b SelectionArrowDimensionBits, d1 ; Width (bits 0-1) and height (bits 2-3) in tiles move.b 0x00, d2 ; H/V flipping (bits 3/4), palette index (bits 5-6), priority (bit 7) move.b SelectionArrowTileID, d3 ; Index of first tile move.w #selectionarrow_start_position_x, d4 ; x coord (+ 128) lea (spritelist_table), a0 ; load address of sprite list table into a0 bsr AddSprite
; *************************************************************; AddSprite; Adds a sprite to the sprite table and increments counter; d0 - sprites y position; d1 - width and height tile bits; d2 - special (flipping, palette index, priority); d3 - tile id; d4 - sprites x position; a0 - sprite table; *************************************************************AddSprite:move.b(sprite_count),d5; sprint count in d5move.bd5,d6; d6 is used to calculate the sprite table offsetcmp.b#80,d5; are there too many sprites in the table already?bltSpriteLimitNotReached; if not branchrts; returnSpriteLimitNotReached:lsl.w#$03,d6; calculate sprite table offset (sprite count * sprite size)add.wd6,a0; increment address by offsetmove.wd0,(a0)+; move sprites y position into tablemove.bd1,(a0)+; move sprites demensions into tablelsl.w#8,d2; move priority, palette and flips to upper bitsor.wd2,d3; combine with tile idmove.wd2,(a0)+; save sprites special bits and tile id in tableaddq.l#1,d5; increment d5(sprite_count) by 1move.bd5,(a0)+; index of next sprite is d5(sprite_count +1) ; move.b d3, (a0)+ ; save sprites tile id in tablemove.wd4,(a0)+; save sprites x position in tableaddq#1,(sprite_count); increment sprite counter by 1rts
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.