iigs-game-engine/src/blitter/Tiles00011.s
Lucas Scharenbroich 4e779e71d2 Tile rendering reorganization
This significantly simplifies the dispatch process by creating a
proper backing store for the tiles.  Most values that were
calcualted on the fly are now stored as constants in the tile
store.

Also, all tile updated are run through the dirty tile list which
solved a checken-and-egg problem of which order to do sprites vs
new tiles and affords a lot of optimizations since tile rendering
is deferred and each tile is only drawn at most once per frame.
2021-10-21 08:50:07 -05:00

65 lines
2.6 KiB
ArmAsm

; _TBDynamicMaskTile
;
; Insert a code sequence to mask the dynamic tile against the background. This is quite a slow process because
; every word needs to be handled with a JMP exception; but it looks good!
_TBDynamicMaskTile dw _TBDynamicMaskTile_00,_TBDynamicMaskTile_00,_TBDynamicMaskTile_00,_TBDynamicMaskTile_00
dw _TBDynamicTile_00,_TBDynamicTile_00,_TBDynamicTile_00,_TBDynamicTile_00
_TBDynamicMaskTile_00
jsr _TBDynamicDataAndMask
jmp _TBFillJMPOpcode
; A = dynamic tile id (must be <32)
_TBDynamicDataAndMask
and #$007F ; clamp to < (32 * 4)
sta _T_PTR
stx _X_REG
CopyMaskedDWord $0003
CopyMaskedDWord $1003
CopyMaskedDWord $2003
CopyMaskedDWord $3003
CopyMaskedDWord $4003
CopyMaskedDWord $5003
CopyMaskedDWord $6003
CopyMaskedDWord $7003
inc _T_PTR ; Move to the next column
inc _T_PTR
inc _X_REG ; Move to the next column
inc _X_REG
CopyMaskedDWord $0000
CopyMaskedDWord $1000
CopyMaskedDWord $2000
CopyMaskedDWord $3000
CopyMaskedDWord $4000
CopyMaskedDWord $5000
CopyMaskedDWord $6000
CopyMaskedDWord $7000
rts
; A simple helper function that fill in all of the opcodes of a tile with the JMP opcode.
_TBFillJMPOpcode
sep #$20
lda #$4C
sta: $0000,y
sta: $0003,y
sta $1000,y
sta $1003,y
sta $2000,y
sta $2003,y
sta $3000,y
sta $3003,y
sta $4000,y
sta $4003,y
sta $5000,y
sta $5003,y
sta $6000,y
sta $6003,y
sta $7000,y
sta $7003,y
rep #$20
rts