CGA: Why the 80-column text mode requires the border color to be set

The original IBM Color Graphics Adapter has a curious quirk - it won't by default display colour on the composite output in 80-column text mode. By looking at the schematics, I've figured out why this is, and what the CGA's designers could have done differently to avoid this bug. The following diagram illustrates the structure of the various horizontal and vertical sync pulses, overscan and visible areas in the CGA.

There are two horizontal sync pulses - there's the one generated by the 6845 (the 160-pixel wide red/grey/yellow band in the diagram) and there's the one output to the monitor (the 64-pixel wide grey band within it). The CGA takes the 6845's hsync pulse and puts it through various flip flops to generate the output hsync pulse (delayed by 2 LCLKs and with a width of 4 LCLKs) and also the color burst pulse (in yellow, delayed by 7 LCLKs and with a width of 2 LCLKs).

The 6845 can generate an hsync pulse anywhere from 1 to 16 clock ticks in width. The IBM's BIOS sets it up at 10 ticks (as shown in the diagram). However, in 80-column text mode those ticks are only half as wide, so only extend 3/4 of the way through the output hsync pulse. The 6845's hsync pulse ends before the color burst pulse gets a chance to start, so it never happens and the display will show a monochrome image.

By changing the overscan color to brown, one can create one's own color burst signal at the right point in the signal, and this was the usual way of working around the problem (possibly the only way that works reliably)

By changing the 6845's pulse width to the maximum of 16, one could generate the first half of the color burst pulse (I think) and some monitors might recognize this as a color burst.

If the CGA's designers had started the output hsync pulse at the beginning of the 6845's hsync pulse (or delayed by only 1 LCLK instead of 2) then using the maximum pulse width would have been sufficient to generate the correct color burst. I guess they were just trying to center the output hsync pulse and the color burst within the 6845 pulse, without thinking of the high-res case.

The diagram also shows why interlaced mode doesn't work on the CGA - the output vertical sync pulse is generated in a similar way to the output horizontal sync pulse, only it's 3 lines instead of 4 LCLKs. It always starts at the beginning of an output hsync pulse, so a field can't start halfway through a scanline.

2 Responses to “CGA: Why the 80-column text mode requires the border color to be set”

    • Andrew says:

      Good question. It's got to be a colour with hue in order to get a 3.57MHz signal, so that rules out black, white and the two greys. NTSC specifies that the phase corresponds to the yellow hue, so the two best candidates are yellow and brown. In the composite output these differ by signal level (there is an additional DC component in the high-intensity colours) and brown is closer to the "correct" signal than yellow (the actual signal emitted by the CGA for the color burst is darker still, and I think the NTSC specifies a color burst with a lower saturation than the CGA provides). Yellow might work (and, if it does, will produce the same colours as brown), but some monitors might get confused by a signal so far out of spec.

      The other low-intensity saturated colours (blue, green, cyan, red and magenta) would work just as well as brown, but the hues would be different than normal. That gives a very cheap way to do hue shifting, though.

Leave a Reply