It is currently Mon Oct 14, 2019 1:08 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Thu Sep 19, 2019 5:05 pm 
Offline

Joined: Thu Sep 19, 2019 4:50 pm
Posts: 2
Hai!

I'm trying to learn how to code an emulator, I know it's likely just another one for the pile of existing emulators. But, it's more for a learning exercise. So far emulating the 6502, working great! So i started to tackle the PPU of course. And I'm hitting some stumbling points.

The big one I can't wrap my head around, and my google-fu hasn't been too helpful, is how or where the other 32 colors in the palette are defined. What I mean is addresses 0x3F00 to 0x3F1F are the various "colors" which are 32 colors. However, all the tables I've seen have 64 colors in them. The other 32 look more like pastel colors. So have i just not dived enough in the PPU to discover where a flag is set to produce the other 32 colors, like a "bank" switch in the palette?

Now the sources I've been using as guidelines usually just hard code the 64 values, but how are they addressed? If the PPU can only request up to 0x3F1F how would it obtain those other colors. I'm not needing someone to hold my hand through it, just to point where maybe this info exists in the nesdev wiki. Or let me know if I just need to emulate more of the PPU.

I thought for sure getting the hard coded stuff (the various ROMs) would be the best place to start.

Thanks for any help!


Top
 Profile  
 
PostPosted: Thu Sep 19, 2019 5:24 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 21625
Location: NE Indiana, USA (NTSC)
Addresses $3F00-$3F1F refer to RAM inside the PPU. The values stored in that RAM determine which color is actually used. If you write the value $36 into $3F01, then background color 1 will be displayed in pastel pink.

_________________
Pin Eight | Twitter | GitHub | Patreon


Top
 Profile  
 
PostPosted: Thu Sep 19, 2019 5:32 pm 
Offline

Joined: Thu Sep 19, 2019 4:50 pm
Posts: 2
OOOOOOOOOOH!

That makes so much more sense, lol. So to make sure i understand this right, you use the color table to pick which color to put in that address (0x3F01) so it uses that color (0x36) when drawing something that uses the BG1 color.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 7 hours


Who is online

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