Difference between revisions of "Color Graphics Adapter"

From TheAlmightyGuru
Jump to: navigation, search
(Graphic Mode 160x100, 4-bit Color)
(Display Modes)
Line 8: Line 8:
  
 
==Display Modes==
 
==Display Modes==
The CGA supported four display modes, both using RGB or composite output. RGB was usually sent to computer monitors while composite was usually sent to televisions. It is actually possible to simulate additional colors using composite output, but by sacrificing visual clarity.
+
[[Image:Color Palette - CGA.png|thumb|256x256px|16 colors of CGA text mode.]]
 +
 
 +
The CGA supports two primary display modes, text or graphic. In text mode, the programmer can place an 8x8 pixel character at a fixed row and column at intervals of 8 pixels. Characters must be chosen from a pre-made set of 256 characters representing [[Code page 437]] which are stored on the card's ROM. The card stores a normal and narrow version of the character set, and the programmer may switch between the two, but only for the entire screen. Text could displayed with a custom foreground and background color chosen from a pre-made set of 16 colors. The graphic modes allowed the programmer to address every pixel individually, but the trade-off was lower resolution, fewer colors, or both.
 +
 
 +
Both modes could use RGB or composite output. RGB was usually sent to computer monitors while composite was usually sent to televisions. It is actually possible to simulate additional colors using composite output, but by sacrificing visual clarity.
 +
 
 +
===Text Mode: 40x25, 4-bit Color===
 +
This mode run at 40x25 characters of 8x8 pixel characters. This yields a resolution of 320x200, with a pixel ratio of 1:1.2 (visually 320x240). Users who outputted to a low resolution monitor or a television had to use this display, but those with high resolution monitors could still use this mode if they preferred larger text.  
  
===Text Mode 80x25, 4-bit Color===
+
When displayed on a 4:3 CRT monitor of the day, the display was stretched in height, scanlines would be present, and a curved distortion would be noticeable near the edges of the display.
[[Image:Color Palette - CGA.png|thumb|256x256px|16 colors of CGA text mode.]]
+
 
 +
{|
 +
| <p style="text-align:center;">[[Image:CGA Example - 40x25.gif|320px]]<br/>Actual screen data.</p>
 +
| <p style="text-align:center;">[[Image:CGA Example - Simulated 40x25.gif|320px]]<br/>Simulated monitor.</p>
 +
|}
 +
 
 +
===Text Mode: 80x25, 4-bit Color===
 +
This text mode has 80x25 characters, each made up from the same 8x8 pixel data as the 40x25 mode. This yields a resolution of 640x200 with a pixel ratio of 1:2.4 (visually 640x480). Most programs that were written for CGA and relied on text output used this resolution.
  
===Text Mode 40x25, 4-bit Color===
+
{|
 +
| <p style="text-align:center;">[[Image:CGA Example - 80x25 Text - QuickBASIC.png|320px]]<br/>Actual screen data of [[QuickBASIC]].</p>
 +
| <p style="text-align:center;">[[Image:CGA Example - Simulated 80x25 Text - QuickBASIC.png|320px]]<br/>Simulated monitor.</p>
 +
|}
  
===Graphic Mode 320x240, 2-bit Color===
+
===Graphic Mode: 320x240, 2-bit Color===
This was the most popular CGA mode for graphics. The display resolution is 320x200 pixels with a pixel ratio of 1:1.2 (visually 320x240). When displayed on a CRT monitor, the display was stretched in height, scanlines would be present, and a curved distortion would be noticeable near the edges of the display.
+
This was the most popular CGA mode used for graphics. The display resolution is 320x200 pixels with a pixel ratio of 1:1.2 (visually 320x240). Only four colors could be displayed on the screen at a time, and they were mostly fixed, which is why so many CGA games look the same.
  
 
{|
 
{|
Line 23: Line 40:
 
|}
 
|}
  
A programmer could switch between one of two palettes, each with four colors. Palette 0 is black, green, red, yellow, palette 1 is black, cyan, magenta, white. Neither is very useful for displaying realistic images, but each color effectively contrasts with each other. Each palette could be displayed at high or low intensity, shifting the entire image's brightness.
+
A programmer could switch between one of two palettes, each with four colors. Palette 0 is black, green, red, yellow, palette 1 is black, cyan, magenta, white. Neither is very useful for displaying realistic images, but each color effectively contrasts with each other. Each palette could be displayed at high or low intensity, shifting the entire screen's brightness.
  
 
{|
 
{|
Line 33: Line 50:
 
|}
 
|}
  
In either palette mode, color 0 is customizable and can be replaced with any of the 16 colors from the text mode. This gives the benefit of adding a custom color, provided all the graphics on the screen don't need black, however, color 0 is always the background color which displays in the overscan region (border), so changing the color may cause unwanted results near the edge of the screen.
+
In either palette mode, color 0 is black, but it is customizable and can be replaced with any of the 16 colors from the text mode. This gives the benefit of adding a custom color, provided no black exists on the screen (as it would be replaced as well). Color 0 is always the background color which displays in the overscan region (or border) of the screen, so changing the color sometimes caused unwanted results near the edges of the screen.
  
 
{|
 
{|
Line 40: Line 57:
 
|}
 
|}
  
Through a simple trick, an alternate palette can be attained. This is possible by changing settings on the board outside of its normal specifications. The result is a palette using the colors black cyan, red, and white. This palette also supports high and low intensity, but it only on RGB monitors.
+
Through a simple trick, an alternate palette can be attained. This is possible by changing settings on the board that normally only function in composite output when the output is actually set to RGB output. The result is an additional palette using the colors black cyan, red, and white. This palette also supports high and low intensity, but it can only be attained on RGB monitors.
  
 
{|
 
{|
Line 47: Line 64:
 
|}
 
|}
  
===Graphic Mode 640x200, 1-bit Color===
+
===Graphic Mode: 640x200, 1-bit Color===
Far fewer programs used this higher resolution mode because it only supported monochrome graphics, but the larger resolution made more detailed interfaces. Games like [[SimCity]] supported this mode. The resolution is 640x200 pixels, but has a dramatic pixel ratio of 1:2.4 (visually 640x480). When displayed on a CRT monitor, the display was visibly stretched in height, scanlines would be present, and a curved distortion would be noticeable near the edges of the display.
+
Few programs used this mode because it was monochrome, but the higher resolution allowed for more detailed interfaces. The resolution is 640x200 pixels, but has a dramatic pixel ratio of 1:2.4 (visually 640x480). When displayed on a CRT monitor, the display was visibly stretched in height, scanlines would be present, and a curved distortion would be noticeable near the edges of the display. Games like [[SimCity]] supported this mode.
  
 
{|
 
{|
Line 55: Line 72:
 
|}
 
|}
  
In this mode, color 0 must remain black, but color 1 can be customized to any of the 16 text mode colors. For example:
+
Unlike in the 320x200 mode, in this mode, color 0 must remain black, but color 1 can be customized to any of the 16 text mode colors. It wasn't common practice to program in this way because most programs that were written in monochrome mode assumed the user had a monochrome display. However, for those who owned a color monitor, and wanted high resolution, you could get a display like this:
  
 
{|
 
{|
Line 61: Line 78:
 
|}
 
|}
  
===Graphic Mode 160x100, 4-bit Color===
+
===Graphic Mode: 160x100, 4-bit Color===
This is not technically a graphic mode, but a creative tweak of text mode 80x25. It changes the 80x25 text display to be a 80x100 by only displaying the top 2 pixels of reach text row. By drawing character 222 (which is half the fore color and half the back color), and changing the foreground and background colors after each character, you effectively get 160x100 pixels, each with any color from the palette of 16.
+
This is not technically a graphic mode, but a clever tweak of text mode 80x25. The row height in text mode could be increased by cutting off the bottom lines of each row. By setting a row height to only 2 pixels, a programmer would get a text resolution of 80x100 instead of 80x25, but all display would still have to be made up from the existing 256 possible characters in ROM. By drawing character 222 (which is half the fore color and half the back color), and changing the foreground and background colors after each character, you effectively get 160x100 pixels, each with any color from the palette of 16.
  
 
{|
 
{|
Line 69: Line 86:
 
|}
 
|}
  
Technically, this trick could also be done in the 40x25 text mode, but it would result in a fairly block 40x100 resolution, so few, if any, programs ever used it.
+
Technically, this trick can be done in the 40x25 text mode, but it would result in a more-blocky 40x100 resolution, so few, if any, programs ever used it.
  
 
==Software==
 
==Software==

Revision as of 11:09, 14 June 2018

An IBM CGA card.

The Color Graphics Adapter (CGA) is a graphics display adapter developed by IBM and released in 1981. It gives IBM personal computers limited color graphics capabilities. It was superseded in 1984 by the Enhanced Graphics Adapter (EGA) which added superior color graphic capabilities. Though the card was developed and sold by IBM, competing companies quickly reverse-engineered it and sold clones.

By the time I got into computers, EGA was already standard, and VGA graphics had just been introduced, so the MS-DOS games I played that used CGA looked pretty dated to me, and I wasn't very interested in them. However, there were some that were just so fun, I saw past the poor color quality.

I did a little bit of programming with CGA graphics in QuickBASIC where it was screen 1, but I mostly preferred the superior screens I had access to, 7, 12, and 13.

Display Modes

File:Color Palette - CGA.png
16 colors of CGA text mode.

The CGA supports two primary display modes, text or graphic. In text mode, the programmer can place an 8x8 pixel character at a fixed row and column at intervals of 8 pixels. Characters must be chosen from a pre-made set of 256 characters representing Code page 437 which are stored on the card's ROM. The card stores a normal and narrow version of the character set, and the programmer may switch between the two, but only for the entire screen. Text could displayed with a custom foreground and background color chosen from a pre-made set of 16 colors. The graphic modes allowed the programmer to address every pixel individually, but the trade-off was lower resolution, fewer colors, or both.

Both modes could use RGB or composite output. RGB was usually sent to computer monitors while composite was usually sent to televisions. It is actually possible to simulate additional colors using composite output, but by sacrificing visual clarity.

Text Mode: 40x25, 4-bit Color

This mode run at 40x25 characters of 8x8 pixel characters. This yields a resolution of 320x200, with a pixel ratio of 1:1.2 (visually 320x240). Users who outputted to a low resolution monitor or a television had to use this display, but those with high resolution monitors could still use this mode if they preferred larger text.

When displayed on a 4:3 CRT monitor of the day, the display was stretched in height, scanlines would be present, and a curved distortion would be noticeable near the edges of the display.

CGA Example - 40x25.gif
Actual screen data.

CGA Example - Simulated 40x25.gif
Simulated monitor.

Text Mode: 80x25, 4-bit Color

This text mode has 80x25 characters, each made up from the same 8x8 pixel data as the 40x25 mode. This yields a resolution of 640x200 with a pixel ratio of 1:2.4 (visually 640x480). Most programs that were written for CGA and relied on text output used this resolution.

CGA Example - 80x25 Text - QuickBASIC.png
Actual screen data of QuickBASIC.

CGA Example - Simulated 80x25 Text - QuickBASIC.png
Simulated monitor.

Graphic Mode: 320x240, 2-bit Color

This was the most popular CGA mode used for graphics. The display resolution is 320x200 pixels with a pixel ratio of 1:1.2 (visually 320x240). Only four colors could be displayed on the screen at a time, and they were mostly fixed, which is why so many CGA games look the same.

CGA Example - Pal 1 - High.png
Actual screen data.

CGA Example - Simulated 320x200.png
Simulated monitor.

A programmer could switch between one of two palettes, each with four colors. Palette 0 is black, green, red, yellow, palette 1 is black, cyan, magenta, white. Neither is very useful for displaying realistic images, but each color effectively contrasts with each other. Each palette could be displayed at high or low intensity, shifting the entire screen's brightness.

CGA Example - Pal 0 - High.png
Palette 0, high intensity. The actual Prince of Persia title screen.

CGA Example - Pal 0 - Low.png
Palette 0, low intensity.

CGA Example - Pal 1 - High.png
Palette 1, high intensity.

CGA Example - Pal 1 - Low.png
Palette 1, low intensity.

In either palette mode, color 0 is black, but it is customizable and can be replaced with any of the 16 colors from the text mode. This gives the benefit of adding a custom color, provided no black exists on the screen (as it would be replaced as well). Color 0 is always the background color which displays in the overscan region (or border) of the screen, so changing the color sometimes caused unwanted results near the edges of the screen.

CGA Example - Simulated 320x200 - Alternate Black.png
A simulation with black replaced by blue.

CGA Example - 320x200 - Alternate Black.png
Street Fighter in CGA mode used this feature in the player select screen.

Through a simple trick, an alternate palette can be attained. This is possible by changing settings on the board that normally only function in composite output when the output is actually set to RGB output. The result is an additional palette using the colors black cyan, red, and white. This palette also supports high and low intensity, but it can only be attained on RGB monitors.

CGA Example - Pal Alt - High.png
Alternate palette, high intensity.

CGA Example - Pal Alt - Low.png
Alternate palette, low intensity.

Graphic Mode: 640x200, 1-bit Color

Few programs used this mode because it was monochrome, but the higher resolution allowed for more detailed interfaces. The resolution is 640x200 pixels, but has a dramatic pixel ratio of 1:2.4 (visually 640x480). When displayed on a CRT monitor, the display was visibly stretched in height, scanlines would be present, and a curved distortion would be noticeable near the edges of the display. Games like SimCity supported this mode.

CGA Example - 640x200.png
Actual screen data.

CGA Example - Simulated 640x200.png
Simulated monitor fpr Space Racer.

Unlike in the 320x200 mode, in this mode, color 0 must remain black, but color 1 can be customized to any of the 16 text mode colors. It wasn't common practice to program in this way because most programs that were written in monochrome mode assumed the user had a monochrome display. However, for those who owned a color monitor, and wanted high resolution, you could get a display like this:

CGA Example - 640x200 - Alternate White.png
Custom foreground color.

Graphic Mode: 160x100, 4-bit Color

This is not technically a graphic mode, but a clever tweak of text mode 80x25. The row height in text mode could be increased by cutting off the bottom lines of each row. By setting a row height to only 2 pixels, a programmer would get a text resolution of 80x100 instead of 80x25, but all display would still have to be made up from the existing 256 possible characters in ROM. By drawing character 222 (which is half the fore color and half the back color), and changing the foreground and background colors after each character, you effectively get 160x100 pixels, each with any color from the palette of 16.

CGA Example - 160x100.png
Actual screen data.

CGA Example - Simulated 160x100.png
Simulated monitor.

Technically, this trick can be done in the 40x25 text mode, but it would result in a more-blocky 40x100 resolution, so few, if any, programs ever used it.

Software

All software that used 2-bit Color

These are programs that I think made good use of CGA graphics:

Links