The number of entries in the palette and the format of the colour data supplied by RISC OS is dependent upon the palette type and the current colour depth.
Palette type | Colour depth | Range of indices | Format |
---|---|---|---|
0 (Normal) | 1bpp | 0-1 | &BBGGRRSS palette entry |
2bpp | 0-3 | ||
4bpp | 0-15 | ||
8bpp | 0-255 | ||
16bpp | See below | VIDC20 16bpp gamma table entry | |
32bpp | 0-255 | &BBGGRRSS gamma table entry | |
1 (Border) | – | 0 | &BBGGRRSS border colour |
2 (Pointer) | – | 0-3 | &BBGGRRSS pointer colour |
In 32bpp modes, the hardware gamma table is expected to be a set of three 8bit lookup tables which translate the red, green and blue components of a pixel to new values. When receiving a request to update the gamma table, the palette index is used to indicate which table entry to write, for all three tables. The red table entry should be updated with bits 8-15 of the colour, the green table entry with bits 16-23, and the blue table entry with bits 24-31.
In 16bpp modes, the hardware gamma table is expected to be a set of three 5bit lookup tables, which operate in an identical manner to the gamma tables in 32bpp modes. However RISC OS supplies the data in a convoluted format that matches the format required by VIDC20 hardware. This can be converted to a set of three 5bit table indices and a set of three 5bit R,G,B values as follows:
red_idx = idx & 0x1f; green_idx = (idx>>1) & 0x1f; blue_idx = (idx>>2) & 0x1f; red_val = (val>>11) & 0x1f; green_val = (val>>19) & 0x1f; blue_val = (val>>27) & 0x1f;