Aaron Giles

Programming War Stories

Basement-Dwelling Kid Writing Code

I’ve always had a natural affinity and talent for computers, and it all started with video games, specifically arcade games. My first programming efforts were focused on the Heathkit H-89 my dad and I assembled when I was a kid. Eventually I moved on to the IBM PCjr, where I pretty much wrote all assembly, all the time before finally discovering that there were other languages beyond BASIC that performed well enough to write games in.


Video Games

Asteroids, one of my first arcade experiences
Asteroids, one of my first arcade experiences

My first exposure to video games was back when the local 7-Eleven cleared out a corner of space near the front door and filled it with a shiny new Space Invaders arcade machine. Soon afterwards they added an Asteroids cabinet next to it, and it was then that I truly became an arcade game fanatic.

Over the course of the next several years, the 7-Eleven and other local drug stores faithfully cycled in more and more new games, from my all-time favorites—Mappy, Moon Patrol, Elevator Action, Gyrussto less popular games like Popeye and Food Fight, and even really obscure stuff like Nova 2001.

But riding my bike to the store to play games was annoying, and the quarters didn’t last long. I just had to find a way to play video games in my own home.

The Atari 2600, which I sadly never owned
The Atari 2600, which I sadly never owned

Sadly (for me), I was not the first on my block to get a video game console. My best friend down the street got an Atari 2600 for Christmas. I was jealous, of course, but it really meant that I just spent a lot of time over at his house. We played a lot of Space Invaders, Superman, and Adventure in those early days. I especially loved Space Invaders because it reminded me of the arcade.

Mattel Intellivision, my first console
Mattel Intellivision, my first console

The first (and only) video game console I owned as a kid was a nice new Mattel Intellivision, shortly after it was released. I played that machine relentlessly, so much that we eventually had to replace it with a new one a couple years later.

I even managed to get my father hooked on great action titles like Astrosmash and Space Armada. But my most vivid memory is that we would laugh ourselves to tears playing Hockey, running around and checking each other for no good reason.

Of course, every young video game addict’s dream at the time was to make their own video game, and I was no exception. But to do that, I discovered that what I really needed was a full-blown computer….

Heathkit H-89

I can’t remember exactly when we got our first computer, but it was when I was around 10 or 11. My best friend’s dad had an Apple II+, and he was writing video games on it. Worse, my best friend was already busy learning Apple BASIC and 6502 assembly language and writing his own games. I had some serious computer envy as a result.

Yep, this is a Heathkit H-89!
Yep, this is a Heathkit H-89!

So I begged and pleaded with my father (who was himself a mainframe software engineer—think COBOL and RPG) to get a personal computer so that I could learn to program it and make my own video games. Then one Christmas (I think it was Christmas 1980) he did it. He went out and bought a….

….a Heathkit H-89? (sad trombone) What the heck kind of computer is that? I had been thinking more along the lines of an Apple II like my friend had, or maybe an Atari 400. But instead here was this computer that wasn’t even put together yet. Talk about a lack of instant gratification!

Also, understand that my dad is a software engineer—not exactly the kind of guy who wields a soldering iron all the time. But he had done his homework. Building the computer was labor intensive, but it certainly didn’t require an EE degree. And, it saved us some money, which was kind of tight at the time.

So we spent a good month or two assembling it together in our basement nights and weekends. It was pretty interesting stuff, but way over my head at the time. I doubt I was really any help. I just wanted a computer so I could write games!

One of the old games I used to play on the Heathkit
One of the old games I used to play on the Heathkit

The specs on the H-89 were pretty decent for the time: a 2MHz Z80 CPU, 48K of RAM, and a single 100K 5.25' floppy drive. It ran a real operating system: CP/M, not that silly HDOS. But there was one crucial element missing: a graphics mode. All it had was a fixed 80-column text mode with a few pre-loaded graphics shapes in the upper ASCII part of the character set.

Classic book of text-based BASIC programs to learn from
Classic book of text-based BASIC programs to learn from

So how in the world was I going to learn to write video games on a system that had no graphics mode? Well, the short answer is: I tried my hardest. I started with BASIC, typing in programs from those old computer games books that contained page after page of BASIC games that ran on any system. Then I started modifying them to make them better.

But already I knew that real video games were written in assembly language. So it didn’t take long before I bought a book on 8080 assembly language and started learning how to write optimized code. To this day, I can’t really remember any of the games that I ended up writing, but I did manage to master the basic concepts of writing in assembly, which served me very well later.

The IBM PCjr

I wanted a Commodore 64 so bad...
I wanted a Commodore 64 so bad...

I think my dad knew I was never really satisfied with the Heathkit. I could tell that what he really wanted was an IBM PC. Of course, what I wanted was one of those swanky new Commodore 64’s, which ran all the best video games.

In the end, he compromised, sold the H-89, and picked up an IBM PCjr (this was in the days after IBM had replaced the chicklet keyboard with something moderately usable). Finally, I had a real graphics mode, and could get serious about writing games. And I could finally play them as well.

An IBM PCjr, with the proper keyboard
An IBM PCjr, with the proper keyboard

One nice feature of the PCjr compared to a boring old IBM PC was that it had improved graphics (16 color 320×200) and sound (a 3-channel SN76489 sound chip). It was quite easy to type up programs in BASIC to play back polyphonic music on the chip, and that ultimately inspired my 8th grade science fair project, “Music in the Computer Age.”

Typed up a bunch of Bach Inventions for my science fair project
Typed up a bunch of Bach Inventions for my science fair project

For this project, I programmed a couple of 3-part Bach inventions into several different computer systems to compare their capabilities: the PCjr of course, plus the Commodore 64 (which had a SID sound chip), and the Apple II add-on Mockingboard (which had a pair of AY-3-8910’s). The project ended up taking home a superior rating at the state level.

Unfortunately, one of the major problems with the PCjr was compatibility with the original IBM PC. In order to reduce the cost of the machine, IBM removed some “unnecessary” hardware.

One thing that hurt the PCjr’s speed was the fact that video RAM was shared with the main computer’s RAM, meaning that some of the memory bandwidth was taken up by video refresh. As it turned out, this only affected the built-in 128k of RAM; any memory installed above that would be full speed. So it was common to install a DOS TSR that occupied the low 128k of RAM, thus forcing all other DOS programs to run in the upper memory banks that were unhindered by the video system.

Another missing piece of hardware was the DMA controller. This meant that when the PCjr read data off the floppy drive, it sucked it down one byte at a time through an I/O port, instead of letting the DMA hardware transfer the data asynchronously.

Spent a lot of time hacking DOS programs using debug
Spent a lot of time hacking DOS programs using debug

The only problem was that a lot of advanced game copy protection involved talking directly to the floppy controller and using the DMA controller to receive the data. Since there was no DMA controller to talk to, the copy protection failed, and a lot of games that should have worked just fine on the PCjr didn’t. At least until I got my hands on them.

Thanks to good old debug and a knowledge of the low-level systems on the machine, I probably hacked half a dozen games I had bought into submission, rather than taking them back to the store.

All Assembly, All the Time

My first modem was an actual (expensive!) Hayes
My first modem was an actual (expensive!) Hayes

Once I had the PCjr and its graphics mode, I developed quite a few shareware and freeware DOS games and utilities, all written in 100% assembly language. I tried to polish a few of them to “release” status and uploaded them (at 1200 baud) to local BBSes, but I doubt any of them survived to the present day. And the floppies with all my DOS code were lost after I left college.

One of my first games was Rescue, a game where you had to rescue little creatures that were being eaten by marauding monsters. I even designed the graphics myself (frankly I am a terrible artist, but in those days of low-resolution displays, even I could make passable game graphics).

The cool thing about Rescue was the scoring: you didn’t have to rescue all of the creatures, you just had to save more than the monsters ate. At higher levels the monsters would lay eggs, spawning new monsters. In the later levels, you could have a good dozen monsters running around, which got pretty intense. I was always pretty proud of that one.

Spent a good chunk of change on Microsoft’s MASM back in the day
Spent a good chunk of change on Microsoft’s MASM back in the day

Another early game I did was Riské, a version of the board game Risk. My friend and I took graph paper and mapped out the Risk game board into pixels. I then wrote a scan line compressor and code to draw each country. I even wrote a half-decent computer AI for it. The game itself was pretty fun as a distraction, but I don’t think it was really all that popular.

I did all my early assembly programming using the standard Microsoft MASM, but it was very memory hungry on my 128k machine. Then I discovered A86, which was much leaner and had a built-in linker, but cost more than I could afford. So I did what any enterprising high school student would: I wrote my own assembler. In assembly language.

The assembler I wrote was called qasm. It had an expression evaluator, supported reusable local symbols, and compiled directly into a .COM file, much like A86. Looking back on it, that was a pretty hard core project!

High-end Okidata printer I ruined and then hacked back to usefulness
High-end Okidata printer I ruined and then hacked back to usefulness

Probably the best story from my PCjr days was how I saved the day after accidentally breaking our printer. We had splurged and picked up a really nice Okidata 24-pin dot matrix printer to go with the PCjr. It was one of those old models that used a modified typewriter ribbon (I think it was the µ82 as pictured here). When the ribbon was dead, you needed to hook up the new one by carefully threading it through the print head.

One day I was doing this and got too impatient. I ended up bending the pins on the print head, so that everything came out jagged. I knew I was in big trouble unless I could figure out a solution that didn’t involve buying a new printer.

First, I set down and figured out exactly how all the pins were offset. Then I wrote some assembly code to render everything in graphics mode, drawing the text using a font I developed that compensated for the jagged pins. I incorporated that into an INT 17h TSR program so that any DOS program that printed would automatically get my straightened text.

My first “productivity” software was a clone of Borland’s Sidekick
My first “productivity” software was a clone of Borland’s Sidekick

One of the last all-assembly things I wrote was another TSR that allowed you to pop up a file manager, calendar, etc. at any time while running another DOS program. It was essentially a less feature-rich version of Borland’s Sidekick. I submitted it to COMPUTE!’s PC and PCjr magazine, but alas, it wasn’t accepted.

Beyond BASIC

Turbo Pascal, my first compiled language
Turbo Pascal, my first compiled language

As the 1980’s approached their midpoint, it gradually dawned on me that not everything needed to be written in assembly. I knew the standard interpreted BASIC was too slow, so I eventually picked up a copy of Borland’s Turbo Pascal and began teaching myself how to code in Pascal.

I began by writing bunch of utility programs. I was a big AD&D fan at the time, so there were lots of great ideas including random number generators, character sheet printers, character generators, name generators, you name it. It was so much faster to write something quick in Pascal that I’d find any excuse to write something useful.

Temple of Apshai Trilogy showed that Pascal can be used for video games
Temple of Apshai Trilogy showed that Pascal can be used for video games

The turning point for me, though, was when I picked up a copy of the Temple of Apshai Triology for DOS. Having had experience with Turbo Pascal, I immediately recognized that the files ending in .000, .001, etc were program overlay files generated by Turbo Pascal. Wait. So you mean this game wasn’t written in assembly?

I did eventually relent and start writing some games in Pascal. Nothing too intensive, as I recall. There was a simple one-player-versus-the-computer version of Uno. And I remember writing a version of Tetris that ran in text mode, just for fun.

The Amiga 1000, where I spent my AP CompSci days
The Amiga 1000, where I spent my AP CompSci days

But at school I did get a chance to write some graphics-intensive games in Modula-2 (basically Pascal++) on the Commodore Amiga. After realizing that I pretty much knew enough to ace my AP Computer Science exam, my teacher let me party on the Amiga and write games during my senior year of high school.

So I wrote a Gauntlet-style dungeon crawling game in collaboration with my Apple II-owning friend, and also developed a Qix clone. The Amiga was a cool machine, but unfortunately that was the last chance I had to write code for one.


This site and all contents Copyright © Aaron Giles