1986 · Domark

Friday the 13th: music

This minisite was curated by air, unorig.

Seven tunes played by the game's own driver from under the KERNAL ROM, and a scream recorded one bit to a sample.

01 · Music

Music: the theme and six tunes

The theme plays throughout and starts again whenever nothing else plays. Five rooms have a tune of their own, and a sixth tune plays only when Jason throws off his disguise. Three are tunes everyone knows: the theme is Teddy Bears’ Picnic, the song that warns of a big surprise in the woods; the church’s organ plays the opening of Bach’s Toccata and Fugue in D minor; and the barn plays Old MacDonald Had a Farm.

The player runs the game's own music code, play_tune and once a frame irq_music, on a copy of the C64's processor in the page, over the game's bytes from the Source tab.

The seven tunes lie under the KERNAL ROM, from $E000 to $EF02. To read them, music_swap banks the ROM out for each step and back in after it. Each voice is a list of note and length pairs, with four commands: repeat, waveform, attack and decay, and sustain and release. A tune's speed is a number of frames between steps at tune_tempo, and only the theme repeats.

TuneWhere it playsFrames per stepLength

A room's tune comes from place_tune, which looks the room up in six places at tune_places. It starts one only when the last tune started was the theme, so a room's tune never cuts into another room's, or into Jason's. The fourth place is $FF, which no room has, so tune 4 is heard only when Jason reveals himself (jason_reveal).

02 · The scream

Sound: a scream in 18,416 bits

The scream that plays over the title and whenever someone dies is a recording, one bit per sample, played by turning the sound chip's volume fully up or fully down.

The player calls a port of play_scream once for each bit, every 107 cycles, the average gap between the game's own volume writes; the gaps run from 104 to 125 cycles. The volume steps are heard through the 6581 chip's mixer, whose voices carry a constant level that the volume scales. The interrupts are off while the scream plays, so the game stops for its two seconds.

The sample starts at $36A0 with its length, $08FE bytes, and the bits follow, high bit first. For each 1 bit, scream_click sets volume 15 and starts a triangle wave on voice 1; for each 0 bit, scream_quiet sets volume 0. The two paths are padded with NOPs so that each takes about as long as the other. Before it plays, scream blanks the panel to the room's background colour, and redraws it afterwards. The introduction carries the same routine and the same bytes at the same address.