The Color Graphics Adapter (CGA), originally also called the Color/Graphics Adapter or IBM Color/Graphics Monitor Adapter, introduced in 1981, was IBM's first color graphics card for the IBM PC. It established a de facto computer display standard.
Hardware design The original IBM CGA graphics card was built around the Motorola 6845 display controller, came with 16 kilobytes of video memory built in, and featured several graphics and text modes. The highest display resolution of any mode was , and the highest color depth supported was 4-bit (16 colors).
The CGA card could be connected either to a direct-drive CRT monitor using a 4-bit digital (TTL) RGBI interface, such as the IBM 5153 color display, or to an NTSC-compatible television or composite video monitor via an RCA connector. The RCA connector provided only baseband video, so to connect the CGA card to a television set without a composite video input required a separate RF modulator.
IBM produced the 5153 Personal Computer Color Display for use with the CGA, but this was not available at release and would not be released until March 1983.International Business Machines Corporation (February 4, 1983). Announcement Letter Number 183-002 - IBM COLOR DISPLAY, 5153.
Although IBM's own color display was not available, customers could either use the composite output (with an RF modulator if needed), or the direct-drive output with available third-party monitors that supported the RGBI format and scan rate. Some third-party displays lacked the intensity input, reducing the number of available colors to eight, and many also lacked IBM's unique circuitry which rendered the dark-yellow color as brown, so any software that used brown would be displayed incorrectly.
Output capabilities CGA offered several video modes.
Graphics modes: in 16 colors, chosen from a 16-color palette, utilizing a specific configuration of the text mode to make the screen 100 rows. This used 8 bits per pixel (4 bits foreground, 4 bits background), with a total memory use of (160 × 100 × 8) / 8 = 16 kilobytes. in 4 colors, chosen from 3 fixed palettes, with high- and low-intensity variants, with color 1 chosen from a 16-color palette. This used 2 bits per pixel, with a total memory use of (320 × 200 × 2) / 8 = 16 kilobytes. in 2 colors, one black, one chosen from a 16-color palette. This used 1 bit per pixel, with a total memory use of (640 × 200) / 8 = 16 kilobytes. Some software achieved greater color depth by utilizing artifact color when connected to a composite monitor.
Text modes: with pixel font (effective resolution of ) with pixel font (effective resolution of )
IBM intended that CGA be compatible with a home television set. The text and graphics modes are usable with a television, and the text and graphics modes are intended for a monitor.
Color palette CGA uses a 4-bit RGBI 16-color gamut, but not all colors are available at all times, depending on which graphics mode is being used. In the medium- and high-resolution modes, colors are stored at a lower bit depth and selected by fixed palette indexes, not direct selection from the full 16-color palette.
When four bits are used (for low-resolution mode, or for programming color registers) they are arranged according to the RGBI color model:
The lower three bits represent red, green, and blue color components The fourth "intensifier" bit, when set, increases the brightness of all three color components (red, green, and blue).The color brown, represented by R=1, G=1, B=0, I=0, is an exception; whereas a straight interpretation of these bit values would resolve this color as dark yellow, the intensity of the green component is reduced, to produce brown, for only this one 4-bit value. See this page for details. This special RGBI interpretation for brown is performed in the monitor; the IBM 5153 monitor designed for the CGA performs it, but some early third-party monitors did not. +CGA palette internal bit arrangement (4-bit RGBI)ColorIRGBColorIRGBBlack0000Gray 21000Blue0001Light Blue1001Green0010Light Green1010Cyan0011Light Cyan1011Red0100Light Red1100Magenta0101Light Magenta1101Brown0110Light Yellow1110Gray 10111White1111 These four color bits are then interpreted internally by the monitor, or converted to NTSC colors (see below).
With an RGBI monitor When using a direct-drive monitor, the four color bits are output directly to the DE-9 connector at the back of the card.
Within the monitor, the four signals are interpreted to drive the red, green and blue color guns. With respect to the RGBI color model described above, the monitor would translate the digital four-bit color number to some seven distinctive analog voltages in the range from 0.0 to 1.0 for each gun.
dark yellow 6 #AAAA00
Color 6 is treated specially; normally, color 6 would become dark yellow, as seen to the right, but in order to achieve a more pleasing brown tone, special circuitry in most RGBI monitors, starting with the IBM 5153 color display,International Business Machines Corporation (1983): IBM Personal Computer XT Technical Reference Manual, pages D-42 to D-43. makes an exception for color 6 and changes its hue from dark yellow to brown by reducing the analogue green signal's amplitude. The exact amount of reduction differed between monitor models: the original IBM 5153 Personal Computer Color Display reduces the green signal's amplitude by about one third, while the IBM 5154 Enhanced Color Display internally converts all 4-bit RGBI color numbers to 6-bit ECD color numbers, which amounts to halving the green signal's amplitude. The Tandy CM-2, CM-4 and CM-11 monitors provide a potentiometer labelled "BROWN ADJ." to adjust the amount of green signal reduction.
This "RGBI with tweaked brown" palette was retained as the default palette of later PC graphics standards such as EGA and VGA, which can select colors from much larger gamuts, but default to these until reprogrammed.
Later video cards/monitors in CGA emulation modes would approximate the colors with the following formula: red := 2/3×(colorNumber & 4)/4 + 1/3×(colorNumber & 8)/8 green := 2/3×(colorNumber & 2)/2 + 1/3×(colorNumber & 8)/8 blue := 2/3×(colorNumber & 1)/1 + 1/3×(colorNumber & 8)/8 if (color == 6) green := green * 2/3
which yields the canonical CGA palette:
+ Full CGA 16-color palette 0 black#000000 8 dark gray#555555 1 blue#0000AA 9 light blue#5555FF 2 green#00AA00 10 light green#55FF55 3 cyan#00AAAA 11 light cyan#55FFFF 4 red#AA0000 12 light red#FF5555 5 magenta#AA00AA 13 light magenta#FF55FF 6 brown#AA5500 14 yellow#FFFF55 7 light gray #AAAAAA 15 white#FFFFFF Note: Color hex values shown are 8-bit RGB equivalents, internally CGA is 4-bit RGBI
With a composite color monitor/television set For the composite output, these four-bit color numbers are encoded by the CGA's onboard hardware into an NTSC-compatible signal fed to the card's RCA output jack. For cost reasons, this is not done using an RGB-to-YIQ converter as called for by the NTSC standard, but by a series of flip-flops and delay lines.Dean et al. (1984): Composite video color signal generation from digital color signals. U.S. Patent #4,442,428International Business Machines Corporation (1983): IBM Personal Computer XT Technical Reference Manual, page D-40.
Consequently, the hues seen are lacking in purity; notably, both cyan and yellow have a greenish tint, and color 6 again looks dark yellow instead of brown.
The relative luminances of the colors produced by the composite color-generating circuit differ between CGA revisions: they are identical for colors 1-6 and 9–14 with early CGAs produced until 1983, and are different for later CGAs due to the addition of additional resistors.
Standard text modes
CGA offers four BIOS text modes (Modes 0 to 3, called alphanumeric or A/N modes in IBM's documentation). In these modes, individual pixels on the screen cannot be addressed directly. Instead, the screen is divided into a grid of character cells, each displaying a character defined in one of two bitmap fonts, "normal" and "thin", included in the card's ROM. The fonts are fixed and cannot be modified or selected from software, only by a jumper on the board itself.
Fonts are stored as bitmaps at a color depth of 1-bit, with a "1" representing the character and a "0" representing the background. These colors can be chosen independently, for each character on the screen, from the full 16-color CGA palette. The character set is defined by hardware code page 437.
The font bitmap data is only available to the card itself, it cannot be read by the CPU. In graphics modes, text output by the BIOS operates by copying text from the font ROM bit-by-bit to video memory.
40 × 25 mode BIOS Modes 0 and 1 are both 40 columns by 25 rows text modes, with each character a pattern of dots. The effective screen resolution in this mode is pixels (a pixel aspect ratio of 1:1.2.) The card has sufficient video RAM for eight different text pages in this mode.
The difference between these two modes can only be seen on a composite monitor, where mode 0 disables the color burst, making all text appear in grayscale. Mode 1 enables the color burst, allowing for color. Mode 0 and Mode 1 are functionally identical on RGB monitors and on later adapters that emulate CGA without supporting composite color output.
80 × 25 mode BIOS Modes 2 and 3 select 80 columns by 25 rows text modes, with each character still an dot pattern, but displayed at a higher scan rate. The effective screen resolution of this mode is pixels. In this mode, the card has enough video RAM for four different text pages.
As with the 40-column text modes, Mode 2 disables the color burst in the composite signal and Mode 3 enables it.
Textmode color Each character cell stores four bits for foreground and background color. However, in the card's default configuration, the fourth bit of the background color does not set intensity, but sets the blink attribute for the cell. All characters on the screen with this bit set will periodically blink, meaning their foreground color will be changed to their background color so the character becomes invisible. All characters blink in unison.
By setting a hardware register, the blink feature can be disabled, restoring access to high-intensity background colors.
All blinking characters on the screen blink in sync. The blinking attribute effect is enabled by default and the high-intensity background effect is disabled; disabling blinking is the only way to freely choose the latter eight-color indexes (8–15) for the background color.
Notably, the GW-BASIC and Microsoft QBASIC programming languages included with MS-DOS supported all the text modes of the CGA with full color control, but did not provide a normal means through the BASIC language to switch the CGA from blink mode to 16-background-color mode. This was still possible however by directly programming the hardware registers using the OUT statement of the BASIC language.
An early commercial example of software operating within these specific color text-mode parameters is Animation Creation, an entertainment and utility package published by IBM in 1983. Operating within the IBM BASICA environment, the program bypassed early CPU and bus bottlenecks by manipulating text-mode video memory directly rather than relying on pixel-level rendering. It utilized the hardware font ROM's 95 standard text characters alongside 160 special characters (selectable in banks of six at a time), which users could align horizontally and vertically to construct larger pseudo-graphical objects.