Sequence syntax

Explains the sequence data format of the RareWare Sound Driver used in Super Donkey Kong and Donkey Kong Country, and the specification of all its commands.
A disassembly and an equivalent implementation are published at RareSpc.
For the DKC2/DKC3 driver, see DKC2 development documents - Sequence syntax.

Contents of this section

Sequence data structure
Explains specifications common to all sequence data, such as sequence data placement, event types, how note lengths are specified, and tempo.

Event list

CommandSyntaxDescription
0x800x80, durationRest
0x81-0xFFnote, durationNote
0x000x00Ends the channel’s sequence.
0x010x01, byte instrumentSets the channel’s instrument (source number).
0x020x02, sbyte left, sbyte rightSets the channel’s left and right volume.
0x030x03, ushort addressMoves the read position to the specified address.
0x040x04, byte count, ushort addressPlays the sequence at the specified address repeatedly, the specified number of times.
0x050x05Marks the end of a subroutine.
0x060x06, byte duration // normalFixes the length of subsequent notes and rests (default duration mode).
0x070x07Cancels default duration mode.
0x080x08, byte delay, byte interval, byte count, sbyte delta, byte reverseSets a pitch bend. Uses the change amount as is.
0x090x09, byte delay, byte interval, byte count, sbyte delta, byte reverseSets a pitch bend. Uses the change amount with its sign inverted.
0x0A0x0ADisables pitch bend.
0x0B0x0B, byte tempoSets the BGM tempo.
0x0C0x0C, sbyte deltaAdds a value to the BGM tempo.
0x0D0x0D, byte length, byte rate, sbyte depthSets vibrato without delay.
0x0E0x0EDisables vibrato.
0x0F0x0F, byte length, byte rate, sbyte depth, byte delaySets vibrato with delay.
0x100x10, byte adsr1, byte adsr2Sets the channel’s envelope (ADSR).
0x110x11, sbyte left, sbyte rightSets the DSP master volume.
0x120x12, sbyte tuningSets the channel’s tuning value.
0x130x13, sbyte transposeSets the channel’s transpose value.
0x140x14, sbyte deltaAdds a value to the channel’s transpose value.
0x150x15, sbyte feedback, sbyte left, sbyte rightSets the echo feedback and volume, and enables echo.
0x160x16Enables echo on the channel.
0x170x17Disables echo on the channel.
0x180x18, sbyte c0, sbyte c1, sbyte c2, sbyte c3, sbyte c4, sbyte c5, sbyte c6, sbyte c7Sets the echo FIR filter coefficients.
0x190x19, byte clockSets the DSP noise frequency.
0x1A0x1ASwitches the channel’s sound source to noise.
0x1B0x1BSwitches the channel’s sound source back to the sample.
0x1C0x1C, sbyte left, sbyte right, byte adsr1, byte adsr2Registers volume/ADSR preset 1.
0x1D0x1D, sbyte left, sbyte right, byte adsr1, byte adsr2Registers volume/ADSR preset 2.
0x1E0x1E, sbyte left, sbyte right, byte adsr1, byte adsr2Registers volume/ADSR preset 3.
0x1F0x1F, sbyte left, sbyte right, byte adsr1, byte adsr2Registers volume/ADSR preset 4.
0x200x20, sbyte left, sbyte right, byte adsr1, byte adsr2Registers volume/ADSR preset 5.
0x210x21Writes volume/ADSR preset 1 to the DSP.
0x220x22Writes volume/ADSR preset 2 to the DSP.
0x230x23Writes volume/ADSR preset 3 to the DSP.
0x240x24Writes volume/ADSR preset 4 to the DSP.
0x250x25Writes volume/ADSR preset 5 to the DSP.
0x260x26, byte delay, byte interval, byte count, sbyte deltaSets a pitch bend that goes back and forth the same number of times. Uses the change amount with its sign inverted.
0x270x27, byte delay, byte interval, byte count, sbyte deltaSets a pitch bend that goes back and forth the same number of times.
0x280x28, byte instrument, sbyte left, sbyte rightSets the channel’s instrument and left and right volume.
0x290x29, byte stepStarts a fade-out of the master volume and echo volume.
0x2A0x2A, byte dividerSets the driver’s operating period (timer 0 divider).
0x2B0x2BSwitches to the mode where note lengths are specified in 16 bits.
0x2C0x2CSwitches back to the mode where note lengths are specified in 8 bits.
0x2D0x2D, ushort address0, ushort address1, ...Moves to an address selected from an address table according to the conditional jump index.
0x2E0x2E, byte indexSets the conditional jump index.
0x2F0x2F, byte length, byte rate, sbyte depth, byte delaySets a tremolo that varies the volume in a triangle wave.
0x300x30Disables tremolo.