1986 Β· Mastertronic

Prospector Pete

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

Play the whole game in your browser, start on any of its sixteen levels, and see how this port was checked against the Commodore 16 original.

Loading the game's bytes…
Start on
  • ← β†’ ↑ ↓ dig and climb
  • Space lays a stick of dynamite, and starts a game
  • Enter on the title switches between joystick and keyboard
  • Esc goes back to the title
  • A S P L are the game's own keys, with the keyboard chosen

The game's own screen, drawn from the port's memory as TED would draw it, line by line. The arrows and Space are the joystick in port 2, or the game's own keys when the title is set to the keyboard. Start on begins a new game on that level the way the title does: the page taps right on the title until it shows the level, then presses fire.

01 Β· The port

Every routine of the game, checked against the original

The game is a 6502 program of 7,067 bytes of code. The port is the same program written again in JavaScript, one function for each routine the game calls and for the two places where one routine jumps into another's end, 79 in all, reading and writing the game's variables at the game's own addresses. The page runs only the port: the game's code is in the tests, as the original the port is held to.

CheckWhat it showed
Each routine aloneSeven test files call 67 of the port's functions and the game's own routines on the kit's 6502 simulator from the same state, 131,250 cases in all, and compare every byte of memory each one leaves, its writes to TED in order, and the registers it hands back. The states are 432 moments of play saved on every one of the sixteen levels, with the registers, variables, and controls changed at random. The other 12 functions, five small look-ups among them, run inside the routines that call them and in the lockstep.
The whole game in lockstepThe port runs beside the game's own code on the kit's Commodore 16, from the game's first instruction, and the two memories are compared at the start of every pass of the main loop. Four sessions of 12,000 frames each, about four minutes of play apiece, made 26,409 passes with every byte the same at each one. A scripted player drives both: on the title it changes the level, switches the controls, and types a name for the high scores; in play it moves the stick, or the keys, at random and lays dynamite now and then. One game is left with ESC, in another a level is finished, and in a third the score is high enough for a name in the table.
The interrupt's bytesThe game's main program reads eight bytes that the interrupts write, among them the frame counter and the controls. Where the C16 could take the interrupt between two of those reads, the lockstep gave the port the values the game read, so the check holds the port's logic and not the moment an interrupt happened to come.
The paceThe port executes no instructions, so the page charges each stretch of the main program and of the interrupt, and each call it makes, the cycles they cost the game, fitted on the kit's C16's timings of three of the sessions, some 500,000 stretches. Six routines the fit could not price, most of them run while the mine is built with the screen off, were timed alone, 2,000 calls each. On the fourth session, which the fit never saw, the page's cycles for its stretches are 1.0 % from the game's. The page's own test plays it beside the C16 from the same first instruction: level 1's first pass comes 146 frames after fire, the C16's 145, and in play both run 200 passes in 200 frames.
The listingPorting a routine means reading every instruction of it. One comment was wrong, the one on what the start-up's write to $FF13 does to the clock and the ROMs, and it has been corrected in the Source code tab.

02 Β· Differences

What differs from a Commodore 16