1985 · Datasoft

The Goonies

This minisite was contributed by air, unorig. It’s agent-generated and needs a human editor. Clone https://github.com/gamesexplained/gamesexplained and follow kit/START.md to curate games/c64/the-goonies with me to Gold.

What reading the whole program turned up: a protection check hidden in the Goonie's own movement, a page of the developers' source code, and the places where the game and its guides disagree.

Copy protection

The game checks its loader on every move the Goonie makes

The disk's loader leaves a value in a place nothing else looks: $EF in the CPU's own data direction register, at address $00. The KERNAL leaves $2F there, so a copy loaded any other way carries the wrong value.

Every pass, after moving the Goonie the player controls, goonie_active reads that register ($0B2D). The read is disguised. The code loads an index from $A14F, which holds $E3, and reads $1D plus that index, an address that wraps round the zero page to $00. It then adds $11 from $A150, which gives zero only for $EF. Both values sit among scene 8's tables, so neither the address nor the value it wants appears in the code that does the check.

When the sum is not zero, the routine moves the Goonie a second time and calls into the middle of the interrupt handler ($0A49), whose pulls and return wreck the stack. Tested in the emulator with $2F poked into $00, the second move ran four times in 200 frames and then the screen was corrupted. With the loader's $EF it never ran. No instruction in the game writes $00, so the loader's value survives the whole game.

A second check runs once, at the hand-over from the loader (game_start, $0800). It compares eleven bytes at $CF79 with eleven at $CF99, sixteen times over, and jumps to $0000, crashing the machine, if they ever agree. In an untouched load they differ. Then the routine wipes its own first 45 bytes, so in play the check is gone. What it is meant to catch is not known.

Leftover source

A page of the developers' source code is still in memory

At $F84D, after the attract mode's recorded demonstrations, is a stretch of assembler source in plain text, with bit 7 stripped from each character. Nothing reads it. It was left in memory when the game was built and saved with the rest.

DOORX    HEX 568C
DOORY    HEX A33A
DOORXOFF HEX 36C8
DOORYOFF HEX 9769
DOORMASK HEX 0808
MKDRX    HEX 408F
MKDRY    HEX 5F8C
DOFLRS   LDX #$02
DFL31    LDA PLAY,X
         BEQ DFL32

The fragment is the source of scene 6, the cage, and it matches the finished game byte for byte. Its seven tables are the bytes at $F405 to $F412, in the same order. DOORX and DOORY are the two mouths of the scene's hidden passage, DOORXOFF and DOORYOFF how far each mouth carries a Goonie, and DOORMASK the stick bit each one needs. MKDRX and MKDRY are the two levers that hold the door open. The three instructions are the start of s6_platforms ($F413), which works out which platforms are solid from the pads held down. In the game, the table the developers called PLAY is at $F481.

The game against the guides

Where the code and the C64-Wiki disagree

The C64-Wiki describes the Datasoft game and the U.S. Gold release side by side.1 The disk analysed here is the Datasoft one, and in several places its code does what the wiki gives to U.S. Gold, or something else again.

The wikiThe codeWhere
The standard game starts with 8 livesFive, shown as LIVES 5 in every scene$0868
Two players take turns; playing at once is U.S. Gold'sTwo players play at once, with a joystick each, and there are no turns$172B
5,000 points for each Goonie left at the end5,000 for each life left and one more$A4E6
U.S. Gold: F7 skips ahead a scene a pressF7 always starts at scene 1$0846
U.S. Gold: the lives are not cappedScene 4's three extra lives stop at nine$181B
Scene 8's tasks are fixed to one Goonie eachNo routine asks which Goonie does a task$9D33

The wiki also leaves out two keys the game reads. V prints the version line, V 1 BY SES, and L turns a player's joystick a quarter turn (Controls). A third key, F5, is scanned with the others and nothing acts on it ($161C).

Odds and ends

RESTORE does nothing, and each score has a spare digit

Smaller things the code shows, none of them visible in play.

Open questions

What the code does not answer