Display/Palette
The display system provides sixteen different palettes that can be used to color or shade tiles.
- Palettes 0-7 can be used for the two screens only;
- Palettes 8-15 can be used for both screens and sprites.
Palette format
Mono
In mono modes, palettes are stored in I/O ports 0x20 through 0x3F. Each palette contains four three-bit entries, which are pointers into a global, four-bit shade lookup table:
Palette Global shade LUT 1 ===========> 2 ==========================> 5 ^ (0, 2, 4, 6) ^ (1, 3, 5, 7, 9, 11, 13, 15) ^ | | | Palette index Value Displayed shade
The shade value corresponds to the darkness of the pixel: shade 0 is the brightest, while shade 15 is the darkest.
Color
In color modes, palettes are stored as 16-bit words in memory addresses 0xFE00 through 0xFFFF, without additional lookup tables:
Address 15 bit 8 7 bit 0 ---- ---- ---- ---- 1111 111p pppi iii. | |||| ||| | |||+-+++-- Index in palette (0-15) +--+++------- Palette number (0-15) Data 15 bit 8 7 bit 0 ---- ---- ---- ---- .... rrrr gggg bbbb |||| |||| |||| |||| |||| ++++- Blue (0-15) |||| ++++------ Green (0-15) ++++------------ Red (0-15)
In 2 bits per pixel color modes, palette entries 4 through 15 are not used.
Palette transparency
In two bit per pixel modes:
- Palettes 0-3 and 8-11 are opaque. For these, index zero is treated as opaque.
- Palettes 4-7 and 12-15 are translucent. For these, index zero is treated as transparent. This means that the color/shade value set to it is ignored, and only three distinct colors/shades can be used for tiles.
In four bit per pixel modes, all palettes are translucent. Index zero is always treated as transparent, and fifteen different colors/shades can be used for tiles.