It is currently Thu Oct 19, 2017 6:44 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Why do games do this
PostPosted: Mon Jan 03, 2005 10:51 pm 
Offline
User avatar

Joined: Wed Nov 10, 2004 6:47 pm
Posts: 1845
LDA #$3F
STA $2006
LDA #$00
STA $2006
STA $2006
STA $2006


I've seen this in several games, and even some demos (Q's Copper Bars). They're even usually followed by more $2006 or $2005 writes... which makes it seem pretty useless.

Anyone know what's up with that? Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 03, 2005 11:14 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19104
Location: NE Indiana, USA (NTSC)
Fragment 1:
Code:
lda #$3f
sta $2006
lda #$00
sta $2006

This sets a PPU-internal palette pointer to 0. You should do this after a partial palette update, or Bad Things will happen to your background color

Fragment 2:
Code:
lda #$00
sta $2006
sta $2006

This sets the VRAM address to $0000, which has the effect of scrolling to (0, 0) of nametable $2000. Loopy's scrolling doc explains this in more detail.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 03, 2005 11:51 pm 
Offline

Joined: Mon Sep 20, 2004 11:13 am
Posts: 134
Location: Sweden
tepples wrote:
This sets a PPU-internal palette pointer to 0. You should do this after a partial palette update, or Bad Things will happen to your background color

PPU-internal palette pointer?
Hmm, are you saying that this:
Code:
lda #$3f
sta $2006
lda #$10
sta $2006

would result in the sprite palette being used for the background?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 04, 2005 10:24 am 
Offline
User avatar

Joined: Sun Sep 19, 2004 10:59 pm
Posts: 1389
There are no palette entries at addresses 3F10/3F14/3F18/3F1C - they simply point to 3F00/3F04/3F08/3F0C. The reason you set the palette address to 3F00 at all is so the screen will be set to the correct color when rendering is disabled; otherwise, the PPU will output whatever palette entry was selected last (which is usually NOT what you want).

_________________
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.


Top
 Profile  
 
 Post subject: o_o
PostPosted: Thu Jan 06, 2005 3:00 am 
Offline
User avatar

Joined: Wed Nov 17, 2004 12:34 pm
Posts: 41
Did I miss a doc explaining the extra workings of $2006...


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