MARCIN RUSINOWSKI — ONLINE SINCE 90s MAC OS · C++ · UNREAL ENGINE EN · PL*
Retro — ← back to Retro

What's hiding in the mysterious code shown in Terminator?

2020-08-31

Fans of every brand have stories that glorify the people or things they're obsessed with. I'll tell you about my disappointment with Steve Wozniak some other time — but today it's about the mysterious code shown on the T-800's HUD in Terminator. I won't hide it: I like the Apple II, I grew up on the Atari 800XL, and Terminator is part of that same childhood.

The film hit theaters in autumn 1984, right at the October–November boundary. What makes it interesting is that this iconic code shows up across several scenes — and fans have long attributed it to Atari computers.

One thing is certain: the code comes from a MOS 6502/65C02 processor*, given the distinctive mnemonics.

The code compiles to address $4000 — nothing special there. But we do have three pointers worth looking at.

AUXMOVE and the zero-page variables

There's `AUXMOVE` at address `$C311`, plus three zero-page variables — A1, A2, A4 (`$3C`, `$3E`, `$42`). Then there's `VTOC` — Volume Table of Contents, a name that shows up in more or less every disk operating system as the way file locations are tracked across sectors and tracks. In Polish that's roughly "root directory plus file allocation table."

Start with the first pointer. `$C311` — on Atari, there's no ROM routine that actually lives at that address. One byte lower, at `$C310`, you land in the middle of a ROM routine that references DOSVEC, but a call to `$C311` makes no sense at all on Atari. On an Apple II with an 80-column card (in practice, an auxiliary RAM card), though, that's exactly the system area containing the routine. For anyone curious enough to dig further, here's a good source:

You use the AUXMOVE routine to move data blocks between main and auxiliary memory, but the task still remains of setting up the routine so that it knows which data to write, and where to write it. To use this routine, some byte pairs in the zero page must be setup with the data block addresses, and the carry bit must be fixed to indicate the direction of the move.

So this code can run on an Apple II with an 80-column card (64K), most likely an Apple IIe or newer with 128K of RAM — but definitely not an Atari. Plenty of people fell into this trap, including the now-defunct Dutch Atari Portal.

What the code actually does

What does the code do? It's a program that sets up a RAM disk in the Apple IIe's expanded memory — even back in the 1980s it was possible to use up to 1MB of RAM, banked of course, since the MOS 6502 can't address more than 64K at once.

Key Perfect was a program used to generate checksums for listings published in the magazine. On the right side of the screen you can see a generated checksum table for the file `OVLY.OBJ` — a 16-bit checksum for every `0x50` bytes, produced by that same program. On the left is the listing meant for the Apple II's built-in monitor, which lets you enter hex codes directly into memory.

What's in this particular code? It's a fragment of a program that displays a slideshow in Double-Hi-Res mode — 560×192px monochrome, or 280×192px in 16 colors, which, thanks to the color-mixing artifacts the mode produces, effectively gave you 140×192px — loading bitmap images off a floppy disk.

Where the mnemonics actually come from

So where do these mnemonics come from, and where can you find the published source code? This is where it gets genuinely interesting: it looks like the code was added to the film at the very last minute, because it comes from the August and — get this — September issue of Nibble magazine's Apple II coverage. In other words, this was done right before the film hit theaters. And the checksums don't even come from the original listing — they come from a correction printed a month later, because the original publication shipped with an error.

Nibble was one of the most significant magazines published in the 1980s dedicated to the Apple II. Unfortunately, its archives have become very difficult to access since the publisher stopped maintaining an online presence.

Terminator is, without question, an iconic film of the 1980s. Doubly iconic for me — unofficially inspired by Harlan Ellison's short story "I Have No Mouth, and I Must Scream."


* MOS, not Motorola as I originally wrote — a Freudian slip. I meant the Motorola 6800, which the MOS 6502 was "based on" — some even say stolen, copied, but above all stripped down by one data register and one index register compared to the 6800. You probably know the story: the team that worked on the Motorola 6800 left in 1974 for MOS Technology, which would shortly become Commodore property after Jack Tramiel decided to buy it — the same Jack Tramiel who would later buy the failing Atari from Warner Bros. Another story from the industry about engineering teams moving from one company to another. The same thing would happen again between Commodore and Atari: Tramiel took the team working on a 16-bit computer under the Commodore banner with him, and finished it — very quickly — under the Atari banner instead.