RAM cleared on engine start: { $00..EF $0120..BF $0250..7F $0390..FF $EF00..FEFF } $00: Value read from CPU IO 0 (by $0518) $01: Value read from CPU IO 1 (by $0518) $02: Value read from CPU IO 2 (by $0518) $03: Value read from CPU IO 3 (by $0518) $04: Value for CPU IO 0 (by $0518) $05: Value for CPU IO 1 (by $0518) $06: Value for CPU IO 2 (by $0518) $07: Value for CPU IO 3 (by $0518) ? $08: Previous value read from CPU IO 0 ? $09: Previous value read from CPU IO 1 ? $0A: Previous value read from CPU IO 2 ? $0B: Previous value read from CPU IO 3 ? $0C: Music track status { 0: Music track playing 1: Music track, ready to play 2: New music track loaded, need to initialise } ? $0D: Unused $0E: Zero. Used to clear DSP key off flags in DSP update loop. ? Used in $1B58 as a convenient way to clear YA $10: { ? Note when calling $169B/$16B1/$1D56/$1D74/$1D76 (play note routines). Unit 1/100h semitone. ? Panning bias when calling $1C4A. Range 0..1400h, 0 = fully right, 1400h = fully left } ? $12: Usually used as sign bit. DSP voice volume index in $1C4A ? $13: Note modified flag $14..17: Miscellaneous 16-bit values $18: Random number. Updated in main game loop, otherwise unused $1A: Enabled sound voices / disabled music voices ? $1B: Disable note processing { If set, causes main loop to short circuit to music track processing, but notes aren't processed. Tracker and tracks advance as normal, current notes are played until finished, sound effects are not processed at all. Set to 80h by tracker command 80h, cleared by tracker command 81h. Set to 1 by track command FDh, cleared by track command FEh } ? $1C..1F: Unused ? $20: Return address in $2875 ? $22: Sound 1 instruction list pointer set. Set to [$2AED + [current sound 1 index]] when changing sound ? $24: Pointer to sound 1 channel voice bitset ? $26: Pointer to sound 1 channel voice mask ? $28: Pointer to sound 1 channel voice index ? $2A: Sound 1 channel 0 instruction list pointer ? $2C: Sound 1 channel 1 instruction list pointer ? $2E: Sound 1 channel 2 instruction list pointer $30..3F: Track pointers ? $40: Tracker pointer ? $42: Tracker timer $43: Sound effects clock. Sound effects are processed when this counter overflows (11.64 ms) ? $44: Track index $45: Key on flags (DSP register $4C). Part of DSP update loop { v = hgfedcba a: Key on voice 0 b: Key on voice 1 c: Key on voice 2 d: Key on voice 3 e: Key on voice 4 f: Key on voice 5 g: Key on voice 6 h: Key on voice 7 } $46: Key off flags (DSP register $5C). Part of DSP update loop { v = hgfedcba a: Key off voice 0 b: Key off voice 1 c: Key off voice 2 d: Key off voice 3 e: Key off voice 4 f: Key off voice 5 g: Key off voice 6 h: Key off voice 7 } $47: Current music voice bitset. During music processing, this is the bitset of the voice being processed. During sound processing, this is essentially zero { During sound processing: All voice bitsets are clear before sound processing Voice bitset is set when resetting channel Voice bitset is cleared when initialising channel Voice bitset is cleared when processing next instruction and legato disabled This variable is usually used for the check `[$47] & [$1A] != 0`, which, if true, prevents changes to the voice. During sound processing, this check is always false and so the changes can be done. The way it's done with the above writes is completely redundant } $48: FLG (DSP register $6C). Part of DSP update loop { v = rmefffff f: Noise frequency { 0: 0 Hz 1: 16 Hz 2: 21 Hz 3: 25 Hz 4: 31 Hz 5: 42 Hz 6: 50 Hz 7: 63 Hz 8: 83 Hz 9: 100 Hz Ah: 125 Hz Bh: 167 Hz Ch: 200 Hz Dh: 250 Hz Eh: 333 Hz Fh: 400 Hz 10h: 500 Hz 11h: 667 Hz 12h: 800 Hz 13h: 1.0 KHz 14h: 1.3 KHz 15h: 1.6 KHz 16h: 2.0 KHz 17h: 2.7 KHz 18h: 3.2 KHz 19h: 4.0 KHz 1Ah: 5.3 KHz 1Bh: 6.4 KHz 1Ch: 8.0 KHz 1Dh: 10.7 KHz 1Eh: 16 KHz 1Fh: 32 KHz } e: Disable echo buffer writes m: Mute amplifier r: Soft reset (key off all voices and set envelope 0) } $49: Noise enable flags (DSP register $3D). Part of DSP update loop { v = hgfedcba a: Output noise on voice 0 b: Output noise on voice 1 c: Output noise on voice 2 d: Output noise on voice 3 e: Output noise on voice 4 f: Output noise on voice 5 g: Output noise on voice 6 h: Output noise on voice 7 } $4A: Echo enable flags (DSP register $4D). Part of DSP update loop { v = hgfedcba a: Enable echo on voice 0 b: Enable echo on voice 1 c: Enable echo on voice 2 d: Enable echo on voice 3 e: Enable echo on voice 4 f: Enable echo on voice 5 g: Enable echo on voice 6 h: Enable echo on voice 7 } $4B: Pitch modulation flags (DSP register $2D). Part of DSP update loop { v = gfedcba0 a: Modulate voice 1 pitch by voice 0 amplitude b: Modulate voice 2 pitch by voice 1 amplitude c: Modulate voice 3 pitch by voice 2 amplitude d: Modulate voice 4 pitch by voice 3 amplitude e: Modulate voice 5 pitch by voice 4 amplitude f: Modulate voice 6 pitch by voice 5 amplitude g: Modulate voice 7 pitch by voice 6 amplitude } $4C: Echo timer. Incremented every echo period (16 ms). When negative, echo is completely disabled. When positive, echo output is disabled, but echo buffer writes are enabled. Set to min(0, [$4C]) - 1 - [DSP echo delay] $4D: Echo delay (echo buffer size) (DSP register $7D). Range 0..Fh. 0 = one sample (4 bytes). Otherwise delay = v * 16 ms (v * 2 KB) $4E: Echo feedback volume (DSP register $0D). Signed. Part of DSP update loop ? $4F: Unused ? $50: Music transpose. Signed. Units semitone $51: Music track clock. Music track is processed when this counter overflows. Incremented by [$52] / 100h every 2 ms $52: Music tempo. Music track is pressed every 10000h / [$52] * 2 ms = [$52] times per 131 seconds { Set to 2000h by music track initialisation (62.5 ticks per second) Set to 1000h by boot (31.3 ticks per second) 0..FFh means music track never gets processed again } ? $54: Dynamic music tempo timer. Cleared by $1758. Timer. If non-zero: $52 += [$56]. Clears $52 once decremented to zero(!) ? $55: Target music tempo ? $56: Music tempo delta ? $58: Music volume multiplier. Unit 1/10000h. Set to C000h by $1758 ? $5A: Dynamic music volume timer. Cleared by $1758. Timer. If non-zero: $58 += [$5C]. Clears $58 once decremented to zero ? $5B: Target music volume multiplier. Unit 1/100h ? $5C: Music volume multiplier delta. Unit 1/10000h $5E: Music voice volume update bitset ? $5F: Percussion instruments base index $60: Echo volume left (DSP register $2C). Unit 1/100h. Signed. Part of DSP update loop $62: Echo volume right (DSP register $3C). Unit 1/100h. Signed. Part of DSP update loop ? $64: Echo volume left delta ? $66: Echo volume right delta ? $68: Dynamic echo volume timer. If non-zero: $60 += [$64], $62 += [$66]. Clears $60 and sets $62 = [$6A] * 100h once decremented to zero ? $69: Target echo volume left ? $6A: Target echo volume right ? $6B..6F: Unused ? $70..7E: Track note timers (decremented on music track processing) ? $71..7F: Track note ring timers. Set to max(1, track command byte * [track $0201] / 100h) if 80h < track command byte < E0h ? $80..8E: Track repeated subsection counters. 0 = not repeating subsection. 1 = stop repeating and return. 2+ = repeat subsection ? $81..8F: Unused ? $90..9E: Track dynamic volume timers ? $91..9F: Track dynamic panning timers $A0..AE: Track pitch slide timers $A1..AF: Track pitch slide delay timers $B0..BE: Track vibrato delay timers ? $B1..BF: Track vibrato extents $C0..CE: Track tremolo delay timers ? $C1..CF: Track tremolo extents ? $D0: Sound 1 channel 3 instruction list pointer ? $D2: Pointer to echo buffer in RAM clear routine on engine start ? $D4: Sound 2 instruction list pointer set. Set to [$39B3 + [current sound 2 index]] when changing sound ? $D6: Pointer to sound 2 channel voice bitset ? $D8: Pointer to sound 2 channel voice mask ? $DA: Pointer to sound 2 channel voice index ? $DC: Sound 2 channel 0 instruction list pointer ? $DE: Sound 2 channel 1 instruction list pointer ? $E0: Sound 3 instruction list pointer set. Set to [$4E8F + [current sound 3 index]] when changing sound ? $E2: Pointer to sound 3 channel voice bitset ? $E4: Pointer to sound 3 channel voice mask ? $E6: Pointer to sound 3 channel voice index ? $E8: Sound 3 channel 0 instruction list pointer ? $EA: Sound 3 channel 1 instruction list pointer ? $EC: Unused ? $EE: Address of memory to clear (in $1ED7) $F0..FF: IO ports ? $0100..0E: Track dynamic vibrato timers $01??..CF: Stack ? $01D0..FF: Unused ? $0200..038F: Music RAM { ? $0200..0E: Track note lengths. Set to track command byte if 0 < track command byte < 80h. Value for track timer after all instructions processed ? $0201..0F: Track note ring length multipliers. Unit 1/100h. Set to [$5800 + (track parameter >> 4 & 7)] if 0 <= track parameter < 80h ? $0210..1E: Track note volume multipliers. Unit 1/100h. Set to [$5808 + (track parameter & Fh)] if 0 <= track parameter < 80h. Checked against zero when new track data loaded, skips call to track command E0h ? $0211..1F: Track instrument indices. CAh..DFh are percussion instrument indices taken relative to [$5F] - CAh ? $0220..2F: Track instrument pitch multipliers / 100h ? $0230..3F: Track repeated subsection return addresses ? $0240..4F: Track repeated subsection addresses ? $0250..7F: Unused $0280..8E: Track slide lengths $0281..8F: Track slide delays $0290..9E: Track slide directions. 0 = slide in, 1 = slide out $0291..9F: Track slide extents. Signed. Unit semitone $02A0..AE: Track vibrato phases ? $02A1..AF: Track vibrato rates ? $02B0..BE: Track vibrato delays $02B1..BF: Track dynamic vibrato lengths ? $02C0..CE: Track vibrato extent deltas ? $02C1..CF: Track static vibrato extents. Reset value for vibrato extent after dynamic vibrato finishes $02D0..DE: Track tremolo phases. 0 = max volume, 80h = min volume. If tremolo extent = FFh, all negative values are min volume. Incremented by track tremolo rate ? $02D1..DF: Track tremolo rates ? $02E0..EE: Track tremolo delays ? $02E1..EF: Unused $02F0..FE: Track transposes. Signed. Unit semitone ? $02F1..FF: Unused ? $0300..0F: Track volume multipliers. Unit 1/10000h ? $0310..1F: Track volume multiplier deltas. Unit 1/10000h ? $0320..2E: Track target volume multipliers. Unit 1/100h ? $0321..2F: Track output volume multipliers. Unit 1/100h. Base volume multiplier before apply panning calculations ? $0330..3F: Track panning biases. Range 0..1400h (0 is fully right, 1400h is fully left). Set to A00h by $1758 ? $0340..4F: Track panning bias deltas ? $0350..5E: Track target panning biases ? $0351..5F: Track phase inversion options. Cleared by $1758 { 80h: Phase invert left volume 40h: Phase invert right volume } $0360..6E: Track notes. Unit 1/100h semitone ? $0370..7F: Track note deltas (due to pitch slide). Unit 1/100h semitone ? $0380..8E: Track target notes (due to pitch slide). Unit semitone $0381..8F: Track subtransposes } $4B00..??: Sample table $EF00..FEFF: Echo buffer. Reduced to $F700..FEFF if [echo delay] = 1