Thriller · for anyone who wants to see how it was doneThe program listings

About the listingsTitle programCard programThe woodsThe graveyardThe mansionPictures, tunes and sounds

Games of 1984 were often passed around as listings: pages of program you could read, type in, and change. In that spirit, here is all of Thriller, in the language it was designed in, with comments written for a reader who has never seen it before.

Never compiled. These listings were written as the design of the game, in Action!, within what a 48K Atari 800 of 1984 could do. They have not been through the Action! cartridge or run on an Atari. What plays on the game page is a line-for-line translation into JavaScript, made by hand, PROC for PROC. Expect small mistakes a compiler would have caught, and note the parts marked NOT WRITTEN: loading one program from another off the disk.

The language

Action! was a programming language for Atari home computers, sold on a cartridge from 1983. It looks a little like Pascal or C: PROC starts a procedure, IF … THEN … FI and DO … OD bracket their blocks, BYTE and CARD are numbers of one and two bytes, and a ; starts a comment. It compiled to fast machine code, which is why it suited games. A few things to know when reading:

x==+1add 1 to x (any operator works: ==-, ==& and so on)
LSH, RSH, &, %, !shift left, shift right, AND, OR, exclusive OR
BYTE consol=53279a variable placed at a fixed address, here one of the Atari’s hardware registers, so reading it reads the hardware
Poke(a,v), PokeC, Peekwrite or read memory directly: how colours, the display list and the players are set up
MoveBlock, Zerocopy or clear a run of bytes: how a figure is drawn into player memory
{inv}…{/inv}our own mark for text typed in inverse video, which a web page cannot show otherwise

Five programs and how they pass the baton

The game is too big for one program, so it is five, each loaded in turn. They hand over through a few bytes in a quiet corner of memory (page 6) that survives from one program to the next.

ListingFileLinesPROCsWhat it does
The title programTHRILLER.ACT102625The front screen with its three little pictures, the moonwalker under them, the loop of digitized sound, and the verses that climb the screen when a game ends. It also keeps the score, the lives and the high score between screens.
The card programTHRILLERC.ACT1604The card shown before every screen: the night, the screen, the score and the lives, with a short piece of digitized sound when a game opens. It is a program of its own because that sound would not fit in memory beside the front screen’s.
Screen 1: the woodsTHRILLER1.ACT142142The werewolf, the girl, the scrolling woods and the house. The woods are a wide map of characters that slides past; the wolf and the girl are players laid over it.
Screen 2: the graveyardTHRILLER2.ACT120840The graveyard, the ghouls that climb out of it, the dance and the dawn. One screen, no scrolling, up to eight ghouls drawn as characters and two people drawn as players.
Screen 3: the mansionTHRILLER3.ACT197561Twelve dark rooms joined by doors, a lamp that lights a little of one, her voice, the ghoul pack, lightning, and lightning in a bottle. The longest of the five.
Pictures, tunes and soundsSHAPES.ACT171The INCLUDE files: every character and player shape as rows of bytes, the three tunes as lists of notes, and the four pieces of digitized sound. The shapes and tunes are written out by small Python programs from drawings made of letters, so nobody typed these numbers by hand.
SHAPES1.ACT100
SHAPES3.ACT67
TITLE.ACT108
MUSIC.ACT29
MUSIC1.ACT29
MUSIC3.ACT29
LAUGH.ACT553
LOOPER1.ACT516
BUMPER.ACT403
HAPPY.ACT412

The order of play: the title program shows the front screen, then runs the card program, which shows the card and runs a screen. When the screen is won or the game is lost it runs the title program again, which reads the shared bytes to see what happened and carries on from there.

AddressNameWhat it holds
$6F0chain1 while a game is going on; 0 when a screen was started by itself
$6F1winsscreens won so far this game; the night is wins / 3 + 1
$6F2liveslives left
$6F3–$6F4scorethe score, two bytes
$6F5result1 the screen was won, 0 the game is over
$6F6nextthe screen to run: 1, 2 or 3
$6F7–$6FAhi, lastthe high score and the last game’s score
$6FBmagica marker that says the high score has been set up since power-on
$6FCbonus1 when a bonus life has just been earned, for the card to announce

How the pictures are made

Scenery, ghouls and furniture are characters: the Atari lets a program redraw its own letters, and in its four-colour character mode each redrawn letter is a tile four dots wide and eight high. The hero, the wolf and the girl are players, the Atari’s name for sprites: strips eight dots wide that lie over the picture and are moved by writing one byte. He is three players stacked for three colours; she is the fourth player and the four missiles. The byte tables are on the pictures, tunes and sounds page.

How the sound is made

The tunes play through the Atari’s four sound channels, a note at a time, from lists of notes. The laugh and the other short pieces of digitized sound are played the only way a 1984 Atari could: by writing a volume level to the sound chip four thousand times a second, which keeps the processor so busy that everything else on screen has to be fitted in between samples. The listings say where that would be rough on a real machine.

The translation, and the tools

What actually runs on the game page is a second copy of each program, translated by hand into JavaScript: one function for each PROC, with the same names. They are plain files too: thriller0.js (title), thrillerC.js (card), thriller1.js, thriller2.js, thriller3.js. Whenever the game changed, the Action! listing was changed first and the translation second.