Clone wiki

agtools / CryptoChrome palettes

This section describes the (very simple) file formats emitted from the PCS CryptoChrome modes for palette data.

This data is currently emitted as 3 files with hardcoded names (this is likely to change in future, to adopt the name of the input file).


This is plain ST/e raw palette data, organised as 16 words in the expected swizzled 0:4:4:4 format. Ready to assign to palette registers. Only one of these is emitted, even in dual-field mode. The same palette serves both fields!


This is the colour reduction translation table. It consists of 64x64x64 bytes which map a 6:6:6 format (18bit) packed RGB values to 8bit hybrid colours.

The hybrid colours are not ST/e colours but simulated ones called solution pairs. For a 16 colour palette, a theoretical maximum of 136 hybrid colours can be generated for any image but it is usually a bit less than this - it depends a lot on the input material and configuration/tuning switches.

These hybrid colours need indexed again to find the real ST/e pixel colours to use.


This is the table of 256 (really, 136 max) solution pairs. Each one represents a hybrid colour, and contains two real ST/e pixel colours.

The entries are formatted as 4:4 bits, with each field mapping to complementary ST/e pixel colours.

Single-field palettes will contain the same colour in both fields, so you can just ignore the upper 4 bits.

Dual-field palettes (or dithered single-field palettes) can contain different colours in the upper and lower 4 bits. These should be dithered in alternating fashion to reproduce the intended hybrid colour.

For dual-field graphics, two images should be dithered out using the same values, with each image using the opposite arrangement of both ST/e colours in the dither pattern.

Typical Usage

  1. Get the 8:8:8 RGB from the source image to be remapped
  2. Convert 8:8:8 RGB to an index formatted as 6:6:6 most significant RGB bits
  3. Use this index to look up the [.ccr] table to obtain the 8bit hybrid colour index
  4. Use the hybrid colour index to look up the [.ccs] table, to find the solution pair of 4bit ST/e colours to use
  5. Each 4bit ST/e colour in the solution pair can index the [.ccp] palette to find the hardware colour for each

As mentioned above, the 4bit pairs are intended to be dithered with, if the palette was generated in dual-field mode. Otherwise just use the lower 4 bits and ignore the rest.


Most of the -ccmode modes will output this palette data. Some will also output preview images for inspection, for individual interlace fields and for the composite image. Some modes will not output a preview image (e.g. superpalette batching, where more than one image is being fed in).

The solution pair 4bit fields are sorted by intensity. Colour field 1 is always brighter than colour field 0, and each are tied to their own 4bit field in the solution pair. This is deliberate to ensure dithering them produces even intensity when interlaced/strobed.

The palette data (chunky8.ccs) can be passed to agtcut as a palette source. agtcut knows how to dither graphics using this data. Some additional options allow agtcut to use just one or other field of the solution pair (upper or lower) for all pixels.