VBlank and PPU registers

Strictly for discussing ZSNES development and for submitting code. You can also join us on IRC at irc.libera.chat in #zsnes.
Please, no requests here.

Moderator: ZSNES Mods

Post Reply
byuu

VBlank and PPU registers

Post by byuu »

Just for the record, does anyone know exactly which PPU registers are accessible when dot < 256 and scanline < 224/239 (when the screen is drawing)?

Blocking off $2100-$213f seemed the most logical to me, but that causes hundreds of graphical errors. Blocking off just $21:18,19,21,22,39,3a,3b (vram and cgram read/write) results in all games working fine though.
evilant
Rookie
Posts: 44
Joined: Thu Nov 11, 2004 5:06 am

Post by evilant »

byuusan wrote:Blocking off $2100-$213f seemed the most logical to me, but that causes hundreds of graphical errors. Blocking off just $21:18,19,21,22,39,3a,3b (vram and cgram read/write) results in all games working fine though.
According to anomie's doc, everything from 2101 to 2133 is not accessible while drawing the screen. 2134-2136 (mul result regs) are marked with a '?' -- unknown whether they are accessible. 2137 and 213C-213F are accessible, but 2138-213B are not.

The doc does include a disclaimer though (where '-' means inaccessible):
Note that it may be possible to write registers anytime even if marked '-', but until we have proof '-' is a better guess.
Anomie's doc also indicates a few registers (2104, 2118-2119) that are not accessible during H-blank (and there's about 2 dozen unknown ones in that column).
anomie
Lurker
Posts: 151
Joined: Tue Dec 07, 2004 1:40 am

Post by anomie »

It'll be quicker to list the ones I know about.

$2100 can be written any time. If you disable force-blank mid scanline, you get graphics glitches for a few tiles (and OBJ probably for the rest of the scanline).

$2102, $2103, $2104, and $2138 may be accessed any time. However, the behavior will not be what you expect. It seems the PPU is constantly changing the OAM Address affected by $2102/3 during rendering, so writing $2104 or reading $2138 will probably not affect the address you expect. Even during H-Blank. Uniracers 2-player mode is the only known ROM that does this. IIRC, if you force blank mid-screen then $2102/3 is still 'randomized', but is no longer continuously updated. But this could use more testing. Anyway, this explains why at the start of V-Blank the OAM Address gets reset to the last value written to $2102/3...

$2118/9 we know does not work during the frame, even during H-Blank. I suspect writes are completely ignored, but i haven't tested yet. $2115 and $2116/7 are unknown.

IIRC, someone else has found that writing $2122 during rendering will always write word 0, and reads return some unknown data. In either case the 'current address' is not affected, so later accesses during the normal time will act as if the mid-scanline accesses never happened.

$2134-6 can very likely be accessed during the scanline.

$2137 most certainly can be. $213c and up as well.

And BTW, we don't know what happens if you access $4016/7 or $4218-f during auto joypad read.
Post Reply