I'm using the load palette loop specified by the tutorial to load the palettes into the PPU. Here is the loop. Pretty basic stuff.
Code: Select all
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
LoadPalettesLoop:
LDA palette, x ; load data from address (palette + the value in x)
; 1st time through loop it will load palette+0
; 2nd time through loop it will load palette+1
; 3rd time through loop it will load palette+2
; etc
STA $2007 ; write to PPU
INX ; X = X + 1
CPX #$20 ; Compare X to hex $10, decimal 16 - copying 16 bytes = 4 sprites
BNE LoadPalettesLoop ; Branch to LoadPalettesLoop if compare was Not Equal to zero
; if compare was equal to 32, keep going down
Code: Select all
palette:
.db $20,$00,$10,$2d, $20,$01,$21,$31, $20,$06,$16,$26, $20,$09,$19,$29 ;;background palette
.db $22,$1C,$15,$14, $20,$02,$38,$3C, $20,$1C,$15,$14, $20,$02,$38,$3C ;;sprite palette
Instead of loading $20 for the first byte of background palette, fceux loads $22. And instead of loading $22 for the first byte of sprite palette, fceux loads $00. I can see these palettes in the PPU viewer. However, when I check the debugger and monitor the values that the loop is loading step by step, it appears to load the appropriate values. Its just the final product doesn't match what the debugger says is being loaded as palettes.
Any thoughts on this would be appreciated!
Thanks!
Hundo