TylerBarnes 183 Member · Posted November 5, 2019 Share Posted November 5, 2019 (edited) Anyone have the secret sauce on reading palettes from the PPU via $2007? I know it is not buffered like normal reads from VRAM since palettes are stored on the PPU itself, but everytime I try to read palettes to save in RAM, I get values from my name table. I'm doing this in my NMI with other graphics updates. Routine: LDA $2002 ; Clear Hi/Lo Latch LDA #$3F ; Opening the port $3F00 STA $2006 ; to read palette data LDA #$00 STA $2006 TAX ; Use #$00 already in A as an X offset. SaveCurrentPalette: LDA $2007 STA TempPalette, x INX CPX #$20 ; Do this 32 times to aquire both palettes BNE SaveCurrentPalette The pallet I loaded into the PPU at bootup: $3E,$16,$36,$3E,$3E,$27,$37,$3F,$3E,$27,$36,$17,$3E,$3E,$3D,$0C $3F,$1A,$3A,$0B,$3F,$16,$36,$06,$3F,$27,$38,$17,$3F,$20,$3D,$2D What I get after this routine tries to read the pelette to store into ram. These value are present in my .nam and the first $9A you see there starts at $0260 of that file. That $00 would no doubt be the throw away buffer read. $00,$9A,$9A,$9A,$BE,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99 $99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$CD,$BF,$9A , Edited November 5, 2019 by TylerBarnes Link to comment Share on other sites More sharing options...
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!Register a new account
Already have an account? Sign in here.Sign In Now