CGIA palette MODE0

-

CGIA got support for paletted text and graphics modes.

Newly introduced MODE0 and MODE1 work without dedicated color attribute memory areas. Instead these use a palette table stored in CGIA registers. This allows to have colorful graphics modes with very little memory usage.

MODE0 is a text/tile mode similar to MODE2, and MODE1 is a bitmap graphics mode similar to MODE3.

Second half of the 16 plane registers are used to select one of 256 CGIA available colors. This gives us 8 palette entries. Both MODE0 and MODE1 allow selecting color depth of 1-4 bits per pixel, allowing to use 2, 4, 8 or 16 colors from the palette.

The palette entry selection works a bit differently between graphics and text modes. In MODE1 graphics mode, the BITMAP bits directly select the palette entry for pixel. 1/2/4bpp is straightforward - generating 8/4/2 pixels per byte respectively. In 3bpp mode pixels are bitpacked in 4 pixels every 3 bytes - similarly to MODE6 HAM.

In MODE0 text/tile mode, each character/tile cell contributes character code and character generator bits to a color index. One bit comes from the character generator selecting off or on pixels. In modes with more than 1bpp, additional bits are “stolen” from high bits of character code. This restricts usable number of glyphs at the advantage of allowing more colorful text and tile graphics.

I did mention we have 8 palette entries in the plane registers, but we have 4bpp modes allowing to select 16 different colors. How does that work?
Well, in 4bpp modes the highest bit of the color index does not select palette entry, but acts as a half-bright flag. When the highest bit is set, the selected color from palette is rendered at brightness lowered or raised by half, depending whether the color was originally in the dark or bright half of the CGIA palette color row.

MODE0 screenshot

MODE0 is also available in multi-color variant, where it takes two bits from character generator per pixel - similarly to MODE2 multi-color. This makes only 2bpp and 3bpp color depths usable. 1bpp is not possible as we already have 2 bits per pixel, and 4bpp does not make sense as half-bright feature cannot tell which of the three colors selected by character generator bits should be rendered at half-bright.

MODE0 multi-color screenshot


Share: