7

I'm curious about how graphics were drawn on systems using the Motorola 6845. I understand this was used in the CGA? If so, did the 6845 really work bitwise, was the bitwise graphics entirely separate, or did they use changing character sets on the fly to represent different patterns?

8

Basically the 6845 was a bunch of counter registers, which you could program by defining end values (and sometimes start values), and use to generate RAM addresses and CRT sync signals. There was also a separate row address, so the original intention clearly was for character based displays: With a bit of additional components, you'd read some RAM content describing a character into a latch, and then you'd use this to index a ROM describing the pixel pattern for that character. Which you'd load into a shift register and shift out to the video DAC.

But of course then people also thought of ways to use this to display bit graphics. E.g. with a "character height" of 1, and no ROM access, and piping to RAM contents directly out of the shift registers. Or other variants for color.

And you could have configuration bits that control which variant of external components to use (with ROM lookup, without ROM lookup, with color table lookup).

And so, and so on. Bit the differences was all in the additional components, so "the 6845 worked bitwise" etc. doesn't really make sense.

The chip was quite successful, and used in many different ways, and the registers used ended up in the CGA, EGA, VGA etc. cards (with various extensions), and today's graphics card still have a legacy mode with this register layout. But the 6845 by itself still only is a bunch of counters.

In the 6845 data sheet, there's an example for additional components to create a character-based display, and you can read up on the details of operation.

  • Most excellent. So was memory bandwidth a problem if you did things bitwise? Or did it include some sort of "stuffing" system? – Maury Markowitz May 13 at 13:54
  • 2
    The "stuffing" system was the shift register I mentioned - RAM wasn't fast enough at that time to read memory every pixel (say, for 80x25 characters with 8x9 pixels per character), so e.g. you'd read 8 pixels at once, and then shift them out. Same for bit graphics. – dirkt May 13 at 13:57
  • The 6845 was limited to 127 rows per screen, so a character height of 1 wouldn't work. Instead, 6845-based bitmap displays would use the 6845's row output to select among several partial bitmaps of 127 or fewer lines each, which would then be displayed interleaved. – supercat May 13 at 21:20
  • On some machines that use the 6845 - certainly the Amstrad CPC and the Acorn BBC Micro - it's possible to get past the 127 line limit by changing register values mid-frame. I'm not sure how feasible that would be on a PC with a CGA card though. – Matthew Barber May 14 at 6:36
  • @supercat: I vaguely remember that some bitmap graphic modes worked by setting character height to 1; not sure about the context (it may have been a modified 6845 design that has become part of an integrated graphics card, with the total line counter width increased). Anyhow, the alternative is to set it to a power of two, and use the row address pins to address the RAM. – dirkt May 14 at 6:40
6

CGA and Hercules Graphics use the 6845. In graphics mode, each pixel is controlled individually, with no involvement from the character generator.

Graphics mode is controlled by bit 1 of the 03D8h control register; when it’s set, the framebuffer is treated as containing bitmap information, and when it’s cleared, the framebuffer is processed by the character generator. The bitmap layout in CGA isn’t linear; even rows come first, followed by odd rows (offset by 8 KiB). Pixels are packed, four pixels per byte in low resolution, eight pixels per byte in high resolution. Hercules has a similar interleaved layout, with four banks instead of two.

This page has lots of details on CGA.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.