It is currently Tue Mar 28, 2017 8:53 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Wed Jan 25, 2017 6:10 pm 
Offline

Joined: Sat Oct 22, 2016 3:36 am
Posts: 8
I am setting the universal color every time in my NMI. However, when playing, the horizontal scroll seems to be set to 255 (it should be 0) to show the right nametable.

Here's the code I'm using to set the universal color:
Code:
   BIT $2002
   LDA #$3F
   STA $2006
   LDA #$00
   STA $2006
   LDA sharedColor
   STA $2007

I am setting the scroll at the end of NMI like so:
Code:
   BIT $2000
   LDA scrollX
   STA $2005
   LDA scrollY
   STA $2005

What am I doing wrong?


Top
 Profile  
 
PostPosted: Wed Jan 25, 2017 6:17 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 17993
Location: NE Indiana, USA (NTSC)
Reading $2000 won't help much, nor will reading any other PPU port other than $2002 or $2007.* When setting the scroll position, you need to write a value to $2000.


* Except reading $3F16, a mirror of $2006, to exploit PPU open bus as part of detecting the console's region.


Top
 Profile  
 
PostPosted: Wed Jan 25, 2017 6:32 pm 
Offline

Joined: Sat Oct 22, 2016 3:36 am
Posts: 8
tepples wrote:
Reading $2000 won't help much, nor will reading any other PPU port other than $2002 or $2007.* When setting the scroll position, you need to write a value to $2000.


* Except reading $3F16, a mirror of $2006, to exploit PPU open bus as part of detecting the console's region.


D'oh, I guess I just habitually put a read there after doing BIT $2002 all the time.

Do I need to do a BIT $2002 before the write to $2000 to prevent another NMI from firing?


Top
 Profile  
 
PostPosted: Wed Jan 25, 2017 6:39 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1422
Location: DIGDUG
Perhaps you should try...

LDA #xxxx xx00 (for nametable 0)
STA $2000
LDA scrollX
STA $2005
LDA scrollY
STA $2005

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


Top
 Profile  
 
PostPosted: Wed Jan 25, 2017 7:46 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 9421
Location: Rio de Janeiro - Brazil
zhanj wrote:
Do I need to do a BIT $2002 before the write to $2000 to prevent another NMI from firing?

IIRC, you only get an instant NMI when the NMI enable bit switches from 0 to 1, so no.


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 2 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