This page is a mirror of Tepples' nesdev forum mirror (URL TBD).
Last updated on Oct-18-2019 Download

Mid-frame VRAM writes (not palette)

Mid-frame VRAM writes (not palette)
by on (#35381)
Which games write to CHR-RAM and/or nametable VRAM mid-frame, if any? I don't think mid-frame VRAM writes (i.e. writes to CHR-RAM or nametable data) have ever been mentioned in stuff about hard-to-emulate games; and I'm not talking about mid-frame palette writes. I think they could be useful for writing both nametable and CHR data for (small) status bars for playfields that need lots of nametable/CHR data, like for special effects or bosses. I imagine that they could also be useful for replacing tiles with text, like in RPGs or graphic/text adventures. Though they would probably take some time, so are they really worth the cycles they steal?

EDIT: Yes, I am aware that these writes are only possible if PPU rendering is turned off.

by on (#35382)
Mid-frame VRAM writing I think would require turning the PPU rendering off. If you don't then you can't set the VRAM pointer to what you want as the PPU when rendering is busy using it. I don't think there is any reason you would want to update VRAM mid-frame. If you need new graphics later down in the frame you use CHR-ROM or have bank switched CHR-RAM.

Really I cannot think of any reason you would want to do this.

by on (#35383)
Wizards and Warriors III turns off the screen at the status bar point, DMAs a new sprite table, writes some graphics to VRAM, resets scrolling, then turns on the screen to draw the status bar.

RC Pro Am (PRG 0 version) also turns off the screen, but to generate a new sprite table using manual OAM writes. The PRG 1 version runs on MMC1, has VROM, and does not change the sprite table mid screen.

by on (#35391)
RC Pro-Am (PRG0) DMAs from PRG $F800, which contains all $F8, then updates specific entry with manual OAM writes.

I checked Wizards and Warriors III (and Ironsword as well), neither of them touch the sprite registers mid-frame, but they appear to reserve Kuros' (the player) CHR updates mid-frame. After some quick analysis (with FCEUxD), both games appear change the sprite 0-hit tile's nametable entry back to its original tile mid-frame, so that the game can still read off the original tile's CHR data to produce the sprite 0-hit tile.

So from this, mid-frame CHR-RAM writes could be useful to split CHR-RAM update tasks; in these games' case, Kuros' graphics task is one frame early, but after the playfield is rendered during that frame.

by on (#35392)
The ONLY way you could possibly modify VRAM (through registers $2006, and $2007) mid-screen is if

1. The VRAM had dual ports and one of them was hooked up to the CPU bus, which is not the case, or

2. If the PPU is not rendering at time of modify.

And I'm not sure what's going on in those other games you mentioned :-P

by on (#35395)
doppelganger wrote:
The ONLY way you could possibly modify VRAM (through registers $2006, and $2007) mid-screen is if

1. The VRAM had dual ports and one of them was hooked up to the CPU bus, which is not the case, or

2. If the PPU is not rendering at time of modify.

And I'm not sure what's going on in those other games you mentioned :-P

Yes, those games turn off rendering first before writing to CHR-RAM and VRAM.