Correct PPU 2003/2004 functionality

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
WedNESday
Posts: 1284
Joined: Thu Sep 15, 2005 9:23 am
Location: Berlin, Germany
Contact:

Correct PPU 2003/2004 functionality

Post by WedNESday »

I'm currently in the process of writing a series of test ROMs for both my emulator and my Famicom. The first one checks memory for basic things like RAM mirroring, whether or not a register can be read from and/or written to and open bus behaviour.

Everything listed on the wiki has been correct so far. However, one interesting discrepancy I've found is that the PPU register 'OAM address' ($2003) is both read and write on my RP2C02H-O even though the wiki maintains that it is write only. Can anyone else confirm if they've noticed the same thing? If the wiki is anything to go by, it seems that the read ability was only introduced in later PPU revisions.

It'll be interesting to be able to read from this register during rendering to see what the PPU sets it (even though I do believe that we already know the answer).
User avatar
Dwedit
Posts: 4924
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: Correct PPU 2003/2004 functionality

Post by Dwedit »

If this can be shown to be consistent across different bootups, different PPU-CPU timing alignments, etc, then this is a neat discovery.

When hardware tests disagree with the wiki, edit the wiki.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
User avatar
Quietust
Posts: 1920
Joined: Sun Sep 19, 2004 10:59 pm
Contact:

Re: Correct PPU 2003/2004 functionality

Post by Quietust »

What type of tests did you perform that led you to this conclusion?
Are you certain that this is not an instance of PPU I/O open bus behavior?
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
WedNESday
Posts: 1284
Joined: Thu Sep 15, 2005 9:23 am
Location: Berlin, Germany
Contact:

Re: Correct PPU 2003/2004 functionality

Post by WedNESday »

Quietust wrote: Thu Mar 03, 2022 10:12 am On the 2C02G, attempting to read from any write-only register will give you the last value you read from or wrote to any other register. Are you sure that's not what you're seeing here?
Wrong. Attempting to read from any write only register results in open bus behaviour. My Famicom confirms this.

I've just done another test using the following code:

Code: Select all

LDA #$FF
STA $2003
LDA #$00
LDA $2003
STA $10
This results in $0010 = $FF. If the register were read-only, you would expect $0010 = $20 (i.e. open bus behaviour).

Thought that having $FF return might just be some kind of coincidence so I tested the value $7E as well and got the exact same result.

I'll upload a screenshot when I can. My web hosting service is down right now. :shock:
User avatar
Quietust
Posts: 1920
Joined: Sun Sep 19, 2004 10:59 pm
Contact:

Re: Correct PPU 2003/2004 functionality

Post by Quietust »

WedNESday wrote: Thu Mar 03, 2022 11:01 am I've just done another test using the following code:

Code: Select all

LDA #$FF
STA $2003
LDA #$00
LDA $2003
STA $10
This results in $0010 = $FF. If the register were read-only, you would expect $0010 = $20 (i.e. open bus behaviour).

Thought that having $FF return might just be some kind of coincidence so I tested the value $7E as well and got the exact same result.
This behavior is explained on the wiki as "PPU open bus", to which a link can be found in my post above (which I edited before you actually posted your reply so there's no "Edited" marker on it) - if you write a value to any PPU register ($2000-$2007) and then read from $2003 (or any other write-only register, such as $2000/$2001 or $2005/$2006), you will get that same value back for at least a few seconds.
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Correct PPU 2003/2004 functionality

Post by tepples »

See also my previous topic "Riding the open bus", in which I too was initially confused about the difference between PPU open bus and CPU open bus.
User avatar
Dwedit
Posts: 4924
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: Correct PPU 2003/2004 functionality

Post by Dwedit »

I guess this just means that open bus has ways of being incredibly misleading. It can make write-only registers look like they are read-write by giving the same value back.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
Post Reply