1986 · U.S. Gold

Gauntlet

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

Ben Daglish's three pieces for the game and its eighteen sound effects, played by the game's own drivers running in this page.

01 · The music

Music: three tunes on two players

The disk carries three pieces of music by Ben Daglish, played by two different music drivers.

The game's own players, running in this page. Each button runs the game's code on the kit's 6502 simulator in the page and plays what it writes through the site's model of the SID. The title music and the level jingle go through the player in PLAYER-$E000; the treasure-room tune goes through the second player at $A036. test_music.js runs the page's players beside the same code called on the simulator directly, on the committed listing: every register write of every frame is the same for all three tunes, to their ends. The treasure tune's bass goes down to about 35 Hz, which laptop and phone speakers barely play.

The title music is the file DATATITLE, 18 seconds long, and the level jingle DITTIDATA, 4 seconds. Both are data for the full driver at $E000, which has 33 commands, vibrato, slides, pulse sweeps, and arpeggios (music_commands, $E643). The level jingle plays before each level (level_intro, $9BEF), with the game waiting until it ends.

The treasure-room tune, DATATREASURE, plays on a simpler driver built into the game program at $A036, called once a frame from the raster interrupt while a treasure room runs. Its 96-note frequency table (note_freqs, $A29E) is tuned for an American machine: 95 of its notes are within 10 cents of true pitch at the NTSC clock. On the PAL machines this release was sold for the tune plays about 65 cents flat, two thirds of a semitone. The $E000 driver's table is tuned for PAL.

02 · The sound effects

Sound: eighteen effects, two bytes a frame

Every noise in play comes from one small player in the game program and a table of eighteen effects in the file OBJDIS. One of the eighteen is never played.

The game's own effects player, running in this page. Each button starts an effect as the game does, with sfx_reset ($CD77) and sfx_start ($CDDB), then runs sfx_play ($CCD3) once a frame on a small 6502 core and plays what it writes through the site's model of the SID. test_sfx.js runs the page's core beside the kit's 6502 simulator on the committed listing: every register write of every frame is the same for all eighteen effects, to their ends.

EffectWhen it playsStarted byFrames
$00A ghost hits and vanishesmonster_attack $BC819
$01Never playedno code starts it9
$02Death's touchdeath_drain $BCBE25
$03A level beginslevel_begin $811321
$04A player firesshot_fire $A75B6
$05A potion, used or shotmagic_use $BAC3, potion_shot $AD4726
$06Into the exitexit_enter $B78E55
$07A keypickup_sounds $B85329
$08Hit by a fireball or a rockshot_hits_player $AC8E9
$09The amuletpickup_sounds31
$0AA monster's blowmonster_attack $BC568
$0BA transporterteleport_place $903A52
$0CA lobber throwsrock_throw $AAB326
$0DMagic with no potion; a player joinsmagic_use $BAC9, players_join $A59B16
$0EDoors openpickup_sounds, idle_doors_open $B59539
$0FA player diesplayer_leaves $981E86
$10A trap, poison, a new power, the walls turning to exits, the end of a treasure roomtrap_set, poison_eaten, power_message, idle_walls_exit, treasure_end36
$11Treasure, food and potions picked uppickup_sounds9

Each effect and the code that starts it, from every call to sfx_start in the program; the pickups take theirs from pickup_sounds ($B853), one byte for each pickup tile. Lengths in frames, 50 a second, as sfx_play runs them.

OBJDIS loads at $F000. Its first 36 bytes are the offsets of the eighteen effects' streams (sfx_table), and the streams follow, two bytes for every frame of sound: the first byte's high nibble sets the sustain and release and its low nibble picks noise or a pulse wave, and the second byte is the pitch. A zero ends the effect. Each frame, sfx_play restarts the voice's note with the new pitch and wave (sfx_note, $CE47), so an effect is a run of short notes, one a frame.

sfx_start picks the voice. While the treasure-room tune plays, every effect goes to voice 1 and any other effect stops. Otherwise it takes a voice already playing the same effect, then a free one, then the one furthest through its effect. Effects run from the raster interrupt, beside the tune, so the game never waits for one unless it asks to: the message screens and the end of a treasure room wait for the sound to finish (sfx_wait, $CEAA).

Effect 1 is on the disk and nothing starts it: every call to sfx_start in the program loads its effect's number directly or from the pickup table, and none of them gives 1. When an effect on voice 3 ends, the zeroing meant for the voice's frequency goes to $D414 and $D415, its sustain and release and the filter's cutoff; the voice falls silent anyway, its sustain now 0.