From 2820d318a025edb66a754e7cbba10b940d3f401c Mon Sep 17 00:00:00 2001 From: Lucas Scharenbroich Date: Tue, 21 Jun 2022 11:23:06 -0500 Subject: [PATCH] Final cleanups for Fast mode --- src/Tiles.s | 10 ++++------ src/render/Fast.s | 8 ++++---- src/render/Render.s | 12 ++++++------ src/render/Sprite1.s | 7 ++----- src/render/Sprite2.s | 6 ++++++ 5 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/Tiles.s b/src/Tiles.s index 02e2f62..4731ab5 100644 --- a/src/Tiles.s +++ b/src/Tiles.s @@ -352,14 +352,12 @@ _SetTileProcs FastProcs FastOverZA dw _TBConstTile0,GenericOverZero,_OneSpriteFastOver0 FastOverZV dw _TBConstTile0,GenericOverZero,_OneSpriteFastOver0 -FastOverNA dw _TBCopyDataAFast,GenericOverZero,_OneSpriteFastOverA -FastOverNV dw _TBCopyDataVFast,GenericOverZero,_OneSpriteFastOverV -;FastOverNA dw _TBCopyDataAFast,GenericOverAFast,_OneSpriteFastOverA -;FastOverNV dw _TBCopyDataVFast,GenericOverVFast,_OneSpriteFastOverV +FastOverNA dw _TBCopyDataAFast,GenericOverAFast,_OneSpriteFastOverA +FastOverNV dw _TBCopyDataVFast,GenericOverVFast,_OneSpriteFastOverV FastUnderZA dw _TBConstTile0,GenericUnderZero,GenericUnderZero FastUnderZV dw _TBConstTile0,GenericUnderZero,GenericUnderZero -FastUnderNA dw _TBConstTile0,GenericOverZero,_OneSpriteFastUnderA -FastUnderNV dw _TBConstTile0,GenericOverZero,_OneSpriteFastOver0 +FastUnderNA dw _TBCopyDataAFast,GenericUnderAFast,_OneSpriteFastUnderA +FastUnderNV dw _TBCopyDataVFast,GenericUnderVFast,_OneSpriteFastUnderV ;FastUnderNA dw _TBCopyDataFast,GenericUnderAFast,_OneSpriteFastUnderA ;FastUnderNV dw _TBCopyDataVFast,GenericUnderVFast,_OneSpriteFastUnderV diff --git a/src/render/Fast.s b/src/render/Fast.s index 586e3ca..b1f2fbb 100644 --- a/src/render/Fast.s +++ b/src/render/Fast.s @@ -90,12 +90,12 @@ GenericUnderAFast lup 8 lda tmp_sprite_data+{]line*4} andl tiledata+{]line*4}+32,x - oral tiledata+{]line*4}+32,x + oral tiledata+{]line*4},x sta: $0004+{]line*$1000},y lda tmp_sprite_data+{]line*4}+2 andl tiledata+{]line*4}+32+2,x - oral tiledata+{]line*4}+32+2,x + oral tiledata+{]line*4}+2,x sta: $0001+{]line*$1000},y ]line equ ]line+1 --^ @@ -116,12 +116,12 @@ GenericUnderVFast lup 8 lda tmp_sprite_data+{]line*4} andl tiledata+{]src*4}+32,x - oral tiledata+{]src*4}+32,x + oral tiledata+{]src*4},x sta: $0004+{]line*$1000},y lda tmp_sprite_data+{]line*4}+2 andl tiledata+{]src*4}+32+2,x - oral tiledata+{]src*4}+32+2,x + oral tiledata+{]src*4}+2,x sta: $0001+{]line*$1000},y ]src equ ]src-1 ]dest equ ]dest+1 diff --git a/src/render/Render.s b/src/render/Render.s index 17722a7..ed74ca2 100644 --- a/src/render/Render.s +++ b/src/render/Render.s @@ -22,17 +22,17 @@ _RenderTile ; flatten the sprite data into the direct page workspace and then pass control ; to the configurable routine which is set in SetTile and knows what to do ; based on the tile properties (over/under, engine mode, etc.) +; +; NOTE: Could pull the CopyXXXSprites function inline and same the 3 cycles for the JMP, +; - or - put the TYX into the macro and jump directly from there. TwoSprites tyx - jsr CopyTwoSpritesDataAndMaskToDP - jmp (K_TS_SPRITE_TILE_DISP,x) + jmp CopyTwoSpritesDataAndMaskToDP ThreeSprites tyx - jsr CopyThreeSpritesDataAndMaskToDP - jmp (K_TS_SPRITE_TILE_DISP,x) + jmp CopyThreeSpritesDataAndMaskToDP FourSprites tyx - jsr CopyFourSpritesDataAndMaskToDP - jmp (K_TS_SPRITE_TILE_DISP,x) + jmp CopyFourSpritesDataAndMaskToDP ; Helper functions (and macros) diff --git a/src/render/Sprite1.s b/src/render/Sprite1.s index 57350ff..cea6c33 100644 --- a/src/render/Sprite1.s +++ b/src/render/Sprite1.s @@ -27,11 +27,8 @@ _OneSpriteFastOver0 plb ; Restore the TileStore bank rts -; Next implementation; drawing a sprite onto a regular tile. In this case we need to make -; use of the K_TS_COPY_TILE_DATA function because that takes care of copying the correct -; tile data into the direct page buffer. - -; The 1-sprite dispatch prserves the X-register, so it already points to the TileStore +; Next implementation; drawing a sprite onto a regular tile. The 1-sprite dispatch preerves the +; X-register, so it already points to the TileStore _OneSpriteFastOverV jsr FastCopyTileDataV diff --git a/src/render/Sprite2.s b/src/render/Sprite2.s index 6f296da..04c3467 100644 --- a/src/render/Sprite2.s +++ b/src/render/Sprite2.s @@ -80,9 +80,13 @@ CopyTwoSpritesDataToDP ]line equ ]line+1 --^ rts + CopyFourSpritesDataAndMaskToDP CopyThreeSpritesDataAndMaskToDP CopyTwoSpritesDataAndMaskToDP + pei DP2_SPRITEDATA_AND_TILESTORE_BANKS + plb + ]line equ 0 lup 8 ldy #{]line*SPRITE_PLANE_SPAN} @@ -98,5 +102,7 @@ CopyTwoSpritesDataAndMaskToDP sta tmp_sprite_mask+{]line*4}+2 ]line equ ]line+1 --^ + + plb jmp (K_TS_SPRITE_TILE_DISP,x)