When does $2006 update the PPU A lines?

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

Post Reply
User avatar
Disch
Posts: 1848
Joined: Wed Nov 10, 2004 6:47 pm

When does $2006 update the PPU A lines?

Post by Disch »

This might be a confusing question to answer, because it's also a confusing question to ask.

We all know that you can toggle PPU A12 (and thus manually clock the MMC3 IRQ counter) with repeated writes to $2006. My question is basically "why?". Specifically... why does the NES put the address on the bus after the 2nd $2006 write? There's no memory access taking place, is there?

And what happens during rendering when memory accesses (those UNRELATED to the current PPU address, mind you) are taking place? Does the address still get pushed on the bus and conflict with the address currently being read from?
User avatar
Zepper
Formerly Fx3
Posts: 3262
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Re: When does $2006 update the PPU A lines?

Post by Zepper »

Disch wrote:Specifically... why does the NES put the address on the bus after the 2nd $2006 write? There's no memory access taking place, is there?
Isn't that something that belongs to the loopy's ppu scrolling logic?
User avatar
Disch
Posts: 1848
Joined: Wed Nov 10, 2004 6:47 pm

Re: When does $2006 update the PPU A lines?

Post by Disch »

Loopy's doc talks about updating the PPU address. That's no problem. But it doesn't make any mention as to what is put on the bus and when.

The PPU would need to update the bus for the below things:
1) Rendering fetches (NT/CHR/Attribute)
2) $2007 writes
3) Refilling the read buffer after $2007 reads

For #2 and #3, LoopyV (ie: the PPU address) is put directly on the bus. But for #1 (specifically the attribute reads), LoopyV and the PPU bus hold two very different values. So they must be two different things internally.

So why do $2006 writes touch the bus? Not only do they not need to, it seems like it would be problematic. But they must, because it can be observed through the MMC3 IRQ counter.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: When does $2006 update the PPU A lines?

Post by tepples »

If the bus isn't 3-state, the PPU has to output something on the address bus at all times. A rule "whenever rendering is disabled, put v on the bus" probably takes fewer gates than "when rendering is disabled, hold the last value that happened to be on the bus".
User avatar
Bregalad
Posts: 8056
Joined: Fri Nov 12, 2004 2:49 pm
Location: Divonne-les-bains, France

Re: When does $2006 update the PPU A lines?

Post by Bregalad »

And what happens during rendering when memory accesses (those UNRELATED to the current PPU address, mind you) are taking place?
They are very related. The "current PPU address" is the NT tile which is being rendered, and on attribute table and pattern table fetch, the adress is replaced by something else, I guess with an internal multiplexer.
User avatar
Disch
Posts: 1848
Joined: Wed Nov 10, 2004 6:47 pm

Re: When does $2006 update the PPU A lines?

Post by Disch »

I know these things, Bregalad... and I think you know what I meant. But hey, if you want to get into a technicality war.... I'm game... ;P
Bregalad wrote:They are very related. The "current PPU address" is the NT tile which is being rendered
Not entirely. Only the low 10 bits. A10 and A11 are in fact completely unrelated to LoopyV, as they are forced to %10 for NT reads.
and on attribute table and pattern table fetch, the adress is replaced by something else, I guess with an internal multiplexer.
For attributes, the address could be derived from LoopyV, so in that sense I suppose it is related (except for A10 and A11 as above).

CHR fetches, however, use only 3 bits from LoopyV, making them the least related of all.



So I suppose those fetches are "partially related" to LoopyV. :D



EDIT:

Also tepples, your answer makes sense, I guess. :) Thanks.
User avatar
Bregalad
Posts: 8056
Joined: Fri Nov 12, 2004 2:49 pm
Location: Divonne-les-bains, France

Re: When does $2006 update the PPU A lines?

Post by Bregalad »

CHR fetches, however, use only 3 bits from LoopyV, making them the least related of all.

So I suppose those fetches are "partially related" to LoopyV. :D
No, the 3 bits are from the fine scrolling, and are not part of the current adress, which only increase by 32 once the fine scrolling reach 7. Anyhow, how the PPU internally drive it's adress lines is still some black magic, I guess.
User avatar
Quietust
Posts: 1920
Joined: Sun Sep 19, 2004 10:59 pm
Contact:

Re: When does $2006 update the PPU A lines?

Post by Quietust »

Taking a brief look at Visual 2C02, A0-A13 are not tristated and output the contents of the V register whenever rendering is disabled.
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
User avatar
Disch
Posts: 1848
Joined: Wed Nov 10, 2004 6:47 pm

Re: When does $2006 update the PPU A lines?

Post by Disch »

@Bregalad:

Fine Y scrolling is absolutely part of the address, as can be evidenced by the first $2006 write's impact on it (forces high bits to zero and changes the low bit). Also, doing a $2007 write when the PPU address is $2FFF will increment the fine Y scroll.


@Quietust:

Cool, so tepples was right. That makes sense. Thanks. I assume that happens during VBlank as well.
Post Reply