From 02bc6fe493501d6e2b82ca028c4c7f6c75435181 Mon Sep 17 00:00:00 2001 From: Lucas Scharenbroich Date: Tue, 14 Mar 2023 09:11:53 -0500 Subject: [PATCH] Comment cleanup; rename FRINGE tile control bit --- src/Defs.s | 2 +- src/render/Render.s | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/Defs.s b/src/Defs.s index 10e4529..3d48e3d 100644 --- a/src/Defs.s +++ b/src/Defs.s @@ -219,7 +219,7 @@ PAD_KEY_DOWN equ $0400 ; Tile constants TILE_DAMAGED_BIT equ $8000 ; Mark a tile as damaged (internal only) TILE_PRIORITY_BIT equ $4000 ; Put tile on top of sprite (unimplemented) -TILE_FRINGE_BIT equ $2000 ; Unused +TILE_USER_BIT equ $2000 ; User-defined tile. Execute registered callback. TILE_SOLID_BIT equ $1000 ; Hint bit used in TWO_LAYER_MODE to optimize rendering TILE_DYN_BIT equ $0800 ; Is this a Dynamic Tile? TILE_VFLIP_BIT equ $0400 diff --git a/src/render/Render.s b/src/render/Render.s index 27ad255..8bd8606 100644 --- a/src/render/Render.s +++ b/src/render/Render.s @@ -4,6 +4,10 @@ _RenderTile lda TileStore+TS_SPRITE_FLAG,x ; any sprites on this tile? bne _HasSprites +; Probably best to rework this to just jump to the tile routine directly, event if there +; is some boilerplate code because it is useful to be able to access the data bank before +; switching to the code field bank. + lda TileStore+TS_CODE_ADDR_HIGH,x ; load the bank of the target code field line pha ; and put on the stack for later. Has TileStore bank in high byte. ldy TileStore+TS_CODE_ADDR_LOW,x ; load the address of the code field @@ -11,23 +15,23 @@ _RenderTile plb ; set the code field bank jmp (K_TS_BASE_TILE_DISP,x) ; go to the tile copy routine -; This is the specialized rederer for the dirty tile rendering mode. The difference is that +; This is the specialized renderer for the dirty tile rendering mode. The difference is that ; it is assumed that the screen is static and the tiles are aligned with the graphics screen. ; The engine must be in "Fast" tile mode for dirty tile rendering to work. It is possible ; to switch the engine into this mode by rendering a full screen of solid tiles and then ; doing a dirty tile rendering. ; ; The main result is that this renderer skips copying tile data into the play field and -; just draws to the screen directly. +; just draws to the screen directly, and only draws tiles in the dirty tile queue _RenderDirtyTile lda TileStore+TS_SPRITE_FLAG,x ; any sprites on this tile? bne _HasSprites jmp (K_TS_BASE_TILE_DISP,x) ; This is just to select between H/V flips ; Execute the sprite tree. If there is only one sprite, control will immediately be passed to -; the routine at K_TS_ONE_SPRITE. Otherwise, the control passed to the routines with a different -; number of sprites. These routines need to copy the flattened sprite data and mask into the -; direct page workspace to be used by the K_TS_SPRITE_TILE_DISP routine +; the routine at K_TS_ONE_SPRITE. Otherwise, the control is passed to a routine based on the +; different number of sprites. These routines need to copy the flattened sprite data and mask +; into the direct page workspace to be used by the K_TS_SPRITE_TILE_DISP routine _HasSprites txy SpriteBitsToVBuffAddrs $0000;TwoSprites;ThreeSprites;FourSprites @@ -36,7 +40,7 @@ _HasSprites txy ; 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, +; NOTE: Could pull the CopyXXXSprites function inline and save the 3 cycles for the JMP, ; - or - put the TYX into the macro and jump directly from there. TwoSprites tyx jmp CopyTwoSpritesDataAndMaskToDP