The Dead Code Diaries

When you find a weird program from four decades ago and realize that it's yours.

This is a cool video that someone recently took of a tardigrade walking. These little guys, sometimes called “Water Bears” are microscopic creatures known for their heartiness and ability to survive in extreme climates. The internet seems fond of tardigrades, and I always seem to see stories and memes involving them. But the thing about them that stuck in my head was how they can remain dormant for decades without food or water, and then be revived as if nothing had happened.

I thought a bit about what it would be like if people could do that:

“Susie this is your Uncle Joe. You never met him because he went dormant ten years before you were born. We’re cooking a big dinner tonight though because he just woke up and he hasn’t eaten in forty years.”

But more appropriately for the article, I also thought about how software programs are like tardigrades. They could sit around dormant somewhere for decades, but then be revived, and run like they were just written.

I admit that this is kind of a fascinating topic for me, In my article about old storage systems, I speculated that there may be some old mainframe computers out there somewhere with non-volatile core memory in them, that are holding the remains of the last programs those machines ever ran.

Other people too seemed to like this idea, saying it would make a good premise for maybe a sci-fi story or something. I’d love to read that someday, or maybe I’d like to write it. But for now, I can tell those interested of a real-life encounter with this dormant program phenomenon that I had recently.

One day last fall, I was looking through a pile of old stuff I had. Now if there were a packrat scale from “0” to “F”, where “0” is Tibetan Monk and “F” is Subject of an episode of “Extreme Hoarders”, I would rate myself maybe a “B” — Retaining an above-average amount of junk, but not worryingly so. (Non-nerds, sorry but my packrat scale seems to be in hexadecimal) There are a lot of old computers and things I used to own that I wish I had hung onto, and also a lot of stuff I saved that is probably doing me no good.

In this case, I had come across something I pack-ratted that I did not even remember: An issue of (apparently rare) Popular Computing from 1982, which I could probably spend a whole article going through because it is a nostalgia goldmine, containing articles such as “Telecomputing” and “Beyond VisiCalc”. But the thing being featured today isn’t the magazine, but an old, two-page dot-matrix printout stuck between the pages.

It was clearly a BASIC program but I did not recognize it immediately, thinking it may have been something I had at one point typed in from a magazine, perhaps even the Popular Computing issue it was in (for non-old-timers, it was fairly common back in the day for magazines to publish code printouts, that users would then type in by hand to run on their computers)

But a look at the first line of the program surprised me.


The mystery program was my own, and I had no specific memory of writing it. In general though I did remember a time in my teenage years when I was learning to program, writing games for the TRS-80 that I had access to thanks to a generous neighbor (something I briefly discussed in my Radio Shack post). I just didn’t remember this one at all.

I thought it was pretty cool though, that I still had a program I wrote 40 years ago. So I sent a text to my friend Keith telling him about it, eliciting this response:

And Keith knew exactly what he was doing here when he replied. We had been friends a long time, and I am sure he was aware a challenge like this would not go unmet. In what is probably another good example of last week’s topic, pretty much all real work then stopped, while I tried to figure out this program of mine.

A hardcore vintage computing guy probably would have had an actual old TRS-80 on hand, but that would have required a packrat level of “C” or “D” for me, and I was similarly not inclined to go out on eBay and get one (although confession: always tempted).

Fortunately, there was a really good TRS-80 emulator out there called trs80gp, that supports pretty much all the early TRS-80 models. So the easy part of how to run it was figured out at least. Getting the program off of the paper was going to be the hard part.

We were talking about under 200 lines of code, so I could have just gone old-school and typed it in again. But I was sitting now on top of computing power I could not even imagine in 1981, and it seemed wrong to not go the modern way. So I took some photos of the code, and tried running it through the optical character recognition (OCR) built into Google Photos.

I had fairly high expectations for Google, since it seemed fine at finding picnic tables in my photo collection, and I had been training it for years to find busses and crosswalks. But with simple text, it struggled, and the first attempt produced this:

Then I completed the exercise everyone who has attempted an indoor closeup photo with their phone has done, namely adjusting the lighting one million times to eliminate hotspots and shadows (yeah I know, I should get a ring light, or whatever is in now).

I got it mostly there with some editing work, and loaded it into the trs80 emulator. But there were a lot of weird random characters that were still around and these caused runtime issues, and I soon realized that Oh my God, I need to learn to use the TRS-80 debugger. Again.

Running old programs is one thing, debugging them is another. For some reason the nostalgic fondness wears away faster when you are trying to get something done, but you are used to using tools that were significantly more evolved than 1981 development software had to offer.

This also is when I had that moment you might have had in the past where you looked back at some totally unfamiliar code (or maybe math homework) of your own making and wonder things like:

…What the hell was I doing here? When was it that I actually understood any of this?

It often happens to me with programs I wrote much more recently, in fact. Your own code sometimes can look like something a stranger wrote, sometimes after many years, but sometimes after a frighteningly short period of time even. Finally though after a lot of messing around, it ran! (In retrospect, not really sure it was faster to go the OCR route, maybe typing would have been better, oh well. )

Seeing the game run once again after 40 years of hibernating in a magazine though was very satisfying! Not really much to look at I know. It featured a box, inside of which a 1-pixel ball would bounce around. This was kind of like the game Breakout, which featured a paddle you would use to direct the ball to destroy a wall, in this game replaced with a short vertical block. Most certainly Breakout relates to the origin of the “Breaker Ball” game name (and luckily, I did not call it “Ball Breaker”).

But there was a twist… The ball would shoot little arrows down at you, as it bounced around, and instead of having a paddle to reflect the ball, you could shoot arrows back at it! This mechanic was more like Space Invaders or maybe Galaxian, which was new at the time, and this game seemed to be fusing that mechanic with the Breakout one into a single game.

There were numerous problems with the game, you moved without stopping sometimes, and could not fire while moving. The box and the ball being trapped in it seemed like an unfinished concept - the box was too small, and had no real purpose. But I will give my 17-year-old self a little credit for coming up with a kind-of-new idea, rather than just trying to clone an existing game.

I also had the experience of fixing a few of those bugs in this program, that had been there for four decades, which reminded me of this article I read recently about another developer that fixed a similarly-aged bug in his TRS-80 game code. Something about that is almost weirder than getting the program running in the first place. I guess perhaps it is the suggestion that no program can be truly said to be complete, if even after 40 years it could be updated.

The thing I guess that surprised me the most about the program was what happened when you died. There was a top text banner of sorts that proclaimed “HA HA HA!” and then the program would go into the self-playing, “demo mode” that was a staple of the arcade games of the day. I was clearly influenced by this arcade mechanic and wanted Breaker Ball to feel like an arcade title, because a significant portion of the code seemed to be devoted to the title screen demo mode.

There was even a series of marquis messages that displayed at top, and after a delay destroyed by a ball moving over them from right to left over them. “PLAY BREAKER BALL”, “HIT SPACE BAR”, “GRAPHICS BY NED”.

It seems I was really interested in getting my name into the credits of this game, which was probably wholly unnecessary given the likely players of this game were my parents, or at least people who knew I wrote it. I also laughed a bit at my “Branding” in the opening game prompt:


Of course! I guess I had a high opinion of my programming skills, even though the number of complete programs I had written at this point probably were in the single digits. LOL.

Is There A Takeaway?

I don’t know why it is so satisfying to bring dead code back to life, but it is, and doubly so if it is your own code. That’s my personal takeaway, but I also did try to glean from this old code of mine something about my younger self. What was the same as today? What was different?

Certainly I had learned a lot more about programming over the years, and even if I were to recreate this exact program on that same TRS-80 machine again today, I would probably write better code. More organized maybe, more compact, fewer bugs perhaps. Also, I tend to be better at commenting my code now, but to be fair the PC days of the 80’s punished verbose commenters because comments took up valuable characters, which could add up given available memory was measured in Kilobytes.

You would basically expect someone to be a better coder now though, because if they were not, it means they spent 40 years without really learning anything, which would be a pretty depressing result. The real question was, what was the same? What reminded me of me, and seemed like something I might still do today?

To be perfectly honest, probably the self-promotional aspects of my old code have survived. I still like creating things, and crave being able to create things others also enjoy, whether it is an arcade game or newsletter article. Also, I see a desire there to make something original, and not just create a simple knockoff of something prior. That is a priority that still resonates strongly with me. And with something like 50% of my program devoted to things like the splash screens, I would say there is a general love of that arcade aesthetic evident, which is also an interest that has lasted the decades for me.

So that’s about it, no great insights gained or mysteries solved, beyond getting some closure about what this program I had no recollection of actually did. I am brewing a possible second edition of The Dead Code Diaries for some point in the future however, because we unearthed another sleeping tardigrade (game) that my friends and I worked on quite a while back that was mentioned last article.

I don’t know if my friends will go along with the idea of resurrecting this other 30-year-old game right now, but fairly sure it will run at some point, because there really is no such thing as dead code, you know!


Explore Further

Next Time: If you think getting a bad review at work sucks, try giving one. Some thoughts about surviving a manager job when you are a semi-willing participant coming up in: Being Not-So-Bad at Bad Reviews

The Mad Ned Memo covers topics in Computer Engineering and Technology over the past 40 years. Sign up and get nerdy tales and discussions of computing’s past, present, and future delivered straight to your inbox, and never miss an issue! (See the link for a sample selection of past articles) The Mad Ned Memo is cost-free and ad-free, and you can unsubscribe at any time.

The Mad Ned Memo takes subscriber privacy seriously and does not share email or other personal information with third parties. For more information, click here.