Page 1 of 1

Palette/colors clarification

Posted: Tue Nov 17, 2015 6:54 pm
by Bowie90333212391
I'm reading through a document (http://nesdev.com/NESDoc.pdf) and it states (Under 3.4 Colour Palette):

"These palettes do not store the actual colour values but rather the index of the colour in the system palette."

So if I look at one of the background palettes at $3F01, am I correct in understanding that it contains an index to a color that is in the system palette? Where is this "system palette" located?.

I don't see a reference to information regarding the NES system palette anywhere else in the document or on the nesdev wiki.

Re: Palette/colors clarification

Posted: Tue Nov 17, 2015 6:57 pm
by Dwedit
Sounds like documents intended for people who only think in 24-bit RGB and are unfamiliar with the ideas of a hardwired palette. You can safely ignore that bit.

The 'hardwired palette' is just the pattern of square waves that each color value produces on the composite video signal.

Re: Palette/colors clarification

Posted: Tue Nov 17, 2015 7:43 pm
by tepples
You could think of it as stored half in the PPU's signal generator (which produces the square waves) and half in the TV's NTSC decoder. Every TV model is slightly different, but the result looks a little like this:

Image
You'll never see a Fifty Shades of Grey game on the NES


For example, if the value at $3F01 is $27, the result will be orange. Or if it's $22, it'll be blue like the sky in Super Mario Bros.

On the RGB PPUs (2C03, 2C04, and 2C05), the palette is stored in a 64-word by 9-bit ROM, with 3 bits of each component feeding a DAC. These ROMs have been dumped.

Re: Palette/colors clarification

Posted: Wed Nov 18, 2015 8:58 pm
by Bavi_H
When computers send a picture to a computer monitor, the picture signals that get sent are made up of seperate red, green, and blue signals. In the computer's picture memory, the color number is sometimes built from bits that represent red, green, and blue values. Other times the color number is just an index, and the actual red, green, and blue values are stored somewhere else.

On older game consoles and computers that send a picture to a TV, the picture signal that gets sent is one "composite" signal. When using a composite signal, you can't directly specify red, green, and blue values. In the NTSC composite signal, the signal is made of phase, amplitude, and average level as shown in this diagram. The TV converts the one composite signal into red, green, and blue levels (this conversion is done by the TV's NTSC decoder that tepples mentioned).

The document you are reading seems to be trying to say that the color number is not built from bits that map to red, green, and blue values. You might call the color number an index. But instead of selecting red, green, and blue values stored somewhere else, the color number is used to select which electronic components control the phase, amplitude, and average level that gets sent out (that's what Dwedit means by a hardwired palette).

Some NES systems do use RGB signals. (For example, NES arcade systems that connect to a monitor using seperate RGB signals. These systems use the RGB PPUs that tepples is talking about.) In that case, there are red, green, and blue values stored somewhere for each color number.

Re: Palette/colors clarification

Posted: Wed Nov 18, 2015 10:03 pm
by Bavi_H
If you want to start exploring the NTSC signals the NES sends out, refer to the palette picture tepples posted above, and take a look at the nesdev wiki article NTSC video, section Brightness Levels. For now, look at the rows for "Color xx" and the column for "Normalized". For these normalized values, 0 represents black and 1 represents white.

For the black, white, and gray colors (color numbers ending with _0, _D, _E, or _F), the output signal is a flat signal. According to the notes above the table, color numbers ending in _E and _F use the same level as color 1D (the normalized zero black).

For the chromatic colors (color numbers ending in _1 to _C), the output signal quickly fluctuates between a high and low level. The beginning digit (0_ to 3_) controls the top and bottom levels of the fluctuating signal: the signal fluctuates between the _0 color and the _D color that begins with the same digit. The ending digit (_1 to _C) controls the phase shift of the fluctuating signal.

_______

If you want to start exploring how a TV converts the NTSC composite signal into red, green, and blue levels... well, you can search online for descriptions of how the NTSC signal works. I haven't found a single source that clearly explains it all well enough for me to link to and recommend you read. My best suggestion is that you read as many different documents about NTSC you can find online to piece together an understanding of how it works. Understanding NTSC color signals is a hobby for me, and I don't remember all of it myself.