mirror of
https://github.com/lscharen/iigs-game-engine.git
synced 2025-01-16 08:33:17 +00:00
Move dispatch table into K bank and save 9 cycles per tile in dispatch
This commit is contained in:
parent
227643d7df
commit
3c41e97b0f
@ -46,7 +46,6 @@ ToolStartUp
|
||||
rts
|
||||
|
||||
MasterId ds 2
|
||||
;UserId ds 2
|
||||
|
||||
; Fatal error handler invoked by the _Err macro
|
||||
PgmDeath tax
|
||||
|
11
src/Tiles.s
11
src/Tiles.s
@ -111,7 +111,7 @@ InitTiles
|
||||
bra :out
|
||||
:fast
|
||||
ldal FastTileProcs
|
||||
sta TileStore+TS_BASE_TILE_DISP,x
|
||||
stal K_TS_BASE_TILE_DISP,x
|
||||
:out
|
||||
|
||||
; lda DirtyTileProcs ; Fill in with the first dispatch address
|
||||
@ -213,7 +213,9 @@ _SetTile
|
||||
|
||||
:fast
|
||||
ldal FastTileProcs,x
|
||||
sta TileStore+TS_BASE_TILE_DISP,y
|
||||
tyx
|
||||
stal K_TS_BASE_TILE_DISP,x
|
||||
|
||||
:out
|
||||
jmp _PushDirtyTileY ; on the next call to _ApplyTiles
|
||||
|
||||
@ -412,4 +414,7 @@ b_12_3 stpbit 12;3;]4
|
||||
b_13_3 stpbit 13;3;]4
|
||||
b_14_3 stpbit 14;3;]4
|
||||
b_15_3 endbit 15;3;]4
|
||||
<<<
|
||||
<<<
|
||||
|
||||
; Store some tables in the K bank that will be used exclusively for jmp (abs,x) dispatch
|
||||
K_TS_BASE_TILE_DISP ds TILE_STORE_SIZE
|
@ -13,25 +13,20 @@ NoSpriteFast
|
||||
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
|
||||
lda TileStore+TS_BASE_TILE_DISP,x ; go to the tile copy routine (just basics)
|
||||
stal nsf_patch+1
|
||||
; lda TileStore+TS_BASE_TILE_DISP,x ; go to the tile copy routine (just basics)
|
||||
; stal nsf_patch+1
|
||||
lda TileStore+TS_TILE_ADDR,x ; load the address of this tile's data (pre-calculated)
|
||||
plb ; set the code field bank
|
||||
nsf_patch jmp $0000
|
||||
jmp (K_TS_BASE_TILE_DISP,x)
|
||||
|
||||
;nsf_patch jmp $0000
|
||||
|
||||
; The TS_BASE_TILE_DISP routines will come from this table when ENGINE_MODE_TWO_LAYER and
|
||||
; ENGINE_MODE_DYN_TILES are both off.
|
||||
FastTileProcs dw _TBCopyDataFast,_TBCopyDataFast,_TBCopyDataFast,_TBCopyDataFast
|
||||
|
||||
; dw _TBCopyDataFast,_TBCopyDataFast,_TBCopyDataVFast,_TBCopyDataVFast
|
||||
|
||||
; NOTE: Inlining the dispatch would eliminate a JSR,RTS,LDX, and JMP (abs,x) because the exit code
|
||||
; could jump directly to the target address. Net savings of 20 cycles per tile. For a 16x16
|
||||
; sprite with a 3x3 block coverage this is 180 cycles per frame per block... This would also
|
||||
; preserve a register
|
||||
;
|
||||
; For comparison, a fast one sprite copy takes 22 cycles per word, so this would save
|
||||
; about 1/2 block of render time per tile.
|
||||
;
|
||||
; Need to determine if the sprite or tile data is on top, as that will decide whether the
|
||||
; sprite or tile data is copied into the temporary buffer first. Also, if TWO_LAYER is set
|
||||
; then the mask information must be copied as well....This is the last decision point.
|
||||
|
Loading…
x
Reference in New Issue
Block a user