It is currently Fri Oct 20, 2017 2:30 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: How did Zelda scroll?
PostPosted: Sun Jun 04, 2017 5:21 am 
Offline

Joined: Tue Oct 06, 2015 10:16 am
Posts: 558
I'm having trouble understanding how Zelda scrolls. The docs state mid-screen Y split was not discovered during the commercial era, and my debugging seems to confirm this.

I watched all writes to 2005 and 2006 during screen transitions. Scrolling does not change at any point, not during vblank, not at the bottom of the status bar. When going up/down, there are 32 writes to vram, writing a row of the new tiles, over two frames.

The Zelda commented disassembly online (computerarcheology.com) does not comment on this. I searched nesdev and found nothing more than guesses. Google has nothing.

--

So, it does not scroll, and it does not rewrite an entire nametable. It does not have a mid-screen split. How the heck does it work?

edit: I confirmed the watchpoint also catches (indirect),y writes, so it's not writing to 2005 like that either.


Top
 Profile  
 
PostPosted: Sun Jun 04, 2017 5:31 am 
Online
User avatar

Joined: Mon Jan 03, 2005 10:36 am
Posts: 2962
Location: Tampere, Finland
Pretty sure it changes the scroll with $2006. At least I seem to have debugged it at some point in the past: viewtopic.php?p=153799#p153799

They were able to do Y splits back in the day, just not pixel perfect. (If we discount rare cases like Battletoads, which seems to have managed in some way.)

_________________
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: kkfos.aspekt.fi


Top
 Profile  
 
PostPosted: Sun Jun 04, 2017 5:41 am 
Offline

Joined: Tue Oct 06, 2015 10:16 am
Posts: 558
I did check for the wiki's "two 2006 writes" technique too. The values written to 2006 were constant, despite the screen clearly changing.


Top
 Profile  
 
PostPosted: Sun Jun 04, 2017 6:06 am 
Offline

Joined: Sun Mar 27, 2016 7:56 pm
Posts: 137
How are you going about checking which values are written to $2005 and $2006? If you're trying to use something like the Watch feature in Mesen to watch [$2005] and [$2006], keep in mind those are write-only registers, so trying to read from them won't get you anywhere.


Top
 Profile  
 
PostPosted: Sun Jun 04, 2017 6:26 am 
Online
User avatar

Joined: Mon Jan 03, 2005 10:36 am
Posts: 2962
Location: Tampere, Finland
Put a breakpoint at $8560. It's writing to $2006 at scanline 63.

_________________
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: kkfos.aspekt.fi


Top
 Profile  
 
PostPosted: Sun Jun 04, 2017 7:59 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5726
Location: Canada
calima wrote:
The docs state mid-screen Y split was not discovered during the commercial era, and my debugging seems to confirm this.

What docs say that? There's tons of games that clearly know how to Y split. (Super Mario 3, Rad Racer, Battletoads...)


Top
 Profile  
 
PostPosted: Sun Jun 04, 2017 8:53 am 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10064
Location: Rio de Janeiro - Brazil
The $2006/5/5/6 trick wasn't widely known (or at all?), but $2006-only scroll changes were frequently used, which means that games would usually set the scroll to the very top of a tile, and if they wanted pixel precision, they'd use timed code or IRQs to vary the pixel count BEFORE the split.


Top
 Profile  
 
PostPosted: Sun Jun 04, 2017 11:04 am 
Offline

Joined: Tue Oct 06, 2015 10:16 am
Posts: 558
Nicole wrote:
How are you going about checking which values are written to $2005 and $2006? If you're trying to use something like the Watch feature in Mesen to watch [$2005] and [$2006], keep in mind those are write-only registers, so trying to read from them won't get you anywhere.


Mednafen shows the contents of registers. For a sta write, I look at the A register.


Top
 Profile  
 
PostPosted: Sun Jun 04, 2017 11:06 am 
Offline

Joined: Tue Oct 06, 2015 10:16 am
Posts: 558
thefox wrote:
Put a breakpoint at $8560. It's writing to $2006 at scanline 63.


Yes, that's the target address for the 32 tiles write.
edit: Sample values for that are $22a0, $22c0... Normal nametable addresses that do not make sense with the wiki's two-write 2006 formula. Those were taken from a vertical transition on successive frames.

According to the wiki, that would cause a 2-pixel fine Y scroll. Yet the tiles in Zelda are perfectly 8-aligned.


Top
 Profile  
 
PostPosted: Sun Jun 04, 2017 11:18 am 
Online

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6288
Location: Seattle
calima wrote:
According to the wiki, that would cause a 2-pixel fine Y scroll. Yet the tiles in Zelda are perfectly 8-aligned.
You sure about that? I'm pretty certain I see an offset during the vertical scrolling.


Top
 Profile  
 
PostPosted: Sun Jun 04, 2017 11:26 am 
Offline

Joined: Tue Oct 06, 2015 10:16 am
Posts: 558
Took fresh screenshots, and there's indeed an offset - 5 pixels. Which is not possible according to the wiki, which says the high fine Y bit is cleared, or to the written value which would result in a 2-pixel offset.

Okay, then it's indeed that write and I'm just confused. But why the offset discrepancy?


Top
 Profile  
 
PostPosted: Sun Jun 04, 2017 1:37 pm 
Online
User avatar

Joined: Mon Jan 03, 2005 10:36 am
Posts: 2962
Location: Tampere, Finland
I can't be bothered to do the math, but note that those two $2007 reads also affect the address (and thus, scroll).

_________________
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: kkfos.aspekt.fi


Top
 Profile  
 
PostPosted: Mon Jun 05, 2017 3:25 am 
Offline

Joined: Tue Oct 06, 2015 10:16 am
Posts: 558
I've been thinking about how the writes are an exact match to nametable addresses. Did the Zelda programmers believe it should be a nametable address, and take the fine Y offset as an unavoidable quirk?

Have official NES docs been leaked? Or, do other double-2006 games also write nametable addresses, ie the high nibble being 2?


Top
 Profile  
 
PostPosted: Mon Jun 05, 2017 8:14 am 
Online
User avatar

Joined: Mon Jan 03, 2005 10:36 am
Posts: 2962
Location: Tampere, Finland
calima wrote:
I've been thinking about how the writes are an exact match to nametable addresses. Did the Zelda programmers believe it should be a nametable address, and take the fine Y offset as an unavoidable quirk?

I'm guessing a fair bit of trial and error was involved. There are some bugs which they could've avoided. E.g., when the screen starts to scroll up, it first yanks downwards for one frame. Likewise, when the screen scrolls down, at the end of the scroll it scrolls a bit too far, and then corrects itself.

_________________
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: kkfos.aspekt.fi


Top
 Profile  
 
PostPosted: Mon Jun 05, 2017 8:43 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19110
Location: NE Indiana, USA (NTSC)
And 1-frame jank tends to have been more likely when engineers lacked access to the frame-stepping tools available in the emulator era.


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

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 9 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