From 58705653c4e54d687f3bee5a6e2ccc9b8765adbd Mon Sep 17 00:00:00 2001 From: Lucas Scharenbroich Date: Wed, 6 Jul 2022 07:18:49 -0500 Subject: [PATCH] Work on helpers to refresh TileStore procs based on rendering mode --- src/Tiles.s | 55 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 9 deletions(-) diff --git a/src/Tiles.s b/src/Tiles.s index 19e5c78..6b0d5c3 100644 --- a/src/Tiles.s +++ b/src/Tiles.s @@ -124,13 +124,6 @@ InitTiles :out -; lda DirtyTileProcs ; Fill in with the first dispatch address -; stal TileStore+TS_DIRTY_TILE_DISP,x -; -; lda TileProcs ; Same for non-dirty, non-sprite base case -; stal TileStore+TS_BASE_TILE_DISP,x - - ; The next set of values are constants that are simply used as cached parameters to avoid needing to ; calculate any of these values during tile rendering @@ -144,7 +137,6 @@ InitTiles lda BRowTableLow,y sta :base -; sta TileStore+TS_BASE_ADDR,x ; May not be needed later if we can figure out the right constant... lda :col ; Set the offset values based on the column asl ; of this tile @@ -155,7 +147,6 @@ InitTiles lda Col2CodeOffset+2,y clc adc :base -; adc TileStore+TS_BASE_ADDR,x sta TileStore+TS_CODE_ADDR_LOW,x ; Low word of the tile address in the code field lda JTableOffset,y @@ -175,6 +166,52 @@ InitTiles bpl :loop rts +; Reset all of the tile proc values in the playfield. +ResetVisibleTiles +:col equ tmp0 +:row equ tmp1 + + lda ScreenTileHeight + sta :row + lda ScreenTileWidth + sta :col + +:loop + lda EngineMode + bit #ENGINE_MODE_DYN_TILES+ENGINE_MODE_TWO_LAYER + beq :fast + bit #ENGINE_MODE_TWO_LAYER + beq :dyn +; ldal TileProcs +; sta TileStore+TS_BASE_TILE_DISP,x + bra :out +:fast + lda #0 ; Initialize with Tile 0 + ldy #FastProcs + jsr _SetTileProcs + bra :out + +:dyn lda #0 ; Initialize with Tile 0 + ldy #FastProcs + jsr _SetTileProcs + +:out + +; The next set of values are constants that are simply used as cached parameters to avoid needing to +; calculate any of these values during tile rendering + + dec :col + bpl :hop + dec :row + lda ScreenTileWidth + sta :col +:hop + + dex + dex + bpl :loop + rts + ; Set a tile value in the tile backing store. Mark dirty if the value changes ; ; A = tile id