Enhanced Graphics Adapter


The Enhanced Graphics Adapter is an IBM PC computer display standard from 1984 that superseded and exceeded the capabilities of the CGA standard introduced with the original IBM PC, and was itself superseded by the VGA standard in 1987.

History

EGA was introduced in October 1984 by IBM, shortly after its new PC/AT.
The EGA standard was made obsolete by the introduction in 1987 of MCGA and VGA with the PS/2 computer line.
Shortly before the introduction of VGA, Genoa Systems introduced a half-size graphics card built around a proprietary chip set, which they called Super EGA. Also around that time, Byte Magazine reviewed various proprietary enhanced EGA adapters described with the term "EEGA".

Design

EGA produces a display of sixteen simultaneous colors from a palette of sixty-four, at a resolution of up to 640×350 pixels. The EGA card includes a 16 KB ROM to extend the system BIOS for additional graphics functions, and includes a custom CRT controller that has limited backward compatibility with the Motorola MC6845 chip used to generate video timing signals in earlier IBM PC graphics controllers. The EGA CRTC can support all of the modes of the IBM MDA and CGA adapters, partially through specific mode options intended for this purpose, but even in its maximum-compatibility mode configuration it is not register-compatible with an MC6845, so programs that directly program the 6845 to set up video modes will fail on an EGA. When an MDA or CGA mode is set up on the EGA by calling the BIOS, then the raster timing, video memory layout, data format, and some other low-level hardware details such as cursor control are identical to those aspects of the operation of an MDA or CGA, providing a high degree of direct software and hardware compatibility.
In the 640×350 high resolution mode, each of the sixteen colors can be selected from a palette comprising all possible combinations of two bits per pixel each for red, green and blue, allowing four levels of intensity for each primary color and sixty-four possible colors overall. EGA also includes full sixteen-color versions of the CGA 640×200 and 320×200 graphics modes. Depending on the monitor, only the sixteen CGA/RGBI colors are available in these modes; see [|color palette] below. EGA four-bit graphic modes are also notable for a sophisticated use of bit planes and mask registers together with CPU bitwise operations, which constitutes an early graphics accelerator inherited by VGA and numerous compatible hardware design models.
EGA is dual-sync; it scans at 21.8 kHz when 350-line modes are used and 15.7 kHz when 200-line modes are used. The original CGA modes are also present, though EGA is not 100% hardware compatible with CGA, as was mentioned. EGA can drive an MDA monitor by a special setting of switches on the board ; only 640×350 high-resolution monochrome graphics and the standard MDA text mode are available in this mode. In summary, the EGA supports all BIOS-standard video modes of all previous IBM PC video adapters except the enhanced CGA of the IBM PCjr. The standard MDA and CGA modes are supported 100% at the BIOS level, with additional support in some details at the hardware register level. The three enhanced graphics modes of the PCjr—160x200 16-color, 320x200 16-color, and 640x200 4-color—are not supported by the EGA, and IBM lists their BIOS video mode numbers as reserved. However, the EGA can generate displays equivalent to these modes using different modes. The EGA 320x200 16-color mode is not the same as nor compatible with the PCjr mode of the same format: the PCjr mode uses 4-bit pixels that are packed 2 pixels to a byte in a 32 KB video buffer that is split into 4 banks of interleaved lines, whereas the EGA mode uses the linear bit-plane format that is native to the EGA.
EGA cards use the PC ISA bus and were available starting in both eight- and sixteen-bit versions. The original IBM EGA card had 64 KB of onboard RAM and required a daughter-board to add an additional 64 KB. All third-party cards came with 128 KB already installed and some even 256 KB, allowing multiple graphics pages, multiple text-mode character sets, and large scrolling displays. A few third-party EGA clones feature a range of extended graphics modes, as well as automatic monitor type detection, and sometimes also a special 400-line interlace mode for use on CGA monitors.

Output capabilities

EGA supports:
Text modes:
Extended graphics modes of third party boards:
The EGA palette allows all 16 CGA colors to be used simultaneously, and it allows substitution of each of these colors with any one from a total of 64 colors. This also allows the CGA's alternate brown color to be used without any additional display hardware. The later VGA standard built on this by allowing each of the 64 colors to be further customized.
However, standard EGA monitors do not support use of the extended color palette in 200-line modes. The monitor cannot distinguish between being connected to a CGA card or being connected to an EGA card in a 200-line mode. Compared to CGA, EGA redefines some pins of the connector to carry the extended color information. If the monitor were connected to a CGA card, these pins would not carry valid color information, and the screen might be garbled if the monitor were to interpret them as such. For this reason, standard EGA monitors will use the CGA pin assignment in 200-line modes so the monitor can also be used with a CGA card. Some EGA monitors are switchable, meaning they can be set up to use the full palette even in 200-line modes, often through a mechanical switch. Only a few commercial games were released with support for the extended color palette in 320×200 or 640×200.
When selecting a color from the EGA palette, two bits are used for the red, green and blue channels. This allows each channel a value of 0, 1, 2 or 3. To select the color magenta, the red and blue values would be medium intensity and the green value would be off. When calculating the intended value in the 64-color EGA palette, the binary number of the intended entry is of the form "rgbRGB" where a lowercase letter is the least significant bit of the channel intensity and an uppercase letter is the most significant bit. For magenta, the most significant bit in the red and blue values is a 1, so the uppercase R and B placeholders would become 1. All other digits are zeros, giving the binary number 000101 for the color magenta. This is 5 in decimal, so setting a palette entry to 5 would result in it being set to magenta. All the color values for the default colors are listed in the table on the right.
NumberColorHexadecimalrgbRGBDecimal
0Black#0000000000000
1Blue#0000AA0000011
2Green#00AA000000102
3Cyan#00AAAA0000113
4Red#AA00000001004
5Magenta#AA00AA0001015
6Brown#AA550001010020
7White / light gray#AAAAAA0001117
8Dark gray / bright black#55555511100056
9Bright Blue#5555FF11100157
10Bright green#55FF5511101058
11Bright cyan#55FFFF11101159
12Bright red#FF555511110060
13Bright magenta#FF55FF11110161
14Bright yellow#FFFF5511111062
15Bright white#FFFFFF11111163

Specifications

The EGA uses a female nine-pin D-subminiature connector which looks identical to the CGA connector. The hardware signal interface, including the pin configuration, is largely compatible with CGA. The differences are in the re-purposing of three pins for the EGA's secondary RGB signals: the CGA "Intensity" pin has been changed to "Secondary Green "; the second ground of CGA has been changed to "Secondary Red ", and pin seven is now used for "Secondary Blue ". If the EGA is operated in modes having the same scan rates as CGA, a connected CGA monitor should operate correctly, though if the monitor connects pin two to ground, the shorting of the EGA's secondary red output to ground could conceivably damage the EGA adapter. Similarly, if the CGA monitor is wired with pin two as its sole ground, it will not work with the EGA, though it will work with a CGA. Finally, because of the use of the CGA's intensity pin as secondary green, on a CGA monitor connected to an EGA, all CGA colors will display correctly, but all other EGA colors will incorrectly display as the standard CGA color which has the same values for the g, R, G, and B bits Conversely, an EGA monitor should work with a CGA adapter, but the secondary red signal will be grounded and the secondary blue will be floating, causing all high-intensity CGA colors except brown to display incorrectly, and all colors to potentially have a variable blue tint due to the indeterminate state of the unconnected secondary blue.
Almost all EGA cards have DIP switches on the back of the card to select the monitor type. If CGA is selected, the card will operate in 200-line mode and use 8x8 characters in text mode. 350-line modes cannot be accessed, nor any of the extended color palette. If EGA is selected, the card will operate in 350-line mode and use 8×14 text. When 200-line modes are set, it will sync down to 15 kHz. If MDA is selected, the card also uses 350 lines and 8×14 text, but the only graphics mode that can be accessed is 640×350×2.
The IBM 5154 EGA monitor has a special IBM 5153 CGA compatibility mode when operating with CGA sync signals, and it will automatically change to the CGA pinout to avoid all of the mentioned problems when operating in this mode.

Memory mapping

EGA graphics modes are planar, as opposed to the interlaced CGA and Hercules modes. The video memory is divided into four pages, one for each component of the RGBI color space. Each bit represents one pixel. If a bit in the red page is enabled, but none of the equivalent bits in the other pages are, a red pixel will appear in that location on-screen. If all the other bits for that particular pixel were also enabled, it would become white, and so forth. The planes are 8 KB in size, 16 KB, or 32 KB and reside at segment A000 in the CPU's address space. They are bank-switched and only one plane can be read on the CPU bus at once, although the programmer may set the control registers on the EGA card to select which planes are written to. Thus, it is possible to write to all of them at once even though just one plane can be read from at any given moment. However, there is an exception: in read mode 1, all four planes are read and compared with programmed "Color Compare" data, and a byte indicating the result of comparing all four planes is what is read on the I/O bus.
For color text and CGA graphics modes, the video memory is mapped to 16 KB of memory addresses beginning at address B8000h. In monochrome text mode, video memory occupies 16 KB beginning at B0000h. These address mappings are for backwards compatibility. For modes new to the EGA, the video memory begins at address A0000h and occupies 64 KB. The card can also be set to map 128 KB at that base address, but no standard BIOS video modes use that option. The different base addresses for color vs. monochrome modes makes it possible for an EGA to be operated simultaneously with a monochrome graphics card in the same computer, or for an EGA in MDA text mode to operated simultaneously with a CGA in the same computer.

Connector

Female DE-9 connector, on EGA.

Pin numbers : top row is pins 1–5, bottom row is pins 6 to 9, both numbered from right to left in this illustration.
PinNameFunction
1GNDGround
2SRSecondary Red
3PRPrimary Red
4PGPrimary Green
5PBPrimary Blue
6SGSecondary Green
7SBSecondary Blue
8HHorizontal Sync
9VVertical Sync

Signal

Adoption

A PC clone with EGA had better graphics than contemporary rivals Commodore 64 or Apple II, which before 1987 were more popular for games in the USA, although at a substantially higher price than the C64. In Europe other home computers such as the Sinclair ZX Spectrum and the Amstrad CPC were also very popular. However CGA had inferior graphics to the Atari ST and Amiga computer families, which became very popular in Europe in particular from 1987 onward delaying general acceptance of the PC as home and games machines until the early 90s. The Atari could display 16 colours from a palette of 512 in 320×200 or 256, while the first generation Amigas generally displayed 32 colours out of a pallette of 4096 in 320×200 or 256, but could display all 4096 simultaneously. Commercial software began supporting EGA by 1986 and Sierra's King's Quest III was one of the earliest PC games to use it. Most software made up to 1991 can run in EGA, although the vast majority of commercial games used 320×200 with 16 colors for reasons of compatibility with CGA and Tandy and to support users who did not own a proper EGA monitor. The 350-line modes were mostly used by freeware/shareware games and application software, although SimCity is a notable example of a commercial game that runs in 640×350×16 mode.