EGA Colour Palette

END.CPA page
TITLE.PIC page

## Colour Palette

Because the game runs in EGA, it uses 16 colour mode for all its graphics. This means there's one nibble for each pixel, thereby allowing 2 pixels per byte. Because the game uses the EGA's emulation of the full CGA palette, it can support only 16 colours. These 16 colours are as follows:

Here is an index color gif with the correct color values:

## Why Palettized Colour?

Nowadays, we have thousands or millions of colours on screen at once, because computers are powerful enough to send 32-bits of data to each pixel on the screen, and not die from bandwidth-choking. This was not always so. In the bad old days, the CPU had to do a \*lot\* of work to get graphics on-screen, so they limited it to one byte(eight bits), for every TWO pixels on the screen. If you're running at 320x240 at 60 Hz refresh, this is still 2.3 Megs of data to be sent down the bus to the graphics card per second, which was a lot back then. If you're monitor is running at 1024x768 at 16-bit colour depth at 75 Hz, your graphics card is handling 118Mbytes Per Second! In 1988, when a 'fast' PC ran at 20Mhz, such throughputs would have been unthinkable.

Because one byte was used to represent two pixels, this meant that each pixel could hold one of only sixteen colours (half a byte is four bits, and there are sixteen different ways of making up a four-bit string). So, they made the EGA colour palette.

Of course, this didn't spring from nowhere.. EGA was preceded by CGA (four colours, or two-bits per pixel), and CGA was preceded by monochrome (black or white, one bit per pixel). CGA and EGA allowed the user to 'pre-select' one of a number of palettes to paint the screen with. So, if you chose the "reds" palette, each of your colours could be shades of red.

So. by providing a 'palette', you could represent any colour in your image with a very small bit-string. When this small bitstring got to the graphics card, it decoded it into the full RGB specification, and programmed the gun to make the required colour on-screen. Nowadays most graphics don't have a palette, we represent the colour directly as a mix of red, green and blue. #a800a8, for instance, is lots of red, no green and lots blue, making magenta. That's a 24-bit number. In the EGA days magenta would have been "d", or 4 bits.

The above EGA palette proved to be the most generic and the most versatile of the selectable palettes. It was also the standard, and so was guaranteed to work on all graphics cards, not that there were many to choose from back then. Combined with some clever dithering, it's amazing what you can do with it, really. The down-side is that, of course, you have so few colours to choose from that graphics can appear cartoonish, even if they're just colour-reduced natural images.

So the whole of wasteland, all it's graphics, are encoded as 4-bit nibbles-per-pixel. Usually you read in whole bytes and just deal with two pixels at once, because it's simpler. For this reason, all graphics thus far found have been even-number-sized. The tiles are 16x16, the title gif is 288x128 as is the END.CPA. If you make them all even-numbered-sized, you can use the computer's ability to process 8-bits at once to do 2-pixel operations in the same clock-cycle.

For a game like wasteland, which had lots of map scrolling and animated gifs, the ability to process multiple pixels per second, was very important. There is talk that the game was going to ship with more tile animation. Given what we know so far about it, this would have been superb, and probably made the game even more immersive. The designers already did a superb job, given the limited palette and space.