Every fourth byte in palette is transparent?

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

Post Reply
User avatar
GradualGames
Posts: 1106
Joined: Sun Nov 09, 2008 9:18 pm
Location: Pennsylvania, USA
Contact:

Every fourth byte in palette is transparent?

Post by GradualGames »

Is this true? I have been working on developing a graphics editor for NES game development, and now that I have the ability to edit the pattern table, name table, attribute table, and palette---I noticed that I wasn't seeing attribute colors when I used palette entry 0, 4, 8 or 12. From reading NESDoc.pdf, it looks like all four of these locations in the palette are treated as transparent. The doc goes on to say that there are 13 displayable colors. Wait a sec---isn't it 12? Or are they counting that background color as the 13th color?

Regards,
-Zom
User avatar
Disch
Posts: 1848
Joined: Wed Nov 10, 2004 6:47 pm

Re: Every fourth byte in palette is transparent?

Post by Disch »

ZomCoder wrote:I noticed that I wasn't seeing attribute colors when I used palette entry 0, 4, 8 or 12. From reading NESDoc.pdf, it looks like all four of these locations in the palette are treated as transparent.
This is true. Not only for sprites, but also for the BG.
The doc goes on to say that there are 13 displayable colors. Wait a sec---isn't it 12? Or are they counting that background color as the 13th color?
It'd actually be 25. 4 sets of 3 (12) for sprites, plus another 4 sets of 3 (12) for the BG, plus the background color = 25.

But if they said 13 they're probably talking about just the BG colors and the background color.

The Background color is at ppu address $3F00, but is also mirrored at $3F10, so a write to either of those will change the background color. The layering of the NES works like so:

FG priority sprites <--- top layer
Background (nametables)
BG priority sprites
Background color ($3F00) <--- bottom layer

Transparent sprite/bg pixels reveal the layer beneath it, with the background color being the catch all if all BG/sprite pixels are transparent.
Post Reply