CGA

The Color Graphics Adapter (CGA), originally also called the Color/Graphics Adapter or IBM Color/Graphics Monitor Adapter,[1] 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 is equipped with 16 kilobytes of video memory, and can be connected either to a NTSC-compatible monitor or TV via an RCA jack, or to a dedicated RGBI interface CRT monitor. Based around the Motorola MC6845 display controller, the CGA card features several graphics and text modes. The highest resolution of any mode is 640×200, and the highest color depth supported is 4-bit (16 colors).

The CGA's maximum color depth of four bits results in a palette of 16 colors. The lower three bits, representing red, green and blue, corresponded to the three cathode rays, with black meaning all three cathodes are almost off. Cyan is a mixture of blue and green, magenta was blue and red, and orange-brown is green and red. White (or light gray) uses all three cathodes.

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

Standard text modes

CGA offers two text modes:

  • 40×25 characters in up to 16 colors. Each character is a pattern of 8×8 dots. The effective screen resolution in this mode is 320×200 pixels (a pixel aspect ratio of 1:1.2), though individual pixels cannot be addressed independently. The choice of patterns for any location is thus limited to one of the 256 available characters, the patterns for which are stored in a ROM chip on the card itself. The display font in text mode (the code page 437 character set) is therefore fixed and cannot be changed (although when using the original IBM CGA in an original IBM PC, it is possible to select one of two different fonts—normal or thin—by changing a jumper. Many clones didn't offer this possibility). The card has sufficient video RAM for 8 different text pages in this mode.
  • 80×25 characters in up to 16 colors. Each character is again an 8×8 dot pattern (the same character set is used as for 40×25), in a pixel aspect ratio of 1:2.4. The effective screen resolution of this mode is 640×200 pixels. Again, the pixels cannot be individually addressed. Since there are twice as many characters on the screen in this mode, the card has enough video RAM for just 4 different text pages.

In every text mode, each character has a background and a foreground color — e.g. red on yellow text for one character, white on black for the next, etc. While the same 4-bit nybble used for the foreground color would normally allow all 16 colors to be used for the background color, the most significant bit of the background nybble is also used to denote whether or not the character should blink (a hardware effect offered by CGA independent of the CPU). The blinking attribute effect is enabled by default, so disabling it is the only way to freely choose the latter 8 color indexes (8-15) for the background color.

CGA offers two commonly-used graphics modes:

  • 320×200 pixels, as with the 40×25 text mode. In the graphics mode, however, each pixel can be addressed independently. The tradeoff is that only 4 colors can be displayed at a time. However, only one of the four colors can be freely chosen from the 16 CGA colors — there are only two official palettes for this mode:

 

  • 640×200 pixels, as with the 80×25 text mode. All pixels can be addressed independently. This mode is monochrome with a pixel aspect ratio of 1:2.4. By default the colors are black and white, but the foreground color (white) can be changed to any other color of the CGA palette. This can be done at runtime without refreshing the screen.

In text mode, font bitmap data comes from the character ROM on the card, which is only available to the card itself. In graphics modes, text output by the BIOS uses two separate tables: The first half of the character set (128 characters) is supplied by a table in the BIOS ROM chip on the computer's mainboard at F000:FA6E, and the second half is supplied by the location pointed to by interrupt 1F (0000:007C). The second half of the character set will display as blanks (or garbage, depending on implementation) unless they are explicitly defined, usually by a utility such as GRAFTABL or by the calling program.