I've succesffuly write colors palettes and nametables.
So know, I try to understand how to read colors palettes. (Because I would probably compute it)
For know I just try to read the early first byte of the nes palette at $3F00. Regarding the wiki, it seems possible to Read at $2007 "DATA" when the screen is turned off or during Vblank Time.
So I found different talk about it accross the forum, but never find "code" that show it in reality.
Can you help me figure it out how I must doing it:
I try different things, so the simple would be like this ? (palette is already filled with colors)
Code: Select all
VBlankWait: ; wait for Vblank, PPU is ready after this
bit PPU_STATUS ; read bit 7 of PPU_STATUS $2002
bpl VBlankWait ; if N = 0 (bit 7 of PPU_STATUS) goto VblankWait
lda #$00001100 ; Disable NMI & Set Increment Per 1
sta PPU_CTRL ; = $2000
lda #$00000110 ; Screen Display OFF
sta PPU_MASK ; = $2001
SetPaletteAddress: ; palette start always at $3F00 in PPU Memory
lda #$3F
sta PPU_ADDR ; $2006 write low byte
lda #$00
sta PPU_ADDR ; write high byte
lda PPU_DATA ; $2007
sta $00 ; will be the first color ?
lda PPU_DATA
sta $01 ; just to check if it could be here or it "must" be second color ?