Damian Walker

Personal Web Pages

What Can CGA Do?

Silly Knight: CGA colour tweaking

Saturday, 8th August 2020

Part 2 of a blog series on CGA palettes.

Today I want to give a broad outline of what the CGA card is capable of, particularly for gaming. Modern gamers who've been exposed to it might think that it's capable of black, cyan, magenta and white, but there's a bit more to it than that. Before talking about the graphical capabilities, it's worth discussing the text modes.

There are four text modes on CGA, two monochrome and two colour. The monochrome modes differ from the colour ones only in disabling the colour on a composite monitor. On an RGB monitor the monochrome modes are identical to the colour ones. That leaves us with two effective modes: 40-column mode and 80-column mode. They could in theory display only text, and "graphics" were limited to using the lines and boxes and various other cute characters in the IBM character set. The main advantage of these text modes was that all sixteen colours of the CGA palette could be used at once. The IBM character set had some half-block characters, so without any special tweaks you could create a 16-colour block graphic display of 80x50 "pixels".

That graphical tweak was to adjust the height of each text line to something less than the usual 8 pixels. By setting the card to display 2-pixel high characters, you had an effective resolution of 80x100. Since IBM had a vertical half-block character, filling the screen with that character and modifying the foreground and background colours of each character allowed an effective resolution of 160x100 using all sixteen colours. This could look very good but sadly was rarely used back in the machine's heyday. The picture shows Silly Knight, a modern game that uses the technique.

At the opposite end of the resolution scale was the "high resolution" monochrome mode. This gave a resolution of 640x200 pixels, and you could choose a palette of any one of the sixteen colours on a black background. A few games used it where detail was more important than colour.

The most common mode was 320x200 in four colours. The default colours where black, cyan, magenta and white, which you will see on many, many games of the era. The colours couldn't be changed individually. Only the background colour could be set freely, changing the default black to any of the sixteen colours of the full CGA palette. The three foreground colours had to be chosen together from a set of six different combinations, three of those being bright versions of the others. More on those later.

There was another tweak available that allowed sixteen colours to be displayed at an effective resolution of 160x200, but it came with a number of caveats. NTSC composite monitors would render colour artefacts in 320x200 or 640x200 mode, bleeding pixels into one another and rendering a third colour. This colour bleeding blended pixels together to create a somewhat blurred image at an effective resolution of 160x200, with a total of sixteen resultant combined colours. One caveat was that this only worked in countries that used NTSC colour standard. PAL composite monitors like those used in Europe would just render the graphics in black and white at the intended resolution. RGB monitors would just display the 4-colour palettes at the intended resolution. The other caveat was that different systems would give a different set of colours: early IBM PCs, late IBM PCs, the IBM PCjr and Tandy PCs would all give different colours to one another making it difficult to predict how graphics would appear on the screen.

The rest of this blog series will focus on the plain old 320x200 4-colour graphics mode. This is the most common one for games, and unlike some of the more impressive tweaked modes, is (almost) fully compatible with later graphics standards. In particular I'd like to emphasise the little-used art of selecting the best available colour combinations for a particular theme of game.