33

The IBM CGA video card generated 16 colours indicated via four binary TTL signals: R, G, B and I (red, green, blue and intensity). This was not an entirely linear transformation: in particular, RGBI=1100, or "low-intensity yellow" appeared not dark yellow but brown¹; this was done by reducing the amplitude of the green channel as sent to the picture tube for this particular colour (i.e., combination of bits).

My understanding is that the analogue voltage levels eventually sent to the picture tube for that particular combination were different from those for, e.g., RGBI=1010 or RGBI=0110.

What exactly was this change, and how did the circuitry in the IBM to do this work? Were any other colours processed differently in this way, or were all the others a direct mapping using the same transformation function for all other low-intensity colours (and presumably a second transformation for all high-intensity colours)?


¹ Yes, I know that yellow and brown are the same colour.

1
  • 8
    According to the linked video, it's orange and brown which are the same hue.
    – Leo B.
    Commented Jul 27, 2022 at 8:56

3 Answers 3

33

Dr. H. Holden describes the general workings of the IBM 5153 colour conversion circuit (which converts the digital RGBI signals to analogue RGB levels) on pages 21-24 of his document "Fitting an EGA Card to an IBM 5155". The following schematics are taken from that document; I'm not sure if they are exactly the circuits in the IBM 5153 (which are on the third page of this PDF), but they do an excellent job of giving the general idea.

There's a detection circuit that looks roughly like the following, connecting the detector output to ground when RGBI=1100 (low-intensity yellow, or "brown" as I'll call it here) is detected. Otherwise the detector output is left floating (unconnected to anything).

RGBI=1100 detection circuit

This signal is then fed into the main colour conversion circuitry through a resistor. If "brown" is not detected, this has no effect on the analogue green level (it's effectively not connected to anything). However, when "brown" is detected this resistor is now connected to ground and becomes part of the voltage divider generating the analogue green level, pulling it about 33% lower than it would be without this signal.

Basic Arrangement of Intensity System IBM 5153

This can be seen in the measured outputs of this circuit (measured at the B, G and R nodes at the right-hand side of the schematic above):

IBM 5153 RGB Analogue Drive Levels

If you're trying to emulate this circuit, it's worth noting that when the intensity bit is set the R, G and B drive levels increase as more bits are turned on. E.g., with RGBI=1001, R=1.12 V, but with RGBI=1101, R=1.24 V and with RGBI=1111, R=1.30 V. It's not clear if this is an intended effect of the circuit design, but it does change the colours as compared to what you'd see from other methods of conversion.

The "brown adjustment" here and the "intense channel level" changes above are generally not replicated in other systems. Neither the CGA CVBS (composite) output nor the IBM 5154 (EGA) monitor when displaying CGA input treat the colours in quite the same way. (The 5154 brown is less bright than the 5153 brown, for example.) And the "standard" RGB values used by full-colour systems trying to "emulate" CGA are also different from the 5153 display.

3
  • 3
    The effect of voltage rising is due to how simple the circuit is. If I had to guess, the circuit is just good enough for it's purpose, and spending any more money for components and better circuit design would not affect much. And even if these voltages change slightly, how it affects the next stages are unknown, it might be that voltages are clamped at some point, so it might not even have any effect on the gun drive and color intensity in any way. Or even if it does, then many other factors and non-linearities can also change the relative color intensities (brightness/contrast setting etc).
    – Justme
    Commented Jul 27, 2022 at 10:29
  • Also, in 5154 EGA monitor, there are basically only a 2-bit DAC per color, so all channels are identical (except RED channel is slightly different). When 5154 in it is driven with a 200-line CGA mode, it just internally maps the 4-bit RGBI value to 6-bit RrGgBb value. In 350-line EGA mode, the 6-bit RrGgBb values are directly sent from the EGA video card. The 4 to 6 bit mapping is made with TI TBP28L22N PROM, and it has unused outputs, so in theory, 5154 could detect the brown color. But EGA uses closest brown (#AA5500) and VGA matches EGA. It's close enough, while CGA CVBS has dark yellow.
    – Justme
    Commented Jul 27, 2022 at 11:16
  • I wonder if it would have been practical to arrange the connector pinout so that the old IRGB would connect to rRgB, with the voltage on b resistively pulled toward r, and the voltage on G resistively pulled toward (r+(g and (r or not R)))/2. That would have avoided the need to have the monitor's color decoding be dependent upon scan rate, and allowed the use of 64 EGA colors at all scan rates.
    – supercat
    Commented Jan 1 at 22:24
12

The circuitry does exactly what you described, it detects the bit pattern for that specific color that would be "dark yellow", and when the bit pattern matches, an extra transistor is turned on to reduce green intensity.

In general, the digital R/G/B signals are used to add voltage to respective R/G/B analog signal, and the digital intensity signal adds to all three RGB channels.

More specifically, the digital RGBI input circuitry uses 74S05 inverting digital logic buffers with open-collector output to receive and buffer the four digital color signals. Because the buffers are inverting, the signals are inverted twice to end up back with a non-inverted signal that can be used to drive resistor networks, in order to convert the digital signals to analog levels for the transistors that drive the analog RGB signal levels.

So, because you have all the buffered digital RGBI signals, and their inverted complements available through inverters, and your inverters have open-collector outputs, you can combine the inverter output signals to make a wired-AND circuit.

The wired-AND circuit uses the non-inverted and inverted RGBI signals in such a way, that only one combination of them allows the output of "dark yellow" bit pattern detecting inverter to go high and modify green to darker, otherwise, the output stays low and green is not modified.

The logic is as follows:

B bit is high, inverted B bit stays low -> output is low
I bit is high, inverted I bit stays low -> output is low
G bit is low,  buffered G bit stays low -> output is low
R bit is low,  buffered R bit stays low -> output is low

So the only combination that allows the output to become is high, is low on blue and intensity, and high on red and green, RGBI = 1100, which would be dark yellow.

The output of the wired-AND circuit turns on a separate transistor to pull current away from the green analog line via a 560 ohm resistor, as otherwise it would get full current via a 150 ohm resistor, while green analog line would be OFF when pulled low via 220 ohm resistor.

6

The 5153 does colour generation by adding voltages:

  • Basic voltage for a colour is 0.66V for a set colour bit (RGB)
    • e.g. Red is 0.66/0.0/0.0 V

This produces 7 colours plus black.

  • The 'light' colours are gone by adding 0.33V to all colours, making
    • Light Red 1.0/0.33/0.33V

This lifts all 7 colours to 'full' intensity. Plus, since a black lifted by 0.33V is no longer Black, an additional dark grey.

So far all fine within the straight RGB model, except, humans do like to see brown as well, we're kind of made for it (*1). So adding brown would help with a balanced palette. Except, it can not be described by simple two level (binary) RGB, as it needs three different activity levels. Having intensity is no help either, as it shifts all levels.

The solution picked was to turn the basic Yellow, binary 110, into a brown by driving green by 0.33V less. This is detected by a clever analogue circuit made from inverters, which simply do not add the full 0.66V to green in case of basic 'Yellow' (IRGB: 0/1/1/0). This is nicely shown on page 3 of SAMS 5153 VDU schematics (page 3 of this PDF). The inverter logic is on the top right of the page, while the colour voltage adders are below.

Of course, turning Yellow into Brown would have made Light Yellow an odd name for the only yellow left, so it got renaimed to simply yellow - which also is the reason why Yellow is much brighter than the other 'basic' colours.


1 - The area between red and green is what our eyes are most sensitive, so not having brown will be a serious issue for a colour display. The same reason why Amber and Green screens are the most easy to read as mentioned here and https://retrocomputing.stackexchange.com/a/7694/6659

Same reason why blue is often encoded with less bandwidth (like 3-3-2) - we simply don't see the difference.

4
  • 6
    The comments how human vision is flawed. Encoding blue with less bandwidth does not mean quantising the blue with less bits, they are completely different contexts. And even if blue accounts to least amount of brightness sensation, eyes are actually very sensitive to blue colour, so Wikipedia is not correct here, the 3-3-2 palette is just made up because you have to choose whether red or blue gets less bits. See poynton.ca/PDFs/ColorFAQ.pdf
    – Justme
    Commented Jul 27, 2022 at 9:29
  • 1
    @Justme "Encoding blue with less bandwidth does not mean quantising the blue with less bits" that's nonsense. bandwidth information (bits) per unit, and using less bits to encode is the very definition of less bandwidth. And of corse is the eye less sensitive to blue, as there are simply far less S-Cones - the ones detecting blue - than L (red) or M (green). which BTW is exactly what the paper you link describes in section 9.
    – Raffzahn
    Commented Jul 28, 2022 at 0:36
  • 3
    Let's try again with section 10 : poynton.ca/notes/colour_and_gamma/ColorFAQ.html#RTFToC10 which contradicts what you just said. And bandwidth is not only about less bits per unit. In pictures and audio, bandwidth means frequencies, not data rate. Yes, you can halve audio data rate by either halving the sampling rate (bandwidth) or halving the bit depth (quantization). Same with images, you can quantize the bit depth, or you can reduce the image bandwidth by halving the resolution (horizontally, vertically, or both). Human eyes are more sensitive to bit depth than resolution.
    – Justme
    Commented Jul 28, 2022 at 0:59
  • Less analog bandwidth would be like digital subsampling; averaging nearby pixels (horizontally). So fine details in the blue channel would be lost, but the actual blue level of a uniform area can be any analog value. Unlike with quantizing to few bits, which (as @Justme 's last link points out) can result in visible banding artifacts. It makes some sense to me that fewer blue cones in the eye might be less sensitive to fine details in blue if that's true (worse spatial resolution = video bandwidth), but still be sensitive to colour gradients or steps between two decent-sized areas (bit depth). Commented Aug 4, 2022 at 3:20

You must log in to answer this question.

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