; *************************************************************; ClearSprite; Clears the sprite counter; a0 address of sprite counter; *************************************************************ClearSprites:move.b#0,(a0); set sprite list count to 0rts; *************************************************************; 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 - spritelist; a1 - spritelist counter; *************************************************************AddSprite:clr.wd5; clear register d5move.b(a0),d5; sprint list counter in d5cmp.b#79,d5; are there too many sprites in the table already?bgt.sSkipAddSprite; if not branchclr.wd6; clear register d6move.bd5,d6; d6 is used to calculate the sprite table offsetlsl.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 tableaddq.l#1,d5; increment d5(sprite_count) by 1move.bd5,(a0)+; index of next sprite is d5(sprite_count +1) move.bd2,(a0)+; save sprites special bitsmove.bd3,(a0)+; save sprites tile id in tablemove.wd4,(a0)+; save sprites x position in tablemove.bd5,(a0); store new sprite list counterSkipAddSprite:rts; *************************************************************; Updates and draws the sprite table; d0 - spritelist counter; a0 - spritelist; *************************************************************UpdateSprites:and.l#0x000000FF,d0mulu.w#SizeSpriteDesc,d0; Offset into sprite tableswapd0; To upper wordor.l#vdp_write_sprite_table,d0; Add to write addressmove.ld0,vdp_control; Set read addressmove.l(a0)+,vdp_data; 8 bytes of datamove.l(a0)+,vdp_datarts
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.