1987 · Electronic Arts

Skate or Die!

This minisite was contributed by unorig, air. It’s currently claimed by unorig who is editing it to reach a Gold tier standard.

Rob Hubbard's title music with sampled guitars, then one sound driver for every event, whose music never plays the same way twice in a row.

The title music

A fourth voice through the volume register

Rob Hubbard has said that Skate or Die! was the first thing he did for Electronic Arts, written on a visit to the United States: "That's when I did 'Skate or Die' C64 with the sampled guitars mixed in with the SID chipsounds."4

The title tune is one piece, 243.2 seconds long before it repeats: two voices carry the tune and a third plays one drum pattern over and over ($4576, $457C). Notes are read every two and three frames in turn, twenty times a second, and the vibrato deepens the longer a note is held.

The guitars are a fourth channel the SID does not have. The SID has no way to play recorded sound, but it does have a master volume, and changing the volume quickly enough makes a wave of its own. The title loads seven short recordings, four bits a sample ($49F1 holds where each starts and loops), and a timer interrupt writes them to the volume register one value at a time ($5106), between 2,200 and 6,700 times a second. The music sets the timer's speed for each note, so the same recording plays at different pitches.

The seven recordings, from the title's own bytes. Each plays once from its start to its end mark at one fixed rate, a timer of 256 cycles, about 3,850 samples a second; the tune plays them at many rates and loops them while the note lasts. The tune's SID voices are not played here: the page's player cannot model sound made through the volume register, so it would play the tune without its guitars.

High Jump's music

Nine phrases, chosen as it goes

The High Jump music is not one long tune. The music is nine phrases for two voices, and each time one ends, the game picks the next at random from a short list ($3549). Press the music to hear it, played by the game's own code.

The game's own driver, run in the page. The kit's 6502 simulator runs High Jump's sound code and scripts, $2000-$3CFF as the game loads them: init_sound_driver ($22B7), then queue_sound_id ($22F5) with the sound's number, then update_sid_voices ($232C) once a frame, as the main loop does. Checked against the game itself running in the kit's 6502 simulator from the High Jump snapshot: every one of 16,917 SID writes over five minutes matched, in order. The page starts the music from the random state the event's file brings from the disk ($35AB-$35AD = $8F $D0 $FF), so it plays the phrases in the order the game plays them the first time after loading.

Phrase 0 always comes first ($34E3). After it, a table at $3C6C lists where each phrase may lead: phrase 0 to any of 1 to 4; phrases 1 to 4 to any of 1 to 8 but themselves; phrases 5 to 8 back to 1 to 4. The chooser also refuses the phrase that was just played ($356F). The two voices run their own copies of the phrase, and whichever voice finishes first makes the choice for both ($35A8); each voice's script then rewrites the address of the notes it will play next inside itself ($3517, $3530).

The random numbers come from a byte at $35AB that High Jump never sets ($357E): its value comes from the disk with the event's code, so the music's first run after each load takes the same path, and later runs carry on from where the byte has got to.

The driver

Sounds as little programs

Every sound in the event, the music included, is a script for the sound driver ($22B7-$29DB). There are 26 of them, found through a table of addresses at $307B ($3095 for the high bytes) with a priority for each at $30AF. A script command's low four bits pick the operation and its high bits the variant: set or add to a SID register, compare and branch, count a loop, call a subroutine in the script, wait some frames, poke a byte into memory or wait until a byte holds a value, ask for another sound, or call machine code ($2394). Sounds use the memory commands to stop each other: the ticking noise of sounds 7 and 8 runs until a byte at $30CA changes, and sound 0 does nothing but change it.

The music's notes are in a denser form, a note stream: one byte per note, its low four bits the note, two bits the octave, and two bits one of four lengths set by the script ($2752). The notes come from a table of the top octave, A to G sharp ($29E1), halved for each octave down. That table is tuned for an American C64: on the European machine, whose clock is slower, the music plays about two thirds of a semitone flat (worked out from the clock rates, not measured).

The driver plays three sounds at once, one on each SID voice. A sound asked for takes the voice whose current sound has the lowest priority, if its own priority is at least as high ($2981). The driver runs once a frame, counted by the interrupt at the bottom of the screen ($0B31), so a busy frame never slows the music down: the main loop catches up.

Every event

One driver, moved around memory

Every event plays its sound through the same driver, moved to wherever its program has room: High Jump at $22B7, the Freestyle ramp at $271E, the Downhill Race at $2FAC, the Downhill Jam at $E000, and the Pool Joust at $22C8. Only the shop is silent: it never writes to the SID.

Each event brings its own music, built the way High Jump's is: phrases for two voices, the next chosen at random from a list of the phrases that may follow, never straight back to a phrase just heard. The ramp has sixteen phrases with drums on one voice ($E000), the race and the Jam sixteen each ($75D0, $AADC), and the joust sixteen ($3355). In every one, the random numbers come from bytes loaded with the event that nothing seeds (Discoveries).

Every event's music

Four more tunes, as they first play

Each player runs that event's own copy of the driver over the event's memory, and starts its music from the random bytes the disk brings, so each tune takes the phrases it takes the first time it plays after the event loads.

Freestyle ramp, sound 1, random bytes $E13B = $99 $C1 $03.

Downhill Race, sound 4, random bytes $7638 = $38 $F4 $01.

Downhill Jam, sound $15, random bytes $AB3E = $0B $11 $4C.

Pool Joust, sound 1, random bytes $3493 = $00 $FF $00, as the joust starts against Poseur Pete.

Checked against the game. Each event ran in the kit's 6502 simulator from the moment it asks for its music, and its SID writes were compared, in order, with the page's over three minutes: 28,627 for the ramp, 7,297 for the race, 7,805 for the Jam, and 10,382 for the joust, every one the same. The simulator drops some of the Jam's frames, so that comparison covers the writes the game made. The race's listing is missing one byte the driver runs, the RTS at $3329, so the page puts it back.

Sound effects

Seven sounds for High Jump

Besides the music, High Jump's code asks for seven sounds. Seventeen of the 26 numbers are never asked for in this event, and three of those (3, 24, and 25) point at a script that ends at once. Each button below starts one through queue_sound_id, as the game does.

SoundWhenWhere
4three short blips when the skater crosses to the right half$0CE0
15a falling hiss as the skater drops into the bottom of the ramp$172E
16a rising hiss as the skater climbs out after the middle$1739
20a pulse sweep each time the skater changes direction$1ADC
22a fall at low speed$16A0
9a fall at high speed, a speed of 840 or more in the game's units$16A0
6bursts of noise at the end of the run$10D5