mirror of
https://github.com/lscharen/iigs-game-engine.git
synced 2025-02-16 10:32:20 +00:00
Add rendering path for masked dynamic tiles
This commit is contained in:
parent
59f9e61559
commit
2966b1052b
@ -7,7 +7,7 @@ MoveLeft
|
||||
lsr
|
||||
jsl SetBG1XPos
|
||||
|
||||
jsl Render
|
||||
; jsl Render
|
||||
rts
|
||||
|
||||
MoveRight
|
||||
@ -23,7 +23,7 @@ MoveRight
|
||||
lsr
|
||||
jsl SetBG1XPos
|
||||
|
||||
jsl Render
|
||||
; jsl Render
|
||||
pla
|
||||
rts
|
||||
|
||||
@ -46,7 +46,7 @@ MoveUp
|
||||
; lsr
|
||||
; jsl SetBG1YPos
|
||||
|
||||
jsl Render
|
||||
; jsl Render
|
||||
rts
|
||||
|
||||
MoveDown
|
||||
@ -62,7 +62,7 @@ MoveDown
|
||||
; lsr
|
||||
; jsl SetBG1YPos
|
||||
|
||||
jsl Render
|
||||
; jsl Render
|
||||
pla
|
||||
rts
|
||||
|
||||
|
@ -34,7 +34,7 @@ NO_MUSIC equ 1 ; turn music + tool loadi
|
||||
|
||||
; Set up our level data
|
||||
jsr BG0SetUp
|
||||
; jsr BG1SetUp
|
||||
jsr BG1SetUp
|
||||
jsr TileAnimInit
|
||||
|
||||
; Allocate room to load data
|
||||
@ -51,6 +51,9 @@ NO_MUSIC equ 1 ; turn music + tool loadi
|
||||
lda #$FFFF
|
||||
jsl Render
|
||||
EvtLoop
|
||||
jsl DoTimers
|
||||
jsl Render
|
||||
|
||||
jsl ReadControl
|
||||
and #$007F ; Ignore the buttons for now
|
||||
|
||||
@ -59,16 +62,6 @@ EvtLoop
|
||||
brl Exit
|
||||
|
||||
:1
|
||||
jsl DoTimers
|
||||
jsl Render
|
||||
bra EvtLoop
|
||||
|
||||
cmp #'r'
|
||||
bne EvtLoop
|
||||
|
||||
jsl Render
|
||||
brl EvtLoop
|
||||
|
||||
cmp #'l'
|
||||
bne :1_1
|
||||
jsr DoLoadFG
|
||||
@ -102,7 +95,7 @@ EvtLoop
|
||||
sbc #'1'
|
||||
tax
|
||||
jsl SetScreenMode
|
||||
; jsr MovePlayerToOrigin
|
||||
jsr MovePlayerToOrigin
|
||||
brl EvtLoop
|
||||
|
||||
:6 cmp #'t'
|
||||
|
File diff suppressed because one or more lines are too long
@ -60,12 +60,12 @@
|
||||
41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,
|
||||
41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,11,12,13,14,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,
|
||||
41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,15,16,17,18,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,
|
||||
41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,11,12,13,14,41,41,41,41,41,41,41,41,41,41,41,41,19,20,21,22,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,
|
||||
41,41,41,41,57,58,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,15,16,17,18,41,41,41,41,41,41,41,41,41,41,41,41,19,20,21,22,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,
|
||||
41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,169,170,169,170,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,11,12,13,14,41,41,41,41,41,41,41,41,41,41,41,41,19,20,21,22,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,
|
||||
41,41,41,41,57,58,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,209,210,209,210,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,15,16,17,18,41,41,41,41,41,41,41,41,41,41,41,41,19,20,21,22,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,
|
||||
41,41,41,56,21,62,59,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,11,12,13,14,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,19,20,21,22,41,41,41,41,41,41,41,41,41,41,41,41,19,20,21,22,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,
|
||||
41,41,56,21,21,21,21,59,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,57,2147483705,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,15,16,17,18,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,19,20,21,22,41,41,41,41,41,41,41,41,41,41,41,41,19,20,21,22,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,
|
||||
41,56,21,62,21,21,62,21,59,41,41,41,169,170,169,170,169,170,169,170,169,170,41,41,42,43,42,43,42,43,41,41,41,56,21,62,2147483704,41,41,41,41,41,41,41,41,41,41,41,42,43,41,41,41,41,41,41,19,20,21,22,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,19,20,21,22,41,41,41,41,42,43,42,43,41,41,41,41,19,20,21,22,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,
|
||||
56,21,21,21,21,21,21,21,21,59,41,41,209,210,209,210,209,210,209,210,209,210,41,44,45,45,45,45,45,45,46,41,56,21,21,21,21,2147483704,41,41,41,41,41,41,41,41,41,44,45,45,46,41,41,41,41,41,19,20,21,22,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,19,20,21,22,41,41,41,44,45,45,45,45,46,41,41,41,19,20,21,22,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,
|
||||
41,56,21,62,21,21,62,21,59,41,41,41,169,170,169,170,169,170,169,170,169,170,41,41,42,43,42,43,42,43,41,41,41,56,21,62,2147483704,41,41,41,169,170,169,170,169,170,41,41,42,43,41,41,41,41,169,170,19,20,21,22,41,41,169,170,41,41,41,41,41,41,41,41,41,41,41,41,19,20,21,22,41,41,41,41,42,43,42,43,41,41,41,41,19,20,21,22,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,
|
||||
56,21,21,21,21,21,21,21,21,59,41,41,209,210,209,210,209,210,209,210,209,210,41,44,45,45,45,45,45,45,46,41,56,21,21,21,21,2147483704,41,41,209,210,209,210,209,210,41,44,45,45,46,41,41,41,209,210,19,20,21,22,41,41,209,210,41,41,41,41,41,41,41,41,41,41,41,41,19,20,21,22,41,41,41,44,45,45,45,45,46,41,41,41,19,20,21,22,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,
|
||||
1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,
|
||||
3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,
|
||||
1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,
|
||||
|
@ -149,21 +149,34 @@ mixed cmp #$FFFF ; All 1's in the mask is fully transparent
|
||||
|
||||
; This is the slowest path because there is a *lot* of work to do. So much that it's
|
||||
; worth it to change up the environment to optimize things a bit more.
|
||||
;
|
||||
; Need to fill in the first 8 bytes of the JMP handler with the following code sequence
|
||||
;
|
||||
; lda (00),y
|
||||
; and #MASK
|
||||
; ora #DATA
|
||||
|
||||
lda #$004C ; JMP instruction
|
||||
sta: ]3,y
|
||||
|
||||
ldx _X_REG ; Get the addressing offset
|
||||
ldal JTableOffset,x ; Get the address offset and add to the base address
|
||||
; clc ; may be able to be removed...
|
||||
adc _BASE_ADDR ; of the current code field line
|
||||
adc #{]3&$F000} ; adjust for the current row offset
|
||||
sta: ]3+1,y
|
||||
|
||||
tay ; This becomes the new address that we use to patch in
|
||||
txa ; Get the offset and render a LDA (dp),y instruction
|
||||
xba
|
||||
ora #$00B1
|
||||
sta: $0000,y
|
||||
|
||||
sep #$20
|
||||
sta: $0001,y ; LDA (00),y operand
|
||||
lda #$B1
|
||||
sta: $0000,y ; LDA (00),y opcode
|
||||
lda #$29
|
||||
sta: $0002,y ; AND #$0000 opcode
|
||||
lda #$09
|
||||
sta: $0005,y ; ORA #$0000 opcode
|
||||
rep #$20
|
||||
|
||||
ldx _T_PTR ; restore the original x-register value
|
||||
ldal ]2,x ; insert the tile mask and data into the exception
|
||||
@ -184,13 +197,49 @@ transparent
|
||||
next
|
||||
eom
|
||||
|
||||
; Masked renderer for a dynamic tile. What's interesting about this renderer is that the mask
|
||||
; value is not used directly, but simply indicates if we can use a LDA 0,x / PHA sequence,
|
||||
; a LDA (00),y / PHA, or a JMP to a blended render
|
||||
;
|
||||
; If a dynamic tile is animated, there is the possibility to create a special mask that marks
|
||||
; words of the tile that a front / back / mixed across all frames.
|
||||
;
|
||||
; ]1 : tiledata offset
|
||||
; ]2 : tilemask offset
|
||||
; ]3 : code field offset
|
||||
CopyMaskedDWord MAC
|
||||
|
||||
; Need to fill in the first 8 bytes of the JMP handler with the following code sequence
|
||||
;
|
||||
; lda (00),y
|
||||
; and $80,x
|
||||
; ora $00,x
|
||||
; bcc *+4
|
||||
|
||||
ldx _X_REG ; Get the addressing offset
|
||||
ldal JTableOffset,x ; Get the address offset and add to the base address
|
||||
adc _BASE_ADDR ; of the current code field line
|
||||
adc #{]1&$F000} ; adjust for the current row offset
|
||||
sta: ]1+1,y
|
||||
|
||||
tax ; This becomes the new address that we use to patch in
|
||||
lda _X_REG ; Get the offset and render a LDA (dp),y instruction
|
||||
|
||||
sep #$20 ; Easier to do 8-bit operations
|
||||
sta: $0001,x ; Set the LDA (00),y operand
|
||||
lda #$B1
|
||||
sta: $0000,x ; Set the LDA (00),y opcode
|
||||
|
||||
lda _T_PTR
|
||||
sta: $0005,x ; Set ORA 00,x operand
|
||||
ora #$80
|
||||
sta: $0003,x ; Set AND 00,x operand
|
||||
lda #$35
|
||||
sta: $0002,x ; Set AND 00,x operand
|
||||
lda #$15
|
||||
sta: $0004,x ; Set ORA 00,x operand
|
||||
rep #$30
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
lda #$0290 ; BCC *+4
|
||||
sta: $0006,x
|
||||
eom
|
||||
|
@ -209,7 +209,8 @@ RenderTile
|
||||
jmp (:actions,x)
|
||||
|
||||
:actions dw solid,solid_hflip,solid_vflip,solid_hvflip
|
||||
dw dynamic,dynamic,dynamic,dynamic
|
||||
; dw dynamic,dynamic,dynamic,dynamic
|
||||
dw dyn_masked,dyn_masked,dyn_masked,dyn_masked
|
||||
dw masked,masked_hflip,masked_vflip,masked_hvflip
|
||||
dw dyn_masked,dyn_masked,dyn_masked,dyn_masked
|
||||
|
||||
@ -308,7 +309,7 @@ FillPEAOpcode
|
||||
|
||||
; Masked tiles
|
||||
;
|
||||
; Can result in one or three different code sequences
|
||||
; Can result in one of three different code sequences
|
||||
;
|
||||
; If mask === $0000, then insert PEA $DATA
|
||||
; If mask === $FFFF, then insert LDA (DP),y / PHA
|
||||
@ -529,6 +530,55 @@ DynamicTile
|
||||
rep #$20
|
||||
rts
|
||||
|
||||
DynamicTileM
|
||||
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
|
||||
|
||||
sep #$20
|
||||
lda #$4C ; Set everything to JMP instructions
|
||||
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
|
||||
|
||||
; Helper functions to copy tile data to the appropriate location in Bank 0
|
||||
; X = tile ID
|
||||
; Y = dynamic tile ID
|
||||
@ -545,6 +595,26 @@ CopyTileToDyn ENT
|
||||
adc #$0100 ; Go to the next page
|
||||
tay
|
||||
jsr CopyTileDToDyn ; Copy the tile data
|
||||
jsr CopyTileMToDyn ; Copy the tile data
|
||||
rtl
|
||||
|
||||
; Helper functions to copy tile data and mask to the appropriate location in Bank 0
|
||||
; X = tile ID
|
||||
; Y = dynamic tile ID
|
||||
CopyTileAndMaskToDyn ENT
|
||||
txa
|
||||
jsr _GetTileAddr
|
||||
tax
|
||||
|
||||
tya
|
||||
and #$001F ; Maximum of 32 dynamic tiles
|
||||
asl
|
||||
asl ; 4 bytes per page
|
||||
adc BlitterDP ; Add to the bank 00 base address
|
||||
adc #$0100 ; Go to the next page
|
||||
tay
|
||||
jsr CopyTileDToDyn ; Copy the tile data
|
||||
jsr CopyTileMToDyn ; Copy the tile data
|
||||
rtl
|
||||
|
||||
; X = address of tile
|
||||
@ -705,8 +775,12 @@ dynamic
|
||||
|
||||
dyn_masked
|
||||
pla
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
xba ; Undo the x128 we just need x4
|
||||
plx
|
||||
rts
|
||||
brl DynamicTileM
|
||||
|
||||
; Merge
|
||||
;
|
||||
|
Loading…
x
Reference in New Issue
Block a user