It is currently Sun Sep 24, 2017 12:26 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Rough x/y split ?
PostPosted: Fri Sep 01, 2017 11:27 am 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1733
Location: DIGDUG
Dumb question. Can you do a rough X/Y scroll split with 2 writes to $2006.

(If I remember correctly, affecting all but the fine Y bits)

I've never tried it.

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


Top
 Profile  
 
 Post subject: Re: Rough x/y split ?
PostPosted: Fri Sep 01, 2017 12:09 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5645
Location: Canada
Reference:
https://wiki.nesdev.com/w/index.php?title=PPU_scrolling#Summary

It doesn't set any of the fine X bits, and it sets the top bit of fine Y to 0.


Top
 Profile  
 
 Post subject: Re: Rough x/y split ?
PostPosted: Fri Sep 01, 2017 12:24 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1733
Location: DIGDUG
Ok, I see. So if your fine X is wrong, 2 writes to $2006 might not be enough for...say...a HUD at the bottom of the screen?

What about...
LDA #0
STA $2005
STA $2005
LDA #something
STA $2006
LDA #something
STA $2006

(ie, during rendering, perhaps after a sprite zero hit)

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


Top
 Profile  
 
 Post subject: Re: Rough x/y split ?
PostPosted: Fri Sep 01, 2017 12:36 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6182
Location: Seattle
That makes the math easier, but makes the raster timing much worse. The first write to $2005 will immediately cause glitches for the remainder of the drawn scanline.

In contrast, the 6-5-5-6 method requires more calculation, but only the last two writes need to be during horizontal blanking.


Top
 Profile  
 
 Post subject: Re: Rough x/y split ?
PostPosted: Thu Sep 07, 2017 7:14 am 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7209
Location: Chexbres, VD, Switzerland
dougeff wrote:
Dumb question. Can you do a rough X/Y scroll split with 2 writes to $2006.

Of course you can. Most games do it that way. My game does it that way too. Fine X scroll stays the same.

Quote:
What about...
LDA #0
STA $2005
STA $2005
LDA #something
STA $2006
LDA #something
STA $2006

(ie, during rendering, perhaps after a sprite zero hit)

This is the "standard" way to do it. All games does it that way. The 6-5-5-6 method was only decovered by the reverse-engineering retroscene in the 2000s.


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: No registered users and 13 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