It is currently Mon May 28, 2018 1:07 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Fri Jan 05, 2018 1:07 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 2054
Location: DIGDUG
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

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
PostPosted: Fri Jan 05, 2018 1:10 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 6296
Location: Canada
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.


Top
 Profile  
 
PostPosted: Sun Jan 07, 2018 2:07 am 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7432
Location: Chexbres, VD, Switzerland
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.


Top
 Profile  
 
PostPosted: Sun Jan 07, 2018 2:24 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 6296
Location: Canada
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: koitsu, Nicole and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group