From 0a7d9e15c7700b9225ba2e785f2d83ef389201ed Mon Sep 17 00:00:00 2001 From: Lucas Scharenbroich Date: Thu, 28 Oct 2021 22:18:33 -0500 Subject: [PATCH] Add external entry point to the erase function --- src/Sprite.s | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/Sprite.s b/src/Sprite.s index d2c837e..d72dbaa 100644 --- a/src/Sprite.s +++ b/src/Sprite.s @@ -46,9 +46,16 @@ _RenderSprites ; from. :render stx tmp0 ; stash the X register -; jsr _EraseSprite ; erase from the old position - ldx tmp0 + + txy + ldx _Sprites+OLD_VBUFF_ADDR,y + jsr _EraseTileSprite ; erase from the old position + + ldx _Sprites+VBUFF_ADDR,y + lda _Sprites+TILE_DATA_OFFSET,y + tay jsr _DrawTileSprite ; draw the sprite into the sprite plane + ldx tmp0 ldy #0 ; flags to mark if the sprite is aligned to the code field grid or not @@ -334,14 +341,14 @@ _DrawTileSprite ; Erase is easy -- set an 8x8 area of the data region to all $0000 and the corresponding mask ; resgion to all $FFFF ; -; A = sprite ID +; X = address is sprite plane -- erases an 8x8 region SPRITE_PLANE_SPAN equ 256 -_EraseSprite - asl - tay - ldx _Sprites+OLD_VBUFF_ADDR,y +EraseTileSprite ENT + jsr _EraseTileSprite + rtl +_EraseTileSprite phb ; Save the bank to switch to the sprite plane pea #^spritedata