1987 · Pandora

Into the Eagle's Nest

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

The whole game, ported to JavaScript routine by routine and run on its own bytes at the C64's pace, from the title to the last mission.

01 · Play

Play Into the Eagle's Nest with the keyboard

The arrow keys are the joystick in port 2, and Z or Enter is its fire button. Fire leaves the title and picks the mission and the floor. On the high score screen the stick moves along the alphabet and fire takes a letter.

Cheats
KeysOn the C64Does
← → ↑ ↓the joystick in port 2walk, a tile every four frames, and aim
Z or Enterfireshoot; leave the title, pick a mission or a floor, take a letter of your name
SpaceSPACEpause; SPACE, the stick or fire goes on
EscRESTOREgive up the game for the high score check and the attract loop

The game as the port runs it, from the tape loader's hand-over to the title and on. The game reads one key, SPACE, by driving one row of the keyboard and reading one column ($5FCB), and the port reads it the same way. RESTORE runs the game's warm start at $8031, which the KERNAL's NMI handler reaches through the signature at $8004. The page takes it only while the game has the KERNAL switched in. With the KERNAL out, the C64 would take the vector in RAM at $FFFA, which holds 0.

02 · Cheats

The game's own cheat, whole or a part at a time

Into the Eagle's Nest has one cheat of its own: type %MAGGOTS!& as your name on the high score screen. The buttons give it to you without the high score, and split it into its three parts. Each can be switched on and off at any moment. With all four off, the game is the original again.

When a floor is built, check_cheat_word ($6F3B) compares the ten characters of the last name typed, at $081F, with the word at $6F31, and sets the flag $603F to 1 if they match or 0 if not. Three places in the game read the flag, and each of the three part buttons does what one of them does with the flag set.

CheatHow
%MAGGOTS!&Sets $603F to 1 at once, and keeps it set when the next floor is built. The game then does the other three itself. Switched off, the page runs the game's own check again, so a name typed as the cheat word still counts.
No hitshit_the_player ($639F) returns without adding a hit, as it does when the flag is set. A guard who walks into you does no harm, and you never reach the fifty hits that end a mission.
Full ammunitionAfter the game stamps the player into the map ($5B1B), the rounds at $02BD are put back to 99, which is where the game's cheat writes them.
Always a keyThe game's state routine ($5BBA), which the interrupt runs every frame of play, puts a door key in hand ($02AC = 1), as it does when the flag is set. A door uses the key up and the next frame brings it back, so every locked door opens.

03 · The port

Every pass checked against the game's own code

Nothing on this page emulates a 6502. The game is written out in JavaScript, one function for each routine of the listing, in nine files under reference/: the main loop and its interrupt, the attract screens and the high score table, the title, menus and briefings, the mission's set-up, the pickups, the game's state and messages, the guards and the prisoner, and the floor builder. It runs on the game's own 64 KB, loaded from the bytes the Source code tab shows, and every variable stays where the game keeps it: the floor's map at $9000, the guards' list at $8100, the tile grid at $5C22, the score at $02C2.

test_play.js runs the port beside the game's own code on the kit's model of the C64, from the hand-over, with the same input to both. The port has no stand-ins: a call to any routine of the game's that it had not written would throw. At the start of every pass of the main loop at $4871 the two memories are compared, and so are colour RAM and every register written to the video chip and the SID. Out of play, where no pass begins, the comparison is made at checkpoints in the title, the menus, the briefings and the end screens. In play the input comes from a player that searches the floor breadth first for the squares it has seen least, heads for a key, a pickup or the lift, and fires at a guard or a chest ahead, and now and then it pauses with SPACE and goes on with SPACE, the stick or fire. Every so often the test forces the next of the four ends of a mission, in both at once, so that it goes through all four: a lift ride, a prisoner brought home, the castle destroyed and the game over. A third session goes round the attract loop before it starts, and holds the stick still and then moves it on each screen between missions. The page's own runtime then runs alone for 20,000 frames with SPACE, RESTORE and every end of a mission, and must never stop. In a second session the mission's prisoner is put on the floor play starts on and moved beside the player, so that his own code runs.

The guards' and the chests' dice come from the SID's noise generator, read at $D41B. On the page that is a model of the SID's 23-bit noise register, stepped as the voice's oscillator runs. The game builds its table of 256 dice in a loop of 14 cycles a read, so neighbouring dice are alike, and the page keeps that pattern. Over ten tables the model gave one chest in seven jewels and one in ten explosives, as the game did in VICE with the SID on.

The page keeps the C64's pace by keeping its clock. Between two of the port's checkpoints the clock moves on by the average of the cycles the game's own code took over that stretch on the kit's machine, with its interrupts taken out. The delays that hold a screen name their own cycles, a turn at a time. The clock runs the raster interrupt on its line, held back while the game has interrupts off. The game does its work in that interrupt, and how long the work takes depends on the play: how many guards are near enough to take a step, and which shots are in the air. So an interrupt moves the clock by a base for its state plus a cost for each of the port's routines it called. Those costs were fitted, none below zero, to 6,809 interrupts of the test's two sessions, and their total comes within a hundredth of a percent of the game's.

The test then runs the page and the game from the hand-over with a stick that moves at random, input the costs were not fitted on, for 4,000 frames. On 28 October 2026 the page reached play at frame 692 and the game at frame 694. In play the main loop, which only waits for the interrupt, went round 1.5 % fewer times a frame on the page than on the C64. The guards, the shots and the player are all moved by the interrupt, a frame at a time, so they keep the C64's time.

The screen is drawn by the site's model of the video chip from the port's memory, with each write to the chip at the line and cycle where the clock stood, and each change to memory where the game's code made it. The sound is the port's writes to the SID, in twelfths of a frame, played through the site's model of the SID.