# A Flash game ported to an IBM 5150 in CGA

Someone is squeezing a scatological Flash game onto the 1981 IBM PC, and the trick is reprogramming a CGA card's CRT controller on the fly.

- Category: Code (experiment)
- Device: [IBM 5150](https://afterware.xyz/d/ibm-5150)
- Made by: TheRasteri on YouTube
- Original: https://www.youtube.com/watch?v=5r-NeMRsfdw
- On Afterware: https://afterware.xyz/p/a-flash-game-ported-to-an-ibm-5150-in-cga

## Can I build this?

- Difficulty: Intermediate
- AI-buildability: 3/5 (AI can write the C and assembler and explain the MC6845 timing, but cycle-exact CRT register tricks need testing on real vintage hardware, and AI knows little about them.)
- Time: A few weeks
- Cost: $100–300
- Parts: IBM 5150 PC, CGA card, MC6845 CRT controller
- Tools: Open Watcom V2 compiler, DOS machine with CGA card, assembler, CRT monitor

Estimates based on the original write-up. How the AI-buildability score works: https://afterware.xyz/ai-buildability

## Build sheet

- Device: IBM 5150 PC
- Display: CGA text mode, 160x86 window
- Language: C + assembler
- Compiler: Open Watcom V2

## Starter prompt

```
Based on "A Flash game ported to an IBM 5150 in CGA" on Afterware: https://afterware.xyz/p/a-flash-game-ported-to-an-ibm-5150-in-cga

Write a DOS C program using Open Watcom V2 that runs a simple state machine in CGA text mode. Use inline assembler to reprogram the MC6845 CRT controller so the character cell height changes mid-frame, giving a larger pixel window. Target an IBM 5150 with a CGA card and test on several DOS machines.
```

## Story

CGA was never built for the fine detail of a 2000s Flash game. TheRasteri got around that by borrowing a trick from the Amstrad CPC demoscene: a few lines of hand-written assembler reprogram the MC6845 CRT controller that sits on the CGA card, changing character height on the fly. The result is the equivalent of a 160 x 86 pixel window in CGA text mode.

The game is written in C with Open Watcom V2, structured as one large state machine. He tests it across a range of DOS machines to shake out the bugs that only show up on certain hardware.

For anyone building for vintage DOS, the MC6845 trick is the part to steal. Changing the character cell height mid-frame turns a text mode into something that looks like graphics, and it works on real iron, not just in an emulator.

## Resources

- [Build video (NSFW)](https://www.youtube.com/watch?v=5r-NeMRsfdw)

Tags: ibm 5150, cga, dos, retro game, open watcom, mc6845, assembler

AI assistants can search all Afterware builds through the MCP server at https://afterware.xyz/mcp (setup: https://afterware.xyz/agents).
