1983 · Cosmi

Aztec Challenge

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/aztec-challenge with me to Gold.

Seven deadly levels in 28 KB, each its own small program, and a soundtrack that starts as a low pulse and adds its melody and voices as the player gets further, because the music is the level's progress counter made audible.

01 · The game

One escape from an Aztec sacrifice, in seven levels

The player is chosen as a sacrifice and runs for freedom: through a gauntlet of spear throwers, up the temple stairs under rolling blocks, through the temple's trapped rooms, past its creatures, across a floor of booby-trapped tiles, through a lake of piranhas and over a bridge with holes in it. Each level is a short dash with five lives; losing all five sends the player back to the scorecard to try the same level again. Win all seven and they start again, faster, for four phases, the last at night.

Paul Norman wrote it for the Commodore 64 in 1983, after Robert T. Bonifacio's Atari game of the same name; Cosmi published it, and U.S. Gold sold the cassette in Britain. The game is one file of 28,671 bytes, read from tape by the computer's own slow loader in about six minutes.

The title screen: AZTEC above and CHALLENGE below the sun stoneThe Gauntlet: the runner seen from behind between two rows of spear throwers, the temple on the horizon

The title, and the first level, the Gauntlet.

02 · The music

Music: the soundtrack is the level's progress, played aloud

Every level counts its progress in stages, 0 to 9 (the byte $45), and calls one routine each time the count goes up ($6530). That routine changes the music: at stage 1 the three voices switch from soft triangle waves to sawtooth; at stage 2 the melody comes in; at 3 the title tune returns, faster; at 4 a tune heard nowhere else takes over and a voice drops out; at 5 that voice comes back, and at 6 it turns to a sawtooth too. A player who hears the melody start knows they are a fifth of the way through, which is what the manual means when it says the music will "indicate the extent of your progress". Hopaztec is the one level that never calls it, so its music never builds.

Each button runs the game's own code: the start-up's sound set-up ($1000), the menu's ($1121), a level's start ($1CA0) and the stage routine once for each stage, then the interrupt at $1C00 60 times a second, as the computer's own timer calls it. The menu's pulse is very low, about 15 to 55 hertz: laptop and phone speakers barely play it, and headphones do.

The music player itself is 155 bytes ($1C00-$1C9A). It steps through a tune six bytes at a time, the high and low byte of each voice's pitch, one step every few interrupts ($36), and starts again at the address in $30/$31 when it reads a byte $FF. It never touches a voice's waveform or volume: those are set once by the start-up from the table at $41C0 and changed only by the levels and the stage routine. That is why the same tune sounds different at different stages.

The game keeps three tunes. The first, at $5F00, opens with seven steps of a low pulse that the menu and every level start with, and goes on at $5F30 with the melody that stage 2 switches to. The title tune, at $5700, plays under the logo and comes back at stage 3. The level tune, at $4900, is the longest, 127 steps, and plays only from stage 4 on, so a player hears it only deep into a level.

03 · The sound effects

Sound: the effects are part of each level's code, timed by its delay loops

There is no sound-effects driver. A level makes its noises itself, by writing voice 1's waveform and pitch in the middle of its own code, and the noise lasts as long as that code takes to run. The spears' whoosh is noise whose pitch drops one step each time the spear moves ($63D0); the fall through the Bridge lowers the pitch a step for each line the runner sinks, with the delay between steps growing ($7E1B); the swimmer eaten by the piranhas sets all three voices to noise and changes their pitch from voice 3's own noise at every row of water it redraws ($1B80).

Each button runs the stretch of the game's code that makes the effect, a video frame's worth of cycles at a time, so the effect keeps the pace its delay loops give it in the game. The music is left out: in the game the tune's interrupt goes on writing the same voices, so an effect on voice 1 is heard against the tune. The Gauntlet's fall is noise at the lowest pitch, a dull thud that small speakers barely play.

04 · One frame

The Gauntlet, rebuilt from memory

The play screen is characters and sprites, nothing else: the sand, the spear throwers and the temple are characters from the set at $3800, and the runner and the spears are sprites. The picture below is not a screenshot. It is drawn from the memory and the video registers of one frame recorded in play.

One frame of the Gauntlet, drawn from every write the game made to the video chip. The other six levels are on the Levels tab.

05 · Seven programs

Each level is its own program, run from the scorecard

The scorecard ($1195) shows both players' level, phase and score and the level's four lines of instructions (from $1600), and waits for the stick. Then $122E copies the phase's settings into zero page and jumps to the level's own code by the level's number. The level sets up its own screen, sprites and controls and runs its own loop until the runner wins or loses five lives, and then jumps to $1300, which scores the attempt and goes back to the scorecard. Nothing is shared between the levels but a few routines and the music.

The dispatch at $12A2 and the size of each level's code in the listing. The level and the phase are kept as the digit characters themselves, '1' to '7' ($31-$37), so the scorecard prints them straight from memory.

06 · The runner

The runner is two sprites, and the levels see it from three sides

A hardware sprite is 24 by 21 pixels, so every level makes its hero from two, an upper and a lower half moved together. The Gauntlet and the Stairs show the runner from behind, the Temple, the Vermin and the Bridge from the side, Hopaztec from above at an angle and the Piranha swimming. Collisions come from the video chip, which sets a bit for each sprite that touches another; the levels read that register and decide from its bits, which is why some of them only notice a hit on one half (Discoveries). Every shape, animated, is on the Graphics tab.

The first pose of each level's hero, drawn from the listing's sprite shapes in the level's colours.

07 · Controls

One joystick, seven meanings

The game reads only the joystick in port 2 ($DC00, fourteen times in the code), and each level reads it its own way. The manual tells most of it; the code adds a few things it did not say.

LevelUpDownLeftRightFireRead at
Gauntletjumpducknothingnothingnothing$6219
Stairsmove leftmove leftmove leftmove rightmove right$71A0
Templestopstopstopjumpjump$7700
Verminhigh jumplow jumpnothingnothingnothing$6B10
Hopaztechop forwardhop backhop lefthop rightnothing$732A
Piranhaswim upswim downswim leftswim rightdive$1DE0
Bridgehigh jumplow jumpmiddle jumpnothing (but scores)nothing$7D10

From each level's reading code. In the Gauntlet any input held for 8 passes of the loop makes the runner fall. On the scorecard any direction or fire starts the level, and RUN/STOP starts the whole game again. F1 and F3 on the menu choose one or two players, read through the computer's own keyboard routine.

08 · Scoring

A win pays for the lives left, and every attempt pays 10 points an achievement

When a level ends, $1300 looks at the lives lost ($02). Five lost means the level was failed: the score gets only the achievements. Fewer means it was won: $1400 adds 1,000 points with no life lost, 200 less for each life lost, and then the achievements. Achievements are counted in one byte ($68) by each level its own way: a spear dodged, a creature touched, a room crossed, a hop forward (and one taken away for a hop back). $1456 pays 10 points for each, and 10 more.

The arithmetic of $1400 and $1456, in binary-coded decimal as the game keeps its eight-digit scores ($60-$67). The Gauntlet won with no life lost and no achievements adds 1,010; five lives lost with none adds 10.

With two players the turn passes after every attempt, won or lost ($1360), not only after five lives as the manual says.

09 · Progress and difficulty

Every level counts to nine its own way

Each level moves the progress stage $45 on by its own measure, and the stage both builds the music and ends the level. The phase's 16 settings, copied in as each level starts, set how fast things come; the Levels tab has them all.

LevelA stage isWon atWhere
Gauntlet88 steps of the run; the temple grows a stagethe call after stage 8$62E0
Stairs128 counts of the climb8 stages$6E45
Temple1, 2, 4 or 6 rooms, by phasestage 9$75DB
Vermin112 characters of scrollingstage 9$6AF1
Hopaztec(no stages)reaching tile 44, the doorway$7320
Piranhatwo passages off the edge of the lakestage 9$1AB8
Bridge1,024 passes of its loopstage 9$7C6B