Skip to content

Commit

Permalink
fix(bg): update stack entries and gfxptr instead of mapptr function
Browse files Browse the repository at this point in the history
  • Loading branch information
alekmaul committed Feb 9, 2024
1 parent 2bc3d1d commit c8f04de
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions pvsneslib/source/backgrounds.asm
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ bgSetMapPtr:

;---------------------------------------------------------------------------
;void bgInitTileSet(u8 bgNumber, u8 *tileSource, u8 *tilePalette, u8 paletteEntry, u16 tileSize, u16 paletteSize, u16 colorMode, u16 address)
;5 6-9 10-13 14 15-16 17-18 19-20 21-22
bgInitTileSet:
php

Expand Down Expand Up @@ -609,16 +610,25 @@ bgInitMapSet:
bgInitTileSetData:
php

sep #$20
lda #0
pha
jsl setBrightness ; Force VBlank Interrupt (value 0)
rep #$20
tsa
clc
adc #1
tas
wai

rep #$20
lda 10,s ; get tileSize
pha
lda 14,s ; get address (12+2)
pha
lda 14,s ; get tileSource bank address (10+4)
lda 12,s ; get tileSource bank address (8+4)
pha
lda 18,s ; get tileSource data address (12+6)
lda 12,s ; get tileSource data address (6+6)
pha
jsl dmaCopyVram
tsa
Expand All @@ -638,7 +648,7 @@ bgInitTileSetData:
lda 7,s ; get bgNumber (5+2)
pha
rep #$20
jsl bgSetMapPtr
jsl bgSetGfxPtr
tsa
clc
adc #3
Expand Down

0 comments on commit c8f04de

Please sign in to comment.