Fix banking bug and enable BG1 tile maps

This commit is contained in:
Lucas Scharenbroich 2021-08-20 20:20:47 -05:00
parent e607612344
commit 238d2f0a6f
4 changed files with 23 additions and 10 deletions

View File

@ -136,8 +136,6 @@ NO_MUSIC equ 1 ; turn music + tool load
sta BankLoad ; Store "Bank Pointer"
jsr MovePlayerToOrigin ; Put the player at the beginning of the map
lda #74
jsr SetBG0XPos
lda #DIRTY_BIT_BG0_REFRESH ; Redraw all of the tiles on the next Render
ora #DIRTY_BIT_BG1_REFRESH
@ -1307,3 +1305,6 @@ qtRec adrl $0000

View File

@ -73,7 +73,7 @@ Render
jsr _ApplyBG1XPosPre
jsr _UpdateBG0TileMap
; jsr _UpdateBG1TileMap
jsr _UpdateBG1TileMap
jsr _ApplyBG0XPos ; Patch the PEA instructions with exit BRA opcode
jsr _ApplyBG1XPos ; Patch the PEA instructions with exit BRA opcode
@ -140,5 +140,6 @@ Render

View File

@ -502,7 +502,7 @@ _UpdateBG1TileMap
sta :Left
:DoXUpdate
jsr _DrawRectBG1 ; Fill in the rectangle.
jmp _DrawRectBG1 ; Fill in the rectangle.
:NoXUpdate
rts
@ -568,11 +568,9 @@ _DrawRectBG1
asl ; This is the number of bytes to move the Offset to advance from the end of
sta :Span ; one line to the beginning of the next
; Now we need to figure out the code field tile coordinate of corner of
; play field. That is, becuase the screen is scrolling, the location of
; tile (0, 0) could be anywhere within the code field
; Now we need to figure out the tile coordinate of corner of play field.
lda BG1StartYMod208 ; This is the code field line that is at the top of the screen
lda BG1StartYMod208 ; This is the line that is at the top of the screen
and #$FFF8 ; Clamp to the nearest block
lsr
lsr
@ -658,3 +656,10 @@ _DrawRectBG1

View File

@ -753,9 +753,12 @@ CopyTileBG1
adc BG1YTable,y
tay
pei BG1DataBank
plb
sep #$20
lda BG1DataBank
pha
plb ; set the bank
rep #$20
pla ; pop the tile ID
jsr RenderTileBG1
@ -771,3 +774,6 @@ CopyTileBG1