It is currently Tue Dec 12, 2017 1:03 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Sun Jan 03, 2016 12:12 pm 
Offline

Joined: Sun May 10, 2015 5:01 pm
Posts: 4
I'm trying to understand how the address latch works when dealing with PPUSCROLL and PPUADDR.

The wiki states (for SCROLL and ADDR):
Quote:
Reading the status register will clear D7 mentioned above and also the address latch used by PPUSCROLL and PPUADDR.


My question is this: Since PPUSCROLL and PPUADDR share the same latch, what happens if you mix writes to both addresses?

Example:

Write 0xa to PPUSCROLL, write 0xb to PPUADDR, then write 0xc to PPUSCROLL. What is the value of PPUSCROLL? What is the value of the latch and PPUADDR?

Is it safe to say that the PPUSCROLL and PPUADDR only get set to the value of the latch on their second write, and since the latch is shared, it's whatever the state of the latch is at that point in time? Also what happens when additional writes occur and PPUSTATUS hasn't been read (so the latch hasn't been reset)?

Example:

Write 0xa to PPUSCROLL, write 0xb to PPUSCROLL, write 0xc to PPUSCROLL, what 0xd to PPUSCROLL. What is the value of PPUSCROLL and the latch?


Top
 Profile  
 
PostPosted: Sun Jan 03, 2016 12:46 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6510
Location: Seattle
The exact function of each of the four possible writes to $2005 and $2006 are enumerated here: nesdevwiki:PPU scrolling.


Top
 Profile  
 
PostPosted: Mon Jan 04, 2016 11:14 pm 
Offline

Joined: Sun May 10, 2015 5:01 pm
Posts: 4
Is PPUADDR a 16-bit register? The wiki states that you need to write to the memory mapped address ($2006) twice to full the register with the most and least significant bytes.

The wiki almost makes it seem like PPUADDR is a 8-bit register which wouldn't be large enough to hold the full address that gets written. Is this a typo in the wiki?


Top
 Profile  
 
PostPosted: Mon Jan 04, 2016 11:42 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5891
Location: Canada
There are four related registers: PPU_scrolling#PPU_registers

The PPU address is 15-bit, and there is a second 15-bit register that holds a temporary copy of the PPU address before applying the change.

PPUADDR is not a register, it is just a name given to the port at memory address $2006. Writing to $2006 affects the PPU address registers in various ways. (Read the page that was just linked. lidnariq linked it too.)


Top
 Profile  
 
PostPosted: Tue Jan 05, 2016 6:45 am 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10164
Location: Rio de Janeiro - Brazil
The 6502 is an 8-bit CPU that can only read and write data one byte at a time. The $2005/6 latch exists precisely so that the 8 bits that are writen have a different meaning on two consecutive writes.

The wiki page shows exactly which bits of the internal registers are affected on each of the 4 possible writes ($2005 even, $2005 odd, $2006 even, $2006 odd).


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

All times are UTC - 7 hours


Who is online

Users browsing this forum: Bing [Bot] and 6 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