NESDev and Strangulation Records messageboards
Forum Index | FAQ | New User | Login | Search

Previous ThreadView All ThreadsNext ThreadShow in Flat Mode*


SubjectReading from PPU (0x2007) during non-VBlank  
Posted byAnonymous
Posted on12/3/03 6:32 PM
From IP130.240.201.141  



Hello. I have some trouble designing a cycle-perfect PPU for my emu. This is what I've done so far:

*) Reads from PPU always return the current state of the PPU
*) Writes to PPU during VBlank affect the PPU register immediately
*) Writes to PPU during non-VBlank are stored in a 'stack', where every write to the PPU is performed AFTER the non-VBlank period has ended (pop stack event, perform event, draw pixels 'til next event, loop).

Now, this works perfectly fine visually but Nestress doesn't pass the basic write to VRAM/read from VRAM test. This is probably due to the PPU writes occuring during non-VBlank, and the READS are ALSO done during non-VBlank. I was under the impression that you are not allowed to read from 0x2007 during non-VBlank! This results in Nestress writing to the PPU (which is delayed) and directly reading from it. My PPU hasn't yet processed the 'write to PPU'-event (as this happens at the end of the frame when the bg is drawn), so the read will return an old PPU value. If Nestress had waited 'til VBlank before reading (as I thought was required), the PPU would've processed the events and updated the PPU registers.

Phew... so what I wonder is if reads from PPU (0x2007) are allowed during non-VBlank (ie, if writing to 0x2007 and reading from it directly afterwards should instantly return the new value)? Or maybe I've just missed something... I'd be really grateful if anyone could shed some light onto this.

(Also, what do you suggest if my fears are true and the value should be directly reflected in the PPU? I can't come up with anything else than to duplicate everything in the PPU and let the CPU read the original instantly changed values, while when drawing the bg do the write operations again for the PPU in the duplicate registers. Lots of cycles wasted).

Thank you very much in advance,
Tommi Kiviniemi





-
Entire Thread
Subject  Posted byPosted On
.Reading from PPU (0x2007) during non-VBlank  Anonymous12/3/03 6:32 PM
.*Re: Reading from PPU (0x2007) during non-VBlank  EmuHackMan12/8/03 7:20 PM
.*Re: Reading from PPU (0x2007) during non-VBlank  TimW12/8/03 11:39 AM
..*Re: Reading from PPU (0x2007) during non-VBlank  Anonymous12/10/03 1:44 PM
.*Re: Reading from PPU (0x2007) during non-VBlank  Anonymous12/3/03 6:51 PM
Jump to

Memblers' homepage             Contact Me

Forums powered by WWWThreads Demo