Color Graphics Adapter

From Academic Kids

The Color Graphics Adapter (CGA), introduced in 1981, was IBM's first color graphics card, and the first color computer display standard for the IBM PC.

The standard IBM CGA graphics card was equipped with 16 kilobytes of video memory. The CGA card featured several graphics and text modes with a resolution of up to 640200 and up to 16 colors (albeit not at that resolution). CGA was commonly considered to be able to display a maximum of 4 colors at a resolution of 320200; however, there were several ways (some official, some not) to display more colors, even for graphics display purposes.

The 320200 4 color mode with its default colors — title screen from .
The 320200 4 color mode with its default colors — title screen from Alley Cat.
Contents

The CGA color palette

Full CGA 16-color palette
(hex values adapted from MC6845 specification)
0 — black
#000000
8 — (dark) gray
#545454
1 — blue
#0000A8
9 — bright blue
#5454FE
2 — green
#00A800
10 — bright green
#54FE54
3 — cyan
#00A8A8
11 — bright cyan
#54FEFE
4 — red
#A80000
12 — bright red
#FE5454
5 — magenta
#A800A8
13 — bright magenta
#FE54FE
6 — brown (orange)
#A85400
14 — yellow
#FEFE54
7 — white (light gray)
#A8A8A8
15 — bright white
#FEFEFE

The CGA card worked with CRT RGBI color monitors. It was based around the Motorola MC6845 display controller and had a palette of 16 colors. Red, green and blue corresponded to the three cathode rays and black meant all rays were almost off. Cyan was a mix between the blue and green rays, magenta was a mix between blue and red and orange-brown was a mix between green and red. White (or light gray) was a mix between all three rays.

The remaining 8 colors were achieved by turning on an "intensifier" bit, giving a brighter version of each color, although the dark gray color was indistinguishable from black with many monitors. CGA's "RGB plus intensity bit" design was also called RGBI.

The Commodore 128 used the same method of transmitting colors on its RGBI output and thus could use the same monitors and display the same 16 colors.

Standard text modes

CGA offered two text modes:

  • 4025 characters in up to 16 colors. Each character was a pattern of 88 dots. The effective screen resolution in this mode was 320200 pixels (a pixel aspect ratio of 1:1.2), though individual pixels could not be addressed independently. The choice of patterns for any location was thus limited to one of the 256 available characters. (The upper 128 characters could be redefined to a user-definable font, but would only be recognized by the BIOS when printing text in graphics modes only. Thus, the display font in text mode was fixed and could not be changed.) This mode allowed each character a foreground and a background color, both of which could be freely chosen from the entire CGA palette (see table) — e.g. red on yellow text for one character, white on black for the next and cyan on gray for yet another. The card had sufficient video RAM for 8 different text pages.
  • 8025 characters in up to 16 colors. Each character was again an 88 dot pattern, in a pixel aspect ratio of 1:2.4. The effective screen resolution of this mode was 640200 pixels. Again, the pixels could not be individually addressed. The card had enough video RAM for 4 different text pages.

Standard graphics modes

Fixed CGA 4-color palette #1
default5 — magenta
3 — cyan7 — white (light gray)
Fixed CGA 4-color palette #2
default4 — red
2 — green6 — brown (orange)

CGA offered two commonly-used graphics modes:

  • 320200 pixels, as with the 4025 text mode. In the graphics mode, however, each pixel could be addressed independently. The tradeoff was that only 4 colors could be displayed at a time. These four colors, however, could not be freely chosen from the 16 CGA colors — there were only two official palettes for this mode:
    1. Magenta, cyan, white and background color (black by default).
    2. Red, green, brown and background color (black by default).
The 1:1.2 pixel aspect ratio needed to be taken into account when drawing large geometrical shapes on the screen.
  • 640200 pixels, as with the 8025 text mode. All pixels could be addressed independently. This mode was monochrome, offering only black and white as colors (though this could be changed), with a pixel aspect ratio of 1:2.4.

The composite video modes

Little-known to many was an additional 160200 graphics mode (pixel aspect ratio 1.67:1), which could utilize 16 different colors. The colors in Composite color mode did not use the same color table as the CGA color set, but was more like that of the Apple II's "double-hi-res" mode, as both used a similar technique (composite signal color artifacting). Composite color mode was rarely utilized in software: No BIOS support led to poor programmer adoption, and the cost of an IBM system was high enough that most people who could afford it could also afford the more expensive RGB monitor IBM offered. Only a handful of software titles used the 160200 graphics mode, most of them games.

A common misconception is that Composite color mode was supported on some RGB-equipped machines, but this is a direct contradiction to how composite color mode technically functioned. A more likely explanation for the misconception is that people confuse the 160200 modes of the PCjr/Tandy 1000 and Amstrad CPCs as being the same thing (they are identical in resolution, but not color and memory organization). Attempting to set Composite color mode on any card with an RGB monitor attached would appear identical to the 640200 graphics mode.

Further graphics modes and tweaks

A number of official and unofficial features existed that could be exploited to achieve better graphics on a monitor.

  • In 320200 graphics mode, the background color, which defaulted to black on mode initialization, could be changed to any of the other 15 colors of the CGA palette. This allowed for some variation, as well as flashing effects, as the background color could be changed without having to redraw the screen.
  • In 640200 graphics mode, the foreground color could be changed from its usual white to any of the other 15 colors.
  • In text mode, the border color (displayed outside the regular display area) could be changed from its usual black to any of the other 15 colors.
  • A third 320200 4-color palette was achieved by enabling the monochrome bit while in color graphics mode. This switched the current graphics palette to red, cyan, white and the background color.
  • Through precision timing, it was possible to switch to another palette while the screen content was still being drawn, allowing the use of any one of the 3 palettes per scanline. The best example of this in use is the game California Games [1] (http://www.mobygames.com/game/shots/p,2/gameId,1823/gameShotId,7722/) when run on a stock 4.77MHz 8088. (Running it on a faster computer did not produce the effect, as producing the timing necessary to switch palettes at predetermined locations was extremely sensitive to machine speed.)
  • Additional colors were often approximated using dithering, although the low resolution made it very apparent.

Some of these above tweaks could even be combined. Examples could be found in several games [2] (http://www.mobygames.com/attribute/sheet/p,2/attributeId,5/). Most software titles did not use these possibilities, but there were a few impressive exceptions.

The 160100 16 color mode

Technically, this mode was not a graphics mode, but a tweak of the 8025 text mode. The character cell height register was changed to display only 2 lines per character cell instead of the normal 8 lines. This quadrupled the number of text rows displayed from 25 to 100. These "tightly squeezed" text characters were not full characters. The system only displayed their top two lines of pixels (8 each) before moving on to the next row.

 Missing image
ASCII.221.character.gif
Image:ASCII.221.character.gif

 
 Character 221. 
 Missing image
Half-block.character.blue.red.gif
Image:Half-block.character.blue.red.gif

 
 221 with blue text and red background color. 
 Missing image
Half-block.character.red.blue.gif
Image:Half-block.character.red.blue.gif

 
 221 with red text and blue background color. 
 Missing image
ASCII.222.character.gif
Image:ASCII.222.character.gif

 
 Character 222. 

Character 221 in the extended ASCII character set consisted of a box occupying the entire left half of the character matrix. (Character 222 consisted of a box occupying the entire right half.)

Because each character could be assigned different foreground and background colors, it could be colored (for example) blue on the left (foreground color) and bright red on the right (background color). This could be reversed by swapping the foreground and background colors.

Using either character 221 or 222, each half of each truncated character cell could thus be treated as an individual pixel— making 160 horizontal pixels available per line. Thus, 160100 pixels at 16 colors, with an aspect ratio of 1:1.2, were possible.

 
Missing image
Single.pixel.in.CGA.160x100.mode.gif


 

A single big "pixel" in 160100 mode.
This is the two top rows of half of character 221.
Note the 8 constituent pixels and the
overall 1:1.2 aspect ratio.

Although a roundabout way of achieving 16 color graphics display, this worked quite well [3] (http://mobygames.com/game/shots/p,4/gameId,22/gameShotId,919/) and the mode was even mentioned (although not explained) in IBM's official hardware documentation.

More detail could be achieved in this mode by using other characters, combining ASCII art with the aforesaid technique.

The same text cell height reduction technique could also be used with the 4025 text mode. This only made sense when using ASCII art, because without it the resulting resolution would only have been 80100 [4] (http://www.oldskool.org/shrines/lbd/graphics/icon4.gif) [5] (http://www.oldskool.org/shrines/lbd/graphics/icon3.gif) [6] (http://www.oldskool.org/shrines/lbd/graphics/icon2.gif).

Bugs and errata

CGA's most noticeable hardware bug was snow in 8025 text mode. The display RAM on the original IBM CGA card was not dual-ported — read and write access was not possible simultaneously. As such, random pixels were displayed whenever display memory was written to by the CPU at the same time as being read by the display hardware. This bug was fixed in most third-party clones, but still existed in some iterations (such as the AT&T PC 6300 display adapter).

For programmers, another annoyance was that CGA display memory in graphics modes was interlaced. Normally, video memory is strictly linear: the next row of display data corresponds to the next row of pixels. But with CGA, the next row of display data corresponded to the row of pixels two rows down. This continued until the end of the screen and only with the second half of display data were the in-between rows addressed. So the first half of display memory was for rows 0, 2, 4, 6, 8, 10, etc., till the end of the screen and the second half of CGA RAM was for rows 1, 3, 5, 7, 9, etc. This added extra calculation steps to most CGA graphics operations if the programmer wanted to avoid visual artifacts when updating the screen.

Competing adapters

CGA had two main competitors:

  • For business and word processing use, IBM launched its Monochrome Display Adapter (MDA) at the same time as CGA. The MDA produced significantly higher resolution text display in 8025 mode, rendering each character in a box of 914 pixels, of which 711 were the character itself. This was clearly superior than the CGA's 88 dots text character matrix. Because of this and CGA's higher price at the time, MDA was often preferred for business use.
  • In 1982, the non-IBM Hercules Graphics Card (HGC) was introduced. It offered an MDA-compatible high resolution text mode and a monochrome graphics mode. The black and white graphics mode had a resolution of 720348 pixels, which was better than even the highest resolution CGA could offer. Thus, even without a color capability of any kind, the Hercules adapter's offer of better monochrome graphics and its ability to work with less expensive monochrome monitors made it a desirable choice for many. As early as 1985, emulator memory-resident program such as SIMCGA were available, allowing the display of CGA graphics mode data in Hercules graphics modes (the result looking like crude dithering). The HGC was arguably the most commonly-utilized card connected to monochrome monitors throughout the IBM PC's life.

The CGA card was succeeded in the consumer space by IBM's Enhanced Graphics Adapter (EGA) card, which supported most of CGA's modes, and added an additional resolution (640350) as well as a software-selectable palette of 16 colors out of 64 in both text and graphics modes.

References

See also

hu:CGA ja:Color Graphics Adapter pl:CGA sv:CGA

Navigation

Academic Kids Menu

  • Art and Cultures
    • Art (http://www.academickids.com/encyclopedia/index.php/Art)
    • Architecture (http://www.academickids.com/encyclopedia/index.php/Architecture)
    • Cultures (http://www.academickids.com/encyclopedia/index.php/Cultures)
    • Music (http://www.academickids.com/encyclopedia/index.php/Music)
    • Musical Instruments (http://academickids.com/encyclopedia/index.php/List_of_musical_instruments)
  • Biographies (http://www.academickids.com/encyclopedia/index.php/Biographies)
  • Clipart (http://www.academickids.com/encyclopedia/index.php/Clipart)
  • Geography (http://www.academickids.com/encyclopedia/index.php/Geography)
    • Countries of the World (http://www.academickids.com/encyclopedia/index.php/Countries)
    • Maps (http://www.academickids.com/encyclopedia/index.php/Maps)
    • Flags (http://www.academickids.com/encyclopedia/index.php/Flags)
    • Continents (http://www.academickids.com/encyclopedia/index.php/Continents)
  • History (http://www.academickids.com/encyclopedia/index.php/History)
    • Ancient Civilizations (http://www.academickids.com/encyclopedia/index.php/Ancient_Civilizations)
    • Industrial Revolution (http://www.academickids.com/encyclopedia/index.php/Industrial_Revolution)
    • Middle Ages (http://www.academickids.com/encyclopedia/index.php/Middle_Ages)
    • Prehistory (http://www.academickids.com/encyclopedia/index.php/Prehistory)
    • Renaissance (http://www.academickids.com/encyclopedia/index.php/Renaissance)
    • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
    • United States (http://www.academickids.com/encyclopedia/index.php/United_States)
    • Wars (http://www.academickids.com/encyclopedia/index.php/Wars)
    • World History (http://www.academickids.com/encyclopedia/index.php/History_of_the_world)
  • Human Body (http://www.academickids.com/encyclopedia/index.php/Human_Body)
  • Mathematics (http://www.academickids.com/encyclopedia/index.php/Mathematics)
  • Reference (http://www.academickids.com/encyclopedia/index.php/Reference)
  • Science (http://www.academickids.com/encyclopedia/index.php/Science)
    • Animals (http://www.academickids.com/encyclopedia/index.php/Animals)
    • Aviation (http://www.academickids.com/encyclopedia/index.php/Aviation)
    • Dinosaurs (http://www.academickids.com/encyclopedia/index.php/Dinosaurs)
    • Earth (http://www.academickids.com/encyclopedia/index.php/Earth)
    • Inventions (http://www.academickids.com/encyclopedia/index.php/Inventions)
    • Physical Science (http://www.academickids.com/encyclopedia/index.php/Physical_Science)
    • Plants (http://www.academickids.com/encyclopedia/index.php/Plants)
    • Scientists (http://www.academickids.com/encyclopedia/index.php/Scientists)
  • Social Studies (http://www.academickids.com/encyclopedia/index.php/Social_Studies)
    • Anthropology (http://www.academickids.com/encyclopedia/index.php/Anthropology)
    • Economics (http://www.academickids.com/encyclopedia/index.php/Economics)
    • Government (http://www.academickids.com/encyclopedia/index.php/Government)
    • Religion (http://www.academickids.com/encyclopedia/index.php/Religion)
    • Holidays (http://www.academickids.com/encyclopedia/index.php/Holidays)
  • Space and Astronomy
    • Solar System (http://www.academickids.com/encyclopedia/index.php/Solar_System)
    • Planets (http://www.academickids.com/encyclopedia/index.php/Planets)
  • Sports (http://www.academickids.com/encyclopedia/index.php/Sports)
  • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
  • Weather (http://www.academickids.com/encyclopedia/index.php/Weather)
  • US States (http://www.academickids.com/encyclopedia/index.php/US_States)

Information

  • Home Page (http://academickids.com/encyclopedia/index.php)
  • Contact Us (http://www.academickids.com/encyclopedia/index.php/Contactus)

  • Clip Art (http://classroomclipart.com)
Toolbox
Personal tools