n6 wrote:
during scanline 21 to 242: render screen
at scanline -1: reset status register
at scanline 242: call NMI, set VBlank flag.
There are 240 rendered scanlines, not 221 (or however many you have listed there)
The entire NTSC frame is 262 scanlines long:
- 1 "idle" scanline
*NMI here*
- 20 scanlines of VBlank
*clear $2002 here*
- 1 pre-render scanline
- 240 rendered scanlines
very late EDIT-- just realized I had it say "262
cycles long" before when I actually meant 262
scanlines. Looks like I was understood anyway though, so no harm done.
Quote:
palette_ram: #2 (Palette read shouldn't be buffered like other VRAM)
The palette is not buffered on reads. When the game reads from the palette (ppu $3F00-$3F1F or any mirrored region), it gets the desired value IMMEDIATELY. The whole $2007 read buffer thing doesn't apply.
What actually happens is the palette gets returned to the CPU, and the mirrored nametable byte gets put in the read buffer.
For example:
Code:
LDA #$20
STA $2006
LDX #$00
STX $2006 ; ppu address = $2000
LDA $2007 ; fill read buffer with $2000
LDA $2007 ; A gets read buffer ($2000), read buffer filled with $2001
LDA #$3F
STA $2006
STX $2006 ; ppu address = $3F00 (palette)
LDA $2007 ; A gets filled with $3F00 (it is not buffered!)
; former value in buffer ($2001) is discarded
; buffer filled with $2F00 (mirrored nametable -- remember $3xxx mirrors $2xxx)
LDA #$20
STA $2006
STX $2006 ; ppu address = $2000
LDA $2007 ; A gets filled with buffer ($2F00), buffer filled with $2000
Quote:
vram_access: #4 (Read buffer shouldn't be affected by VRAM write)
The Read buffer is unaffected by writes. No buffering occurs on writes to $2007... only on reads. If you are having problems with this and don't understand why, then the only way I could help was if I saw your $2007 read and write code.
Quote:
vbl_clear_time: #3 (VBL flag cleared too late)
This goes hand in hand with the first thing I quoted from your post... it just looks like you're constructing your frame improperly.
Lastly, don't pay any attention to NEStress's PPU errors. They error even when the ROM is run on the actual system.
Stick to blargg's test ROMs for testing PPU/pAPU behavior.