Jump to content

Color Graphics Adapter

From Alfawiki
Color Graphics Adapter (CGA)
Company typeHardware product
IndustryComputer hardware
Founded1981
FounderIBM
ProductsGraphics card for IBM PC

The Color Graphics Adapter (CGA), launched in 1981, marked IBM's initial foray into color graphics cards for the IBM PC, setting a de facto benchmark for computer display standards.

Hardware design

IBM's original CGA card incorporated the Motorola 6845 display controller, contained 16 kilobytes of video memory, and supported multiple graphics and text mode configurations. It reached a maximum display resolution of 640 × 200 pixels with a color depth of 4 bits (16 colors).

CGA interfaced either directly with a CRT monitor using a 4-bit digital (TTL) RGBI connection—exemplified by the IBM 5153 color display—or connected to an NTSC-compatible television or composite video display via an RCA connector. Since the RCA output delivered baseband video only, televisions lacking composite inputs required an external RF modulator for compatibility.

The IBM 5153 Personal Computer Color Display, tailored specifically for CGA, was not available at the initial launch and became commercially available only in March 1983. Prior to this, users relied on the composite output (sometimes supplemented by RF modulators) or third-party RGBI-compatible monitors. Certain third-party monitors did not support the intensity input, restricting the palette to eight colors and often missing IBM's circuitry that rendered dark yellow as brown, which led to color discrepancies in software dependent on brown hues.

Output capabilities

CGA provided various video modes:

Graphics modes:

  • 16-color mode derived from a 16-color palette, tied to the text mode layout.
    • Utilized 4 bits per pixel, occupying 8 KB of memory.
  • 4-color mode selected from three fixed palettes, each with high- and low-intensity versions; color 1 was chosen from a 16-color palette.
    • Used 2 bits per pixel, consuming 16 KB of memory.
  • 2-color mode displaying black plus one color from a 16-color palette.
    • Employed 1 bit per pixel, also using 16 KB of memory.

Certain software exploited artifact color effects on composite monitors to simulate enhanced color depth.

Text modes:

  • Mode with an 8 × 8 pixel font (yielding an effective resolution of )
  • Mode with a 9 × 14 pixel font (yielding an effective resolution of )

IBM engineered CGA to be compatible with home television sets. The text mode and graphics mode were compatible with TVs, whereas the higher-resolution text and graphics modes were intended for use with dedicated monitors.

Color palette

The CGA system uses a 4-bit RGBI scheme producing a palette of 16 colors; however, not all colors are accessible across every graphics mode. Medium- and high-resolution modes utilize lower bit depths for colors, selecting from predetermined palette entries rather than the complete set of sixteen.

The four bits employed (either in low-resolution modes or when programming color registers) follow the RGBI format:

  • Three lower bits correspond to red, green, and blue channels
  • The highest bit—known as the "intensifier"—boosts brightness levels of all three channels when activated.

An exception exists for brown (R=1, G=1, B=0, I=0), which does not appear as dark yellow but instead reduces green intensity to produce brown—a feature implemented in IBM's 5153 monitor but missing from some early third-party displays.

Magenta |0 |1 |0 |1 |Light Magenta |1 |1 |0 |1 |- Brown |0 |1 |1 |0 |Light Yellow |1 |1 |1 |0 |- Gray 1 |0 |1 |1 |1 |White |1 |1 |1 |1 |
Internal bit configuration of CGA palette (4-bit RGBI)
Color I R G B Color I R G B
Black 0 0 0 0 Gray 2 1 0 0 0
Blue 0 0 0 1 Light Blue 1 0 0 1
Green 0 0 1 0 Light Green 1 0 1 0
Cyan 0 0 1 1 Light Cyan 1 0 1 1
Red 0 1 0 0 Light Red 1 1 0 0

These bits are either processed by the monitor or translated into NTSC signals for display.

With an RGBI display

In monitors using direct-drive technology, the four color bits sent directly to the DE-9 connector regulate the red, green, and blue electron guns. The device converts the 4-bit digital color code into seven unique analog voltage levels for each color channel.[1]

dark yellow
6 #AAAA00

Color number 6 receives special treatment: rather than showing dark yellow, most RGBI displays (beginning with the IBM 5153) decrease the green signal's intensity to generate brown. Specifically, the IBM 5153 lowers green by roughly one third,Cite error: The opening <ref> tag is malformed or has a bad name whereas the IBM 5154 cuts it by half.[2] The Tandy CM series monitors feature a "BROWN ADJ." knob to fine-tune this adjustment.

This modified "RGBI with brown adjustment" palette became standard in subsequent PC graphics systems like EGA and VGA, which support broader color ranges but initially default to these colors until customized.

Subsequent video adapters and monitors emulating CGA simulate colors by applying weighted calculations to red, green, and blue components, with particular adjustments for color 6 (brown), resulting in the classic CGA color set:[1]

colspan=4 Note: Hexadecimal values reflect 8-bit RGB Web colors colspan=4 Internally, CGA utilizes a 4-bit RGBI format
Complete CGA 16-color set
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
style="background:#aaa;" 7 light gray
#AAAAAA

<style=color:black;background:#fff;">15 white
#FFFFFF</style>


Using a composite color monitor/television

When outputting composite video, the CGA card converts its four-bit color codes into an NTSC-compatible signal through the RCA connector by means of built-in hardware. To minimize expenses, this conversion employs flip-flops and delay lines instead of the NTSC standard’s usual RGB-to-YIQ conversion method.

As a consequence, the displayed colors are less accurate; for example, cyan and yellow exhibit a greenish hue, and color number 6 appears as a dark yellow rather than brown.

The relative brightness levels of colors differ among CGA versions: earlier models produced before 1983 assign the same luminance to colors 1–6 and 9–14, whereas later revisions introduced additional resistors that altered these values.

Standard text modes

CGA supports four BIOS-defined text modes (Modes 0 through 3), all of which rely on character cells arranged in a grid instead of individually addressable pixels. Each cell renders a character selected from one of two fixed bitmap fonts ("normal" or "thin") embedded in the video card’s ROM; these fonts cannot be altered or chosen by software but only switched by setting a hardware jumper on the board.

The fonts consist of monochrome bitmaps, where "1" indicates the character pixels and "0" denotes the background. For each character, foreground and background colors can be independently chosen from the entire 16-color CGA palette. The character set corresponds to hardware code page 437.

Access to font bitmap data is restricted to the video card and is not readable by the CPU. In graphics modes, BIOS text output copies font ROM bits directly into video memory.

40 × 25 mode

BIOS Modes 0 and 1 produce text displays with 40 columns and 25 rows, where each character occupies an 8×8 pixel matrix, resulting in an effective resolution of 320 × 200 pixels with an approximate pixel aspect ratio of 1:1.2. This mode supports up to eight text pages.

The primary distinction arises with composite monitors: Mode 0 disables the color burst signal, yielding grayscale text, while Mode 1 enables full color output. On RGB monitors or CGA emulators lacking composite color capability, both modes behave identically.

80 × 25 mode

BIOS Modes 2 and 3 offer text modes with 80 columns and 25 rows using the same character dimensions but operating at a higher scan frequency, achieving a resolution of 640 × 200 pixels. Four text pages are available in this mode.

As with the 40-column modes, Mode 2 turns off the composite color burst resulting in grayscale display, whereas Mode 3 activates color output.

Textmode color

Each character cell encodes foreground and background colors using four bits. By default, the highest bit in the background color serves as a blinking flag rather than intensity control, causing all characters with this attribute to blink simultaneously by toggling their visibility.

When blinking is disabled via a hardware register setting, this bit instead controls background intensity, enabling use of all sixteen background colors.

It is noteworthy that popular MS-DOS programming environments such as GW-BASIC and QBASIC supported CGA text modes with full color manipulation but did not include built-in commands to toggle between blinking mode and full 16-color backgrounds; achieving this required direct manipulation of hardware registers.

Standard graphics modes

CGA provides graphics capabilities at resolutions of 160 × 100, 320 × 200, and 640 × 200 pixels. While individual pixels can be addressed directly, higher resolution modes impose restrictions on available colors from the standard 16-color palette.

320 × 200

In medium-resolution graphics modes (Modes 4 and 5), each pixel is represented by two bits, selecting from a palette of four colors. Mode 4 provides two separate palettes, whereas Mode 5 utilizes a single palette.

CGA hardware palettes on an RGBI display
# Mode 4 Mode 5
Palette 0 Palette 1 Low intensity High intensity
Low intensity High intensity Low intensity High intensity
0 0 – background 0 – background 0 – background 0 – background 0 – background 0 – background
1 2 – green 10 – light green 3 – cyan 11 – light cyan 3 – cyan 11 – light cyan
2 4 – red 12 – light red 5 – magenta 13 – light magenta 4 – red 12 – light red
3 6 – brown 14 – yellow 7 – light gray 15 – white 7 – light gray 15 – white

The hardware registers permit selection of the active palette, adjustment of the overall screen intensity, and assignment of color zero (background) to any of the sixteen available colors.

BIOS implementation of Mode 4 provides two distinct palettes: one consisting of green, red, and brown, and another featuring cyan, magenta, and white.

Similar to text Modes 0 and 2, Mode 5 disables the composite color burst signal, which results in grayscale output on composite monitors and modifies RGBI monitor colors to a cyan/red/white scheme. This particular palette configuration was not officially documented but found use in certain software titles.

640 × 200

The high-resolution mode at 640 × 200 pixels (Mode 6) employs one bit per pixel, enabling selection between two colors from the full set of sixteen CGA palette colors through hardware register configuration.

In this mode, the video data is stored as a straightforward bitmap where each bit determines whether a pixel uses the foreground or the background color. By default, foreground is bright white and the background is black on original IBM CGA hardware, though the foreground color can be changed to any color within the CGA palette. The black background remains fixed.

This mode inherently disables the composite color burst signal. The BIOS does not provide an option to enable it in Mode 6, so enabling requires direct programming of the mode control register.

Further graphics modes and tweaks

Various official and community-discovered features enable unique visual effects:

  • In the 320 × 200 graphics mode, it is possible to alter the default black background color—which also affects the border—by selecting any of the other fifteen CGA colors. This capability facilitates color changes and flashing effects without modifying video memory contents.
  • For text modes, the border area surrounding the display can be assigned any of fifteen alternative colors in place of black.
  • By precisely timing palette changes during a scanline, up to six different palettes can be displayed within a single line. For instance, California Games utilizes this technique effectively on a standard 4.77 MHz 8088 CPU. However, higher CPU speeds tend to disrupt this effect due to timing sensitivity. Similar methods are employed to produce dynamic backgrounds in titles such as Frogger and Atarisoft's PC adaptation of Jungle Hunt.
  • Dithering methods are used to create the illusion of additional colors beyond those natively supported.
  • Employing palette zero at low intensity with a dark blue backdrop yields primary RGB colors plus brown.

These techniques are frequently combined within games to enrich visual complexity and overall aesthetic appeal.

160 × 100 16-Color Mode

This display mode is derived from the 80 × 25 text configuration by modifying the character cell height register to show only two pixel rows per cell instead of the usual eight. This adjustment expands the number of text rows from 25 to 100, rendering only the upper two lines of pixels within each character.

In the CGA character set, character 221 represents a box filling the left half of the character grid, while character 222 fills the right half. By applying different foreground and background colors to these halves, each side can be independently colored—for example, a blue foreground paired with a bright red background—effectively simulating two separate colored "pixels" within one character.

Utilizing characters 221 and 222 allows each shortened character cell to depict two horizontal pixels individually, which results in a 160 × 100 pixel resolution supporting 16 colors and an aspect ratio close to 1:1.2.

Although this approach is an indirect means of producing a 16-color graphics display, it is documented in IBM’s official hardware manuals and was employed as early as 1983 in titles like Moon Bugs.

Further refinement was achieved by integrating this method with ASCII art, notably by Macrocom, Inc. in games such as Icon: Quest for the Ring (1984) and The Seven Spirits of Ra (1987).

A similar height-reduction technique applied to the 40 × 25 text mode yields an effective resolution of 80 × 100 pixels.

Composite Output

When using composite video output instead of an RGBI monitor, image quality diminished due to NTSC’s limited ability to separate luminance from chrominance signals. This limitation was especially evident with 80-column text modes, where color bleeding and reduced sharpness occurred.

To address this issue, every text and graphics mode included a variant that disabled the composite colorburst signal. This resulted in a monochrome image with enhanced clarity by eliminating color bleeding artifacts. On RGBI monitors, these variants generally appeared identical except in the 320 × 200 graphics mode, where the monochrome version provided an additional third palette option.

Extended Artifact Colors

Developers ingeniously transformed this constraint into an asset by exploiting patterns of high-frequency dots that produced stable solid colors on composite displays, creating what are known as artifact colors. This technique was applicable to both standard 320 × 200 four-color modes and the 640 × 200 color-on-black modes.

Internal Mechanism

The term direct colors refers to the original set of 16 CGA colors.

Artifact colors emerge because the NTSC chroma decoder interprets specific luminance patterns as color information. By carefully arranging pixel patterns, programmers generated cross-color artifacts that produced novel colors—either from black-and-white pixels in 640 × 200 mode or through combinations of direct and artifact colors in 320 × 200 mode.

With selectable options between 320 × 200 and 640 × 200 resolutions, two palette choices, and configurable foreground or background colors, CGA hardware could render over 100 distinct colors using artifact color techniques.

Later demoscene groups expanded on this capability by manipulating text modes to quadruple the number of text rows and employing particular ASCII characters to create required pixel arrangements. This method enabled displaying up to 1024 simultaneous colors without dithering at an effective resolution of 80 × 100 on composite monitors.

This approach capitalized on the NTSC color clock timing—160 cycles per scanline—where pixels occupied either half or quarter cycles depending on column mode. By restricting character rendering to upper scanlines and utilizing codepage 437 character configurations, up to 1024 colors could be displayed concurrently, as showcased in the demoscene production 8088 MPH.

Availability and caveats

The 320 × 200 version of this method aligns with the conventional BIOS-supported graphics mode designed for composite color displays. In contrast, the 640 × 200 variant necessitates altering a hardware register bit (disabling the color burst) within the CGA, which is why it is frequently regarded as a distinct "mode."

Since this technique is entirely reliant on NTSC signal encoding and decoding, composite color artifacting cannot be utilized on RGBI monitors and is not replicated by EGA, VGA, or contemporary graphics cards.

The PC emulator DOSBox includes support for CGA modes that simulate composite monitor color artifacting, covering both the 640 × 200 composite mode and the more intricate 320 × 200 variant.

Resolution and usage

Composite artifacting effectively lowers the horizontal resolution to roughly 160 pixels (with some improvement for black-on-white or white-on-black text) while preserving vertical resolution. This results in a composite video output often referred to as a 160 × 200 / 16-color "mode," although technically it is a technique applied over a standard graphics mode.

Given its limited resolution, composite color artifacting was predominantly employed in gaming applications. Numerous prominent titles optimized their visuals specifically for composite color displays. For example, Ultima II, the first entry in its series adapted for IBM PC, utilized CGA composite graphics. Similarly, King's Quest I delivered 16-color graphics on PC, PCjr, and Tandy 1000 systems but offered an 'RGB mode' at the title screen restricted to four colors using standard CGA capabilities.

Limitations, bugs and errata

The CGA hardware incorporates the Motorola 6845 video controller, which was initially crafted for text-based displays with a maximum of 128 character rows.

To enable graphics modes featuring 200 scanlines, the MC6845 is configured to generate 100 character rows per frame, each consisting of two scanlines. Because the MC6845 outputs identical video memory addresses across all scanlines within a character row, CGA leverages the "row address" as an additional address bit to retrieve raster data.

This approach demands that even-numbered scanlines be stored sequentially in memory, followed by odd-numbered scanlines beginning at address 8,192. Such a memory arrangement imposes extra complexity on software managing graphics data.

Although the MC6845 supports interlaced timing signals, CGA circuitry synchronizes signals exclusively for progressive scanning, thereby preventing vertical resolution from doubling to 400 lines on standard 15 kHz monitors.

In the 80-column text mode, increased bandwidth can cause sporadic short horizontal lines ("snow") when programs write directly to video memory during rendering. The BIOS circumvents this by performing memory access during horizontal retrace intervals or temporarily disabling video output during scrolling operations. While this method introduces flickering, IBM considered it preferable to visual noise. This phenomenon does not affect other adapters or most CGA clones.

The pixel clock frequency and synchronization pulse duration are doubled in 80-column mode except for the composite output's color burst circuit, which emits fewer cycles at the increased clock rate. Consequently, many monitors experience unstable or missing color signals in this mode. IBM identifies this as a "feature" applicable only to RGBI and black-and-white composite displays. Achieving stable color can be done by setting the border color to brown, which generates a phase that matches the appropriate color burst signal as a substitute.

Dual-display capability

The CGA was launched concurrently with the IBM MDA and could be installed alongside it within the same system. PC DOS provides a command to toggle the video output between CGA and MDA adapters. Certain applications, such as Lotus 1-2-3 and AutoCAD, support simultaneous use of both display devices.

Software compatibility

During the early 1990s, CGA maintained extensive software compatibility, including support for:

Rival video adapters

In 1982, BYTE commended CGA’s output as "very good—slightly better than color graphics on existing microcomputers," while PC Magazine in 1983 preferred MDA for text clarity, noting CGA’s text quality as moderate and potentially causing visual fatigue. Looking back, Next Generation described CGA graphics as inferior compared to its contemporaries.

Notable competitors included:

  • IBM’s Monochrome Display Adapter (MDA), initially favored in business environments due to its crisp, high-resolution monochrome text.
  • The non-IBM Hercules Graphics Card (HGC) introduced in 1982, which combined MDA-compatible text with a higher-resolution 720×348 monochrome graphics mode.
  • Plantronics Colorplus (1982), which expanded CGA memory to 32 KB, enabling 16 colors at 320×200 or 4 colors at 640×200 resolutions.
  • The onboard "extended CGA" hardware found in the IBM PCjr (1984) and Tandy 1000 (1985), featuring increased video RAM and enhanced color modes favored by gamers, commonly referred to as "Tandy Graphics Adapter" or "TGA".
  • IBM’s premium Professional Graphics Controller (1984), designed for CAD applications with backward compatibility to CGA, though it saw limited uptake due to its $4,000 cost.

Additional alternatives included:

  • Paradise Systems’ 1984 CGA-compatible card designed for MDA monitors that could render CGA’s full 16-color palette in monochrome shades without requiring special drivers.
  • Certain CGA-compatible chipsets found in devices like the Olivetti M24, DEC VAXmate, Compaq, and Toshiba laptops offered doubled vertical resolution, enhancing text sharpness and adding a 640×400 graphics mode.

The CGA was eventually succeeded by IBM’s Enhanced Graphics Adapter (EGA), which preserved most of the original CGA modes while introducing a 640×350 resolution and a selectable palette of 16 colors from a total of 64 available in both text and graphics modes.

DE-9 connector for RGBI display

The Color Graphics Adapter (CGA) employs a standard DE-9 connector for direct video output to an RGBI monitor. The adapter is equipped with a female connector, whereas the monitor cable uses a male plug.

Pin configuration of the CGA DE-9 connector
Pin Purpose
1 Ground
2 Ground
3 Red signal
4 Green signal
5 Blue signal
6 Intensity
7 Reserved
8 Horizontal synchronization
9 Vertical synchronization
CGA TTL signal characteristics
Signal type Digital TTL
Supported resolutions 640 × 200, 320 × 200
Horizontal frequency 15,699.8 Hz (calculated as 14.318181 MHz divided by 8 then by 114)
Vertical frequency 59.923 Hz (horizontal frequency divided by 262)
Color capability 16 colors

RCA Connector for Composite Television or Monitor

The CGA card includes an RCA connector designed for linking to composite monitors or televisions compatible with NTSC signals. This connector on the card is of the female type, while the cable connecting to the display is male.

CGA Analog Signal Specifications
Signal Type Analog composite, NTSC-compatible
Display Resolution 640 × 200, 320 × 200 pixels
Horizontal Frequency 15,699.8 Hz (calculated as 14.318181 MHz divided by 8 then by 114)
Vertical Frequency 59.923 Hz (derived from horizontal frequency divided by 262)
Color Capability 16 colors, with numerous artifact-generated hues

See also

External links

  1. ↑ 1.0 1.1 Cite error: Invalid <ref> tag; no text was provided for refs named viler
  2. ↑ Cite error: Invalid <ref> tag; no text was provided for refs named :5