Mode X

Mode X

My son has been struggling to memorize his math facts (addition, subtraction, and multiplication tables) at school.  He is obsessed with hockey – so I took a couple of nights last week and hacked together a simple math quiz JavaScript to help him practice.  After answering one-hundred problems, he earns three minutes of ice time (you need a keyboard to play).  It was a fun diversion from work – and it reminded me how/why I ended up getting into computers in the first place – games.

But not just any games.  I grew up in the golden age of side-scrollers, and I idolized Apogee games¹.  Apogee published games such as Commander Keen, Duke Nukem, and Secret Agent.  Apogee would typically split the games into three parts and publish the first part free on the Bulletin Board Systems.  If you liked it, you could mail in a money order to get parts two and three.  In theory, it is a great system – but the cross-boarder part made it a bit too difficult for a young kid from Canada to navigate – so I only ever got to play the first part of the games.

By the time Apogee and Epic were publishing these side-scrollers, I had moved beyond coding in BASIC and Pascal and started teaching myself C.  However, I could never produce anything that could scroll smoothly using Borland’s Graphis Library.  That is until I discovered Mode X.

In a July 1991 issue of Dr. Dobb’s Journal (that I somehow managed to get a copy of in rural Ontario – thanks Dad!), Michael Abrash wrote about an alternative graphics mode for IBM VGA graphics hardware he coined Mode X.  Mode X was a variant of VGA Mode 13h that had five significant advantages that Abrash highlighted:

  1. The 320x240 resolution had a 1:1 aspect ratio which meant that the pixels were “square.” This made drawing things like circles a bit easier.
  2. The resolution enabled “page flipping” (we call it double buffering today) – meaning you could draw on a “second” page of video memory while the first was being displayed and swap the images.
  3. VGAs plane-oriented hardware could be used to process pixels in parallel (improving speeds for certain operations by 4x)
  4. Mode X was a planar video mode – organizing video memory so that each pixel was represented by a byte.
  5. There is more than enough video memory off-screen to store tile and sprite images for easy access (even with double buffering).

It took me a long time to dig in and understand how to make use of Mode X – but I eventually managed to get my side-scrolling engine to work and wrote a bunch of corresponding tools (tile editors, sprite animators, level designers, etc.)  About the only thing I never really did was write and release a proper game on my engine - it turned out my passion was for building the tools and not the games.

The world mostly moved on from side-scrollers, with games like Doom and Quake totally dominating the PC market.  But I still love the simplicity of hopping from platform to platform in a two-dimensional world!

Did you ever code for Mode X?  Share my love for two-dimensional platform games? I would love to hear your thoughts in the comments section below.  

Be Happy!

Like this post?  Please consider sharing, checking out my other articles, and subscribing to my weekly Flegg’s Follies newsletter for more articles on software engineering and careers in tech.

Footnotes:

  1. Apogee was just the game publisher for some/many of these titles.  Commander Keen, for example, was actually written by Hall, Carmack, and Romero from id Software that would later become very well known for their Doom and Quake franchises!


Please note that the opinions stated here are my own, not those of my company.

I coded an x86 assembly graphics library against that mode. Sadly I didn't know about the page flipping feature and spent an insane (and apparently pointless) amount of time trying to unsuccessfully eliminate tearing 🤪 This is what happens we you don't have Stackoverflow...

Mode X was great! Wrote my own graphics library in a mix of Pascal & assembly!

To view or add a comment, sign in

More articles by Brett Flegg

  • Getting Old(er)

    When I first started my professional career, it was hard to envision what it would be like to have a life-long career…

    7 Comments
  • A Tough Year to Graduate

    Summer internships are wrapping up, and rising seniors¹ are heading back to school for their final year. All signs…

    3 Comments
  • The Joys and Sorrows of Soft Delete

    If you are browsing the ConfigMgr database schema (a perfectly normal Sunday afternoon activity for at least some of…

  • Dress like DJam Day

    I am on vacation this week, so just a super short article to remind everyone that this coming Saturday, August 13th is…

    5 Comments
  • Synthetic Transactions

    At Google, we call them probers; at Microsoft, they are called runners; more generically, they are synthetic…

    16 Comments
  • Seagull Management

    One of the favourite parts of my job that the pandemic took away was the chance to walk through team rooms at the end…

    6 Comments
  • Consistency Checkers

    In my article on queues, I alluded to one of the mistakes I often see developers make in modern microservices design:…

    1 Comment
  • Optimal Stress

    In this week’s article, I will discuss stress and its relationship to productivity. A couple of important disclaimers:…

  • When to use a Queue

    I conduct many systems design interviews, and I have recently noticed that candidates seem to have an unnatural…

    4 Comments
  • The Sun Never Sets on Software Development

    Heads-up. If I am interviewing you for an L7 product management position at Google, I will probably ask how you would…

    4 Comments

Others also viewed

Explore content categories