Wednesday, April 15, 2015

CGA in 1024 Colors - a New Mode: the Illustrated Guide

By now you may have heard of the 8088 MPH demo, the winning entry in Revision 2015's Oldskool Demo compo this month.  It's been my pleasure to combine efforts with the likes of Trixter, reenigne and Scali to make it happen - not only did I get the opportunity to work alongside a bunch of extremely talented wizards of code, we also achieved what we set out to do: break some world records on the venerable (and yet much-maligned!) IBM PC, the mommy and daddy of the x86 platform as we still know it today.

One of our "hey, this hardware shouldn't be doing that!"-moments was extending the CGA's color palette by a cool order of magnitude or two.  How'd we pull that off? - reenigne has already posted an excellent technical article answering that very question.  To complement his writeup, I'll take a bit of a different approach – here's my 'pictorial' take on how we arrived at this:

8088 MPH 1K color CGA graffiti
Old dog, posing with new tricks. (Not pictured: blood, sweat, tears.)

The idea that such multi-color trickery was possible came to me some time ago, as I was looking at reenigne's code for patching up composite CGA emulation in DOSBox; messing with that patch during development gave me a much better picture of composite CGA's inner workings.  When I had ironed out the basic concept for this hack, I divulged it to reenigne for 'peer review' and for testing on real hardware.  Soon enough, we had an improved recipe: