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.

Pete digs for gold under a mountain while a flood climbs the tunnels he has dug. The mine is rolled afresh from the machine's timers every time he starts a life, and a creature with nowhere to go stops the game for good.

01 · The game

Dig out every goodie before the water reaches you

A budget tape for the 16 KB Commodore 16, written in four weeks by Doug Turner of British Software and sold by Mastertronic for £1.99.

The title screen: the credits, the five high scores, the controls and the level, and the scrolling message. Level 1 in play: Pete in a tunnel he has dug, the shaft below him white with water, goodies in the earth and a creature in the tunnel.

The title screen and level 1, in plus4emu. On the right Pete has dug down the shaft and out to the right; the water (white) has filled the shaft below him.

Pete starts each level at the top of a shaft that runs down the middle of a mine 90 cells wide and 20 deep, of which the screen shows 39 columns at a time. He digs wherever he walks, leaving a tunnel behind him. Buried in the earth are the goodies: lumps of gold and crystal, seams, oil, gas, money bags, and question marks, worth points when he walks into them. When the last one is collected a ladder appears at the top of the shaft, and Pete climbs out to end the level.

At the bottom of the shaft a big charge of dynamite is already burning when the level starts. When it goes off the floor breaks, water comes up through it and spreads along every tunnel Pete has dug, rising from the bottom up. Creatures come out of the shaft one at a time once the flood has begun. The water or a creature costs Pete a life. He carries sticks of dynamite of his own, which kill the creatures and leave debris they cannot pass.

02 · The mine and the flood

The water follows the tunnels you dig

The whole mine, 90 columns by 23 rows, running on the game's own code. Dig with the arrow keys or the buttons, lay a stick with the space bar, and watch the big charge at the bottom of the shaft let the water in.

The game's own routines, run on the kit's 6502 over the listing: start_level ($1C54) builds the mine with random numbers in place of TED's timers. Then, as irq_play and main_loop do, each frame runs dynamite and check_big_charge, move_pete every other frame (every frame from level 10), and water_step every few frames once the flood has begun. The creatures, the scoring, and Pete's deaths are left out. From the same memory and the same joystick, the game in plus4emu made the same map in each of 1,166 frames of play, and the same mine on levels 1, 6, and 16 from the same timer readings.

The mine is not stored anywhere. start_level fills rows 3 to 22 of the map with earth, scatters the level's goodies at random (place_goodies), opens the shaft at column 44, and lays the walls, every time a level starts and every time Pete loses a life. The random numbers come from TED's two timers, the raster line, and the beam's position, mixed with a running seed (random_below). A goodie is placed only where the four-by-four block round it holds no other, so goodies never touch, and every one of them must be collected. How many of each kind a level gets is on the Maps / levels tab.

The big charge is a stick of dynamite in the bottom cell of the shaft ($3F78) with a longer fuse: 255 frames on level 1, 90 on level 16. When its explosion is over, check_big_charge breaks the floor under it and turns the cell into the first water. The water spreads one stage at a time: falling water spreads left, right, and down, water flowing sideways carries on and also goes down and up, and rising water goes left, right, and up. Water rises above its highest row only when nothing below is still filling (flow_up), so it fills the lowest tunnels first. A cell Pete digs beside full water lets it in (let_water_in). On level 1, with Pete standing still at the top of the shaft, the water reaches him 666 frames into the level, a little over 13 seconds.

03 · Sound

Sound: effects only, one at a time

There is no music. Once a frame, sound plays the first effect that is going, in a fixed order, and an effect higher in the list silences any below it for as long as it plays.

OrderEffectWhat TED playsFrames
1a stick left at the end of a levelnoise, fading from volume 8 to nothing, then from 7, and so on down to 136 a stick
2the end of a levelboth square voices, voice 1 warbling between two pitches, one step quieter every other frame24
3a goodie collectedvoice 1, its pitch wobbling at random, louder to 4 and down, then fading from 3, 2 and 114
4an explosionnoise on voice 2, fading from 5, then lower from 12, three steps in every four frames20
5Pete's deathpulses of noise rising and falling, each pair of pulses one step lower112
6a stick's fuse, then its explosiona hiss of noise at volume 1120 on level 1
7Pete moving, here five cellsa scratch of noise at a random pitch, volumes 0, 1, 2 and 3 over and over8 a cell

Each effect is started by the game's own code from the listing, the code that starts it in the game, and then sound ($3689) runs once a frame, on the kit's 6502; the timer and beam readings it mixes into the pitch are this browser's random numbers, new each time. The writes it makes to TED's sound registers play through the site's model of TED, which matches plus4emu's output to within 1 %. Run so, all seven write what the game wrote in plus4emu, frame by frame (test_pete.js).

TED, the chip that also draws the C16's screen, has two voices: two square waves, and noise in place of the second. The game sets their pitches and the volume straight into TED's registers from the interrupt. Volumes 9 to 15 play as loud as 8 on TED, so the explosion's second fade and the end of a level, which start at 12, hold their level for four steps before they fall.

The end of a level loads $FF10 where the code around it stores, so voice 2's top two pitch bits keep whatever the last effect left in them (Discoveries). Pete has just climbed the shaft, and his steps leave 1 there: voice 2 plays near 157 Hz, almost two octaves under voice 1's 568 Hz. With 3, as a store would have left it, voice 2 takes the pitch voice 1 has just left, so the two voices sound 9 Hz apart and beat against each other.

04 · One frame, rebuilt from memory

The screen is drawn in three bands

The game changes TED's registers three times as the beam goes down the screen, so one picture needs three sets of them.

A frame of play on level 1, drawn from the screen memory the game left ($0800 colours, $0C00 characters) and the character set, with the characters the game had redrawn for Pete and a creature, by the site's TED renderer. Against plus4emu's own picture of the same frame, 0 of the 64,000 pixels differ; drawn with one set of registers, as they stand at the end of the frame, 30,259 differ: the mine slides back seven pixels and the sky takes the mine's colours.

Everything on the screen is a character: the C16 has no sprites. TED shows the game's own 256 characters at $1000 in multicolour mode, where each character is 4 pixels across, each two pixels wide, in one of four colours: the background, two colours shared by the whole screen, and a fourth from the cell's colour byte. The interrupt (irq_play) changes those shared colours twice during each frame. At line 0 it sets the surface's three colours for the time of day; at line $1A, just below the third row, it sets the mine's black, grey, and brown; at line $BA, above the status line, it turns off the sideways scroll and widens the window back to 40 columns, so that the score does not slide with the mine.

The view is 39 columns of the 90-column map, copied to the screen every frame (draw_view), and moved sideways a pixel at a time with TED's fine scroll (scroll_view), whose value the game keeps in $03. The surface darkens through the day: the interrupt moves the day on one of 16 steps every 256 frames, from light blue through grey to black and back, about 82 seconds a day (sky_background, sky_colour1, sky_colour2). The day starts again with every life.

05 · Pete and the creatures

Moving figures are characters redrawn every frame

Pete and each creature are two characters of their own, rebuilt every frame from the earth or tunnel behind them, so they glide between cells.

The game's stamp_figures, draw_figures and unstamp_figures, as irq_play calls them before and after copying the view, run on the kit's 6502 over frames that build_figures made at start-up. On the right, the figure's two characters as draw_figures left them, four times the size.

Each figure has two characters, Pete's $CE and $CF and the creatures' the pairs after them. Before the view is copied to the screen, stamp_figures puts a figure's pair into the map over the cell it is leaving and the cell it is entering, saving what was there. draw_figures then builds each of the two characters' eight rows from the saved character's row, ANDed with a mask and ORed with a picture, so the earth or tunnel shows round the figure. Once the view is copied, unstamp_figures puts the map back.

A move from one cell to the next takes four steps, one multicolour pixel (two screen pixels) a step. The pictures and masks for every step are shifted once, at start-up, from the frames stored in the character set (build_figures, shift_frames): pages $0400 for up and down, $0500 for left, and $0600 for right, Pete's in the first half of each page and a creature's in the second. Pete standing still is one character, his standing picture over the cell he is in (draw_standing).

06 · Digging

Every tunnel is one cell wide

Pete may dig anywhere below the surface, except where the move would open a hole two cells square.

Click a cell to dig it out or fill it in. Pete, on the left, is moving right into the middle cell. The answer is the game's own can_enter ($218C), which calls check_ring, run on the kit's 6502.

Before Pete steps into a cell, can_enter asks check_ring about the eight cells round it, read clockwise from the top left through the offsets at ring_offsets. Each counts as open when it holds tunnel, water, a stick, an explosion, or debris. If any corner and both its neighbours along the sides are open, the cell Pete would open would make a hole two cells square, and the move is refused. Pete cannot dig two tunnels side by side, and every tunnel stays one cell wide.

The rest of the test is about what is in the cell itself. Earth, tunnel, a stick, an explosion, or debris let him in; debris is cleared as he does. Anything else stops him and is left for pete_touches: a goodie is collected, water or the face kills him, and a wall is only in the way. He keeps to columns 1 to 88 and rows 4 to 21 (move_pete). A cell takes four steps to dig, the earth eaten away in three stages drawn for each direction he moves (chr_digging), and Pete takes a step every other frame, every frame from level 10.

07 · The creatures

Where a creature heads next

Each time a creature reaches the middle of a cell it chooses again. Click the map to move the creature and see, for every place Pete could stand, which way it would go.

heads upheads downwandersthe creature

The game's move_creatures ($2778), run on the kit's 6502 once for each of the 1,584 cells Pete can stand in (columns 1 to 88, rows 4 to 21), for a creature moving left with every way round it open. Its reads of TED are fixed so that it chases, and tries up or down before across. "With the creature's row" changes one byte, the operand of the SBC at $27A6, from $8A to $8E.

A creature moves only through tunnel, water, sticks, and explosions: it cannot dig, and debris stops it. At the end of each cell, move_creatures works out how far Pete is across and how far up or down. If those two numbers ANDed together are not zero, five times in eight it chases: it tries the way across towards Pete, or the way up or down, the order chosen at random, never straight back the way it came (chase_across, chase_updown). Otherwise it wanders: it takes the first open way from a random one, turning back only when there is nothing else (move_creature). The randomness is TED's timers again. At night the creatures move at the faster of the level's two speeds.

The distance up or down is Pete's row less the creature's column. Pete's row is 4 to 21 and a creature's column is up to 88, so the distance is nearly always negative, and a creature chasing up or down nearly always goes up, even when Pete is below it. The AND also sends a creature wandering in scattered places where the two distances share no bits. Both slips are on the Discoveries tab.

08 · Goodies

One of the goodies kills Pete

The goodies as the character set draws them, with what each is worth. Click one to have the game score it.

Each goodie drawn from its characters at $1380-$14FF in the mine's colours, and scored by the game's own score_item ($2E3B) on the kit's 6502, which reads the points from points_lo.

There are four sizes: one cell, two across, two down, and two by two, and each level asks for a number of each (place_goodies). score_item turns a goodie's character into one of 19 kinds and looks up its points in points_lo, in binary-coded decimal. Two kinds do something else. The x2, which appears from level 8, doubles every point scored after it in the level, and must be collected like the rest. The question mark is worth a random 0 to 190 points, in tens.

From level 6 one of the large goodies still in the earth turns into a grinning face every 32 to 47 frames, and the one that was a face turns back (swap_face). Walking into the face costs Pete a life.

09 · Progression

A later level is the same mine, faster and fuller

Each level is a column across twelve tables of 16 bytes at $1EC9-$1F88, read by start_level. Pick a level to see its row.

Read from the listing. Water and the creatures' speeds are frames a step, the fuses frames; a second is 50 frames. Every level's mine, rolled, is on the Maps / levels tab.

The mine does not grow. A later level has more goodies to dig out, more sticks to help, faster water and creatures, and shorter fuses: the big charge burns for 255 frames on level 1 and 90 on level 16. From level 10 Pete moves every frame, twice as fast, and the view scrolls twice as fast to keep up. Level 6's fuse, 90 frames, is shorter than level 7's, 95. After level 16 the game stays on level 16 until Pete's last life is gone.

Pete has three lives: MEN shows the two in hand. Every 10,000 points gives another (add_score), and each stick left at the end of a level is worth 50 points. A creature caught in an explosion is worth 150, once for each pass of the creatures however many die in it (kill_bonus).

10 · Controls

A joystick in port 2, or five keys

The game reads the joystick and the keyboard through TED, never through the KERNAL.

ControlJoystickKeyboard
Left, rightleft, rightA, S
Up, downup, downP, L
Lay a stickfireSPACE
Back to the titleESC

read_controls ($20A7) and the key tables from key_p; ESC is read by irq_play.

On the title screen, left and right choose the level to start on, 1 to 16 and round again, fire starts, and RETURN switches between the joystick and the keyboard. With the keyboard chosen the joystick does nothing, and A, S, and SPACE do the same jobs on the title. In play, left and right are looked at before up and down, so a diagonal moves Pete across. Fire lays a stick only when it is newly pressed, in the cell Pete is in or leaving, and only if that cell is tunnel.

11 · The title screen

The scroller passes judgement on your score

After a game the title's scrolling message begins with a verdict chosen by the score. Type a score to see which.

The game's own choice, the code at $3009-$3045 in title, run on the kit's 6502 with the score in $AA-$AC, and the message it points at decoded from scroller_text in the game's alphabet.

The verdict looks only at the score's ten thousands and thousands. Under 2,000 is THAT WAS PATHETIC, under 6,000 NOT QUITE GOT THE HANG HAVE WE, under 9,000 NOT BAD, and 9,000 to 9,999 MY MAIN MAN. From 10,000 it is MEGA SCORE. A game that scored nothing goes straight to the greeting, in which the author says the game took four weeks, one more than his Fingers Malone, and thanks the CBM 700 and 8250 drive that assembled its 5,100 lines of source in three minutes.

The five high scores all start as DOUGGY, 10,000 down to 2,000, and last until the machine is switched off. A score that goes in is given six question marks for a name, which the player spells on the title screen with left, right and fire (high_scores).