Hercules Graphics: High-Res for the Masses
The Amber Glow
In 1982, buying an IBM PC involved a painful compromise. You had two choices for your video card:
- CGA (Color Graphics Adapter): You got color, but the text was ugly, blocky, and hard to read (8x8 pixel font). The maximum resolution was 640x200 (2-color) or 320x200 (4-color).
- MDA (Monochrome Display Adapter): You got beautiful, crisp text (9x14 pixel font) ideal for word processing, but it could not display graphics at all. No charts, no games, just text.
Van Suwannukul, a student in California, wanted to write his doctoral thesis in the Thai language. The MDA card couldn’t render the complex Thai characters. He needed high-resolution graphics, but he didn’t want to sacrifice the crispness of the monochrome monitor. So, he founded Hercules Computer Technology and built the Hercules Graphics Card (HGC).
The Best of Both Worlds
The HGC was a stroke of genius. It was electrically compatible with the IBM Monochrome Monitor (using the same 9-pin TTL connector and 18.432 kHz horizontal sync). In text mode, it behaved exactly like an MDA card. But Suwannukul added a “Graph Mode”. By flipping a bit in the configuration register, the card re-purposed the video memory to drive a bitmap of 720x348 pixels.
This was stunningly high resolution for 1982. It was nearly double the vertical resolution of CGA.
- Lotus 1-2-3: Supported HGC immediately. Suddenly, accountants could see their spreadsheets and their pie charts on the same sharp screen.
- Microsoft Flight Simulator: Added support, allowing for a crisp (albeit black and white) cockpit view.
The Dual-Head Standard
The HGC had another accidental superpower. The IBM PC architecture assigned specific memory addresses to video cards:
- CGA/EGA/VGA:
0xA0000or0xB8000. - MDA/Hercules:
0xB0000.
Because these addresses did not overlap, you could plug a CGA card and a Hercules card into the same motherboard. This became the standard setup for professional software developers.
- Monitor 1 (CGA/VGA): Displays the game or application being tested.
- Monitor 2 (Hercules): Displays the CodeView debugger or Turbo Debugger.
If the game crashed the graphics adapter, the debugger screen on the Hercules monitor remained active, allowing the programmer to inspect variables and find the bug. This dual-monitor capability wasn’t matched by Windows until nearly 15 years later.
Memory Interleaving
To save money on memory controller logic, the Hercules card used an interlaced memory layout similar to CGA, but more complex. The 348 lines were divided into 4 “fields”.
- Line 0 is at offset 0.
- Line 1 is at offset 0x2000.
- Line 2 is at offset 0x4000.
- Line 3 is at offset 0x6000.
- Line 4 is at offset 90 (next byte after line 0).
This made plotting a single pixel computationally expensive, as you had to calculate which bank the line belonged to.
Code Snippet: Plotting a Pixel
// C Code for Turbo C
// Video Memory starts at B000:0000
char far *HGC_MEM = (char far *)0xB0000000L;
void plot_hgc(int x, int y) {
// 1. Determine which of the 4 banks the line is in
// Bank 0: Lines 0, 4, 8...
// Bank 1: Lines 1, 5, 9...
int bank = y % 4;
// 2. Calculate the offset within the bank
// Each line is 90 bytes wide (720 pixels / 8 bits)
// Bank offset is 0x2000 (8192)
int offset = (0x2000 * bank) + (90 * (y / 4)) + (x / 8);
// 3. Create the bitmask (0-7)
// Pixel 0 is the High bit (0x80)
unsigned char mask = 0x80 >> (x % 8);
// 4. OR the byte into memory
HGC_MEM[offset] |= mask;
}
SIMCGA: The Poor Gamer’s Hack
By the late 80s, many gamers had cheap monochrome clones with Hercules cards, but most games were written for CGA.
A cottage industry of “CGA Emulators” appeared, with SIMCGA being the most famous.
These programs used a TSR (Terminate and Stay Resident) to intercept the BIOS video calls. They would:
- Trick the game into thinking a CGA card was present.
- Capture the data the game wrote to the CGA memory (
0xB8000). - On the fly, dither and scale the 320x200 color data into 720x348 monochrome data.
- Copy it to the Hercules memory (
0xB0000).
It was slow and created a “ghosting” effect, but it allowed a generation of kids to play Prince of Persia on their dad’s work computer.