Small initialization and jsr/jsl updates

This commit is contained in:
Lucas Scharenbroich 2021-08-26 16:12:08 -05:00
parent 4af66fa13a
commit 69c6104742
11 changed files with 146 additions and 232 deletions

View File

@ -30,20 +30,21 @@ NO_MUSIC equ 1 ; turn music + tool loadi
jsl SetScreenMode jsl SetScreenMode
; Set up our level data ; Set up our level data
jsr BG0SetUp ; jsr BG0SetUp
jsr BG1SetUp ; jsr BG1SetUp
; Allocate room to load data ; Allocate room to load data
jsl AllocBank ; Alloc 64KB for Load/Unpack ; jsl AllocBank ; Alloc 64KB for Load/Unpack
sta BankLoad ; Store "Bank Pointer" ; sta BankLoad ; Store "Bank Pointer"
jsr MovePlayerToOrigin ; Put the player at the beginning of the map ; jsr MovePlayerToOrigin ; Put the player at the beginning of the map
lda #DIRTY_BIT_BG0_REFRESH ; Redraw all of the tiles on the next Render ; lda #DIRTY_BIT_BG0_REFRESH ; Redraw all of the tiles on the next Render
ora #DIRTY_BIT_BG1_REFRESH ; ora #DIRTY_BIT_BG1_REFRESH
tsb DirtyBits ; tsb DirtyBits
; lda #$FFFF
jsl Render jsl Render
EvtLoop EvtLoop
jsl ReadControl jsl ReadControl
@ -86,7 +87,7 @@ EvtLoop
sbc #'1' sbc #'1'
tax tax
jsl SetScreenMode jsl SetScreenMode
jsr MovePlayerToOrigin ; jsr MovePlayerToOrigin
brl EvtLoop brl EvtLoop
:6 cmp #'t' :6 cmp #'t'
@ -264,7 +265,7 @@ DoLoadBG1
ldx BankLoad ldx BankLoad
lda #0 lda #0
ldy BG1DataBank ldy BG1DataBank
jsr CopyBinToBG1 jsl CopyBinToBG1
lda BankLoad lda BankLoad
ldx #BG1AltDataFile ldx #BG1AltDataFile
@ -273,7 +274,7 @@ DoLoadBG1
ldx BankLoad ldx BankLoad
lda #0 lda #0
ldy BG1AltBank ldy BG1AltBank
jsr CopyBinToBG1 jsl CopyBinToBG1
rts rts
@ -285,7 +286,7 @@ DoLoadFG
ldx BankLoad ; Copy it into the code field ldx BankLoad ; Copy it into the code field
lda #0 lda #0
jsr CopyBinToField jsl CopyBinToField
rts rts
; Load a simple picture format onto the SHR screen ; Load a simple picture format onto the SHR screen
@ -453,36 +454,3 @@ qtRec adrl $0000
PUT App.TileMapBG0.s PUT App.TileMapBG0.s
PUT App.TileMapBG1.s PUT App.TileMapBG1.s

View File

@ -45,9 +45,15 @@ EngineStartUp ENT
rtl rtl
EngineShutDown ENT EngineShutDown ENT
phb
phk
plb
jsr IntShutDown jsr IntShutDown
jsr SoundShutDown jsr SoundShutDown
jsr ToolShutDown jsr ToolShutDown
plb
rtl rtl
ToolStartUp ToolStartUp
@ -221,6 +227,11 @@ EngineReset
stz TileMapPtr stz TileMapPtr
stz TileMapPtr+2 stz TileMapPtr+2
stz BG1TileMapWidth
stz BG1TileMapHeight
stz BG1TileMapPtr
stz BG1TileMapPtr+2
stz OneSecondCounter stz OneSecondCounter
]step equ 0 ]step equ 0

View File

@ -108,13 +108,3 @@ DIRTY_BIT_BG1_X equ $0004
DIRTY_BIT_BG1_Y equ $0008 DIRTY_BIT_BG1_Y equ $0008
DIRTY_BIT_BG0_REFRESH equ $0010 DIRTY_BIT_BG0_REFRESH equ $0010
DIRTY_BIT_BG1_REFRESH equ $0020 DIRTY_BIT_BG1_REFRESH equ $0020

View File

@ -121,7 +121,3 @@ WaitForVBL sep #$20
bpl :wait2 ; spin until transition into VBL bpl :wait2 ; spin until transition into VBL
rep #$20 rep #$20
rts rts

View File

@ -84,8 +84,6 @@ _Render
jsr _ApplyBG0XPos ; Patch the PEA instructions with exit BRA opcode jsr _ApplyBG0XPos ; Patch the PEA instructions with exit BRA opcode
jsr _ApplyBG1XPos ; Patch the PEA instructions with exit BRA opcode jsr _ApplyBG1XPos ; Patch the PEA instructions with exit BRA opcode
; Copy any tiles that have come into view
; The code fields are locked in now and reder to be rendered ; The code fields are locked in now and reder to be rendered
jsr ShadowOff jsr ShadowOff
@ -126,31 +124,3 @@ _Render
stz DirtyBits stz DirtyBits
rts rts

View File

@ -49,6 +49,12 @@ _UpdateBG0TileMap
:BlkX equ tmp12 :BlkX equ tmp12
:BlkY equ tmp13 :BlkY equ tmp13
lda TileMapPtr ; Do nothing if no data is set
ora TileMapPtr+2
bne :valid
rts
:valid
lda StartY ; calculate the tile index of the current location lda StartY ; calculate the tile index of the current location
lsr lsr
lsr lsr
@ -390,6 +396,12 @@ _UpdateBG1TileMap
:Top equ tmp2 :Top equ tmp2
:Bottom equ tmp3 :Bottom equ tmp3
lda BG1TileMapPtr ; Do nothing if no data is set
ora BG1TileMapPtr+2
bne :valid
rts
:valid
lda BG1StartY ; calculate the tile index of the current location lda BG1StartY ; calculate the tile index of the current location
lsr lsr
lsr lsr
@ -648,19 +660,3 @@ _DrawRectBG1
pla pla
rts rts

View File

@ -62,6 +62,7 @@ InitTimers
; A = timer slot ID if C = 0 ; A = timer slot ID if C = 0
AddTimer ENT AddTimer ENT
phb phb
php ; Save the input parameters php ; Save the input parameters
phx phx
pha pha
@ -135,6 +136,7 @@ RemoveTimer ENT
:exit :exit
plb plb
rtl rtl
; Execute the timer functions ; Execute the timer functions
DoTimers ENT DoTimers ENT
phb phb
@ -241,5 +243,6 @@ _DoTimers

View File

@ -1,7 +1,7 @@
; Support routinges for the primary background ; Support routinges for the primary background
_InitBG0 _InitBG0
jsr _ApplyBG0YPos lda #DIRTY_BIT_BG0_X+DIRTY_BIT_BG0_Y
jsr _ApplyBG0XPos tsb DirtyBits
rts rts
; Copy a raw data file into the code field ; Copy a raw data file into the code field
@ -145,8 +145,6 @@ _CopyBinToField
:next :next
ply ply
; dex
; dex
iny iny
iny iny
@ -379,8 +377,3 @@ _CopyPicToField
bra *+5 bra *+5
ora #$000F ora #$000F
rts rts

View File

@ -95,4 +95,3 @@ stk_save lda #0000 ; load the stack
; we don't do anything sprite related; just call function pointers provided to us. ; we don't do anything sprite related; just call function pointers provided to us.
_RenderSprites _RenderSprites
rts rts

View File

@ -345,7 +345,6 @@ _ApplyBG0XPos
; Special note, the SaveOpcode function stores the opcode *within* the code field as it is ; Special note, the SaveOpcode function stores the opcode *within* the code field as it is
; used in odd-aligned cases to determine how to draw the 8-bit value on the left edge of the ; used in odd-aligned cases to determine how to draw the 8-bit value on the left edge of the
; screen ; screen
; y is already set to :base_address ; y is already set to :base_address
tax ; :draw_count_x2 tax ; :draw_count_x2
lda :exit_address ; Save from this location lda :exit_address ; Save from this location

View File

@ -637,14 +637,3 @@ snippets lup 82
]index equ ]index+1 ]index equ ]index+1
--^ --^
top top