Quick question about PPUSTATUS/PPUADDR

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

Post Reply
User avatar
SecretServiceDude
Posts: 99
Joined: Wed Oct 22, 2008 3:49 pm
Location: Los Angeles, CA

Quick question about PPUSTATUS/PPUADDR

Post by SecretServiceDude » Thu Nov 13, 2008 10:04 pm

Assuming you always write to PPUADDR in pairs, is it sufficient to reset the VRAM address latch by reading PPUSTATUS just once near the beginning of NMI?

Or should you always reset the latch before writing to PPUADDR to be safe?

User avatar
Dwedit
Posts: 4329
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Post by Dwedit » Thu Nov 13, 2008 10:34 pm

It all depends on what's going to get interrupted.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!

User avatar
SecretServiceDude
Posts: 99
Joined: Wed Oct 22, 2008 3:49 pm
Location: Los Angeles, CA

Post by SecretServiceDude » Thu Nov 13, 2008 10:37 pm

Suppose all the writes to PPUDATA occur in NMI, and IRQs are disabled. Nothing would get interrupted at that point, right? In that case, is it safe to reset the latch just the one time?

User avatar
Memblers
Site Admin
Posts: 3858
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis
Contact:

Post by Memblers » Fri Nov 14, 2008 1:26 am

Yes, it's safe to reset it just once. If your NMI has the potential to be long enough, you may want to make sure it doesn't interrupt itself, but I doubt it's a problem.

I've seen very few games, actually only one I can think of, that always read PPUSTATUS before setting the address. Myself, I read it in every NMI.

Post Reply