Mid-frame VRAM writes (not palette)

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems. See the NESdev wiki for more information.

Moderator: Moderators

Post Reply
strangenesfreak
Posts: 155
Joined: Thu May 03, 2007 3:07 pm
Contact:

Mid-frame VRAM writes (not palette)

Post by strangenesfreak »

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.
Last edited by strangenesfreak on Wed Jul 30, 2008 8:55 am, edited 1 time in total.
User avatar
MottZilla
Posts: 2837
Joined: Wed Dec 06, 2006 8:18 pm

Post by MottZilla »

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.
User avatar
Dwedit
Posts: 5083
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Post by Dwedit »

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.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
strangenesfreak
Posts: 155
Joined: Thu May 03, 2007 3:07 pm
Contact:

Post by strangenesfreak »

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.
Last edited by strangenesfreak on Tue Jul 29, 2008 8:45 pm, edited 1 time in total.
doppelganger
Posts: 183
Joined: Tue Apr 05, 2005 7:30 pm

Post by doppelganger »

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
Be whatever the situation demands.
strangenesfreak
Posts: 155
Joined: Thu May 03, 2007 3:07 pm
Contact:

Post by strangenesfreak »

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.
Post Reply