First post, by Jinxter
- Rank
- Member
I've been working on a DOS TSR called **CGA2VGA** that gives CGA composite games 16 colors on any VGA system. I thought I'd share it here and see if anyone has ideas on the problems I've hit.
### The goal
I know that many games designed for CGA composite also have EGA or VGA modes — those are obviously better off using their native support. The goal here is specifically for games that are **CGA-only** or **CGA composite-only** — games like Hard Hat Mack, Bruce Lee, and many others that have no EGA or VGA option at all. For these games, CGA composite was the best display option available at the time. On a VGA system without a composite output, you're stuck with 4 RGBI colors.
To be clear: the goal is **not** to mimic how these games look on a CRT composite display — no blurring, no blending, no NTSC simulation. The goal is to provide a clean, **pixel-perfect 16-color display** on VGA, even though the games were never designed for it. Each CGA nibble maps directly to one of 16 colors. It's a reinterpretation, not an emulation.
### How it works
The idea comes from the Olivetti Prodest PC1, which has a V6355D video chip that mirrors the CGA framebuffer and reinterprets each nibble as a 16-color palette index — giving CGA games 16 colors with zero CPU overhead. My TSR does the same thing in software:
- Hooks INT 10h to intercept CGA mode sets (modes 4, 5, and 6)
- Sets VGA Mode 13h behind the scenes
- On every INT 08h tick (~18.2 Hz), converts the CGA framebuffer at B800h to VGA pixels at A000h using a 256-entry lookup table
- Each CGA byte is split into two nibbles, each nibble maps to one of 16 colors
- Graphics Controller register 6 is set to 128K memory map so both A000h and B800h are accessible simultaneously
- CRTC registers are saved at Mode 13h setup and restored every frame, because CGA games reprogram them directly
It includes four palettes (two curated, two reference — based on reenigne's composite model and Nerdly Pleasures' artifact color chart), auto-selected by video mode. Hotkeys let you switch palettes and toggle VSync on the fly.
Requires a 386+ with VGA. Written in NASM, builds to a 3.3KB .COM file.
### What works
Tested on real hardware:
- **West PC** (386-40, Trident TVGA 9000B ISA) — Planet X3, Hard Hat Mack, Flight Simulator 3, King's Quest 1 & 2, Zak McKracken, Bruce Lee, Frogger 2, NM-Pinball all work
- **WIC PC** (Pentium 200 MMX, ATI Mach 64 PCI) — all of the above plus Commander Keen 4, Battle Chess
- **IBM ThinkPad i1411** (NeoMagic NM2160) — Planet X3, Hard Hat Mack, Bruce Lee, King's Quest 1, Tapper
Zak McKracken, Bruce Lee, and the Sierra AGI games are probably the best results — they look like they were meant to have 16 colors.
### Problems I haven't been able to solve
**1. Games that bypass INT 10h**
Ms. Pac-Man and California Games crash. They set the video mode using direct port I/O instead of INT 10h, so the TSR never gets a chance to set up Mode 13h. Is there a practical way to detect CGA mode sets that go around the BIOS? I've considered hooking the CGA register ports, but that seems impractical without V86 mode or a hardware trap.
**2. Cirrus Logic VLB cards**
Both the CL-GD5424 and CL-GD5428 show a garbled display. The problem is that I set GC register 6 to 00h (128K memory map) so that both A000h and B800h are visible. Cirrus's display engine apparently can't render chain-4 Mode 13h correctly with that memory map setting. Has anyone dealt with this? Is there a Cirrus-specific workaround, or is this just a hardware limitation?
**3. Stuttering**
Even with VSync waiting before each frame conversion, some games show visible stutter. The conversion itself takes a measurable chunk of time (~20ms on a 386), and if it overlaps with the game updating the CGA framebuffer, you get tearing or partial frames. I'm not sure if there's a better synchronization approach.
**4. Boulder Dash (and probably others)**
Black screen, but music plays. I suspect it uses a non-standard VRAM layout. Anyone know the details of how Boulder Dash organizes its video memory?
### Source and screenshots
Everything is on GitHub with real hardware screenshots:
https://github.com/RetroErik/CGA-Composite-to-VGA
Any input, ideas, or testing on different hardware would be very welcome. C
Check out my YouTube channel: Retro Erik https://www.youtube.com/c/RetroErik
My collection: https://retro.hageseter.com
X: https://x.com/Retro_Erik