Jump to content

Color Graphics Adapter: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Ropers (talk | contribs)
No edit summary
→‎Competing adapters: Fix typo (prize->price)
Line 83: Line 83:
==Competing adapters==
==Competing adapters==
There were two commonly available competing display adapters:
There were two commonly available competing display adapters:
* For business and wordprocessing use, IBM had launched its Monochrome Display Adapter (MDA) at the same time as their CGA. Again, the MDA produced significantly sharper text display in 80-column mode: It rendered characters in a box of 9×14 pixels, of which 7×11 made out the character itself (the other pixels being used for space between character columns and lines). This was clearly superior than the CGA's 8×8 dots text character matrix. Because of this and because of the CGA's higher prize at the time, MDA was initially often preferred.
* For business and wordprocessing use, IBM had launched its Monochrome Display Adapter (MDA) at the same time as their CGA. Again, the MDA produced significantly sharper text display in 80-column mode: It rendered characters in a box of 9×14 pixels, of which 7×11 made out the character itself (the other pixels being used for space between character columns and lines). This was clearly superior than the CGA's 8×8 dots text character matrix. Because of this and because of the CGA's higher price at the time, MDA was initially often preferred.


* In [[1982]], the non-IBM ''[[Hercules Graphics Card]]'' (also ''HGC'') was introduced. It offered two modes: an MDA compatible high resolution text mode and a monochrome graphics mode. Its graphics mode was black and white at a resolution of 720&times;348 pixels. This resolution was better than even the highest b/w resolution CGA cards could offer. Thus, even without a colour capability of any kind, the Hercules adapter's offer of good (for its time) monochrome graphics without sacrificing MDA-equivalent text quality made it a very desirable choice for many. In addition there were [[emulator]] drivers that allowed the Hercules card to display the standard CGA modes as well (albeit reduced to black and white). The HGC thus outsold both CGA and MDA adapters, and despite no support or standardization by IBM quickly became a de-facto standard.<br />An alternative perspective on these past events is the view that IBM's lack of support for the Hercules card may &mdash; ironically &mdash; have contributed to its popularity: [[Software]] [[developer]]s, then as now, were interested in reaching a widespread customer base. As Hercules cards could emulate the standard CGA graphics display modes (with appropriate software), it made sense to only write e.g. games for the CGA card. However, the Hercules card could ''not'' emulate the possibly more attractive 16 colour CGA display modes (some of which, admittedly, were very complicated to program for as well). So developers may not have supported the 16 colour CGA modes because they could not have sold such software to Hercules users. Instead, they may have restricted themselves to developing only for the more standard 4 colour CGA modes which owners of both graphics adapters could display. This lack of development for the 16 colour CGA modes let them fall into obscurity &mdash; ultimately even few IT professionals knew about them. This may have helped sales of the HGC, because potential customers would not have seen the benefit of a supposedly only 4 colour CGA card over the cheaper Hercules card which could emulate 4 colour modes in black and white. Had there been more emphasis on native Hercules support, rather than maintaining cross-compatibility, there might also have been more development for the CGA's native 16 colour modes.
* In [[1982]], the non-IBM ''[[Hercules Graphics Card]]'' (also ''HGC'') was introduced. It offered two modes: an MDA compatible high resolution text mode and a monochrome graphics mode. Its graphics mode was black and white at a resolution of 720&times;348 pixels. This resolution was better than even the highest b/w resolution CGA cards could offer. Thus, even without a colour capability of any kind, the Hercules adapter's offer of good (for its time) monochrome graphics without sacrificing MDA-equivalent text quality made it a very desirable choice for many. In addition there were [[emulator]] drivers that allowed the Hercules card to display the standard CGA modes as well (albeit reduced to black and white). The HGC thus outsold both CGA and MDA adapters, and despite no support or standardization by IBM quickly became a de-facto standard.<br />An alternative perspective on these past events is the view that IBM's lack of support for the Hercules card may &mdash; ironically &mdash; have contributed to its popularity: [[Software]] [[developer]]s, then as now, were interested in reaching a widespread customer base. As Hercules cards could emulate the standard CGA graphics display modes (with appropriate software), it made sense to only write e.g. games for the CGA card. However, the Hercules card could ''not'' emulate the possibly more attractive 16 colour CGA display modes (some of which, admittedly, were very complicated to program for as well). So developers may not have supported the 16 colour CGA modes because they could not have sold such software to Hercules users. Instead, they may have restricted themselves to developing only for the more standard 4 colour CGA modes which owners of both graphics adapters could display. This lack of development for the 16 colour CGA modes let them fall into obscurity &mdash; ultimately even few IT professionals knew about them. This may have helped sales of the HGC, because potential customers would not have seen the benefit of a supposedly only 4 colour CGA card over the cheaper Hercules card which could emulate 4 colour modes in black and white. Had there been more emphasis on native Hercules support, rather than maintaining cross-compatibility, there might also have been more development for the CGA's native 16 colour modes.

Revision as of 09:34, 18 August 2004

The Color Graphics Adapter (CGA), introduced in 1981, was IBM's first colour graphics card, and the first colour computer display standard, for the 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 640×200 and up to 16 colours (albeit not at that resolution). It is commonly believed that the CGA could only display a maximum of 4 colours at a resolution of 320×200. However, this is not correct: There were several ways — some official, some not — by which more colours could be displayed, even for graphics display purposes. These additional modes and "tricks" were however rather seldom used — even few programmers were aware of their existence. The commonly used modes are described next and the said rarely used modes are discussed further below.

Standard text modes

Full CGA colour palette
0 - black8 - dark gray
1 - blue9 - bright blue
2 - green10 - bright green
3 - cyan11 - bright cyan
4 - red12 - bright red
5 - magenta13 - bright magenta
6 - brown14 - yellow
7 - gray15 - white
Fixed CGA colour palette #1
default5 - magenta
3 - cyan15 - white
Fixed CGA colour palette #2
default4 - red
2 - green6 - brown
these colours may be off –
corrections are welcome

There were two commonly used text modes offered by CGA:

The color values are :

  • The first was for 40×25 characters in up to 16 colours. Each of these characters was a pattern of 8×8 dots. The theoretical screen resolution in this mode was 320×200 pixels. This number is arrived at through calculating character width (8 pixels) by columns of text (40) and character height (8 pixels) by lines of text (25). However, the individual pixels could not be addressed independently in this mode. The choice of patterns for any given row/column location on the screen was thus limited to one of the 256 available ASCII characters. In terms of colour use, this mode allowed for each character to have a foreground and a background colour, both of which could be freely chosen from the entire CGA palette (see table). So for example red on yellow text could be used for one character, white on black for the next and cyan on gray for yet another.
  • The second text mode allowed 80×25 characters in up to 16 colours. For this mode, too, the characters consisted of 8×8 dot patterns (but the dots were rectangular, they were higher than wide). The theoretical screen resolution of this mode was 640×200 pixels. This number is arrived at through calculating character width (8 pixels) by columns of text (80) and character height (8 pixels) by lines of text (25). Again, the individual pixels could not be addressed seperately in this mode. The 80×25 mode, too, could avail of the entire CGA palette in the same way the 40×25 mode could.

A problem which hampered CGA adoption was the fact that the individual characters in CGA text modes looked noticably less sharp when compared to IBM's Monochrome Display Adapter (MDA, see below). This was not only an issue with the 40×25 text mode (which obviously had a lower text resolution), but also with the higher resolution text mode: The reason for its less sharp character rendering was that even in the 80×25 mode, the characters only consisted of a 8×8 pixel matrix, including surrounding space.

Standard graphics modes

There were two commonly used graphics modes offered by CGA:

  • The first allowed for 320×200 pixels, which was the same overall resolution as the 40×25 text mode. In this graphics mode however, each and every pixel could be addressed independently. The tradeoff was a limitation in the colours that could be displayed: In this mode, only 4 colours (out of a the CGA card's palette of 16) could be displayed at a time. These fours colour however could not be freely chosen: There were only two fixed palettes that could be used in this graphics mode:
    1. The first consisted of cyan, magenta, white and black (by default).
    2. The second consisted of green, red, an orange-brown tone and again black (but see below).
    The pixels in the 320×200 mode were not perfect squares; they were actually rectangles, slightly higher than wide, but they were "close enough" to square for most purposes. Their rectangular shape only needed to be taken into account when drawing large geometrical shapes on the screen.
  • The second graphics mode allowed for 640×200 pixels, which was the same overall resolution as the 80×25 text mode. Again, in this graphics mode, all pixels could be addressed seperately. Yet once more, improvement came at a cost in that the mode was a monochrome one, offering only black and white as "colours" (but see below). The pixels were heavily rectangular, which absolutely always had to be taken into account when using this mode.

The composite video modes

Little known to most, there was a 160×200 graphics mode, which could freely use the full 16 colours of the entire CGA palette. This mode however only worked with the RCA jack composite video output. This port, which existed on original IBM CGA cards (but not on all clones), allowed the user to connect e.g. a TV set (or any other display that accepted composite video) to the computer. The CGA card was then capable, if suitably programmed, to display the said 160×200 resolution in 16 colours on such a display unit. It was incidentally precisely to enable the possibility of connecting a TV set to the PC, that IBM chose the original clockspeed of 4.77 MHz for the PC/XT. Only at this clockspeed would the timing be right for such video output. However, there was no BIOS support for this mode at all and few users and programmers were aware of it. Also, most users preferred keep their PC connected to a monitor, because the only modes that could be displayed via composite video were this graphics mode and a further 40×25 text mode, which was monochrome only. There at most only a tiny handful of software titles available that used the 160×200 graphics mode, most of them games.

Further graphics modes and improvements

However, there were still quite a few official and unofficial features that could be exploited to achieve better graphics on the actual computer monitor:

  • With the 320×200 graphics mode, the colour black was actually the background colour and this could be changed to any of the other 15 colours of the CGA palette. This allowed for some variation as well as literally "flashy" effects as the background colour could be changed without having to redraw the screen. (However this feature appears to have been little known, so the fourth colour almost always remained black.)
  • In addition to this, the border colour (the colour displayed outside the regular display area) could be changed from its usual black to any of the other 15 colours.
  • With the 640×200 graphics mode, both colours could be changed, so one could have, say, blue and orange-brown instead of black and white.
  • According to the "Life Before Demos" hobbyist page [1], there also existed another fixed palette (with cyan, red, white and black/default as its colours).
  • It was reportedly also possible to switch to another palette while the screen content was being drawn, possibly multiple times: Using this method, the screen could display more than 4 colours as 2 palettes (or more) would be combined (albeit only in different horizontal areas of the display).

Again, most software titles didn't avail of these possibilities, but there were a few impressive (at the time) exceptions. Some of these above tweaks could even be combined.

The 160×100 16 colour mode

One of the most outlandish features however must be the CGA card's lowest resolution graphics mode, which offered 160 by 100 individually addressable pixels at 16 colours, to which the entire palette was available without limitation.

In technical terms however, this mode wasn't a graphics mode, but rather a tweak of the 80×25 text mode:
To start with, the number of text lines was quadrupled. So instead of having 25 lines of text (with 80 characters each), there now where 100 lines of text squeezed onto the screen (each line still with 80 characters).These "tightly squeezed" text characters would be rectangular in shape and be about twice as wide as high.
To understand the next step it is important to recall that in 16 colour text mode each character would have two colours defined for it: The foreground and the background colour. As explained above, a user might have green on black text for one character and blue on brown for the next.
Now there existed a character within the ASCII table — character 221 in the extended ASCII character set — which consisted of a box occupying the left half of the character matrix. It looked like this: . Now because each character could be assigned different foreground and background colours, this very same single text character could be coloured cyan on the left (foreground colour) and magenta on the right (background colour), like so: File:Half-block.character.cyan.magenta.gif. This could also be reversed without changing the actual character, just by swapping the fore- and background colours: File:Half-block.character.magenta.cyan.gif. Finally, because each and every text character on the screen can have different fore- and background colours, it becomes clear that using the ASCII character 221, every half of every character matrix (box) can be treated like an individual pixel. Through this technique, 2 times 80, ie. 160 horizontal pixels could be made available per each line. As all the lines were highly compressed and their constituent characters twice as wide as high, sort of splitting each of these "wide" characters vertically (using the above technique) would yield near square pixels: Thus, 160×100 pixels at 16 colours would have been made available.

Alert readers might have noticed that a near identical characters to ASCII 221 existed: ASCII 222 occupied the right half and looked like this: . The same effect described above could be achieved by using the ASCII character 222 — the only difference would be that the foreground and background colours for each pixel would have needed to be set the other way around. (Note that these characters are actually inline pictures in this text, to ensure best current browser compatibility. While the characters correspond to Unicode characters 258C and 2590, there are still too many browsers who display inline .gifs more reliable than these characters.)

While this may seem a very roundabout way of achieving 16 colour graphics display, it worked quite well and was reportedly even mentioned in IBM's official documentation.

To top things off, even more detail could be achieved in the 160×100 "graphics" mode by using yet other than the aforesaid characters, thus combining ASCII art with the aforesaid technique.

Links to several screenshots from this graphics mode (with use of other ASCII characters) are listed under "External links" below.

Summary of colour capabilities

As we have seen, the Color Graphics Adapter featured only one 4-colour mode — the 320×200 mode.
It did however feature four 16-colour modes: the 40×25 and 80×25 text modes, the 160×200 composite graphics mode and the 160×100 text/graphics mode.
The claim that CGA was only capable of displaying up to 4-colours thus demonstrably is a scientific myth.

Problems

Besides the less crisp text display there were two further annoyances with the CGA card: Snow and flicker. "Snow" was the name given to random pixels that could appear anywhere on the screen while in graphics mode: Flicker meant that text printed on the screen while in graphics mode could flicker as certain graphical operations were performed. Reportedly both issues might have been caused by design flaws by IBM. There later were third party CGA cards available that were supposedly snow and flicker-free.

Competing adapters

There were two commonly available competing display adapters:

  • For business and wordprocessing use, IBM had launched its Monochrome Display Adapter (MDA) at the same time as their CGA. Again, the MDA produced significantly sharper text display in 80-column mode: It rendered characters in a box of 9×14 pixels, of which 7×11 made out the character itself (the other pixels being used for space between character columns and lines). This was clearly superior than the CGA's 8×8 dots text character matrix. Because of this and because of the CGA's higher price at the time, MDA was initially often preferred.
  • In 1982, the non-IBM Hercules Graphics Card (also HGC) was introduced. It offered two modes: an MDA compatible high resolution text mode and a monochrome graphics mode. Its graphics mode was black and white at a resolution of 720×348 pixels. This resolution was better than even the highest b/w resolution CGA cards could offer. Thus, even without a colour capability of any kind, the Hercules adapter's offer of good (for its time) monochrome graphics without sacrificing MDA-equivalent text quality made it a very desirable choice for many. In addition there were emulator drivers that allowed the Hercules card to display the standard CGA modes as well (albeit reduced to black and white). The HGC thus outsold both CGA and MDA adapters, and despite no support or standardization by IBM quickly became a de-facto standard.
    An alternative perspective on these past events is the view that IBM's lack of support for the Hercules card may — ironically — have contributed to its popularity: Software developers, then as now, were interested in reaching a widespread customer base. As Hercules cards could emulate the standard CGA graphics display modes (with appropriate software), it made sense to only write e.g. games for the CGA card. However, the Hercules card could not emulate the possibly more attractive 16 colour CGA display modes (some of which, admittedly, were very complicated to program for as well). So developers may not have supported the 16 colour CGA modes because they could not have sold such software to Hercules users. Instead, they may have restricted themselves to developing only for the more standard 4 colour CGA modes which owners of both graphics adapters could display. This lack of development for the 16 colour CGA modes let them fall into obscurity — ultimately even few IT professionals knew about them. This may have helped sales of the HGC, because potential customers would not have seen the benefit of a supposedly only 4 colour CGA card over the cheaper Hercules card which could emulate 4 colour modes in black and white. Had there been more emphasis on native Hercules support, rather than maintaining cross-compatibility, there might also have been more development for the CGA's native 16 colour modes.

See also


This article is based on material taken from the Free On-line Dictionary of Computing prior to 1 November 2008 and incorporated under the "relicensing" terms of the GFDL, version 1.3 or later. The article has however since been largely rewritten.