The music

Everything you hear here comes from running the cartridge's own sound engine (bank 13, p13:6000) on an emulated Z80, frame by frame at 60 per second, just as the interrupt calls it (p00:4048). What the engine writes to the PSG is turned into sound with an AY-3-8910 (tools/musica.py). Each MP3 is the whole piece up to where it starts again, plus 8 seconds of the repeat fading out.

Checked against openMSX

The PSG writes have been compared frame by frame with those of openMSX (Japanese C-BIOS MSX2). In every frame the PSG ends up the same:

To hear the ruin 4 tune without playing up to it, the probe swapped the antechamber request for that tune (tools/omsx_psg.tcl). The timbre is not checked: it is a textbook AY-3-8910, not a recording of the emulator.

Each ruin's tune changes with the mood

On entering a stage, musica_de_fase (p00:54C8) asks for the ruin's tune (p15:BE70). It also stores a pitch in 0xC122, p15:BE7A[ruin × 4 + state], which depends on the mood of whoever goes in. With it the engine shifts the note table (p13:625D) and, from instrument 2 on, the instrument (p13:62E2):

PitchThe notesThe instrument
0x20two semitones highertwo further on
0x00as writtenits own
0x40one semitone lowerone before
0x80two semitones lowertwo before

Happy is always 0x20 and calm always 0x00. Sad and angry share 0x80 and 0x40: in Pegu and Alchi, sad is 0x80 and angry 0x40; in Dunhuang, Hunza and Agra, the other way round.

Pegu (0x80)

Happy, pitch 0x20

Calm, pitch 0x00

Sad, pitch 0x80

Angry, pitch 0x40

Dunhuang (0x81)

Happy, pitch 0x20

Calm, pitch 0x00

Sad, pitch 0x40

Angry, pitch 0x80

Alchi (0x82)

Happy, pitch 0x20

Calm, pitch 0x00

Sad, pitch 0x80

Angry, pitch 0x40

Hunza (0x83)

Happy, pitch 0x20

Calm, pitch 0x00

Sad, pitch 0x40

Angry, pitch 0x80

Agra (0x84)

Happy, pitch 0x20

Calm, pitch 0x00

Sad, pitch 0x40

Angry, pitch 0x80

F5 changes a voice in Dunhuang

During a stage, F5 silences the music (p00:5FEF) and brings it back (p00:5FE6). When it comes back it is taken from another table, p15:BE75, which only differs in Dunhuang: you get 0x85, the same score with a different second voice (p13:7690 instead of p13:7507).

Happy, pitch 0x20

Calm, pitch 0x00

Sad, pitch 0x40

Angry, pitch 0x80

The rest

The antechamber: 0x89 (p00:424C).

At the start of a game: 0x8A (p00:41DB).

The statue room: 0x86 (p00:5512).

The bosses: 0x87 in the statue room (p02:8D75). 0x88 plays in each stage's boss room (p02:90A1) and is the same piece: the same three pointers in p13:672C.

On finishing a ruin: 0x8B (p00:454E).

On finishing the last one, Agra: 0x8C (p00:4552).

Death: 0x8D (p01:6309).

GAME OVER: 0x8E (p00:440A).

0x8F is silent: its three voices begin with the end-of-track code (0xFF).