Fix crashing on horizontal tile map rendering; still some off-by-one errors

This commit is contained in:
Lucas Scharenbroich 2021-08-06 15:57:03 -05:00
parent 39639d54b5
commit b8d4ae780b
2 changed files with 21 additions and 3 deletions

View File

@ -121,7 +121,7 @@ NO_MUSIC equ 1 ; turn music + tool loading
lda #0 ; Set the virtual Y-position
jsr SetBG0YPos
lda #0 ; Set the virtual X-position
lda #15 ; Set the virtual X-position
jsr SetBG0XPos
jsr _InitBG1 ; Initialize the second background
@ -1224,3 +1224,5 @@ qtRec adrl $0000
put blitter/BG1.s
PUT TileMap.s
PUT Level.s

View File

@ -289,7 +289,13 @@ _UpdateBG0TileMap
ldy :BlkY
jsr CopyTile
inc :BlkX ; Move to the next block
lda :BlkX
inc
cmp #42 ; If we go past the physical block index, wrap around
bcc *+5
lda #0
sta :BlkX
dec :Width ; Decrement out count
bne :xloop
@ -304,7 +310,13 @@ _UpdateBG0TileMap
lda 1,s ; Reset the width
sta :Width
inc :BlkY
lda :BlkY ; The y lookup has a double0length array, may not need the bounds check
inc
cmp #27
bcc *+5
lda #0
sta :BlkY
dec :Height ; Have we done all of the rows?
bne :yloop
@ -355,3 +367,7 @@ _UpdateBG0TileMap