Color Graphics Adapter
Encyclopedia
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, and the first color computer display standard
for the IBM PC
.
The standard IBM CGA graphics card was equipped with 16 kilobyte
s of video memory
, and could be connected either to a NTSC
-compatible monitor or television via an RCA connector
for composite video
, or to a dedicated 4-bit "RGBI" interface CRT
monitor, such as the IBM 5153 color display.
Built around the Motorola MC6845 display controller, the CGA card featured several graphics and text mode
s. The highest display resolution
of any mode was 640×200, and the highest color depth
supported was 4-bit (16 colors).
in CGA's graphics mode (see below), CGA processes colors in its palette
in four bits, yielding 24 = 16 different colors. The four color bits are arranged according to the RGBI color model: The lower three bits represent red, green, and blue color components; a fourth "intensifier" bit increases the brightness of all three color components (red, green, and blue) of the pixels it is set for.
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
Color 6 is treated differently; when using the formula above, color 6 would become dark yellow, as seen to the left, but in order to achieve a more pleasing brown tone, special circuitry in most RGBI monitors, including the IBM 5153 color display, makes an exception for color 6 and changes its hue from dark yellow to brown by halving the analogue green signal's amplitude:
if colorNumber = 6 then green := green / 2
It is this "RGBI with tweaked brown" palette, shown in the complete palette to the right, that all later PC graphics standards such as EGA
and VGA
have retained for compatibility.
(that they obtained separately, from a third party) to connect the CGA to their television set. The IBM 5153 Personal Computer Color Display would not be introduced until 1983. Resulting from the lack of available RGBI monitors in 1981 and 1982, many users would use simpler RGB monitors (without provisions for the "intensifier" bit), reducing the number of available colors to eight, and displaying both colors 6 and 14 as yellow. This is relevant insofar as if an application or game programmer used either one of these configurations, he will have expected color 6 to look dark yellow instead of brown.
s (called alphanumeric modes in IBM's documentation):
BIOS Modes 0 & 1 select 40 column text modes. The difference between these two modes can only be seen on a composite monitor; mode 0 disables the color burst, making colors 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.
BIOS Modes 2 & 3 select 80 column text modes. As with the 40-column text modes, Mode 2 disables the color burst in the composite signal and Mode 3 enables it.
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 eight-color indexes (8-15) for the background color.
Notably, the GW-BASIC and, later, Microsoft QBASIC
(a lesser derivative of Microsoft QuickBASIC
) programming language interpreters included with MS-DOS (which was the de facto
PC OS while the CGA was popular) 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, though it would be possible by directly programming the hardware registers using the OUT statement. In BASIC, foreground text color numbers 16-31 are the blinking versions of colors 0-15, respectively, but background colors 8-15 are identical to colors 0-7 respectively.
BIOS Modes 4 & 5 set up the 320×200 graphics modes. Similar to the text modes, Mode 4 enables the composite color burst bit, Mode 5 disables it. Unlike the text modes, disabling the composite color burst bit (which setting Mode 5 does) in 320×200 affects the colors displayed on an RGB monitor with the IBM CGA card and true compatibles (see below.)
BIOS Mode 6 sets up the 640×200 graphics mode. This mode disables the composite color burst signal by default. The BIOS does not provide an option to turn the color burst on in 640×200 mode, and the user must write directly to the mode control register to enable it.
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 is ordinarily absent, and trying to display it will result in garbage or blank characters. The character data may be placed into memory manually by the user, or by a utility such as GRAFTABL.
A number of official and unofficial features exist that can be exploited to achieve special effects.
Some of these above tweaks can even be combined. Examples can be found in several games. Most software titles did not use these possibilities, but there were a few impressive exceptions.
Character 221 of code page 437 consists of a box occupying the entire left half of the character matrix. (Character 222 consists of a box occupying the entire right half.)
Because each character can be assigned different foreground and background colors, it can be colored (for example) blue on the left (foreground color) and bright red on the right (background color). This can be reversed by swapping the foreground and background colors.
Using either character 221 or 222, each half of each truncated character cell can thus be treated as an individual pixel—making 160 horizontal pixels available per line. Thus, 160×100 pixels at 16 colors, with an aspect ratio of 1:1.2, are possible.
Although a roundabout way of achieving 16-color graphics display, this works quite well http://mobygames.com/game/shots/p,4/gameId,22/gameShotId,919/ and the mode is even mentioned (although not explained) in IBM's official hardware documentation.
More detail can be achieved in this mode by using other characters, combining ASCII art
with the aforesaid technique.
Because the CGA has 16384 bytes of graphics memory, not 16000, it is just as easy to set the number of lines in this mode to 102 instead of 100 for a resolution of 160×102. This uses extra video memory that is normally unused. However, most games did not do this, perhaps out of fear it would only work on some monitors but not others.
The same text cell height reduction technique can also be used with the 40×25 text mode. This only made sense when using ASCII art, because without it the resulting resolution would only have been 80×100.
It is for this reason that each of the text and graphics modes described above exists twice: once as the normal "color" version and once as a "monochrome" version; the "monochrome" version of each mode would turn off the NTSC color decoding in the viewing monitor completely, resulting in a black-and-white picture, but also no color bleeding, hence, a sharper picture.
On RGBI monitors, the two versions of each mode are identical, with the exception of the 320x200 graphics mode, where the "monochrome" version produces the third palette, as described above.
However, programmers soon found out that this flaw could be turned into an asset, as distinct patterns of high-resolution dots would "smear" into consistent areas of solid colors, thus allowing the display of completely new colors. Since these new colors are the result of cross-color artifacting, they are often called "artifact colors". Both the standard 320×200 four-color and the 640×200 color-on-black graphics modes could be used with this technique.
Artifact colors are seen because the composite monitor's NTSC chroma decoder misinterprets some of the luminance information as color, as stated before. By carefully placing pixels in appropriate patterns, the skilled programmer produces particular cross-color artifacts yielding the desired color; either from purely black-and-white pixels in 640×200 mode, or resulting from a combination of direct and artifact colors in 320×200 mode, as seen in these pictures.
Thus, with the choice of 320×200 vs. 640×200 mode, the choice of palette (1 or 2) and the freely-selectable color 0 in 320×200 modes (see above), plus the ability to set the foreground color in 640×200 mode freely, each one of these parameters results in a different set of artifact colors, making for a total gamut
of over 100 colors, of which 16 can be displayed at the same time.
Being completely dependent on the NTSC encoding/decoding process, composite color artifacting is not available on an RGBI monitor, nor is it emulated by EGA, VGA or contemporary graphics adapters.
Using the same monitor at the same settings, direct colors are constant from card to card and host system to host system. Artifact colors, on the other hand, tend to drift in hue. (This is unrelated to the hue shift problem encountered in the terrestrial reception of NTSC broadcast signals.) For this reason, the original IBM PC and XT design provides a trimpot
labeled "COLOR ADJUST" (on the mainboard, not on the CGA card itself) which modifies the phase difference between the ISA
bus
' CLK and OSC signals that leaves direct colors constant while changing the hue of artifact colors. If the trimmer is not adjusted properly, the composite output may not produce any color at all.
Host systems that lack a "COLOR ADJUST" trimpot, such as the Tandy 1000
's internal video hardware, might produce erratic artifact colors and require hue adjustment on the composite color monitor. Later AT systems usually do not provide a proper OSC signal at all, rendering the composite color display completely unusable.
The low resolution of this composite color artifacting method led to it being used almost exclusively in games, with many of the more high-profile titles optionally, sometimes exclusively, offering graphics optimized for composite color monitors:
Another peculiarity of 80-column text mode is that, on composite displays, the picture will be grayscale if the border color is set to black, white, or gray. Setting the border color to brown results in the normal 16 colors being displayed, while other values cause the colors to become tinted.
The video controller 6845's row counter being only seven bits wide, display RAM in graphics modes is laid out in a 2:1 "interlace" pattern, first laying out the data for rows 0, 2, 4, etc., then the data for rows 1, 3, 5, etc., adding additional software overhead for display RAM manipulation. This is unrelated to the NTSC field interlace.
The CGA card was succeeded in the consumer space by IBM's Enhanced Graphics Adapter
(EGA) card, which supports most of CGA's modes and adds an additional resolution (640×350) as well as a software-selectable palette of 16 colors out of 64 in both text and graphics modes. Along with this move, the price of the older CGA card was lowered considerably; it became an attractive low-cost option and was soon adopted by the new PC cloning companies as well. Entry-level non-AT PCs with CGA graphics sold very well during the next few years, and consequently there were many games released for such systems, despite CGA's limitations. CGA's popularity started to wane after VGA became IBM's high-level standard and EGA the entry-level standard in 1987. However, most software made up to 1990 supported it.
IBM
International Business Machines Corporation or IBM is an American multinational technology and consulting corporation headquartered in Armonk, New York, United States. IBM manufactures and sells computer hardware and software, and it offers infrastructure, hosting and consulting services in areas...
's first color graphics card, and the first color computer display standard
Computer display standard
Computer display standards are often a combination of aspect ratio, display resolution, color depth, and refresh rate.This article describes the different display standards for computer displays.-History:...
for the IBM PC
IBM PC
The IBM Personal Computer, commonly known as the IBM PC, is the original version and progenitor of the IBM PC compatible hardware platform. It is IBM model number 5150, and was introduced on August 12, 1981...
.
The standard IBM CGA graphics card was equipped with 16 kilobyte
Kilobyte
The kilobyte is a multiple of the unit byte for digital information. Although the prefix kilo- means 1000, the term kilobyte and symbol KB have historically been used to refer to either 1024 bytes or 1000 bytes, dependent upon context, in the fields of computer science and information...
s of video memory
Video memory
Video memory is a term generally used in computers to describe some form of writable memory, usually RAM, dedicated to the purpose of holding the information necessary for a graphics card to drive a display device...
, and could be connected either to a NTSC
NTSC
NTSC, named for the National Television System Committee, is the analog television system that is used in most of North America, most of South America , Burma, South Korea, Taiwan, Japan, the Philippines, and some Pacific island nations and territories .Most countries using the NTSC standard, as...
-compatible monitor or television via an RCA connector
RCA connector
An RCA connector, sometimes called a phono connector or cinch connector, is a type of electrical connector commonly used to carry audio and video signals...
for composite video
Composite video
Composite video is the format of an analog television signal before it is combined with a sound signal and modulated onto an RF carrier. In contrast to component video it contains all required video information, including colors in a single line-level signal...
, or to a dedicated 4-bit "RGBI" interface CRT
Cathode ray tube
The cathode ray tube is a vacuum tube containing an electron gun and a fluorescent screen used to view images. It has a means to accelerate and deflect the electron beam onto the fluorescent screen to create the images. The image may represent electrical waveforms , pictures , radar targets and...
monitor, such as the IBM 5153 color display.
Built around the Motorola MC6845 display controller, the CGA card featured several graphics and text mode
Text mode
Text mode is a kind of computer display mode in which the content of the screen is internally represented in terms of characters rather than individual pixels. Typically, the screen consists of a uniform rectangular grid of character cells, each of which contains one of the characters of a...
s. The highest display resolution
Display resolution
The display resolution of a digital television or display device is the number of distinct pixels in each dimension that can be displayed. It can be an ambiguous term especially as the displayed resolution is controlled by all different factors in cathode ray tube , flat panel or projection...
of any mode was 640×200, and the highest color depth
Color depth
In computer graphics, color depth or bit depth is the number of bits used to represent the color of a single pixel in a bitmapped image or video frame buffer. This concept is also known as bits per pixel , particularly when specified along with the number of bits used...
supported was 4-bit (16 colors).
Color palette
Despite varying bit depthsColor depth
In computer graphics, color depth or bit depth is the number of bits used to represent the color of a single pixel in a bitmapped image or video frame buffer. This concept is also known as bits per pixel , particularly when specified along with the number of bits used...
in CGA's graphics mode (see below), CGA processes colors in its palette
Palette (computing)
In computer graphics, a palette is either a given, finite set of colors for the management of digital images , or a small on-screen graphical element for choosing from a limited set of choices, not necessarily colors .Depending on the context In computer graphics, a palette is either a given,...
in four bits, yielding 24 = 16 different colors. The four color bits are arranged according to the RGBI color model: The lower three bits represent red, green, and blue color components; a fourth "intensifier" bit increases the brightness of all three color components (red, green, and blue) of the pixels it is set for.
Full CGA 16-color palette | |||
---|---|---|---|
0 | black #000000 |
8 | 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 (high intensity) #FFFFFF |
With an RGBI monitor
These four bits are passed on unmodified to the DE-9 connector at the back of the card, leaving all color processing to the RGBI monitor connected to it. With respect to the RGBI color model described above, the monitor would use approximately the following formula to process the digital four-bit color number to analog voltages ranging from 0.0 to 1.0: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
Dark Yellow | |
---|---|
6 | #AAAA00 |
Color 6 is treated differently; when using the formula above, color 6 would become dark yellow, as seen to the left, but in order to achieve a more pleasing brown tone, special circuitry in most RGBI monitors, including the IBM 5153 color display, makes an exception for color 6 and changes its hue from dark yellow to brown by halving the analogue green signal's amplitude:
if colorNumber = 6 then green := green / 2
It is this "RGBI with tweaked brown" palette, shown in the complete palette to the right, that all later PC graphics standards such as EGA
Enhanced Graphics Adapter
The Enhanced Graphics Adapter is the IBM PC computer display standard specification which is between CGA and VGA in terms of color and space resolution. Introduced in October 1984 by IBM shortly after its new PC/AT, EGA produces a display of 16 simultaneous colors from a palette of 64 at a...
and VGA
Video Graphics Array
Video Graphics Array refers specifically to the display hardware first introduced with the IBM PS/2 line of computers in 1987, but through its widespread adoption has also come to mean either an analog computer display standard, the 15-pin D-subminiature VGA connector or the 640×480 resolution...
have retained for compatibility.
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. 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:RGBI Monitor availability
When the CGA was introduced in 1981, IBM did not offer an RGBI monitor of their own. Instead, customers were supposed to use the RCA output with an RF modulatorRF modulator
An RF modulator is a device that takes a baseband input signal and outputs a radio frequency-modulated signal....
(that they obtained separately, from a third party) to connect the CGA to their television set. The IBM 5153 Personal Computer Color Display would not be introduced until 1983. Resulting from the lack of available RGBI monitors in 1981 and 1982, many users would use simpler RGB monitors (without provisions for the "intensifier" bit), reducing the number of available colors to eight, and displaying both colors 6 and 14 as yellow. This is relevant insofar as if an application or game programmer used either one of these configurations, he will have expected color 6 to look dark yellow instead of brown.
Standard text modes
CGA offers four BIOS text modeText mode
Text mode is a kind of computer display mode in which the content of the screen is internally represented in terms of characters rather than individual pixels. Typically, the screen consists of a uniform rectangular grid of character cells, each of which contains one of the characters of a...
s (called alphanumeric modes in IBM's documentation):
- 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 ratioAspect ratioThe aspect ratio of a shape is the ratio of its longer dimension to its shorter dimension. It may be applied to two characteristic dimensions of a three-dimensional shape, such as the ratio of the longest and shortest axis, or for symmetrical objects that are described by just two measurements,...
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 437Code page 437IBM PC or MS-DOS code page 437 is the character set of the original IBM PC. It is also known as CP 437, OEM 437, PC-8, MS-DOS Latin US or sometimes misleadingly referred to as the OEM font, High ASCII or Extended ASCII....
character set) is therefore fixed and cannot be changed (although when using the original IBM CGA, it is possible to select one of two different fonts—normal or thin—by changing a jumperJumper (computing)In electronics and particularly computing, a jumper is a short length of conductor used to close a break in or bypass part of an electrical circuit...
. Many clones didn't offer this possibility). The card has sufficient video RAM for eight different text pages in this mode.
BIOS Modes 0 & 1 select 40 column text modes. The difference between these two modes can only be seen on a composite monitor; mode 0 disables the color burst, making colors 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 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 ratioPixel aspect ratioPixel aspect ratio is a mathematical ratio that describes how the width of a pixel in a digital image compares to the height of that pixel....
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 four different text pages.
BIOS Modes 2 & 3 select 80 column text modes. As with the 40-column text modes, Mode 2 disables the color burst in the composite signal and Mode 3 enables it.
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 eight-color indexes (8-15) for the background color.
Notably, the GW-BASIC and, later, Microsoft QBASIC
QBasic
QBasic is an IDE and interpreter for a variant of the BASIC programming language which is based on QuickBASIC. Code entered into the IDE is compiled to an intermediate form, and this intermediate form is immediately interpreted on demand within the IDE. It can run under nearly all versions of DOS...
(a lesser derivative of Microsoft QuickBASIC
QuickBASIC
Microsoft QuickBASIC is an Integrated Development Environment and compiler for the BASIC programming language that was developed by Microsoft. QuickBASIC runs mainly on DOS, though there was a short-lived version for Mac OS...
) programming language interpreters included with MS-DOS (which was the de facto
De facto standard
A de facto standard is a custom, convention, product, or system that has achieved a dominant position by public acceptance or market forces...
PC OS while the CGA was popular) 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, though it would be possible by directly programming the hardware registers using the OUT statement. In BASIC, foreground text color numbers 16-31 are the blinking versions of colors 0-15, respectively, but background colors 8-15 are identical to colors 0-7 respectively.
Standard graphics modes
CGA offers two commonly-used BIOS graphics modes (sometimes called All-Points Addressable by IBM):- 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 four colors can be displayed at a time. Also, only one of the four colors can be freely chosen from the 16 CGA colors—there are only two official palettes for this mode:
EWLINE
|
||||||||||||||||
EWLINE
|
-
- Magenta, cyan, white and background color (any of the 16 colors, black by default).
- Red, green, brown/yellow and background color (any of the 16 colors, black by default).
- By setting the high-intensity bit, brighter versions of these modes can be accessed.
- The 1:1.2 pixel aspect ratio needs to be taken into account when drawing large geometrical shapes on the screen.
BIOS Modes 4 & 5 set up the 320×200 graphics modes. Similar to the text modes, Mode 4 enables the composite color burst bit, Mode 5 disables it. Unlike the text modes, disabling the composite color burst bit (which setting Mode 5 does) in 320×200 affects the colors displayed on an RGB monitor with the IBM CGA card and true compatibles (see below.)
- 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 bright white, but the foreground color can be changed to any other color of the CGA palette. This can be done at runtime without refreshing the screen. The background color cannot be changed from black on a true IBM CGA card.
BIOS Mode 6 sets up the 640×200 graphics mode. This mode disables the composite color burst signal by default. The BIOS does not provide an option to turn the color burst on in 640×200 mode, and the user must write directly to the mode control register to enable it.
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 is ordinarily absent, and trying to display it will result in garbage or blank characters. The character data may be placed into memory manually by the user, or by a utility such as GRAFTABL.
Further graphics modes and tweaks
# | 3rd palette | 3rd Palette in high intensity |
---|---|---|
0 | default | default |
1 | 3 — cyan | 11 — light cyan |
2 | 4 — red | 12 — light red |
3 | 7 — white | 15 — white (high intensity) |
A number of official and unofficial features exist that can be exploited to achieve special effects.
- In 320×200 graphics mode, the background color (which also affects the border color), which defaults to black on mode initialization, can be changed to any of the other 15 colors of the CGA palette. This allows for some variation, as well as flashing effects, as the background color can be changed without having to redraw the screen (i.e. without changing the contents of the video RAM.)
- In 640×200 graphics mode, the foreground color can be changed from its usual white to any of the other 15 colors. The background and border cannot be changed from black.
- In text mode, the border color (displayed outside the regular display area—into the overscan area) can be changed from its usual black to any of the other 15 colors.
- A third 320×200 4-color palette is achieved by disabling the composite color burst bit while in graphics mode. This is what IBM BIOS Mode 5 does, as described above. This switches the current color palette to red, cyan, white and the background color. The intense versions of these colors can also be used and the background color may be changed, but the palette cannot be switched to official palettes 0 or 1 without enabling the composite color signal again. As such, it can only be seen on RGB monitors and will simply appear in grayscale on composite displays. This palette was often used by games because it looked more attractive than the cyan/magenta/white colors. Notably, it is not mentioned in the IBM Reference Guide, and some CGA clones may not support it.
- Through precision timing, it is possible to switch to another palette while the screen being scanned (drawn), allowing the use of any one of the six palettes per scanline. The best example of this in use is the game California GamesCalifornia GamesCalifornia Games is a 1987 Epyx sports video game for many home computers and video game consoles. Branching from their popular Summer Games and Winter Games series, this game consisted of some sports purportedly popular in California including skateboarding, freestyle footbag, surfing, roller...
when run on a stock 4.77 MHz 8088. (Running it on a faster computer does not produce the effect, as the method the programmers used to switch palettes at predetermined locations is extremely sensitive to machine speed.) The same can be done with the background color, to create the river and road in FroggerFroggerFrogger is an arcade game introduced in 1981. It was developed by Konami, and licensed for worldwide distribution by Sega/Gremlin. The object of the game is to direct frogs to their homes one by one. To do this, each frog must avoid cars while crossing a busy road and navigate a river full of...
. Another documented example of the technique is in AtarisoftAtarisoftAtarisoft was a brand name used by Atari, Inc in 1983 and 1984 to market video games they published for home systems made by their competitors. Each platform had a specific color attributed by Atarisoft for its game packages...
's port of Jungle HuntJungle HuntJungle Hunt is a one- or two-player side-scrolling arcade platform game produced by Taito in 1982.The player controls a jungle explorer who sports a pith helmet and a safari suit. The player must rescue his girl from a tribe of hungry cannibals...
to the PC. - Additional colors are often approximated using dithering, although the low resolution makes it very apparent. In particular, many Sierra games use palette 0 at low intensity and dark blue as the background color. This gives it the three primary RGB colors to work with (as well as brown).
Some of these above tweaks can even be combined. Examples can be found in several games. Most software titles did not use these possibilities, but there were a few impressive exceptions.
160×100 16 color mode
Technically, this mode is not a graphics mode, but a tweak of the 80×25 text mode. The character cell height register is changed to display only two lines per character cell instead of the normal eight lines. This quadruples the number of text rows displayed from 25 to 100. These "tightly squeezed" text characters are not full characters. The system only displays their top two lines of pixels (eight each) before moving on to the next row.Character 221. | |
221 with blue text and red background color. | |
221 with red text and blue background color. | |
Character 222. |
Character 221 of code page 437 consists of a box occupying the entire left half of the character matrix. (Character 222 consists of a box occupying the entire right half.)
Because each character can be assigned different foreground and background colors, it can be colored (for example) blue on the left (foreground color) and bright red on the right (background color). This can be reversed by swapping the foreground and background colors.
Using either character 221 or 222, each half of each truncated character cell can thus be treated as an individual pixel—making 160 horizontal pixels available per line. Thus, 160×100 pixels at 16 colors, with an aspect ratio of 1:1.2, are possible.
Although a roundabout way of achieving 16-color graphics display, this works quite well http://mobygames.com/game/shots/p,4/gameId,22/gameShotId,919/ and the mode is even mentioned (although not explained) in IBM's official hardware documentation.
More detail can be achieved in this mode by using other characters, combining ASCII art
ASCII art
ASCII art is a graphic design technique that uses computers for presentation and consists of pictures pieced together from the 95 printable characters defined by the ASCII Standard from 1963 and ASCII compliant character sets with proprietary extended characters...
with the aforesaid technique.
Because the CGA has 16384 bytes of graphics memory, not 16000, it is just as easy to set the number of lines in this mode to 102 instead of 100 for a resolution of 160×102. This uses extra video memory that is normally unused. However, most games did not do this, perhaps out of fear it would only work on some monitors but not others.
The same text cell height reduction technique can also be used with the 40×25 text mode. This only made sense when using ASCII art, because without it the resulting resolution would only have been 80×100.
Special effects on composite color monitors
Using the NTSC TV-out instead of an RGBI monitor not only made for less attractive colors, as described above, but as is common with NTSC composite video, the separation between luminance and chrominance is far from perfect, yielding cross-color artifacts, or color "smearing". This is especially a problem with 80-column text:It is for this reason that each of the text and graphics modes described above exists twice: once as the normal "color" version and once as a "monochrome" version; the "monochrome" version of each mode would turn off the NTSC color decoding in the viewing monitor completely, resulting in a black-and-white picture, but also no color bleeding, hence, a sharper picture.
On RGBI monitors, the two versions of each mode are identical, with the exception of the 320x200 graphics mode, where the "monochrome" version produces the third palette, as described above.
However, programmers soon found out that this flaw could be turned into an asset, as distinct patterns of high-resolution dots would "smear" into consistent areas of solid colors, thus allowing the display of completely new colors. Since these new colors are the result of cross-color artifacting, they are often called "artifact colors". Both the standard 320×200 four-color and the 640×200 color-on-black graphics modes could be used with this technique.
Internal operation
Direct colors are the normal 16 colors as described above under "The CGA color palette".Artifact colors are seen because the composite monitor's NTSC chroma decoder misinterprets some of the luminance information as color, as stated before. By carefully placing pixels in appropriate patterns, the skilled programmer produces particular cross-color artifacts yielding the desired color; either from purely black-and-white pixels in 640×200 mode, or resulting from a combination of direct and artifact colors in 320×200 mode, as seen in these pictures.
Thus, with the choice of 320×200 vs. 640×200 mode, the choice of palette (1 or 2) and the freely-selectable color 0 in 320×200 modes (see above), plus the ability to set the foreground color in 640×200 mode freely, each one of these parameters results in a different set of artifact colors, making for a total gamut
Gamut
In color reproduction, including computer graphics and photography, the gamut, or color gamut , is a certain complete subset of colors. The most common usage refers to the subset of colors which can be accurately represented in a given circumstance, such as within a given color space or by a...
of over 100 colors, of which 16 can be displayed at the same time.
Availability and caveats
The 320×200 variant of this technique (see above) is how the standard BIOS-supported graphics mode looks on a composite color monitor. The 640×200 variant however requires modifying a bit (color burst disable) directly in the CGA's hardware registers, as a result, it is usually referred to as a separate "mode", often just as "the" composite color mode, since its more distinctive set of artifact colors led it to being more commonly used than the 320×200 variant.Being completely dependent on the NTSC encoding/decoding process, composite color artifacting is not available on an RGBI monitor, nor is it emulated by EGA, VGA or contemporary graphics adapters.
Using the same monitor at the same settings, direct colors are constant from card to card and host system to host system. Artifact colors, on the other hand, tend to drift in hue. (This is unrelated to the hue shift problem encountered in the terrestrial reception of NTSC broadcast signals.) For this reason, the original IBM PC and XT design provides a trimpot
Trimmer (electronics)
A trimmer or preset is a miniature adjustable electrical component. It is meant to be set correctly when installed in some device, and never seen or adjusted by the device's user. Trimmers can be variable resistors , variable capacitors, trimmable inductors...
labeled "COLOR ADJUST" (on the mainboard, not on the CGA card itself) which modifies the phase difference between the ISA
Industry Standard Architecture
Industry Standard Architecture is a computer bus standard for IBM PC compatible computers introduced with the IBM Personal Computer to support its Intel 8088 microprocessor's 8-bit external data bus and extended to 16 bits for the IBM Personal Computer/AT's Intel 80286 processor...
bus
Expansion bus
An expansion bus is made up of electronic pathways which move information between the internal hardware of a computer system and peripheral devices. It is a collection of wires and protocols that allows for the expansion of a computer.- History :The first kit-built microcomputers used a bus design...
' CLK and OSC signals that leaves direct colors constant while changing the hue of artifact colors. If the trimmer is not adjusted properly, the composite output may not produce any color at all.
Host systems that lack a "COLOR ADJUST" trimpot, such as the Tandy 1000
Tandy 1000
The Tandy 1000 was the first in a line of more-or-less IBM PC compatible home computer systems produced by the Tandy Corporation for sale in its Radio Shack chain of stores.-Overview:...
's internal video hardware, might produce erratic artifact colors and require hue adjustment on the composite color monitor. Later AT systems usually do not provide a proper OSC signal at all, rendering the composite color display completely unusable.
Resolution and usage
Composite artifacting, whether used intentionally or as an unwanted artifact, reduces the effective horizontal resolution to a minimum of 160 pixels, more for black-on-white or white-on-black text, without changing the vertical resolution. The resulting composite video display with "artifacted" colors was thus sometimes described as a 160x200/16-color "mode", though technically it was a method, not a mode.The low resolution of this composite color artifacting method led to it being used almost exclusively in games, with many of the more high-profile titles optionally, sometimes exclusively, offering graphics optimized for composite color monitors:
Bugs and errata
The higher bandwidth used by 80-column text mode results in random short horizontal lines appearing onscreen (known as "snow") if a program writes directly to video memory, as the CPU has priority when accessing it. This can be avoided by only accessing the memory during the period of vertical or horizontal retrace. The "snow" problem does not occur on any other video adapter, or on most CGA clones.Another peculiarity of 80-column text mode is that, on composite displays, the picture will be grayscale if the border color is set to black, white, or gray. Setting the border color to brown results in the normal 16 colors being displayed, while other values cause the colors to become tinted.
The video controller 6845's row counter being only seven bits wide, display RAM in graphics modes is laid out in a 2:1 "interlace" pattern, first laying out the data for rows 0, 2, 4, etc., then the data for rows 1, 3, 5, etc., adding additional software overhead for display RAM manipulation. This is unrelated to the NTSC field interlace.
Competing adapters
CGA had two main competitors:- For business and word processing use, IBM launched its Monochrome Display AdapterMonochrome Display AdapterThe Monochrome Display Adapter introduced in 1981 was IBM's standard video display card and computer display standard for the PC. The MDA did not have any pixel-addressable graphics modes...
(MDA) at the same time as CGA, which produced a higher resolution text display in 80×25 mode, rendering each character in a box of 9×14 pixels, of which 7×11 were the character itself. This produced sharper and more clearly separated characters than the CGA's 8×8 dots text character matrix allowed. Because of this, MDA was the preferred choice for business use. Also, IBM initially manufactured the MDA card as a printer port/MDA combo card. This meant that users wishing to connect printers to their original IBM PC would have to pay for the MDA card anyway (initially $335), while the CGA card (initially $300) could be left out to save money. While including the CGA card and connecting an existing TV set for use as a monitor allowed users to forgo the purchase of a monitor, this was not significantly cheaper than buying a monochrome monitor (initially $345) and leaving out the CGA card. Also, 80-column text was almost unusable on color composite displays, and the IBM model 5153 CGA color video display that was required to fully exploit the CGA card's capabilities was even more expensive. Since a great many PCs were sold to businesses, the sharp, high-resolution monochrome text was more desirable for running applications.
- In 1982, the non-IBM Hercules Graphics CardHercules Graphics CardThe Hercules Graphics Card was a computer graphics controller made by Hercules Computer Technology, Inc. which, through its popularity, became a widely supported display standard. It was common on IBM PC compatibles connected to a monochrome monitor . It supported one high resolution text mode and...
(HGC) was introduced, the first third-party video card to be made for the PC. In addition to an MDA-compatible text mode, it offered a monochrome graphics mode. With a resolution of 720×348 pixels, it had a higher resolution than that produced by CGA. The Hercules' combination of sharp monochrome text and graphics capabilities made it ideal for running software such as Lotus 123 that supported business graphics. Some games also had Hercules support.
- Important to the gaming community, the IBM PCjrIBM PCjrThe IBM PCjr was IBM's first attempt to enter the home computer market. The PCjr, IBM model number 4860, retained the IBM PC's 8088 CPU and BIOS interface for compatibility, but various design and implementation decisions led the PCjr to be a commercial failure.- Features :Announced November 1,...
(1984) and the compatible Tandy 1000Tandy 1000The Tandy 1000 was the first in a line of more-or-less IBM PC compatible home computer systems produced by the Tandy Corporation for sale in its Radio Shack chain of stores.-Overview:...
(1985) featured onboard "extended CGA" video hardware that extended video RAM beyond 16 kB, thus allowing 16 colors at 320×200 resolution and four colors at 640×200 resolution (later Tandys also had a 640×200 mode with 16 colors). Similar but less widely used was the PlantronicsPlantronicsPlantronics is an electronics company producing audio communications equipment for business and consumers. Its' products provide unified communications, mobile use, gaming and music...
ColorplusPlantronics ColorplusThe Plantronics Colorplus was a graphics card for IBM PC computers, first sold in 1982. It was a superset of the then-current CGA standard, using the same monitor standard and providing the same pixel resolutions....
.
- In 1984, IBM also introduced the Professional Graphics ControllerProfessional Graphics ControllerProfessional Graphics Controller was a graphics card manufactured by IBM for the PC. It consisted of three interconnected PCBs, and contained its own processor and memory....
, a very sophisticated—for its time—high-end graphics solution intended for e.g. CAD applications. It was mostly backwards compatible with CGA. The PGC did not see widespread adoption due to its $4,000 price tag, and was discontinued in 1987.
- Another extension in some CGA-compatible chipsets (including those in the OlivettiOlivettiOlivetti S.p.A. is an Italian manufacturer of computers, printers and other business machines.- Founding :The company was founded as a typewriter manufacturer in 1908 in Ivrea, near Turin, by Camillo Olivetti. The firm was mainly developed by his son Adriano Olivetti...
M24, AT&T 6300, the DECDigital Equipment CorporationDigital Equipment Corporation was a major American company in the computer industry and a leading vendor of computer systems, software and peripherals from the 1960s to the 1990s...
VAXmateVAXmateVAXmate was an IBM PC/AT compatible personal computer introduced by Digital Equipment Corporation in September, 1986. The replacement to the Rainbow 100, in its standard form it was the first commercial diskless personal computer.-OS and files:...
, and some CompaqCompaqCompaq Computer Corporation is a personal computer company founded in 1982. Once the largest supplier of personal computing systems in the world, Compaq existed as an independent corporation until 2002, when it was acquired for US$25 billion by Hewlett-Packard....
and ToshibaToshibais a multinational electronics and electrical equipment corporation headquartered in Tokyo, Japan. It is a diversified manufacturer and marketer of electrical products, spanning information & communications equipment and systems, Internet-based solutions and services, electronic components and...
portables) is a doubled vertical resolution. This gives a higher quality 8×16 text display and an additional 640×400 graphics mode.
The CGA card was succeeded in the consumer space by IBM's Enhanced Graphics Adapter
Enhanced Graphics Adapter
The Enhanced Graphics Adapter is the IBM PC computer display standard specification which is between CGA and VGA in terms of color and space resolution. Introduced in October 1984 by IBM shortly after its new PC/AT, EGA produces a display of 16 simultaneous colors from a palette of 64 at a...
(EGA) card, which supports most of CGA's modes and adds an additional resolution (640×350) as well as a software-selectable palette of 16 colors out of 64 in both text and graphics modes. Along with this move, the price of the older CGA card was lowered considerably; it became an attractive low-cost option and was soon adopted by the new PC cloning companies as well. Entry-level non-AT PCs with CGA graphics sold very well during the next few years, and consequently there were many games released for such systems, despite CGA's limitations. CGA's popularity started to wane after VGA became IBM's high-level standard and EGA the entry-level standard in 1987. However, most software made up to 1990 supported it.
Connector
The Color Graphics Adapter uses a standard DE-9 connector.Pin | Function |
---|---|
1 | Ground |
2 | Ground |
3 | Red |
4 | Green |
5 | Blue |
6 | Intensity |
7 | Reserved |
8 | Horizontal Sync |
9 | Vertical Sync |
Signal
Type | Digital, TTL |
---|---|
Resolution | 640h × 200v, 320h × 200v |
H-freq | 15.75 kHz |
V-freq | 60 Hz |
Colors | 16 |
See also
- RGB color modelRGB color modelThe RGB color model is an additive color model in which red, green, and blue light is added together in various ways to reproduce a broad array of colors...
- Graphics card
- Graphic display resolutionsGraphic display resolutionsThe graphics display resolution describes the width and height dimensions of a display, such as a computer monitor, in pixels. Certain combinations of width and height are standardized and typically given a name and an initialism that is descriptive of its dimensions...
- Graphics processing unitGraphics processing unitA graphics processing unit or GPU is a specialized circuit designed to rapidly manipulate and alter memory in such a way so as to accelerate the building of images in a frame buffer intended for output to a display...
- List of display interfaces
- List of 8-bit computer hardware palettes – CGA section
- Code page 437Code page 437IBM PC or MS-DOS code page 437 is the character set of the original IBM PC. It is also known as CP 437, OEM 437, PC-8, MS-DOS Latin US or sometimes misleadingly referred to as the OEM font, High ASCII or Extended ASCII....
- List of display mode data