Custom PC

Remembering CGA graphics

By Ben Hardwidge. Posted

People often nostalgically reminisce about archaic technology, laughing about the frustrations and limitations of cassette tapes or floppy disks, before adding ‘but they were amazing at the time!’ You simply can’t hide the horror of the PC’s first colour graphics adaptor (CGA) behind such rose-tinted glasses (although orange-tinted glasses might help – more on that later). Nobody, absolutely nobody, thought CGA was amazing at the time.

I had a CGA PC in the 1980s, and even then you felt disappointed when you fired up a PC game to be greeted by a mess of purple and black on the screen. At the time, we joked that CGA stood for ‘crap graphics adaptor’. Nobody thought of IBM computers as games machines then, of course – CGA was the product of IBM trying to make a graphics standard that could display bar charts properly. It wasn’t meant to compete with the Commodore 64.

Better graphics came to the PC later, of course, but CGA was supported for a long time. The later EGA (enhanced graphics adaptor) and VGA (video graphics array) cards were very expensive at first, so CGA still had a home in cheap IBM PC compatible machines, such as Amstrad’s PC1512. CGA first appeared in 1981, but new software was still supporting it well into the early 1990s – you can even run Windows 3.0 on it.

Some ASCII art by Ben Hardwidge, aged 12

Text mode
At its basic level, a standard 16KB (yes, KB) CGA card can access a palette of 16 colours, or rather eight colours at two intensities. It’s basically 4-bit colour, with three bits allocated to red, green and blue (RGB), and the fourth bit enabling you to change the ‘intensity’ of the colour (RGBI).

At the first level of intensity, you get black, blue, green, cyan, red, magenta, brown and light grey. The second level of intensity basically gives you the same colours but with an extra level of intensity, which turns the brown into a yellow, the light grey into a white and the black into a dark grey, while creating light versions of the other colours.

Now, you might think 16 colours sounds okay for 1981, but you can only display all these 16 colours on the screen at once in text mode – the mode you used to see on BIOS screens before we had fancy EFI systems. On a CGA card, the text display has an effective resolution of 640 x 200, but it can only display text characters on it, with 80 characters on the X axis, and 25 on the Y axis.

As a kid, I used to play around with this mode quite a lot, as it was the only way to get a lot of colours on the screen. If you knew your ASCII codes, you could display various lines and blocks as text characters and make a picture. You effectively have to ‘type’ a picture, rather than drawing it – I used to spend hours doing it. To type ASCII codes, you hold down Alt and type a three-digit number – 176, 177, 178 and 256 give you three blocks of variable shading and a solid block, for example – it still works in Windows. In this text mode, you could assign each character a foreground and a background colour.

Game developers used this mode too – I had a clone of Ms Pac-Man that used to run in text mode rather than graphics mode, as well as a clone of Breakout called Bricks. On a standard CGA card, it was the only way to get access to lots of colours. There was a trick to enable you to display all 16 colours at an effective graphical resolution of 160 x 100, by changing the number of lines of each text character to display. However, it was rarely used. If you wanted graphics rather than text, you usually either had four colours on the screen at 320 x 200, or one colour at 640 x 200.

This breakout clone, called Bricks, was effectively built in text mode so it could access all 16 colours

Colour graphics
Let’s start with the former, as that was the one that enabled you to get actual colour graphics on your PC. Generally, black was the background colour, and you then had three other colours. As standard, most games used CGA in BIOS mode 4 (the default BIOS mode for graphics), with the high-intensity version of palette 1, which gave you black, white, light cyan light and magenta.

Captain Blood - BIOS mode 4, palette 1 high intensity

It enabled you to make clearly defined shapes with black on white, gave you cyan for skies and water and then everything else would have to be filled in with magenta. It generally looked hideous, although it was sometimes better for space games – Captain Blood looked surprisingly good in this mode.

You could get other palettes too. Palette 0 was also available in BIOS mode 4, and gave you red, green, black and brown as standard, or light red, light green, black and yellow in high-intensity mode. The latter mode generally looked better in games to me. It meant you couldn’t get blue for skies, but you could do pretty sunsets and dark dungeons well. One of my favourite games to use this palette was a fantasy barbarian game called Targhan, which genuinely did look amazing considering the technology it was using.

Targhan - BIOS mode 4, palette 0 high intensity

As a kid, I also discovered a trick while playing with the night vision filters for my Dad’s binoculars. If you look at the cyan, magenta, black and white palette through an orange filter, it becomes the light yellow, light red, light green and black palette. I bought some orange acetate from the local art shop and stapled it to a cardboard frame with Blu-Tack in each corner – I could then swap between palettes at will!

The low-intensity version of this palette was also used in games occasionally. One example is Pharaoh’s Tomb, an early work by George Broussard at Apogee, who later went on to work on the Duke Nukem games.

Ribit (a Frogger clone) - BIOS mode 4, palette 0 low intensity

Another trick often used by game developers was to switch the CGA card to BIOS mode 5, which in high-intensity mode gave you access to a black, white, light red and light cyan palette. It had the same limitations as the default cyan, magenta, black and white palette, but to my eyes, the red looked less garish than magenta.

A few games also ventured outside these palettes with some tricks, which usually involve replacing black as the background colour.

Accolade Formula 1 Grand Prix Circuit - BIOS mode 5

Sierra’s Leisure Suit Larry in the Land of the Lounge Lizards, for example, used palette 0 at low intensity, but replaced the black background colour with blue (it looks hideous). This palette worked well in golf game World Class Leaderboard, though, with green and brown trees, red leaves, green grass and blue skies and water – colours you should be able to take for granted.

Sierra used the same trick in King’s Quest IV: The Perils of Rosella, but using the BIOS mode 5 palette, again replacing the black with blue. The result was a blue, cyan, red and white palette, which worked well with blue sea against cyan sky, but meant the grass and trees looked very odd.

World Class Leaderboard - BIOS mode 4, palette 0 low intensity, black background replaced with blue

Mono graphics
The other main graphical option available to standard CGA cards was the ‘high-resolution’ 640 x 200 monochrome mode. It was used in games that had a fair amount of detail in the graphics, such as Sim City, Death Track and Xenon II: Megablast, among others. It was also used for early GUI operating systems, such as Gem and Windows 3.0.

However, only the horizontal resolution was higher than the colour graphics resolution – the vertical resolution was the same. The result was double-height, rectangular pixels, rather than square ones. This mode also produced a hideous moiré effect on lots of CGA monitors, making it difficult to look at the screen.

Xenon II: Megablast - 640 x 200 ‘high-resolution’ monochrome mode

Composite mode
There was one more trick to getting a standard CGA card to display more characters, and it involved cleverly using the composite output, rather than the 9-pin RGB monitor output. Irritatingly, most PAL TVs in the UK weren’t able to handle this mode, as it’s dependent on the NTSC chroma decoder mistakenly seeing some luminance signals as colour.

As a result, you could effectively make new colours by lining up pixels in certain patterns on an NTSC display, and again by using different intensities. By placing one colour pixel next to another one, you could make an entirely new colour, and it looked solid rather than a messy mix of pixels. The result is astonishing, enabling you to create a much wider colour palette.

King’s Quest - composite mode (left) and RGB mode (right)

The disadvantage, of course, is that the effect can only be achieved by placing pixels next to each other, which effectively reduces the horizontal resolution from 320 to 160. Some games supported this mode, though, including Sierra’s original King’s Quest game.

Try CGA for yourself
In the unlikely event that you want to try out the shocking disgrace that is CGA graphics for yourself, you can do it in DOSBox. This handy software creates a virtual machine designed to recreate a high-spec PC from the 1990s. It loads a sound card and MIDI drivers automatically, and gets you set up with a mouse too. It’s great if you want to play a round of Doom or X-Wing.

Try CGA for yourself in DOSBox

However, later VGA cards didn’t support CGA palette-switching as standard. They could run CGA software, but usually in the default black, white, magenta and cyan palette, even if they used a different palette on a CGA machine. DOSBox runs in VGA mode by default, which results in the same problem. To get around it, you’ll need to open Options in your Start menu’s DOSBox folder, which takes you into the config file. Scroll down to the ‘[dosbox]’ section, and type ‘cga’ after ‘machine=’. After that, scroll down to the ‘[render]’ section, and type ‘true’ after ‘aspect=’.

On some monitors you may find that you still don’t get the correct 4:3 aspect ratio, even after changing the aspect setting to true. If that happens, we found that setting ‘fullresolution=’ to ‘1366x768’ fixed it on our 4K monitor. We have no idea why, but it seems to work.

If you want to run a really old game, it may also be optimised for early CPUs, and will run too fast on DOSBox’s standard settings. If you want to emulate an XT-era PC, scroll down to [cpu] and type ‘simple’ after ‘core=’ and change the number of cycles to 530 (this isn’t exact, but it was near enough in our tests).

From Custom PC store