Episode 0: PCjr Nostalgia and What I'm Doing with It

Episode 0: PCjr Nostalgia and What I'm Doing with It

Recently I experienced a huge wave of nostalgia for my first computer, the IBM PCjr. This image is forever burned into my mind:

Or rather, something similar to this, because ours had several "sidecar" expansion packs bolted onto the side to increase the memory to 384KB, and it did not have the "chicklet"-style keyboard -- we had the much better keyboard IBM offered as a replacement.

This little guy was brought back to mind after probably 25 years when I installed RetroPie, a set of emulators for old video game consoles, on my Raspberry Pi. After playing through some Nintendo, Sega Genesis and Atari games, I noticed that RetroPie could function as a frontend for DOSBox, allowing me to play all kinds of DOS games from the 80s and 90s. Suddenly Jumpman came to mind:

The first game I played on the first computer my family owned! I remember playing this at 6 or 7 years old. I remembered the thwock sound of the dreaded "dot" zeroing in and launching itself toward Jumpman. I remembered the funny bouncing animation as Jumpman fell to his death. I remembered leaping off a ledge to catch the last donut (apparently they are bombs? Looked like donuts to me at 7 years old!) and complete the level.

 I looked around on the web and found Oldskool's The Jumpman Project. Soon I was playing this game for the first time in more than 25 years. Jumpman reminded me of King's Quest 1, the first of Sierra's great adventure games and a title designed specifically to show off the PCjr's CGA Plus video mode sporting 16 glorious colors at 320x200. Each game brought to mind another... Sopwith... Janitor Joe... Flightmare... I soon found and played them all.

The PCjr also gave me my start at programming. Around age 9 or 10 I was getting into BASIC, discovering how easy it was to change the screen's background color and font color and play rudimentary sounds through the speaker. I designed a simple game to help my brother, 2 years younger than me, learn his multiplication tables. It presented a math problem in the middle of the screen, and if you got it right, the background would change color and present another problem.

I began thinking what coding must have been like in the early 80's. C and PASCAL were around and C++ was beginning to come on the scene, but the PCjr didn't have enough muscle to run the compilers. BASIC was a PC staple, it even came embedded in the PCjr's ROM – but was it powerful enough for serious programming? Jumpman was hand-coded in 8088 assembly, the "bare-metal" language of processors, and you can download the decompiled assembly source – all ten thousand lines of it – from Oldskool's website.

What is it like to code a simple game in assembly? No high-level code abstractions... No bolting on dozens of third-party libraries to handle graphics, sound and input... no organizing your data into variables and structures... in assembly, what you write line-for-line is exactly what the processor does step-for-step.

I wanted to give it a shot. I have no experience in assembly besides a college project long ago requiring us to write a simple calculator -- but I bet some of the guys writing these early applications didn't either. It was new to everyone back then. I'm fluent in high-level languages -- my job is writing touchscreen applications with C#, Android and iOS. But will I be able to shove all that aside and write like a bare-metal coder?

This series is not targeted toward the absolute beginner and it's not a tutorial on assembly language. A lot of steps will be left out, and I expect the reader who cares about this sort of thing will have a look at all the resources I include with each post and fill in the blanks him or herself (of course I'm always open to answering questions in the comments).

Nor is it targeted at the wizened old UNIX-using neckbeard-sporting assembly-language wizard who will no doubt snicker at me for making some of the mistakes I make throughout this series. I started with virtually zero knowledge about assembly-language programming. When I spend time discussing a problem I encountered, it's because I feel like it would be an easy mistake for any assembly-language beginner to make, regardless of skill level in other areas of programming. Assembler is just a different beast altogether.

It's also not a tutorial on game programming. At this point I have no idea what type of game I will end up making. My aim is just to learn how to do stuff on the PCjr -- put pixels on the screen, play sounds from the speaker, process keyboard input, etc. -- in the most intimate, bare-metal way possible.

So let's make something happen. I give you Episode 1: Hello, PCjr!