Hi all,
I'm working on my first NES program following the bunnyboy nerdy nights tutorial. I'm trying to include a palette file from YY-CHR in my program, but it doesn't seem to be working correctly. I saved the palette in YY-CHR as a .pal and am loading it like so:
When I compile and run my rom, I get random colors in both palette tables. Is there something wrong with my code or do I have to do something special to convert YY-CHR .pal files to the correct format? I tried searching around but couldn't come up with an answer.
Thanks in advance,
Brandon
I'm working on my first NES program following the bunnyboy nerdy nights tutorial. I'm trying to include a palette file from YY-CHR in my program, but it doesn't seem to be working correctly. I saved the palette in YY-CHR as a .pal and am loading it like so:
Code:
loadpalettes:
lda $2002 ; read ppu status to reset the high/low latch
lda #$3f
sta $2006 ; write the high byte of $3f00 address
lda #$00
sta $2006 ; write the low byte of $3f00 address
ldx #$00 ; start out at 0
load_pallets_loop:
lda palette, x ; load data from address (palette + the value in x)
sta $2007 ; write to ppu
inx
cpx #$20
bne load_pallets_loop
palette:
.incbin "pong.pal"
lda $2002 ; read ppu status to reset the high/low latch
lda #$3f
sta $2006 ; write the high byte of $3f00 address
lda #$00
sta $2006 ; write the low byte of $3f00 address
ldx #$00 ; start out at 0
load_pallets_loop:
lda palette, x ; load data from address (palette + the value in x)
sta $2007 ; write to ppu
inx
cpx #$20
bne load_pallets_loop
palette:
.incbin "pong.pal"
When I compile and run my rom, I get random colors in both palette tables. Is there something wrong with my code or do I have to do something special to convert YY-CHR .pal files to the correct format? I tried searching around but couldn't come up with an answer.
Thanks in advance,
Brandon