1983 · Epyx

Jumpman Junior

This minisite was contributed by 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/jumpman-junior with me to Gold.

Ten tunes and nineteen sound effects, all played by one small routine that gives each voice to whichever sound asks for it most loudly.

01 · Music

Music: ten tunes, two voices each

A tune plays when a level starts, when it is finished, when Jumpman dies, and at the end of the game. The title has the only tune that uses all three voices.

The player runs the game's own sound code on a copy of the C64's processor in the page, over the game's bytes from the Source tab: tune_play or sound_play to start a sound, then sound_task once a frame, as the raster interrupt's task list calls it.

TuneWhen it playsStarted atSeconds

Every tune is a pair of sounds from tune_table, six bytes an entry: for each of two voices, the address of a script and a priority. tune_play hands both to sound_play. The title starts two entries one after the other, so its tune has three voices, and the third entry's second sound is a script that ends at once. When a level is finished, level_done picks one of the four end-of-level tunes at random.

A script is a list of notes, each an index into a table of frequencies and a length in frames. Four commands change how the voice sounds: $FC sets the waveform and when the note is released, $FD the pulse width, $FE the envelope, and $FF ends the sound. The frequencies are not stored in the game: the start-up code at $808A builds the table at $1200, eight octaves: the twelve notes of the lowest at $81FA, and seven more made by doubling each octave's frequencies.

02 · Sound

Sound: three voices, shared by priority

The game has no voice set aside for music or effects. Each sound asks for a voice with a priority, and gets the first idle voice, or else the voice playing the lowest priority below its own.

The same player, starting each effect as the game's own call does: its script and the priority that call passes to sound_play.

EffectScriptStarted atPriorityFrames

sound_play keeps three records of seven bytes at $0940, one for each voice: the priority, the time left on the note, when to release it, the waveform, and the script's address. A priority of 0 marks a voice as idle. When no voice is idle, a new sound takes the first voice whose priority is lower than its own; when there is none, the sound is not played. sound_task leaves the three priorities ORed together in $5F, so the rest of the game can wait for silence: the title screen does before its tune starts, and the end of the game does before it moves on.

Most effects pass a small priority, from 2 for a step to 8 for a bomb defused or Jumpman being hit. Eight pass the high byte of their own script's address instead, between $97 and $BB (151 to 187): level_done, for one, loads $9E into the accumulator to store the script's high byte, and calls sound_play with it still there. Those eight outrank every tune, whose voices play at priority 16.