nesdev.com
http://forums.nesdev.com/

2005 or 2000 writes, how they affect 2006/2007
http://forums.nesdev.com/viewtopic.php?f=2&t=16904
Page 1 of 1

Author:  dougeff [ Fri Jan 05, 2018 1:07 pm ]
Post subject:  2005 or 2000 writes, how they affect 2006/2007

As previously stated in another thread, I wasn't sure how an errant 2005 or 2000 write would affect a large block of writes to the PPU (ie, if the NMI interrupted the writes and wrote to 2000 and/or 2005). I tested this in FCEUX 2.2.3 and Nintendulator (but not on hardware, sorry). These were my results...they may be obvious to some of the regulars here.

all are writes, except where noted

(basic)
2006 2006 2007
-correct PPU address

(sta 2005 x1)

2005 2006 2006 2007
-!! sets wrong PPU address

2006 2005 2006 2007
-!! never sets an address

2006 2006 2005 2007
-correct PPU address

(sta 2005 x2)

2005 2005 2006 2006 2007
-correct PPU address

2006 2005 2005 2006 2007
-!! sets wrong PPU address

2006 2006 2005 2005 2007
-correct PPU address

2006 2006 2007 2005 2007 2005 2007
-correct PPU address

(lda 2002)

lda2002 2006 2006 2007
-correct PPU address

2006 lda2002 2006 2007
-!! never sets an address

2006 2006 lda2002 2007
-correct PPU address

(sta 2000)

*2000 of same nametable select
2000 2006 2006 2007
-correct PPU address

2006 2000 2006 2007
-correct PPU address

2006 2006 2000 2007
-correct PPU address

*2000 of different (wrong) nametable select
2000 2006 2006 2007
-correct PPU address

2006 2000 2006 2007
-!! WRONG PPU address (different nametable)

2006 2006 2000 2007
-correct PPU address

2006 2006 2007 2000 2007
-correct PPU address

(lda 2007)

lda2007 2006 2006 2007
-correct PPU address

2006 lda2007 2006 2007
-correct PPU address

2006 2006 lda2007 2007
-PPU address is 1 to the right

2006 2006 sta2007 lda2007 sta2007
-correct PPU address, 1 write, skip 1 spot, 1 write

(lda 2006)
(returns open bus, doesn't affect anything)

lda2006 2006 2006 2007
-correct PPU address

2006 lda2006 2006 2007
-correct PPU address

2006 2006 lda2006 2007
-correct PPU address

Author:  rainwarrior [ Fri Jan 05, 2018 1:10 pm ]
Post subject:  Re: 2005 or 2000 writes, how they affect 2006/2007

If you want to walk through why those !! things happen, the mechanics of it are explained here:
http://wiki.nesdev.com/w/index.php/PPU_scrolling

Of particular relevance is the write toggle (w in that article) which is shared by $2005 and $2006.

Author:  Bregalad [ Sun Jan 07, 2018 2:07 am ]
Post subject:  Re: 2005 or 2000 writes, how they affect 2006/2007

I could be mistaken, but the $2005 and $2000.0 writes are only copied to the scrolling counters at specific points in rendering (start of frame, start of scanline), and does not affect $2006/7 outside of those specific points. So if you wanted to, say, adress the PPU using $2005 instead of $2006 for VRAM updates, you can't do that.

Author:  rainwarrior [ Sun Jan 07, 2018 2:24 am ]
Post subject:  Re: 2005 or 2000 writes, how they affect 2006/2007

Well, a quick summary:


$2000 and $2005 write to a temporary register.

$2006 writes to the same temporary register, but the 2nd write also copies that temporary register into the PPU address immediately.

If rendering is on, this copy from temp to PPU address also happens at the end of vblank. (...and the X part is re-copied every scanline.)

$2007 immediately increments the PPU address by 1 or 32.

Reading $2002 resets the write pair order shared by $2005/2006, i.e. the next write will have "1st write" behaviour.

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/