Palettes

From SpecNext official Wiki
Revision as of 19:58, 27 December 2017 by wiki>Hyphz
Jump to: navigation, search

To increase the number of available colours on screen, the Spectrum Next supports palletized colours.

Colour IDs in Layer 2 and Sprites are always taken as palette indices. Colour values in the ULA are mapped to the palette as fixed indices, or can be taken as partial palette indices if ULANext mode is enabled. The palette entry numbers for standard ULA mode are: 0-7 for the standard ink colors, 8-15 for BRIGHT ink colors, 128-135 for standard paper colors, and 136-143 for BRIGHT paper colors.

Palette configuration can be done through registers $40-$44. Enhanced ULA Control Register ($43) sets which palette is being set up. There are two palettes each for Layer 2, Sprites, and ULA; which one of the two is used for each is selected using the lower bits of Enhanced ULA Control Register ($43).

Once a palette is selected, Palette Index Register ($40) sets the palette entry number to set up; you can then send the color to set it to on Palette Value Register ($41) or Enhanced ULA Palette Extension ($44) which then auto-increment. $41 is used for sending 8-bit colours in RRRGGGBB format; the "missing" third blue bit is set to an OR between the other two. $44 is used for sending 9-bit colours in two byte packets; the first byte sent should be RRRGGGBB as with $41, and the second byte's LSB fills in the third blue bit. (Bits in the second byte other than the LSB are reserved and should be 0.)