Re: Thinking about making an NES Z-Machine
Posted: Mon Feb 04, 2019 10:36 pm
Pixel-level synchronization on the NES is notoriously tricky, and even in the best possible scenario you'll still get a couple pixels of jitter...halkun wrote:For fun I was wondering if I could do some "race the beam" kind of things with the NES, but that is going to require real hardware. On the Atari 2600 you could count cycles and alter the scan line while it's drawing on the phosphor. Looks like on the NES you are not even allowed to monkey with the beam during HSYNC.
To access VRAM during display time, you need to turn rendering off, and one side effect of that is that it compromises the sprites for one scanline. Also, the hblank period is so short, that there there's barely enough time to update a single byte in VRAM, since you need to turn rendering off, set the VRAM address, write the data, reset the scroll and turn rendering back on.I was contemplating if you could update the nametables during HSYNC and have it spit out a different pattern for that line. If you can update the nameable on each line, you can have a full screen bitmap. Like I said, I wouldn't even know how to detect when the beam is in HSYNC so I can play with the PPU while it's off.
There are other kinds of raster effects that are much easier and safer to perform though, such as scroll changes, pattern swaps and color emphasis/grayscale.
A full screen bitmap can be achieved fairly easily in 1bpp (i.e. 2-color) with some palette trickery and a pattern table swap halfway down the screen. A regular 2bpp full screen bitmap will require more CHR memory, either RAM or ROM.