I am just wondering if I am doing this the right way, or if there is some secret way to do it that I am missing lol.
in this example, just pretend that:
BACKGROUND_MANSION is an incbin'd nametable 3C0 bytes wide, not 400.
BACKGROUND_LOADING_ADDRESS is 2 bytes in ram meant to be a 16 bit address (hi/lo byte of background mansion nametable incbin).
my goal was to fill the PPU with all 3C0 bytes in 4 loops of #$F0 times but I found that going through the ram address #$F0 amount of times was difficult because no matter how many times I added #$F0 to the LOW byte, it was never incrementing the HIGH byte (i.e $20E0 becomes $10E0 instead of $10E1).
It's a lot easier if you are just doing it in 4 loops for all 400 bytes, since you just add #$1 to the high byte (i.e, $20E0 becomes $20E1 in the next loop). Or just INC address holding the high byte.
the bottom code was the only way I could figure out how to do this
Code: Select all
LDA #LOW(BACKGROUND_MANSION)
STA BACKGROUND_LOADING_ADDRESS
LDA #HIGH(BACKGROUND_MANSION)
STA BACKGROUND_LOADING_ADDRESS+1
LDX #$00
LOOP:
LDA BACKGROUND_LOADING_ADDRESS
CLC
ADC #$F0
BPL INC16P
STA BACKGROUND_LOADING_ADDRESS
JMP CONT
INC16P:
STA BACKGROUND_LOADING_ADDRESS
INC BACKGROUND_LOADING_ADDRESS+1
INX
CPX #$02
BNE LOOP
CONT: