14

It's long been an established fact that the EGA only had four memory planes, which limited the number of colors on the screen to (24) 16. The best compatible monitors at the time had six TTL color lines, meaning the screen was capable of displaying (26) 64 different colors. It was always my assumption that the EGA could be programmed via palette registers to arbitrarily choose any of the 64 display colors for the 16 memory colors, and that none of the EGA DOS games of the era bothered to reprogram the palette because... shrug? Now I'm starting to think there was a hardware limitation, but I'm trying to piece that together.

Based on my research, there were three monitors available in the EGA's heyday:

  • The Monochrome Display, with two pins (video/intensity) allowing for four shades of gray.
  • The Color Display, with four pins (red/green/blue/intensity) allowing for 16 colors.
  • The Enhanced Color Display, with six pins (R/G/B/R-Intensity/G-Intensity/B-Intensity) allowing for 64 colors.

From what I understand, the EGA card was capable of driving all three monitor types provided the selected video mode ran at a supported frequency. If a Color Display was plugged into the EGA card, the R/G/B pins would line up correctly and the monitor's Intensity pin would read the card's G-Intensity pin. The R-Intensity and B-Intensity card outputs would be unused. (In the opposite case -- an Enhanced Color Display plugged into a CGA card -- the monitor would never receive any R-Intensity or B-Intensity input and, presumably, the image would have an incorrect greenish tinge to it.)

It seems (based on discussions like this) that the designers of the EGA felt that CGA/Color Display compatibility was important enough to limit the output in 200-line video modes so it displayed the same on both color monitor types. Based on my own experimentation, I see these limitations as well.

In EGA mode Dh (320×200, 16 color), when calling BIOS INT 10h, AH=10h, AL=0h with various color values in BH, only four of the six bits seem to have any effect. The table of observed effects vs. expectations is:

Bit pos. │ Effect
─────────┼───────────────────────────────────────────
.......X │ Blue
......X. │ Green
.....X.. │ Red
....X... │ No Effect (expected Blue Intensity)
...X.... │ R+G+B Intensity (expected Green Intensity)
..X..... │ No Effect (expected Red Intensity)
00...... │ Not Used

Bits 3 and 5 have absolutely no effect on the image. The end result is that there are only four useful bits that can be set, limiting the output to 16 unique display colors. It appears that no matter how the registers are programmed, the most the programmer can achieve in video mode Dh is a rearrangement of the 16 RGBI colors, with the remaining 48 possible display colors completely out of reach.

Other video modes like 10h (460×350, 16 color) respond to all six bits, so I'm reasonably sure my test programs are correct.

Now, the questions:

  1. Was the 16-color display limitation explicitly documented somewhere? The EGA documentation, pgs. 56/59 sort of hints at this behavior if the reader expects it, but it doesn't directly state "the hardware does something different in 200-line modes"; you just sort of have to know that.
  2. Was the behavior implemented in the EGA card (i.e. the R-Intensity and B-Intensity pins were unconditionally tied to the G-Intensity pin output) or was it implemented in the Enhanced Color Display (i.e. the R-Intensity and B-Intensity pins did output the value the programmer placed in the palette registers, but the monitor ignored it -- sort of how the Color Display had a special case to change "low intensity yellow" into "brown")?
  3. Was there a way the programmer could alter values in the EGA registers to allow any of the "inaccessible" 48 display colors to be used in mode Dh that didn't destabilize the image or fail on certain hardware configurations?
3
  • 2
    On a VGA card you'd be able to program VGA palette registers to use the full VGA colour range in these modes. Certain EGA compatibles also let you change the EGA palette registers, but real EGA cards seem to be hardwired to use only CGA colours in 200 line modes.
    – user722
    Commented Aug 22, 2020 at 15:53
  • @RossRidge Indeed. If I understand correctly, Duke Nukem II used these VGA enhancements to get a more interesting palette while still being 16-color.
    – smitelli
    Commented Aug 23, 2020 at 13:50
  • 1
    @user722 EGA cards are not hardwired to output only CGA colours in 200-line modes. The EGA can output all 64-bit patterns in all video modes (assuming it is not jumpered to "CGA monitor", in that case, it can only output 32 patterns). The accepted answer is correct: The IBM 5153 Enhanced Color Display is hardwired to ignore 2 of the 6 color bits in 200-line mode. I own a "universal" monitor which can be switched (amongst other configurations) to CGA-like 16 colors, EGA-like 64 colors or "auto-switch", which is 16 colors in 200-line mode and 64 colors in 350-line mode. Commented Jul 10, 2021 at 19:42

2 Answers 2

12
  1. It is a feature of the monitor. On an IBM EGA display, the 200-line mode is limited to only 4-bit RGBI color mode input, to be pin compatible with the 16 color IBM CGA display. The monitor ignores the remaining 2 color input bits in 200-line mode. Only on 350-line mode, all the 6 color bits are used as RrGgBb color mode input to allow for 64 colors.

2&3) No the card does not limit this. The EGA card initially sets the palette registers to match the 4-bit output in 200-line modes, but the palette registers can be freely changed by user. There is just little point in this since a standard IBM CGA or EGA monitor also expect 4-bit input in 200-line mode. If the monitor is a non-standard one that allows for 6-bit colors then 64 colors can be used in 200-line mode too.

1
  • Ah, yep, here it is, mentioned on several of the pages. Thanks!
    – smitelli
    Commented Aug 23, 2020 at 13:37
4

As Justme notes, this is a feature of the monitor. The details are described in the manual for the IBM 5154, IBM Enhanced Color Display. Page 1 notes the two modes,

The IBM Enhanced Color Display is an advanced color display capable of operating in two separate modes. Mode 1 is a 16 color ~ 640 by 200 overscan mode with a horizontal scan frequency of 15.75 kHz. Mode 2 is a 64 color 640 by 350 mode with a horizontal scan frequency of 21.8 kHz. Both modes are non-interlaced. The monitor determines which mode to operate in by decoding the vertical sync polarity.

and the details are given on page 3:

Vertical Sync
• Uses polarity of Vertical Sync signal to automatically select Mode 1 or Mode 2 operation. Mode 1 is selected by a normally low positive going TTL pulse. Mode 2 is selected by a normally high negative going TTL pulse.
• Screen may be refreshed from 50 to 60 Hz. At 60 Hz there are either 200 or 350 vertical lines of resolution depending on the mode selected.
• 700 p.sec retrace time

Horizontal Sync
• Normally low, positive going TTL pulse
• In Mode 1, 15.75 kHz.
• In Mode 2,21.8 kHz.
• 6 p.sec retrace time

Though it's certainly not the only way to do it, the Enhanced Color Display designers chose to map the RGBI values to a subset of the 64 colours selectable by RrGgBb values, per the following table from page 4:

RGBI to RrGgBb mapping

Note that this is not the mapping that the IBM 5153 Color Display uses. It's similar enough that you might not notice the difference if you're examining it casually, but the colors are not exactly the same.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .