It is currently Wed Jul 18, 2018 1:32 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 17 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: Fri Jul 31, 2009 5:19 am 
Online
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10600
Location: Rio de Janeiro - Brazil
UncleSporky wrote:
This way you do not have to touch $2000, and the second write to $2006 copies T to V, implementing that new scroll.

Please don't think of setting the scroll with $2005/$2006 as a "shortcut". You may "not have to touch $2000", but it's still slower and more complex than using $2000 and $2005, which is the correct, safe way of setting the scroll.

The correct way to set the scroll is selecting the desired name table by writing to $2000 and then specifying how far into that name table rendering should start with 2 consecutive writes to $2005, all of this still during VBlank. This is the correct and safe way to do it if you are a nice boy and like to play by the rules.

But if you like adventures, and for whatever reason you absolutely need to set the scroll outside of VBlank, you have to use those tricks.

The PPU has this internal register it uses to read and write information in it's address space. We control this register by writing to $2006. Curiously enough, the PPU appears to use this same register to keep track of what's displayed during rendering. The conclusion is that, as long as we obey the format in which the PPU handles that information, we can alter what is fetched for display as the screen renders.

That's it. Obey the format the PPU uses, and use whatever combination of writes to put the information where you want it. Do this at the correct time during rendering and you'll successfully manipulate the scroll mid-frame.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 31, 2009 5:26 am 
Online
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10600
Location: Rio de Janeiro - Brazil
UncleSporky wrote:
Under normal (simple) circumstances with no screen splitting tricks, you would simply wait for vblank, use $2006 and $2007 to write your nametables, then reset with $2000 and set your scroll with $2005.

Yes, you got that right.

Quote:
But if you want to do something like a non-scrolling status bar or parallax, you wait for sprite 0 hit and use $2006 and $2005 as described above to write a new scroll.

Yes, but it doesn't have to be a sprite 0 hit. It can be an IRQ, timed code, it doesn't matter, as long as you have a way to perform the writes at the correct time.

Also, note that depending on the type of split you want, you don't have to go through all the trouble of writing to $2006. If you are only changing the horizontal scroll (X), you can still use $2000 and $2005 just fine. The whole trick with $2006 is only necessary if you have to change the vertical scroll as well.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page Previous  1, 2

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 1 guest


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