Color Graphics Adapter: Difference between revisions

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
Output capabilities: The final word and period of a sentence was removed in an earlier edit (accidentally, I assume); I added it back.
 
imported>Kvng
m redundant
 
(One intermediate revision by one other user not shown)
Line 13: Line 13:
|enthusiast=ATi Small Wonder Graphics Solution with game port
|enthusiast=ATi Small Wonder Graphics Solution with game port
|openglversion=  
|openglversion=  
|d3dversion=
|predecessor=  
|predecessor=  
|successor={{plainlist|
|successor={{plainlist|
Line 24: Line 23:
}}
}}


The '''Color Graphics Adapter''' ('''CGA'''), originally also called the ''Color/Graphics Adapter'' or ''IBM Color/Graphics Monitor Adapter'',<ref name=":0" /> introduced in 1981, was [[IBM]]'s first color [[graphics card]] for the [[IBM PC]] and established a [[De facto standard|de facto]] [[computer display standard]].
The '''Color Graphics Adapter''' ('''CGA'''), originally also called the ''Color/Graphics Adapter'' or ''IBM Color/Graphics Monitor Adapter'',<ref name=":0" /> introduced in 1981, was [[IBM]]'s first color [[graphics card]] for the [[IBM PC]] and established a ''[[De facto standard|de facto]]'' [[computer display standard]].


==Hardware design==
==Hardware design==
The original IBM CGA graphics card was built around the [[Motorola 6845]] display controller,{{r|bradley199009}} came with 16&nbsp;[[kilobyte]]s of [[video memory]] built in, and 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&nbsp;colors).
The original IBM CGA graphics card was built around the [[Motorola 6845]] display controller,{{r|bradley199009}} came with 16&nbsp;[[kilobyte]]s of [[video memory]] built in, and featured several graphics and [[text mode]]s. The highest [[display resolution]] of any mode was {{resx|640 × 200}}, and the highest [[color depth]] supported was 4-bit (16&nbsp;colors).


The CGA card could be connected either to a direct-drive [[CRT monitor]] using a [[4-bit]] digital ([[Transistor-transistor logic|TTL]]) [[RGB(I)|RGBI]] interface, such as the [[IBM 5153]] color display, or to an [[NTSC]]-compatible television or [[composite video]] [[computer monitor|monitor]] via an [[RCA connector]].<ref name=":4">{{cite book|author=A. Kumar|url=https://books.google.com/books?id=8VtwFil-DTEC&q=5153+color+monitor&pg=PA1050|title=Encyclopaedia of Management of Computer Hardware|publisher=Anmol Publications|year=2002|isbn=978-81-261-1030-8|page=1050}}{{Dead link|date=December 2023 |bot=InternetArchiveBot |fix-attempted=yes }}</ref> The RCA connector provided only baseband video, so to connect the CGA card to a television set without a composite video input required a separate [[RF modulator]].<ref name=":0">{{Cite book|url=http://minuszerodegrees.net/oa/OA%20-%20IBM%20Color%20Graphics%20Monitor%20Adapter%20(CGA).pdf|title=IBM CGA manual|page=1}}</ref>
The CGA card could be connected either to a direct-drive [[CRT monitor]] using a [[4-bit]] digital ([[Transistor-transistor logic|TTL]]) [[RGB(I)|RGBI]] interface, such as the [[IBM 5153]] color display, or to an [[NTSC]]-compatible television or [[composite video]] [[computer monitor|monitor]] via an [[RCA connector]].<ref name=":4">{{cite book|author=A. Kumar|url=https://books.google.com/books?id=8VtwFil-DTEC&q=5153+color+monitor&pg=PA1050|title=Encyclopaedia of Management of Computer Hardware|publisher=Anmol Publications|year=2002|isbn=978-81-261-1030-8|page=1050}}{{Dead link|date=December 2023 |bot=InternetArchiveBot |fix-attempted=yes }}</ref> The RCA connector provided only baseband video, so to connect the CGA card to a television set without a composite video input required a separate [[RF modulator]].<ref name=":0">{{Cite book|url=http://minuszerodegrees.net/oa/OA%20-%20IBM%20Color%20Graphics%20Monitor%20Adapter%20(CGA).pdf|title=IBM CGA manual|page=1}}</ref>
Line 33: Line 32:
IBM produced the ''5153 Personal Computer Color Display'' for use with the CGA, but this was not available at release<ref name="williams198201">{{cite news|author=Williams, Gregg|date=January 1982|title=A Closer Look at the IBM Personal Computer|page=36|work=BYTE|url=https://archive.org/stream/byte-magazine-1982-01/1982_01_BYTE_07-01_The_IBM_Personal_Computer#page/n37/mode/2up|access-date=19 October 2013}}</ref> and would not be released until March 1983.<ref>International Business Machines Corporation (February 4, 1983). [http://www-01.ibm.com/common/ssi/ShowDoc.wss?docURL=/common/ssi/rep_ca/2/897/ENUS183-002/index.html&lang=en&request_locale=en Announcement Letter Number 183-002 - IBM COLOR DISPLAY, 5153].</ref>
IBM produced the ''5153 Personal Computer Color Display'' for use with the CGA, but this was not available at release<ref name="williams198201">{{cite news|author=Williams, Gregg|date=January 1982|title=A Closer Look at the IBM Personal Computer|page=36|work=BYTE|url=https://archive.org/stream/byte-magazine-1982-01/1982_01_BYTE_07-01_The_IBM_Personal_Computer#page/n37/mode/2up|access-date=19 October 2013}}</ref> and would not be released until March 1983.<ref>International Business Machines Corporation (February 4, 1983). [http://www-01.ibm.com/common/ssi/ShowDoc.wss?docURL=/common/ssi/rep_ca/2/897/ENUS183-002/index.html&lang=en&request_locale=en Announcement Letter Number 183-002 - IBM COLOR DISPLAY, 5153].</ref>


Although IBM's own color display was not available, customers could either use the composite output (with an RF modulator if needed), or the direct-drive output with available third-party monitors that supported the RGBI format and scan rate. Some third-party displays lacked the intensity input, reducing the number of available colors to eight,<ref name="williams198201" /> and many also lacked IBM's unique circuitry which rendered the dark-yellow color as brown, so any software which used brown would be displayed incorrectly.
Although IBM's own color display was not available, customers could either use the composite output (with an RF modulator if needed), or the direct-drive output with available third-party monitors that supported the RGBI format and scan rate. Some third-party displays lacked the intensity input, reducing the number of available colors to eight,<ref name="williams198201" /> and many also lacked IBM's unique circuitry which rendered the dark-yellow color as brown, so any software that used brown would be displayed incorrectly.


==Output capabilities==
==Output capabilities==
Line 39: Line 38:


Graphics modes:
Graphics modes:
 
* {{resx|160|100}} in 16 colors, chosen from a 16-color palette, utilizing a specific configuration of the {{resx|80|25}} text mode.
* 160&nbsp;×&nbsp;100 in 16 colors, chosen from a 16-color palette, utilizing a specific configuration of the 80&nbsp;×&nbsp;25 text mode.
** This used 4 bits per pixel, with a total memory use of (160&nbsp;× 100&nbsp;× 4)&nbsp;/ 8&nbsp;= 8 kilobytes.
** This used 4 bits per pixel, with a total memory use of (160 * 100 * 4) / 8 = 8 kilobytes.
* {{resx|320|200}} in 4 colors, chosen from 3 fixed palettes, with high- and low-intensity variants, with color 1 chosen from a 16-color palette.
* 320&nbsp;×&nbsp;200 in 4 colors, chosen from 3 fixed palettes, with high- and low-intensity variants, with color 1 chosen from a 16-color palette.
** This used 2 bits per pixel, with a total memory use of (320&nbsp;× 200&nbsp;× 2)&nbsp;/ 8&nbsp;= 16 kilobytes.
** This used 2 bits per pixel, with a total memory use of (320 * 200 * 2) / 8 = 16 kilobytes.
* {{resx|640|200}} in 2 colors, one black, one chosen from a 16-color palette.
* 640&nbsp;×&nbsp;200 in 2 colors, one black, one chosen from a 16-color palette.
** This used 1 bit per pixel, with a total memory use of (640&nbsp;× 200)&nbsp;/ 8&nbsp;= 16 kilobytes.
** This used 1 bit per pixel, with a total memory use of (640 * 200) / 8 = 16 kilobytes.
Some software achieved greater color depth by utilizing [[artifact color]] when connected to a composite monitor.
Some software achieved greater color depth by utilizing [[artifact color]] when connected to a composite monitor.


Text modes:
Text modes:
* {{resx|40|25}} with {{resx|8|8}} pixel font (effective resolution of {{resx|320|200}})
* {{resx|80|25}} with {{resx|8|8}} pixel font (effective resolution of {{resx|640|200}})


* 40&nbsp;×&nbsp;25 with 8&nbsp;×&nbsp;8 pixel font (effective resolution of 320&nbsp;×&nbsp;200)
IBM intended that CGA be compatible with a home television set. The {{resx|40|25}} text and {{resx|320|200}} graphics modes are usable with a television, and the {{resx|80|25}} text and {{resx|640|200}} graphics modes are intended for a monitor.<ref name="bradley199009">{{cite news | url=https://archive.org/stream/byte-magazine-1990-09/1990_09_BYTE_15-09_15th_Anniversary_Summit#page/n451/mode/2up | title=The Creation of the IBM PC | work=BYTE | date=September 1990 | access-date=2 April 2016 | author=Bradley, David J. | pages=414–420}}</ref>
* 80&nbsp;×&nbsp;25 with 8&nbsp;×&nbsp;8 pixel font (effective resolution of 640&nbsp;×&nbsp;200)
 
IBM intended that CGA be compatible with a home television set. The 40&nbsp;×&nbsp;25 text and 320&nbsp;×&nbsp;200 graphics modes are usable with a television, and the 80&nbsp;×&nbsp;25 text and 640&nbsp;×&nbsp;200 graphics modes are intended for a monitor.<ref name="bradley199009">{{cite news | url=https://archive.org/stream/byte-magazine-1990-09/1990_09_BYTE_15-09_15th_Anniversary_Summit#page/n451/mode/2up | title=The Creation of the IBM PC | work=BYTE | date=September 1990 | access-date=2 April 2016 | author=Bradley, David J. | pages=414–420}}</ref>


<gallery mode="packed" caption="CGA graphics modes comparison">
<gallery mode="packed" caption="CGA graphics modes comparison">
Line 63: Line 60:
File:Cga p3 low.png|320&nbsp;×&nbsp;200 in 4 colors palette 3 low intensity
File:Cga p3 low.png|320&nbsp;×&nbsp;200 in 4 colors palette 3 low intensity
File:Cga 640x200.png|640&nbsp;×&nbsp;200 in 2 colors
File:Cga 640x200.png|640&nbsp;×&nbsp;200 in 2 colors
File:Cga 150x100.png|160&nbsp;×&nbsp;100 in 16 colors
File:Cga 160x100.png|160&nbsp;×&nbsp;100 in 16 colors
File:Cga composite 640.png|Composite artifact colors (from 640&nbsp;×&nbsp;200 monochrome)
File:Cga composite 640.png|Composite artifact colors (from 640&nbsp;×&nbsp;200 monochrome)
File:Cga composite 320p1.png|Composite artifact colors (from 320&nbsp;×&nbsp;200 palette 1)
File:Cga composite 320p1.png|Composite artifact colors (from 320&nbsp;×&nbsp;200 palette 1)
Line 192: Line 189:
Within the monitor, the four signals are interpreted to drive the red, green and blue color guns. With respect to the RGBI color model described above, the monitor would translate the digital four-bit color number to some seven distinctive analog voltages in the range from 0.0 to 1.0 for each gun.<ref name="viler">{{cite web|url=https://int10h.org/blog/2022/06/ibm-5153-color-true-cga-palette/|title=The IBM 5153's True CGA Palette and Color Output|publisher=VileR|date=2022-06-11|access-date=2024-05-18}}</ref>
Within the monitor, the four signals are interpreted to drive the red, green and blue color guns. With respect to the RGBI color model described above, the monitor would translate the digital four-bit color number to some seven distinctive analog voltages in the range from 0.0 to 1.0 for each gun.<ref name="viler">{{cite web|url=https://int10h.org/blog/2022/06/ibm-5153-color-true-cga-palette/|title=The IBM 5153's True CGA Palette and Color Output|publisher=VileR|date=2022-06-11|access-date=2024-05-18}}</ref>


{| class="wikitable" style="float:right;"
{| class="wikitable" style="float:right; margin-left:1em"
! style="color:black; background:#aa0;" colspan="2"|dark yellow
!style="color:black; background:#aa0;" colspan="2"| dark yellow
|- style="color:black; background:#aa0;"
|- style="color:black; background:#aa0;"
|| 6
|| 6
|| #AAAA00
|| #AAAA00
|}
|}


Color 6 is treated specially; normally, 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, starting with the IBM 5153 color display,<ref>International Business Machines Corporation (1983): IBM Personal Computer XT Technical Reference Manual, pages D-42 to D-43.</ref> makes an exception for color 6 and changes its hue from dark yellow to brown by reducing the analogue green signal's amplitude. The exact amount of reduction differed between monitor models: the original IBM 5153 Personal Computer Color Display reduces the green signal's amplitude by about one third,<ref>{{cite web|url=https://forum.vcfed.org/index.php?threads/representing-ibm-5153-color-output-more-accurately.1234458/ |title=Representing IBM 5153 color output more accurately &#124; Vintage Computer Federation Forums |publisher=Forum.vcfed.org |date= December 2021|accessdate=2022-03-21}}</ref> while the IBM 5154 Enhanced Color Display internally converts all 4-bit RGBI color numbers to 6-bit ECD color numbers,<ref name=":5">{{Cite book|url=http://minuszerodegrees.net/oa/OA%20-%20IBM%20Enhanced%20Color%20Display%20(5154).pdf|title=IBM Personal Computer Hardware Reference Library: IBM Enhanced Color Display |page=4}}</ref> which amounts to halving the green signal's amplitude. The Tandy CM-2,<ref>{{Cite book|url=https://archive.org/details/tandy-service-manual-cm-2-color-monitor-26-3212|title=Tandy CM-2 Color Monitor Service Manual|page=48}}</ref> CM-4<ref>{{Cite book|title=Tandy CM-4 Color Monitor Service Manual|page=41}}</ref> and CM-11<ref>{{Cite book|url=https://archive.org/details/Sams_Computerfacts_Radio_Shack_Model_CM11_Monitor_1988_Howard_Sams|title=Sams&Company ComputerFacts Technical Service Data: Magnavox® Model 7BM613074G - Radio Shack® Model CM11 Monitor|year=1988 |page=11}}</ref> monitors provide a potentiometer labelled "BROWN ADJ." to adjust the amount of green signal reduction.
Color 6 is treated specially; normally, color 6 would become ''dark yellow'', as seen to the right, but in order to achieve a more pleasing brown tone, special circuitry in most RGBI monitors, starting with the IBM 5153 color display,<ref>International Business Machines Corporation (1983): IBM Personal Computer XT Technical Reference Manual, pages D-42 to D-43.</ref> makes an exception for color 6 and changes its hue from dark yellow to brown by reducing the analogue green signal's amplitude. The exact amount of reduction differed between monitor models: the original IBM 5153 Personal Computer Color Display reduces the green signal's amplitude by about one third,<ref>{{cite web|url=https://forum.vcfed.org/index.php?threads/representing-ibm-5153-color-output-more-accurately.1234458/ |title=Representing IBM 5153 color output more accurately &#124; Vintage Computer Federation Forums |publisher=Forum.vcfed.org |date= December 2021|accessdate=2022-03-21}}</ref> while the IBM 5154 Enhanced Color Display internally converts all 4-bit RGBI color numbers to 6-bit ECD color numbers,<ref name=":5">{{Cite book|url=http://minuszerodegrees.net/oa/OA%20-%20IBM%20Enhanced%20Color%20Display%20(5154).pdf|title=IBM Personal Computer Hardware Reference Library: IBM Enhanced Color Display |page=4}}</ref> which amounts to halving the green signal's amplitude. The Tandy CM-2,<ref>{{Cite book|url=https://archive.org/details/tandy-service-manual-cm-2-color-monitor-26-3212|title=Tandy CM-2 Color Monitor Service Manual|page=48}}</ref> CM-4<ref>{{Cite book|title=Tandy CM-4 Color Monitor Service Manual|page=41}}</ref> and CM-11<ref>{{Cite book|url=https://archive.org/details/Sams_Computerfacts_Radio_Shack_Model_CM11_Monitor_1988_Howard_Sams|title=Sams&Company ComputerFacts Technical Service Data: Magnavox® Model 7BM613074G - Radio Shack® Model CM11 Monitor|year=1988 |page=11}}</ref> monitors provide a potentiometer labelled "BROWN ADJ." to adjust the amount of green signal reduction.


This "RGBI with tweaked brown" palette was retained as the default palette of later PC graphics standards such as [[Enhanced Graphics Adapter|EGA]] and [[VGA]], which can select colors from much larger gamuts, but default to these until reprogrammed.
This "RGBI with tweaked brown" palette was retained as the default palette of later PC graphics standards such as [[Enhanced Graphics Adapter|EGA]] and [[VGA]], which can select colors from much larger gamuts, but default to these until reprogrammed.
Line 213: Line 210:


{| class="wikitable"
{| class="wikitable"
! colspan="4" | Full CGA 16-color palette
|+ Full CGA 16-color palette
|- style="color:white;"  
|- style="color:white;"  
| style="background:#000;" | 0
| style="background:#000;" | 0
Line 225: Line 222:
| style="background:#55f;" | light blue<br />#5555FF
| style="background:#55f;" | light blue<br />#5555FF
|-
|-
| style="color:white; background:#0a0;" | 2
| style="color:black; background:#0a0;" | 2
| style="color:white; background:#0a0;" | green<br />#00AA00
| style="color:black; background:#0a0;" | green<br />#00AA00
| style="color:black; background:#5f5;" | 10
| style="color:black; background:#5f5;" | 10
| style="color:black; background:#5f5;" | light green<br />#55FF55
| style="color:black; background:#5f5;" | light green<br />#55FF55
|-
|-
| style="color:white; background:#0aa;" | 3
| style="color:black; background:#0aa;" | 3
| style="color:white; background:#0aa;" | cyan<br />#00AAAA
| style="color:black; background:#0aa;" | cyan<br />#00AAAA
| style="color:black; background:#5ff;" | 11
| style="color:black; background:#5ff;" | 11
| style="color:black; background:#5ff;" | light cyan<br />#55FFFF
| style="color:black; background:#5ff;" | light cyan<br />#55FFFF
Line 254: Line 251:
| style="background:#fff;" | 15
| style="background:#fff;" | 15
| style="background:#fff;" | white<br />#FFFFFF
| style="background:#fff;" | white<br />#FFFFFF
|-
| colspan="4" |<small>''Note: Color [[Web colors|hex values]] shown are 8-bit RGB''</small>
|-
| colspan="4" |<small>''equivalents, internally CGA is 4-bit RGBI''</small>
|}
|}
<small>''Note: Color [[Web colors|hex values]] shown are 8-bit RGB equivalents, internally CGA is 4-bit RGBI''</small>


===With a composite color monitor/television set===
===With a composite color monitor/television set===
Line 269: Line 263:
==Standard text modes==
==Standard text modes==
{{Unsourced section|date=May 2023}}
{{Unsourced section|date=May 2023}}
CGA offers four BIOS [[text mode]]s ('''Modes 0''' to '''3''', called alphanumeric or A/N modes in IBM's documentation). In these modes, individual pixels on the screen cannot be addressed directly. Instead, the screen is divided into a grid of character cells, each displaying a character defined in one of two bitmap fonts, "normal" and "thin," included in the card's ROM. The fonts are fixed and cannot be modified or selected from software, only by a jumper on the board itself.
CGA offers four BIOS [[text mode]]s ('''Modes 0''' to '''3''', called alphanumeric or A/N modes in IBM's documentation). In these modes, individual pixels on the screen cannot be addressed directly. Instead, the screen is divided into a grid of character cells, each displaying a character defined in one of two bitmap fonts, "normal" and "thin", included in the card's ROM. The fonts are fixed and cannot be modified or selected from software, only by a jumper on the board itself.


Fonts are stored as bitmaps at a color depth of 1-bit, with a "1" representing the character and a "0" representing the background. These colors can be chosen independently, for each character on the screen, from the full 16-color CGA palette. The character set is defined by [[hardware code page]] [[code page 437|437]].
Fonts are stored as bitmaps at a color depth of 1-bit, with a "1" representing the character and a "0" representing the background. These colors can be chosen independently, for each character on the screen, from the full 16-color CGA palette. The character set is defined by [[hardware code page]] [[code page 437|437]].
Line 275: Line 269:
The font bitmap data is only available to the card itself, it cannot be read by the CPU. In graphics modes, text output by the BIOS operates by copying text from the font ROM bit-by-bit to video memory.
The font bitmap data is only available to the card itself, it cannot be read by the CPU. In graphics modes, text output by the BIOS operates by copying text from the font ROM bit-by-bit to video memory.


===40 × 25 mode===
===40&nbsp;× 25 mode===
BIOS '''Modes 0''' and '''1''' are both 40 columns by 25 rows text modes, with each character a pattern of 8×8 dots. The effective screen resolution in this mode is 320 × 200 pixels (a pixel [[aspect ratio]] of 1:1.2.) The card has sufficient video RAM for eight different text pages in this mode.
BIOS '''Modes 0''' and '''1''' are both 40 columns by 25 rows text modes, with each character a pattern of {{resx|8×8}} dots. The effective screen resolution in this mode is {{resx|320 × 200}} pixels (a pixel [[aspect ratio]] of 1:1.2.) The card has sufficient video RAM for eight different text pages in this mode.


The difference between these two modes can only be seen on a composite monitor, where mode 0 disables the color burst, making all text appear in grayscale. Mode 1 enables the color burst, allowing for color. Mode 0 and Mode 1 are functionally identical on RGB monitors and on later adapters that emulate CGA without supporting composite color output.
The difference between these two modes can only be seen on a composite monitor, where mode 0 disables the color burst, making all text appear in grayscale. Mode 1 enables the color burst, allowing for color. Mode 0 and Mode 1 are functionally identical on RGB monitors and on later adapters that emulate CGA without supporting composite color output.


=== 80 × 25 mode ===
=== 80&nbsp;× 25 mode ===
BIOS '''Modes 2''' and '''3''' select 80 columns by 25 rows text modes, with each character still an 8×8 dot pattern, but displayed at a higher scan rate. The effective screen resolution of this mode is 640 × 200 pixels. In this mode, the card has enough video RAM for four different text pages.
BIOS '''Modes 2''' and '''3''' select 80 columns by 25 rows text modes, with each character still an {{resx|8×8}} dot pattern, but displayed at a higher scan rate. The effective screen resolution of this mode is {{resx|640 × 200}} pixels. In this mode, the card has enough video RAM for four different text pages.


As with the 40-column text modes, Mode 2 disables the color burst in the composite signal and Mode 3 enables it.
As with the 40-column text modes, Mode 2 disables the color burst in the composite signal and Mode 3 enables it.
Line 295: Line 289:


==Standard graphics modes==
==Standard graphics modes==
CGA offers graphics modes at three resolutions: 160 × 100, 320 × 200 and 640 × 200. In all modes every pixel on the screen can be set directly, but the color depth for the higher modes does not permit selecting freely from the full 16-color palette.
CGA offers graphics modes at three resolutions: {{resx|160 × 100}}, {{resx|320 × 200}} and {{resx|640 × 200}}. In all modes every pixel on the screen can be set directly, but the color depth for the higher modes does not permit selecting freely from the full 16-color palette.


=== 320 × 200 ===
=== 320&nbsp;× 200 ===
In the medium-resolution 320 × 200 modes ('''Modes 4''' and '''5'''), each pixel is two bits, which select colors from a four-color palette. In mode 4, there are two palettes, and in mode 5 there is a single palette.<!-- PLEASE NOTE: This table setup has been carefully designed to allow for the images/tables to be displayed correctly at a variety of resolutions, including 800×600. Please don't change it without ensuring that your changes also work for users with lower/different resolutions. Not all users accessing Wikipedia are doing so from 1024×768 (or bigger) displays. -->
In the medium-resolution {{resx|320 × 200}} modes ('''Modes 4''' and '''5'''), each pixel is two bits, which select colors from a four-color palette. In mode 4, there are two palettes, and in mode 5 there is a single palette.<!-- PLEASE NOTE: This table setup has been carefully designed to allow for the images/tables to be displayed correctly at a variety of resolutions, including 800×600. Please don't change it without ensuring that your changes also work for users with lower/different resolutions. Not all users accessing Wikipedia are doing so from 1024×768 (or bigger) displays. -->
{| class="wikitable" style="margin:0 auto"
{| class="wikitable" style="margin:0 auto"
|+CGA hardware palettes on a RGBI monitor
|+CGA hardware palettes on a RGBI monitor
Line 316: Line 310:
|-
|-
|1
|1
| style="color:white; background:#0a0;"| 2 – green
| style="color:black; background:#0a0;"| 2 – green
| style="color:black; background:#5f5;"| 10 – light green
| style="color:black; background:#5f5;"| 10 – light green
| style="color:white; background:#0aa;"| 3 – cyan
| style="color:black; background:#0aa;"| 3 – cyan
| style="color:black; background:#5ff;"| 11 – light cyan
| style="color:black; background:#5ff;"| 11 – light cyan
| style="color:white; background:#0aa;"| 3 – cyan
| style="color:black; background:#0aa;"| 3 – cyan
| style="color:black; background:#5ff;"| 11 – light cyan
| style="color:black; background:#5ff;"| 11 – light cyan
|-
|-
Line 345: Line 339:
As with the text modes 0 and 2, '''Mode 5''' disables the color burst to allow colors to appear in grayscale on composite monitor. However, unlike the text modes, this also affects the colors displayed on an RGBI monitor, altering them to the cyan/red/white palette seen above. This palette is not documented by IBM, but was used in some software.
As with the text modes 0 and 2, '''Mode 5''' disables the color burst to allow colors to appear in grayscale on composite monitor. However, unlike the text modes, this also affects the colors displayed on an RGBI monitor, altering them to the cyan/red/white palette seen above. This palette is not documented by IBM, but was used in some software.


===640 × 200===
===640&nbsp;× 200===
In the high-resolution 640 × 200 mode ('''Mode 6'''), each pixel is one bit, providing two colors which can be chosen from the 16-color palette by programming hardware registers.
In the high-resolution {{resx|640 × 200}} mode ('''Mode 6'''), each pixel is one bit, providing two colors which can be chosen from the 16-color palette by programming hardware registers.


In this mode, the video picture is stored as a simple bitmap, with one bit per pixel setting the color to "foreground" or "background". By default the colors are black and bright white, but the foreground color can be changed to any entry in the 16-color CGA palette. The background color cannot be changed from black on an original IBM CGA card.  
In this mode, the video picture is stored as a simple bitmap, with one bit per pixel setting the color to "foreground" or "background". By default the colors are black and bright white, but the foreground color can be changed to any entry in the 16-color CGA palette. The background color cannot be changed from black on an original IBM CGA card.  


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.
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&nbsp;× 200 mode, and the user must write directly to the mode control register to enable it.


==Further graphics modes and tweaks==
==Further graphics modes and tweaks==
Line 356: Line 350:
A number of official and unofficial features exist that can be exploited to achieve special effects.
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 {{resx|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 text mode, the border color (displayed outside the regular display area and including the [[overscan]] area) can be changed from the default black to any of the other 15&nbsp;colors.
* In text mode, the border color (displayed outside the regular display area and including the [[overscan]] area) can be changed from the default black to any of the other 15&nbsp;colors.
* Through precision timing, it is possible to switch to another palette while the video is being output, allowing the use of any one of the six palettes per scanline. An example of this is ''[[California Games]]'',<ref>{{cite web|url=https://www.mobygames.com/game/shots/p,2/gameId,1823/gameShotId,7722/|title=California Games Screenshots for DOS|website=MobyGames|url-status=dead|archiveurl=https://web.archive.org/web/20220811015804/https://www.mobygames.com/game/shots/p,2/gameId,1823/gameShotId,7722/|archivedate=2022-08-11}}</ref> when run on a stock 4.77&nbsp;MHz 8088.  Running 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, as is used to create the river and road in ''[[Frogger]]''.<ref>{{cite web|url=https://www.mobygames.com/game/pc-booter/frogger/screenshots/gameShotId,132859/|title=Frogger (1983) screenshots|website=MobyGames}}</ref> Another documented example of the technique is in [[Atarisoft]]'s port of ''[[Jungle Hunt]]'' to the PC.
* Through precision timing, it is possible to switch to another palette while the video is being output, allowing the use of any one of the six palettes per scanline. An example of this is ''[[California Games]]'',<ref>{{cite web|url=https://www.mobygames.com/game/shots/p,2/gameId,1823/gameShotId,7722/|title=California Games Screenshots for DOS|website=MobyGames|url-status=dead|archiveurl=https://web.archive.org/web/20220811015804/https://www.mobygames.com/game/shots/p,2/gameId,1823/gameShotId,7722/|archivedate=2022-08-11}}</ref> when run on a stock 4.77&nbsp;MHz 8088.  Running 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, as is used to create the river and road in ''[[Frogger]]''.<ref>{{cite web|url=https://www.mobygames.com/game/pc-booter/frogger/screenshots/gameShotId,132859/|title=Frogger (1983) screenshots|website=MobyGames}}</ref> Another documented example of the technique is in [[Atarisoft]]'s port of ''[[Jungle Hunt]]'' to the PC.
Line 364: Line 358:
Some of these above tweaks can be combined. Examples can be found in several games.<ref>{{cite web|url=https://www.mobygames.com/attribute/sheet/p,2/attributeId,5/|title=Video Modes Supported : CGA (Tweaked)|website=MobyGames}}</ref>
Some of these above tweaks can be combined. Examples can be found in several games.<ref>{{cite web|url=https://www.mobygames.com/attribute/sheet/p,2/attributeId,5/|title=Video Modes Supported : CGA (Tweaked)|website=MobyGames}}</ref>


===160 × 100 16 color mode===
===160&nbsp;× 100 16 color mode===
[[File:Single pixel in CGA 160x100 mode.svg|thumb|A single big "pixel" in 160 × 100 mode. This is the two top rows of half of character 221. Note the eight constituent non-square pixels and the overall 1:1.2 aspect ratio.]][[File:Paku Paku.png|thumb|Title screen of PakuPaku, a [[Pac-Man]] clone that uses 160 × 100 mode]]
[[File:Single pixel in CGA 160x100 mode.svg|thumb|A single big "pixel" in {{resx|160 × 100}} mode. This is the two top rows of half of character 221. Note the eight constituent non-square pixels and the 1:1.2 pixel aspect ratio.]][[File:Paku Paku.png|thumb|Title screen of PakuPaku, a [[Pac-Man]] clone that uses {{resx|160 × 100}} mode]]
Technically, this mode is not a graphics mode, but a tweak of the 80 × 25 text mode.<ref>{{Cite book |url=http://minuszerodegrees.net/oa/OA%20-%20IBM%20Color%20Graphics%20Monitor%20Adapter%20(CGA).pdf |title=IBM Color/Graphics Monitor Adapter |via=IBM Personal Computer Hardware Reference Library |publisher=IBM |series=6361509 |pages=9, 20}}</ref> 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.
Technically, this mode is not a graphics mode, but a tweak of the {{resx|80 × 25}} text mode.<ref>{{Cite book |url=http://minuszerodegrees.net/oa/OA%20-%20IBM%20Color%20Graphics%20Monitor%20Adapter%20(CGA).pdf |title=IBM Color/Graphics Monitor Adapter |via=IBM Personal Computer Hardware Reference Library |publisher=IBM |series=6361509 |pages=9, 20}}</ref> 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.


{| class="wikitable" style="font-size: small"
{| class="wikitable" style="font-size: small"
Line 374: Line 368:
|-
|-
|[[File:Half-block.character.blue.red.svg|13px]]
|[[File:Half-block.character.blue.red.svg|13px]]
|style="color: #00a; background: #f55;"|221 with blue text and red background color
|style="color: #00009C; background: #f55;"|221 with blue text and red background color
|-
|-
|[[File:Half-block.character.red.blue.svg|13px]]
|[[File:Half-block.character.red.blue.svg|13px]]
| style="color:#f55; background:#00a;"|221 with red text and blue background color.
| style="color:#FF6161; background:#00009C;"|221 with red text and blue background color.
|-
|-
|[[File:ASCII.222.character.svg|13px]]
|[[File:ASCII.222.character.svg|13px]]
Line 387: Line 381:
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.
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&nbsp;colors, with an aspect ratio of 1:1.2, are possible.
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, {{resx|160 × 100}} pixels at 16&nbsp;colors, with a pixel aspect ratio of 1:1.2, are possible.


Although a roundabout way of achieving a 16-color graphics display, this works quite well and the mode is even mentioned (although not explained) in IBM's official hardware documentation.<ref>{{cite web|url=https://archive.org/stream/bitsavers_ibmpccardsptionsandAdaptersVolume2Apr84_25079400/Technical_Reference_Options_and_Adapters_Volume_2_Apr84#page/n49/mode/2up/search/%22low-resolution+color+graphics+mode%22|title=ibm :: pc :: cards :: Technical Reference Options and Adapters Volume 2 Apr84|page=50|website=[[The Internet Archive]]|date=April 1984|access-date=2020-01-09}}</ref> This mode was used as early as 1983 on the game ''Moon Bugs''.<ref>{{Cite web |title=Moon Bugs (1983) screenshots |url=https://www.mobygames.com/game/pc-booter/moon-bugs/screenshots |access-date=2023-01-06 |website=MobyGames}}</ref><ref>{{Citation |last=Windmill Software |title=Moon Bugs |date=1983 |url=http://archive.org/details/msdos_Moon_Bugs_1983 |access-date=2023-01-06}}</ref><ref name=":1">{{Cite web |title=CGA in 1024 Colors - a New Mode: the Illustrated Guide |url=https://int10h.org/blog/2015/04/cga-in-1024-colors-new-mode-illustrated/ |access-date=2023-01-06 |website=int10h.org}}</ref>
Although a roundabout way of achieving a 16-color graphics display, this works quite well and the mode is even mentioned (although not explained) in IBM's official hardware documentation.<ref>{{cite web|url=https://archive.org/stream/bitsavers_ibmpccardsptionsandAdaptersVolume2Apr84_25079400/Technical_Reference_Options_and_Adapters_Volume_2_Apr84#page/n49/mode/2up/search/%22low-resolution+color+graphics+mode%22|title=ibm :: pc :: cards :: Technical Reference Options and Adapters Volume 2 Apr84|page=50|website=[[The Internet Archive]]|date=April 1984|access-date=2020-01-09}}</ref> This mode was used as early as 1983 on the game ''Moon Bugs''.<ref>{{Cite web |title=Moon Bugs (1983) screenshots |url=https://www.mobygames.com/game/pc-booter/moon-bugs/screenshots |access-date=2023-01-06 |website=MobyGames}}</ref><ref>{{Citation |last=Windmill Software |title=Moon Bugs |date=1983 |url=http://archive.org/details/msdos_Moon_Bugs_1983 |access-date=2023-01-06}}</ref><ref name=":1">{{Cite web |title=CGA in 1024 Colors - a New Mode: the Illustrated Guide |url=https://int10h.org/blog/2015/04/cga-in-1024-colors-new-mode-illustrated/ |access-date=2023-01-06 |website=int10h.org}}</ref>
Line 393: Line 387:
More detail can be achieved in this mode by using other characters, combining [[ASCII art]] with the aforesaid technique. This was explored by ''Macrocom, Inc'' on two games: ''Icon: Quest for the Ring'' (released in 1984) and ''[[The Seven Spirits of Ra]]'' (released in 1987).<ref name=":1" /><ref>{{Cite web |title=Icon: Quest for the Ring for DOS (1984) |url=https://www.mobygames.com/game/icon-quest-for-the-ring |access-date=2023-01-06 |website=MobyGames}}</ref><ref>{{Cite web |title=The Seven Spirits of Ra for DOS (1987) |url=https://www.mobygames.com/game/seven-spirits-of-ra |access-date=2023-01-06 |website=MobyGames}}</ref>
More detail can be achieved in this mode by using other characters, combining [[ASCII art]] with the aforesaid technique. This was explored by ''Macrocom, Inc'' on two games: ''Icon: Quest for the Ring'' (released in 1984) and ''[[The Seven Spirits of Ra]]'' (released in 1987).<ref name=":1" /><ref>{{Cite web |title=Icon: Quest for the Ring for DOS (1984) |url=https://www.mobygames.com/game/icon-quest-for-the-ring |access-date=2023-01-06 |website=MobyGames}}</ref><ref>{{Cite web |title=The Seven Spirits of Ra for DOS (1987) |url=https://www.mobygames.com/game/seven-spirits-of-ra |access-date=2023-01-06 |website=MobyGames}}</ref>


The same text cell height reduction technique can also be used with the 40 × 25 text mode, yielding a resolution of 80 × 100.
The same text cell height reduction technique can also be used with the {{resx|40 × 25}} text mode, yielding a resolution of {{resx|80 × 100}} and a pixel aspect ratio of ~1.67:1.


==Composite output==
==Composite output==
Line 401: Line 395:
[[File:CGA CompVsRGB Text.png|center|590px |thumb|80-column text on RGB (left) vs. composite monitor (right)]]
[[File:CGA CompVsRGB Text.png|center|590px |thumb|80-column text on RGB (left) vs. composite monitor (right)]]


For this reason, each of the text and graphics modes has a duplicate mode which disables the composite [[colorburst]], resulting in a black-and-white picture, but also eliminating color bleeding to produce a sharper picture. On RGBI monitors, the two versions of each mode are usually identical, with the exception of the 320 × 200 graphics mode, where the "monochrome" version produces a third palette.
For this reason, each of the text and graphics modes has a duplicate mode which disables the composite [[colorburst]], resulting in a black-and-white picture, but also eliminating color bleeding to produce a sharper picture. On RGBI monitors, the two versions of each mode are usually identical, with the exception of the {{resx|320 × 200}} graphics mode, where the "monochrome" version produces a third palette.


===Extended artifact colors===
===Extended artifact colors===
Programmers discovered that this flaw could be turned into an asset, as distinct patterns of high-resolution dots would turn into consistent areas of solid colors, thus allowing the display of completely new [[artifact colors]]. Both the standard 320 × 200 four-color and the 640 × 200 color-on-black graphics modes could be used with this technique.
Programmers discovered that this flaw could be turned into an asset, as distinct patterns of high-resolution dots would turn into consistent areas of solid colors, thus allowing the display of completely new [[artifact colors]]. Both the standard {{resx|320 × 200}} four-color and the {{resx|640 × 200}} color-on-black graphics modes could be used with this technique.


====Internal operation====
====Internal operation====
''Direct colors'' are the normal 16 colors as described above under "The CGA color palette".
''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. By carefully placing pixels in appropriate patterns, a programmer can produce specific cross-color artifacts yielding a desired new 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 on the following pictures:
''Artifact colors'' are seen because the composite monitor's NTSC chroma decoder misinterprets some of the luminance information as color. By carefully placing pixels in appropriate patterns, a programmer can produce specific cross-color artifacts yielding a desired new color; either from purely black-and-white pixels in {{resx|640 × 200}} mode, or resulting from a ''combination'' of ''direct'' and ''artifact'' colors in {{resx|320 × 200}} mode, as seen on the following pictures:
<gallery mode="packed" caption="CGA composite artifact color generation: pixels as displayed on a RGBI (left) or composite (right) monitor.">
<gallery mode="packed" caption="CGA composite artifact color generation: pixels as displayed on a RGBI (left) or composite (right) monitor.">
File:CGA CompVsRGB 640.png|<small>640 × 200</small>
File:CGA CompVsRGB 640.png|<small>640 × 200</small>
Line 416: Line 410:
</gallery>
</gallery>


Thus, with the choice between 320 × 200 vs. 640 × 200 mode, the choice between the two palettes, and one freely-selectable color (the background in 320 × 200 modes and the foreground in 640 × 200 mode), it is possible to use many different sets of artifact colors, making for a total [[gamut]] of over 100&nbsp;colors.[[File:CGA-1024-color-mode.png|alt=1024 colors in composite mode|thumb|1024 colors in composite mode|148x148px]]
Thus, with the choice between 320 × 200 vs. 640 × 200 mode, the choice between the two palettes, and one freely-selectable color (the background in {{resx|320 × 200}} modes and the foreground in 640 × 200 mode), it is possible to use many different sets of artifact colors, making for a total [[gamut]] of over 100&nbsp;colors.[[File:CGA-1024-color-mode.png|alt=1024 colors in composite mode|thumb|1024 colors in composite mode|148x148px]]
Later [[Demoscene|demonstrations]] by enthusiasts have increased the maximum number of colors the CGA can display at the same time to 1024.<ref name=":2">{{cite web |last=VileR |date=2015-04-15 |title=8088 MPH: CGA in 1024 Colors - a New Mode: the Illustrated Guide |url=https://int10h.org/blog/2015/04/cga-in-1024-colors-new-mode-illustrated/ |access-date=2022-10-15 |website=int10h.org}}</ref><ref name=":3">{{cite web |date=2015-04-08 |title=1K colours on CGA: How it's done |url=https://www.reenigne.org/blog/1k-colours-on-cga-how-its-done/ |access-date=2018-04-27 |website=Reenigne Blog}}</ref> This technique involves a text mode tweak which quadruples the number of text rows. Certain ASCII characters such as U and ‼ are then used to produce the necessary patterns, which result in non-dithered images with an effective resolution of 80 × 100 on a composite monitor.<ref name="cga8088mph1k">{{cite news |title=CGA in 1024 Colors - a New Mode: the Illustrated Guide |url=https://int10h.org/blog/2015/04/cga-in-1024-colors-new-mode-illustrated/}} A blog entry by the creators of the demo "8088 MPH" explaining this technique.</ref>
Later [[Demoscene|demonstrations]] by enthusiasts have increased the maximum number of colors the CGA can display at the same time to 1024.<ref name="cga8088mph1k">{{cite web |last=VileR |date=2015-04-15 |title=8088 MPH: CGA in 1024 Colors - a New Mode: the Illustrated Guide |url=https://int10h.org/blog/2015/04/cga-in-1024-colors-new-mode-illustrated/ |access-date=2022-10-15 |website=int10h.org}}</ref><ref name=":3">{{cite web |date=2015-04-08 |title=1K colours on CGA: How it's done |url=https://www.reenigne.org/blog/1k-colours-on-cga-how-its-done/ |access-date=2018-04-27 |website=Reenigne Blog}}</ref> This technique involves a text mode tweak which quadruples the number of text rows. Certain ASCII characters such as U and ‼ are then used to produce the necessary patterns, which result in non-dithered images with an effective resolution of {{resx|80 × 100}} on a composite monitor.<ref name="cga8088mph1k" />


160 cycles of the NTSC color clock occur during each line's output, so in 40 column mode each pixel occupies half a cycle and in 80 column mode each pixel uses a quarter of a cycle. Limiting the character display to the upper one or two scanlines, and taking advantage of the pixel arrangement in certain characters of the [[codepage 437]], it is possible to display up to 1024 colors.<ref name=":2" /> This technique was used in the [[Demoscene|demo]] ''8088 MPH''.<ref name=":3" />
160 cycles of the NTSC color clock occur during each line's output, so in 40-column mode each pixel occupies half a cycle and in 80-column mode each pixel uses a quarter of a cycle. Limiting the character display to the upper one or two scanlines, and taking advantage of the pixel arrangement in certain characters of the [[codepage 437]], it is possible to display up to 1024 colors.<ref name="cga8088mph1k" /> This technique was used in the [[Demoscene|demo]] ''8088 MPH''.<ref name=":3" />


====Availability and caveats====
====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."
The {{resx|320 × 200}} variant of this technique (see above) is how the standard BIOS-supported graphics mode looks on a composite color monitor. The {{resx|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".


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.
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.


The modern, games-centric PC emulator [[DOSBox]] supports a CGA mode, which can emulate a composite monitor's color artifacting. Both 640 × 200 composite mode and the more complex 320 × 200 variant are supported.
The modern, games-centric PC emulator [[DOSBox]] supports a CGA mode, which can emulate a composite monitor's color artifacting. Both {{resx|640 × 200}} composite mode and the more complex {{resx|320 × 200}} variant are supported.


====Resolution and usage====
====Resolution and usage====
Composite artifacting, whether used intentionally or as an unwanted artifact, reduces the effective horizontal resolution to a maximum 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 is sometimes described as a 160 × 200 / 16-color "mode", though technically it was a technique using a standard mode.
Composite artifacting, whether used intentionally or as an unwanted artifact, reduces the effective horizontal resolution to a maximum 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 is sometimes described as a {{resx|160 × 200}}&nbsp;/ 16-color "mode", though technically it was a technique using a standard mode.


The low resolution of this composite color artifacting method led to it being used almost exclusively in games. Many high-profile titles offered graphics optimized for composite color monitors. ''[[Ultima II]]'', the first game in the game series to be ported to IBM PC, used CGA composite graphics. ''[[King's Quest I]]'' also offered 16-color graphics on the PC, PCjr and Tandy 1000, but provided a 'RGB mode' at the title screen which would utilize only the ordinary CGA graphics mode, limited to 4 colors.
The low resolution of this composite color artifacting method led to it being used almost exclusively in games. Many high-profile titles offered graphics optimized for composite color monitors. ''[[Ultima II]]'', the first game in the game series to be ported to IBM PC, used CGA composite graphics. ''[[King's Quest I]]'' also offered 16-color graphics on the PC, PCjr and Tandy 1000, but provided a 'RGB mode' at the title screen which would utilize only the ordinary CGA graphics mode, limited to 4 colors.


<gallery mode="packed" caption="Examples of CGA games on RGBI and composite monitors">
<gallery mode="packed" caption="Examples of CGA games on RGBI and composite monitors">
File:Microsoft Decathlon RGBvsComposite.png|''Microsoft Decathlon'' - <small>Top: game in composite mode; bottom: game in RGB mode; left: with RGB monitor; right: with composite monitor</small>
File:Microsoft Decathlon RGBvsComposite.png|''Microsoft Decathlon''. Top: game in composite mode; bottom: game in RGB mode; left: with RGB monitor; right: with composite monitor.
File:KQ CompVsRGB.png|''King's Quest'' - <small>Top: game in composite mode; bottom: game in RGB mode; left: with RGB monitor; right: with composite monitor</small>
File:KQ CompVsRGB.png|''King's Quest''. Top: game in composite mode; bottom: game in RGB mode; left: with RGB monitor; right: with composite monitor.
File:Ultima2 CompVsRGB.png|''Ultima II'' - <small>Left: with RGB monitor; right: with composite monitor</small>
File:Ultima2 CompVsRGB.png|''Ultima II''. Left: with RGB monitor; right: with composite monitor.
</gallery>
</gallery>


Line 456: Line 450:


==Software support==
==Software support==
CGA was widely supported in PC software up until the 1990s. Some of the software that supported the board was:
CGA was widely supported in PC software up until the early 1990s. Some of the software that supported the board was:


* [[Visi On]] (an early GUI, used the 640x200 monochrome mode)
* [[Visi On]] (an early GUI, used the 640x200 monochrome mode)
Line 466: Line 460:
''[[BYTE]]'' in January 1982 described the output from CGA as "very good—slightly better than color graphics on existing microcomputers".{{r|williams198201}} ''[[PC Magazine]]'' disagreed, reporting in June 1983 that "the IBM monochrome display is absolutely beautiful for text and wonderfully easy on the eyes, but is limited to simple character graphics. Text quality on displays connected to the color/graphics adapter ... is at best of medium quality and is conducive to eyestrain over the long haul".<ref name="fastie198306">{{Cite magazine |last=Fastie |first=Will |date=June 1983 |title=The Graphical PC |url=https://books.google.com/books?id=14Kfbrc6cbAC&pg=PA575 |magazine=PC Magazine}}</ref>
''[[BYTE]]'' in January 1982 described the output from CGA as "very good—slightly better than color graphics on existing microcomputers".{{r|williams198201}} ''[[PC Magazine]]'' disagreed, reporting in June 1983 that "the IBM monochrome display is absolutely beautiful for text and wonderfully easy on the eyes, but is limited to simple character graphics. Text quality on displays connected to the color/graphics adapter ... is at best of medium quality and is conducive to eyestrain over the long haul".<ref name="fastie198306">{{Cite magazine |last=Fastie |first=Will |date=June 1983 |title=The Graphical PC |url=https://books.google.com/books?id=14Kfbrc6cbAC&pg=PA575 |magazine=PC Magazine}}</ref>


In a retrospective commentary, ''[[Next Generation (magazine)|Next Generation]]'' also took a negative view on the CGA, stating, "Even for the time (early 1980s), these graphics were terrible, paling in comparison to other color machines available on the market."<ref>{{cite magazine|title=The Next Generation 1996 Lexicon A to Z|magazine=[[Next Generation (magazine)|Next Generation]]|issue=15 |publisher=[[Imagine Media]]|date=March 1996|page=31}}</ref>
In a retrospective commentary, ''[[Next Generation (magazine)|Next Generation]]'' also took a negative view on the CGA, stating: "Even for the time (early 1980s), these graphics were terrible, paling in comparison to other color machines available on the market."<ref>{{cite magazine|title=The Next Generation 1996 Lexicon A to Z|magazine=[[Next Generation (magazine)|Next Generation]]|issue=15 |publisher=[[Imagine Media]]|date=March 1996|page=31}}</ref>


CGA had several competitors:
CGA had several competitors:


* For business and word processing use, IBM provided the '''[[Monochrome Display Adapter]]''' (MDA) at the same time as CGA. MDA was much more popular than CGA at first.<ref name="byte198311">{{cite news | url=https://archive.org/stream/byte-magazine-1983-11/1983_11_BYTE_08-11_Inside_the_IBM_PC#page/n89/mode/2up | title=IBM's Estridge | work=BYTE | date=November 1983 | access-date=19 March 2016 |author1=Curran, Lawrence J. |author2=Shuford, Richard S. | pages=88–97}}</ref> Since a great many PCs were sold to businesses, the sharp, high-resolution monochrome text was more desirable for running applications.
* For business and word processing use, IBM provided the '''[[Monochrome Display Adapter]]''' (MDA) at the same time as CGA. MDA was much more popular than CGA at first.<ref name="byte198311">{{cite news | url=https://archive.org/stream/byte-magazine-1983-11/1983_11_BYTE_08-11_Inside_the_IBM_PC#page/n89/mode/2up | title=IBM's Estridge | work=BYTE | date=November 1983 | access-date=19 March 2016 |author1=Curran, Lawrence J. |author2=Shuford, Richard S. | pages=88–97}}</ref> 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 Card]]''' (HGC) was introduced, the first third-party video card for the PC. In addition to an MDA-compatible text mode, it offered a monochrome graphics mode with a resolution of 720×348 pixels, higher than the CGA.
* In 1982, the non-IBM '''[[Hercules Graphics Card]]''' (HGC) was introduced, the first third-party video card for the PC. In addition to an MDA-compatible text mode, it offered a monochrome graphics mode with a resolution of {{resx|720×348}} pixels, higher than the CGA.
* Also in 1982 the '''[[Plantronics Colorplus]]''' board was introduced, with twice the memory of a standard CGA board (32k, compared to 16k). The additional memory can be used in graphics modes to double the color depth, giving two additional graphics modes—16 colors at 320 × 200 resolution, or 4 colors at 640 × 200 resolution.
* Also in 1982 the '''[[Plantronics Colorplus]]''' board was introduced, with twice the memory of a standard CGA board (32k, compared to 16k). The additional memory can be used in graphics modes to double the color depth, giving two additional graphics modes—16 colors at {{resx|320 × 200}} resolution, or 4 colors at {{resx|640 × 200}} resolution.
* The [[IBM PCjr]] (1984) and compatible [[Tandy 1000]] (1985) featured onboard "extended CGA" video hardware that extended video RAM beyond 16&nbsp;kB, allowing 16&nbsp;colors at 320 × 200 resolution and four colors at 640 × 200 resolution. Because the Tandy 1000 long outlived the PCjr, the video modes became known as '''"[[Tandy Graphics Adapter]]" or "TGA"''', and were very popular for games during the 1980s. Similar but less widely used was the [[Plantronics Colorplus]].
* The [[IBM PCjr]] (1984) and compatible [[Tandy 1000]] (1985) featured onboard "extended CGA" video hardware that extended video RAM beyond 16&nbsp;kB, allowing 16 colors at {{resx|320 × 200}} resolution and four colors at {{resx|640 × 200}} resolution. Because the Tandy 1000 long outlived the PCjr, the video modes became known as '''"[[Tandy Graphics Adapter]]" or "TGA"''', and were very popular for games during the 1980s. Similar but less widely used was the [[Plantronics Colorplus]].
* In 1984, IBM also introduced the '''[[Professional Graphics Controller]]''', a 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.
* In 1984, IBM also introduced the '''[[Professional Graphics Controller]]''', a 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.


Line 479: Line 473:


* [[Paradise Systems]] introduced in 1984 the first successful CGA-compatible card for MDA monitors. It displayed CGA's 16 colors in shades of monochrome. Because it was hardware-compatible with CGA, the Paradise card did not need special software support or additional drivers.<ref name="stark19841002">{{cite news | url=https://books.google.com/books?id=d-tPdHcBE9wC&pg=PA59 | title=Paradise Graphics Card: It's Easier Being Green | work=PC Magazine | date=1984-10-02 | access-date=25 October 2013 | author=Stark, Craig L. | page=59}}</ref>
* [[Paradise Systems]] introduced in 1984 the first successful CGA-compatible card for MDA monitors. It displayed CGA's 16 colors in shades of monochrome. Because it was hardware-compatible with CGA, the Paradise card did not need special software support or additional drivers.<ref name="stark19841002">{{cite news | url=https://books.google.com/books?id=d-tPdHcBE9wC&pg=PA59 | title=Paradise Graphics Card: It's Easier Being Green | work=PC Magazine | date=1984-10-02 | access-date=25 October 2013 | author=Stark, Craig L. | page=59}}</ref>
* Another extension in some CGA-compatible chipsets (including those in the [[Olivetti M24]] / AT&T 6300, the [[Digital Equipment Corporation|DEC]] [[VAXmate]], and some [[Compaq]] and [[Toshiba]] portables) is a doubled vertical resolution. This gives a higher quality 8 × 16 text display and an additional 640 × 400 graphics mode.
* Another extension in some CGA-compatible chipsets (including those in the [[Olivetti M24]] / AT&T 6300, the [[Digital Equipment Corporation|DEC]] [[VAXmate]], and some [[Compaq]] and [[Toshiba]] portables) is a doubled vertical resolution. This gives a higher quality {{resx|8 × 16}} text display and an additional {{resx|640 × 400}} graphics mode.


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&nbsp;colors out of 64 in both text and graphics modes.
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 ({{resx|640 × 350}}) as well as a software-selectable palette of 16 colors out of 64 in both text and graphics modes.


==Specifications==
==Specifications==
Line 498: Line 492:
|- style="color: white; background: #a00;"
|- style="color: white; background: #a00;"
|<small>3</small>|| <small>Red</small>
|<small>3</small>|| <small>Red</small>
|- style="color: white; background: #0a0;"
|- style="color: black; background: #00AF00;"
|<small>4</small>|| <small>Green</small>
|<small>4</small>|| <small>Green</small>
|- style="color: white; background: #00a;"
|- style="color: white; background: #00a;"
Line 518: Line 512:
|-
|-
!Resolution
!Resolution
|| 640h × 200v, 320h × 200v
|| 640&nbsp;× 200, 320&nbsp;× 200
|-
|-
!H-freq
!H-freq
Line 540: Line 534:
|-
|-
!Resolution
!Resolution
|| 640h × 200v, 320h × 200v
|| 640&nbsp;× 200, 320&nbsp;× 200
|-
|-
!H-freq
!H-freq
Line 564: Line 558:


==References==
==References==
{{Reflist|30em}}
{{Reflist}}
;Notes
;Notes
{{refbegin}}
{{refbegin}}

Latest revision as of 17:30, 15 December 2025

Template:Short description Script error: No such module "about". Template:Infobox GPU

The Color Graphics Adapter (CGA), originally also called the Color/Graphics Adapter or IBM Color/Graphics Monitor Adapter,[1] introduced in 1981, was IBM's first color graphics card for the IBM PC and established a de facto computer display standard.

Hardware design

The original IBM CGA graphics card was built around the Motorola 6845 display controller,Template:R came with 16 kilobytes of video memory built in, and featured several graphics and text modes. The highest display resolution of any mode was Template:Resx, and the highest color depth supported was 4-bit (16 colors).

The CGA card could be connected either to a direct-drive CRT monitor using a 4-bit digital (TTL) RGBI interface, such as the IBM 5153 color display, or to an NTSC-compatible television or composite video monitor via an RCA connector.[2] The RCA connector provided only baseband video, so to connect the CGA card to a television set without a composite video input required a separate RF modulator.[1]

IBM produced the 5153 Personal Computer Color Display for use with the CGA, but this was not available at release[3] and would not be released until March 1983.[4]

Although IBM's own color display was not available, customers could either use the composite output (with an RF modulator if needed), or the direct-drive output with available third-party monitors that supported the RGBI format and scan rate. Some third-party displays lacked the intensity input, reducing the number of available colors to eight,[3] and many also lacked IBM's unique circuitry which rendered the dark-yellow color as brown, so any software that used brown would be displayed incorrectly.

Output capabilities

CGA offered several video modes.[5][6]

Graphics modes:

  • Template:Resx in 16 colors, chosen from a 16-color palette, utilizing a specific configuration of the Template:Resx text mode.
    • This used 4 bits per pixel, with a total memory use of (160 × 100 × 4) / 8 = 8 kilobytes.
  • Template:Resx in 4 colors, chosen from 3 fixed palettes, with high- and low-intensity variants, with color 1 chosen from a 16-color palette.
    • This used 2 bits per pixel, with a total memory use of (320 × 200 × 2) / 8 = 16 kilobytes.
  • Template:Resx in 2 colors, one black, one chosen from a 16-color palette.
    • This used 1 bit per pixel, with a total memory use of (640 × 200) / 8 = 16 kilobytes.

Some software achieved greater color depth by utilizing artifact color when connected to a composite monitor.

Text modes:

IBM intended that CGA be compatible with a home television set. The Template:Resx text and Template:Resx graphics modes are usable with a television, and the Template:Resx text and Template:Resx graphics modes are intended for a monitor.[7]

Color palette

CGA uses a 4-bit RGBI 16-color gamut, but not all colors are available at all times, depending on which graphics mode is being used. In the medium- and high-resolution modes, colors are stored at a lower bit depth and selected by fixed palette indexes, not direct selection from the full 16-color palette.

When four bits are used (for low-resolution mode, or for programming color registers) they are arranged according to the RGBI color model:[8]

  • The lower three bits represent red, green, and blue color components
  • The fourth "intensifier" bit, when set, increases the brightness of all three color components (red, green, and blue).[9]
CGA palette internal bit arrangement (4-bit RGBI)[8]
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
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

These four colour bits are then interpreted internally by the monitor, or converted to NTSC colours (see below).

With an RGBI monitor

When using a direct-drive monitor, the four color bits are output directly to the DE-9 connector at the back of the card.

Within the monitor, the four signals are interpreted to drive the red, green and blue color guns. With respect to the RGBI color model described above, the monitor would translate the digital four-bit color number to some seven distinctive analog voltages in the range from 0.0 to 1.0 for each gun.[10]

dark yellow
6 #AAAA00

Color 6 is treated specially; normally, color 6 would become dark yellow, as seen to the right, but in order to achieve a more pleasing brown tone, special circuitry in most RGBI monitors, starting with the IBM 5153 color display,[11] makes an exception for color 6 and changes its hue from dark yellow to brown by reducing the analogue green signal's amplitude. The exact amount of reduction differed between monitor models: the original IBM 5153 Personal Computer Color Display reduces the green signal's amplitude by about one third,[12] while the IBM 5154 Enhanced Color Display internally converts all 4-bit RGBI color numbers to 6-bit ECD color numbers,[8] which amounts to halving the green signal's amplitude. The Tandy CM-2,[13] CM-4[14] and CM-11[15] monitors provide a potentiometer labelled "BROWN ADJ." to adjust the amount of green signal reduction.

This "RGBI with tweaked brown" palette was retained as the default palette of later PC graphics standards such as EGA and VGA, which can select colors from much larger gamuts, but default to these until reprogrammed.

Later video cards/monitors in CGA emulation modes would approximate the colors with the following formula:

red   := 2/3×(colorNumber & 4)/4 + 1/3×(colorNumber & 8)/8
green := 2/3×(colorNumber & 2)/2 + 1/3×(colorNumber & 8)/8
blue  := 2/3×(colorNumber & 1)/1 + 1/3×(colorNumber & 8)/8
if (color == 6)
   green := green * 2/3

which yields the canonical CGA palette:[10]

Full CGA 16-color palette
0 black
#000000
8 dark gray
#555555
1 blue
#0000AA
9 light blue
#5555FF
2 green
#00AA00
10 light green
#55FF55
3 cyan
#00AAAA
11 light cyan
#55FFFF
4 red
#AA0000
12 light red
#FF5555
5 magenta
#AA00AA
13 light magenta
#FF55FF
6 brown
#AA5500
14 yellow
#FFFF55
7 light gray
#AAAAAA
15 white
#FFFFFF

Note: Color hex values shown are 8-bit RGB equivalents, internally CGA is 4-bit RGBI

With a composite color monitor/television set

File:CGA-NTSC-colors.png
CGA's 16 colors when using the NTSC output (post-1983 card revision)

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.[16][17]

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.[18]

The relative luminances of the colors produced by the composite color-generating circuit differ between CGA revisions: they are identical for colors 1-6 and 9-14 with early CGAs produced until 1983,[19] and are different for later CGAs due to the addition of additional resistors.[20]

Standard text modes

Script error: No such module "Unsubst". CGA offers four BIOS text modes (Modes 0 to 3, called alphanumeric or A/N modes in IBM's documentation). In these modes, individual pixels on the screen cannot be addressed directly. Instead, the screen is divided into a grid of character cells, each displaying a character defined in one of two bitmap fonts, "normal" and "thin", included in the card's ROM. The fonts are fixed and cannot be modified or selected from software, only by a jumper on the board itself.

Fonts are stored as bitmaps at a color depth of 1-bit, with a "1" representing the character and a "0" representing the background. These colors can be chosen independently, for each character on the screen, from the full 16-color CGA palette. The character set is defined by hardware code page 437.

The font bitmap data is only available to the card itself, it cannot be read by the CPU. In graphics modes, text output by the BIOS operates by copying text from the font ROM bit-by-bit to video memory.

40 × 25 mode

BIOS Modes 0 and 1 are both 40 columns by 25 rows text modes, with each character a pattern of Template:Resx dots. The effective screen resolution in this mode is Template:Resx pixels (a pixel aspect ratio of 1:1.2.) The card has sufficient video RAM for eight different text pages in this mode.

The difference between these two modes can only be seen on a composite monitor, where mode 0 disables the color burst, making all text appear in grayscale. Mode 1 enables the color burst, allowing for color. Mode 0 and Mode 1 are functionally identical on RGB monitors and on later adapters that emulate CGA without supporting composite color output.

80 × 25 mode

BIOS Modes 2 and 3 select 80 columns by 25 rows text modes, with each character still an Template:Resx dot pattern, but displayed at a higher scan rate. The effective screen resolution of this mode is Template:Resx pixels. In this mode, the card has enough video RAM for four different text pages.

As with the 40-column text modes, Mode 2 disables the color burst in the composite signal and Mode 3 enables it.

Textmode color

Each character cell stored four bits for foreground and background color. However, in the card's default configuration, the fourth bit of the background color does not set intensity, but sets the blink attribute for the cell. All characters on the screen with this bit set will periodically blink, meaning their foreground color will be changed to their background color so the character becomes invisible. All characters blink in unison.

By setting a hardware register, the blink feature can be disabled, restoring access to high-intensity background colors.

All blinking characters on the screen blink in sync. The blinking attribute effect is enabled by default and the high-intensity background effect is disabled; disabling blinking is the only way to freely choose the latter eight-color indexes (8-15) for the background color.

Notably, the GW-BASIC and Microsoft QBASIC programming languages included with MS-DOS supported all the text modes of the CGA with full color control, but did not provide a normal means through the BASIC language to switch the CGA from blink mode to 16-background-color mode. This was still possible however by directly programming the hardware registers using the OUT statement of the BASIC language.

Standard graphics modes

CGA offers graphics modes at three resolutions: Template:Resx, Template:Resx and Template:Resx. In all modes every pixel on the screen can be set directly, but the color depth for the higher modes does not permit selecting freely from the full 16-color palette.

320 × 200

In the medium-resolution Template:Resx modes (Modes 4 and 5), each pixel is two bits, which select colors from a four-color palette. In mode 4, there are two palettes, and in mode 5 there is a single palette.

CGA hardware palettes on a RGBI monitor
# 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

Several choices can be made by programming hardware registers. First, the selected palette. Second, the intensity – which is defined for the entire screen, not on a per-pixel basis. Third, color 0 (the "background" color) can be set to any of the 16 colors.

The specific BIOS graphics mode influences which palettes are available. BIOS Mode 4 offers two palettes: green/red/brown and cyan/magenta/white.

As with the text modes 0 and 2, Mode 5 disables the color burst to allow colors to appear in grayscale on composite monitor. However, unlike the text modes, this also affects the colors displayed on an RGBI monitor, altering them to the cyan/red/white palette seen above. This palette is not documented by IBM, but was used in some software.

640 × 200

In the high-resolution Template:Resx mode (Mode 6), each pixel is one bit, providing two colors which can be chosen from the 16-color palette by programming hardware registers.

In this mode, the video picture is stored as a simple bitmap, with one bit per pixel setting the color to "foreground" or "background". By default the colors are black and bright white, but the foreground color can be changed to any entry in the 16-color CGA palette. The background color cannot be changed from black on an original IBM CGA card.

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.

Further graphics modes and tweaks

A number of official and unofficial features exist that can be exploited to achieve special effects.

  • In Template:Resx 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 text mode, the border color (displayed outside the regular display area and including the overscan area) can be changed from the default black to any of the other 15 colors.
  • Through precision timing, it is possible to switch to another palette while the video is being output, allowing the use of any one of the six palettes per scanline. An example of this is California Games,[21] when run on a stock 4.77 MHz 8088. Running 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, as is used to create the river and road in Frogger.[22] Another documented example of the technique is in Atarisoft's port of Jungle Hunt to the PC.
  • Additional colors can be approximated using dithering.
  • Using palette 0 at low intensity and dark blue as the background color provides the three primary RGB colors, as well as brown.

Some of these above tweaks can be combined. Examples can be found in several games.[23]

160 × 100 16 color mode

File:Single pixel in CGA 160x100 mode.svg
A single big "pixel" in Template:Resx mode. This is the two top rows of half of character 221. Note the eight constituent non-square pixels and the 1:1.2 pixel aspect ratio.
File:Paku Paku.png
Title screen of PakuPaku, a Pac-Man clone that uses Template:Resx mode

Technically, this mode is not a graphics mode, but a tweak of the Template:Resx text mode.[24] 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.

File:ASCII.221.character.svg Character 221
File:Half-block.character.blue.red.svg 221 with blue text and red background color
File:Half-block.character.red.blue.svg 221 with red text and blue background color.
File:ASCII.222.character.svg Character 222

Character 221 of the CGA character set 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, Template:Resx pixels at 16 colors, with a pixel aspect ratio of 1:1.2, are possible.

Although a roundabout way of achieving a 16-color graphics display, this works quite well and the mode is even mentioned (although not explained) in IBM's official hardware documentation.[25] This mode was used as early as 1983 on the game Moon Bugs.[26][27][28]

More detail can be achieved in this mode by using other characters, combining ASCII art with the aforesaid technique. This was explored by Macrocom, Inc on two games: Icon: Quest for the Ring (released in 1984) and The Seven Spirits of Ra (released in 1987).[28][29][30]

The same text cell height reduction technique can also be used with the Template:Resx text mode, yielding a resolution of Template:Resx and a pixel aspect ratio of ~1.67:1.

Composite output

Script error: No such module "Labelled list hatnote". Using the composite output instead of an RGBI monitor produced lower-quality video, due to NTSC's inferior separation between luminance and chrominance.[31] This is especially a problem with 80-column text:[32]

File:CGA CompVsRGB Text.png
80-column text on RGB (left) vs. composite monitor (right)

For this reason, each of the text and graphics modes has a duplicate mode which disables the composite colorburst, resulting in a black-and-white picture, but also eliminating color bleeding to produce a sharper picture. On RGBI monitors, the two versions of each mode are usually identical, with the exception of the Template:Resx graphics mode, where the "monochrome" version produces a third palette.

Extended artifact colors

Programmers discovered that this flaw could be turned into an asset, as distinct patterns of high-resolution dots would turn into consistent areas of solid colors, thus allowing the display of completely new artifact colors. Both the standard Template:Resx four-color and the Template:Resx 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. By carefully placing pixels in appropriate patterns, a programmer can produce specific cross-color artifacts yielding a desired new color; either from purely black-and-white pixels in Template:Resx mode, or resulting from a combination of direct and artifact colors in Template:Resx mode, as seen on the following pictures:

Thus, with the choice between 320 × 200 vs. 640 × 200 mode, the choice between the two palettes, and one freely-selectable color (the background in Template:Resx modes and the foreground in 640 × 200 mode), it is possible to use many different sets of artifact colors, making for a total gamut of over 100 colors.

1024 colors in composite mode
1024 colors in composite mode

Later demonstrations by enthusiasts have increased the maximum number of colors the CGA can display at the same time to 1024.[33][34] This technique involves a text mode tweak which quadruples the number of text rows. Certain ASCII characters such as U and ‼ are then used to produce the necessary patterns, which result in non-dithered images with an effective resolution of Template:Resx on a composite monitor.[33]

160 cycles of the NTSC color clock occur during each line's output, so in 40-column mode each pixel occupies half a cycle and in 80-column mode each pixel uses a quarter of a cycle. Limiting the character display to the upper one or two scanlines, and taking advantage of the pixel arrangement in certain characters of the codepage 437, it is possible to display up to 1024 colors.[33] This technique was used in the demo 8088 MPH.[34]

Availability and caveats

The Template:Resx variant of this technique (see above) is how the standard BIOS-supported graphics mode looks on a composite color monitor. The Template:Resx 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".

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.

The modern, games-centric PC emulator DOSBox supports a CGA mode, which can emulate a composite monitor's color artifacting. Both Template:Resx composite mode and the more complex Template:Resx variant are supported.

Resolution and usage

Composite artifacting, whether used intentionally or as an unwanted artifact, reduces the effective horizontal resolution to a maximum 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 is sometimes described as a Template:Resx / 16-color "mode", though technically it was a technique using a standard mode.

The low resolution of this composite color artifacting method led to it being used almost exclusively in games. Many high-profile titles offered graphics optimized for composite color monitors. Ultima II, the first game in the game series to be ported to IBM PC, used CGA composite graphics. King's Quest I also offered 16-color graphics on the PC, PCjr and Tandy 1000, but provided a 'RGB mode' at the title screen which would utilize only the ordinary CGA graphics mode, limited to 4 colors.

Limitations, bugs and errata

Video timing on the CGA is provided by the Motorola 6845 video controller. This integrated circuit was originally designed only for character-based alphanumeric (text) displays and can address a maximum of 128 character rows.

To realize graphics modes with 200 scanlines on the CGA, the MC6845 is programmed with 100 character rows per picture and two scanlines per character row. Because the video memory address output by the MC6845 is identical for each scanline within a character row, the CGA must use the MC6845's "row address" output (i.e. the scanline within the character row) as an additional address bit to fetch raster data from video memory.[35]

This implies that unless the size of a single scanline's raster data is a power of two, raster data cannot be laid out continuously in video memory. Instead, graphics modes on the CGA store the even-numbered scanlines contiguously in memory, followed by a second block of odd-numbered scanlines starting at video memory position 8,192. This arrangement results in additional overhead in graphics modes for software that manipulates video memory.

Even though the MC6845 video controller can provide the timing for interlaced video, the CGA's circuitry aligns the synchronization signals in such a way that scanning is always progressive. Consequently, it is impossible to double the vertical resolution to 400 scanlines using a standard 15 kHz monitor.

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 during screen drawing. The BIOS avoids the problem by only accessing the memory during horizontal retrace, or by temporarily turning off the output during scrolling. While this causes the display to flicker, IBM decided that doing so was better than snow.Template:R The "snow" problem does not occur on any other video adapter, or on most CGA clones.

In the 80-column text mode, the pixel clock frequency is doubled, and all synchronization signals are output for twice the number of clock cycles in order to last for their proper duration. The composite output's color burst signal circuit is an exception: because it still outputs the same number of cycles, now at the doubled clock rate, the color burst signal produced is too short for most monitors, yielding no or unstable color. Hence, IBM documentation lists the 80-column text mode as a "feature" only for RGBI and black-and-white composite monitors.[36] Stable color can still be achieved by setting the border color to brown, which happens to produce a phase identical to the correct color burst signal and serves as a substitute for it.

Dual-head support

The CGA was released alongside the IBM MDA, and can be installed alongside the MDA in the same computer. A command included with PC DOS permits switching the display output between the CGA and MDA cards.[37] Some programs like Lotus 1-2-3[38] and AutoCAD support using both displays concurrently.

Software support

CGA was widely supported in PC software up until the early 1990s. Some of the software that supported the board was:

Competing adapters

BYTE in January 1982 described the output from CGA as "very good—slightly better than color graphics on existing microcomputers".Template:R PC Magazine disagreed, reporting in June 1983 that "the IBM monochrome display is absolutely beautiful for text and wonderfully easy on the eyes, but is limited to simple character graphics. Text quality on displays connected to the color/graphics adapter ... is at best of medium quality and is conducive to eyestrain over the long haul".[40]

In a retrospective commentary, Next Generation also took a negative view on the CGA, stating: "Even for the time (early 1980s), these graphics were terrible, paling in comparison to other color machines available on the market."[41]

CGA had several competitors:

  • For business and word processing use, IBM provided the Monochrome Display Adapter (MDA) at the same time as CGA. MDA was much more popular than CGA at first.[42] 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 Card (HGC) was introduced, the first third-party video card for the PC. In addition to an MDA-compatible text mode, it offered a monochrome graphics mode with a resolution of Template:Resx pixels, higher than the CGA.
  • Also in 1982 the Plantronics Colorplus board was introduced, with twice the memory of a standard CGA board (32k, compared to 16k). The additional memory can be used in graphics modes to double the color depth, giving two additional graphics modes—16 colors at Template:Resx resolution, or 4 colors at Template:Resx resolution.
  • The IBM PCjr (1984) and compatible Tandy 1000 (1985) featured onboard "extended CGA" video hardware that extended video RAM beyond 16 kB, allowing 16 colors at Template:Resx resolution and four colors at Template:Resx resolution. Because the Tandy 1000 long outlived the PCjr, the video modes became known as "Tandy Graphics Adapter" or "TGA", and were very popular for games during the 1980s. Similar but less widely used was the Plantronics Colorplus.
  • In 1984, IBM also introduced the Professional Graphics Controller, a 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.

Other alternatives:

  • Paradise Systems introduced in 1984 the first successful CGA-compatible card for MDA monitors. It displayed CGA's 16 colors in shades of monochrome. Because it was hardware-compatible with CGA, the Paradise card did not need special software support or additional drivers.[43]
  • Another extension in some CGA-compatible chipsets (including those in the Olivetti M24 / AT&T 6300, the DEC VAXmate, and some Compaq and Toshiba portables) is a doubled vertical resolution. This gives a higher quality Template:Resx text display and an additional Template:Resx graphics mode.

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 (Template:Resx) as well as a software-selectable palette of 16 colors out of 64 in both text and graphics modes.

Specifications

DE-9 connector for RGBI monitor

File:Numbered DE9 female Diagram.svg
DE-9 connector seen when looking at the back of a PC

The Color Graphics Adapter uses a standard DE-9 connector for direct-drive video (to an RGBI monitor). The connector on the card is female and the one on the monitor cable is male.

CGA DE-9 connector pin assignments
Pin Function
1 Ground
2 Ground
3 Red
4 Green
5 Blue
6 Intensity
7 Reserved
8 Horizontal Sync
9 Vertical Sync
CGA TTL signal
Type Digital, TTL
Resolution 640 × 200, 320 × 200
H-freq 15699.8 Hz (14.318181 MHz/8/114)
V-freq 59.923 Hz (H-freq/262)
Colors 16

RCA connector for composite monitor or television

File:Back panel of CGA Video Adapter 1501981 (PCB number 1501982) (15808883229).jpg
Back of a CGA Video Adapter board, with the RCA composite output connector visible on the right

The Color Graphics Adapter uses a standard RCA connector for connection to an NTSC-compatible television or composite video monitor.[2] The connector on the card is female and the one on the monitor cable is male.

CGA analog signal
Type Analog composite NTSC compatible
Resolution 640 × 200, 320 × 200
H-freq 15699.8 Hz (14.318181 MHz/8/114)
V-freq 59.923 Hz (H-freq/262)
Colors 16, hundreds of artifact colors

See also

References

<templatestyles src="Reflist/styles.css" />

  1. a b Script error: No such module "citation/CS1".
  2. a b Script error: No such module "citation/CS1".Script error: No such module "Unsubst".
  3. a b Script error: No such module "citation/CS1".
  4. International Business Machines Corporation (February 4, 1983). Announcement Letter Number 183-002 - IBM COLOR DISPLAY, 5153.
  5. Script error: No such module "citation/CS1".
  6. Script error: No such module "citation/CS1".
  7. Script error: No such module "citation/CS1".
  8. a b c Script error: No such module "citation/CS1".
  9. The color brown, represented by R=1, G=1, B=0, I=0, is an exception; whereas a straight interpretation of these bit values would resolve this color as dark yellow, the intensity of the green component is reduced, to produce brown, for only this one 4-bit value. See this page for details. This special RGBI interpretation for brown is performed in the monitor; the IBM 5153 monitor designed for the CGA performs it, but some early third-party monitors did not.
  10. a b Script error: No such module "citation/CS1".
  11. International Business Machines Corporation (1983): IBM Personal Computer XT Technical Reference Manual, pages D-42 to D-43.
  12. Script error: No such module "citation/CS1".
  13. Script error: No such module "citation/CS1".
  14. Script error: No such module "citation/CS1".
  15. Script error: No such module "citation/CS1".
  16. Dean et al. (1984): Composite video color signal generation from digital color signals. U.S. Patent #4,442,428
  17. International Business Machines Corporation (1983): IBM Personal Computer XT Technical Reference Manual, page D-40.
  18. Script error: No such module "citation/CS1".
  19. Script error: No such module "citation/CS1".
  20. Script error: No such module "citation/CS1".
  21. Script error: No such module "citation/CS1".
  22. Script error: No such module "citation/CS1".
  23. Script error: No such module "citation/CS1".
  24. Script error: No such module "citation/CS1".
  25. Script error: No such module "citation/CS1".
  26. Script error: No such module "citation/CS1".
  27. Script error: No such module "citation/CS1".
  28. a b Script error: No such module "citation/CS1".
  29. Script error: No such module "citation/CS1".
  30. Script error: No such module "citation/CS1".
  31. Script error: No such module "citation/CS1".
  32. Script error: No such module "citation/CS1".
  33. a b c Script error: No such module "citation/CS1".
  34. a b Script error: No such module "citation/CS1".
  35. Script error: No such module "citation/CS1".
  36. Script error: No such module "citation/CS1".
  37. Script error: No such module "citation/CS1".
  38. Script error: No such module "Citation/CS1".
  39. Script error: No such module "citation/CS1".
  40. Script error: No such module "Citation/CS1".
  41. Script error: No such module "Citation/CS1".
  42. Script error: No such module "citation/CS1".
  43. Script error: No such module "citation/CS1".

Script error: No such module "Check for unknown parameters".

Notes

<templatestyles src="Refbegin/styles.css" />

External links

Template:Sister project

Script error: No such module "Navbox". Template:IBM personal computers