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

View File

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

View File

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

View File

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

View File

@ -84,8 +84,6 @@ _Render
jsr _ApplyBG0XPos ; 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
jsr ShadowOff
@ -126,31 +124,3 @@ _Render
stz DirtyBits
rts

View File

@ -49,6 +49,12 @@ _UpdateBG0TileMap
:BlkX equ tmp12
: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
lsr
lsr
@ -390,6 +396,12 @@ _UpdateBG1TileMap
:Top equ tmp2
: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
lsr
lsr
@ -648,19 +660,3 @@ _DrawRectBG1
pla
rts

View File

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

View File

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

View File

@ -345,7 +345,6 @@ _ApplyBG0XPos
; 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
; screen
; y is already set to :base_address
tax ; :draw_count_x2
lda :exit_address ; Save from this location

View File

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