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
| Command | Syntax | Description |
|---|---|---|
| 0x80 | 0x80, duration | Rest |
| 0x81-0xFF | note, duration | Note |
| 0x00 | 0x00 | Ends the channel’s sequence. |
| 0x01 | 0x01, byte instrument | Sets the channel’s instrument (source number). |
| 0x02 | 0x02, sbyte left, sbyte right | Sets the channel’s left and right volume. |
| 0x03 | 0x03, ushort address | Moves the read position to the specified address. |
| 0x04 | 0x04, byte count, ushort address | Plays the sequence at the specified address repeatedly, the specified number of times. |
| 0x05 | 0x05 | Marks the end of a subroutine. |
| 0x06 | 0x06, byte duration // normal | Fixes the length of subsequent notes and rests (default duration mode). |
| 0x07 | 0x07 | Cancels default duration mode. |
| 0x08 | 0x08, byte delay, byte interval, byte count, sbyte delta, byte reverse | Sets a pitch bend. Uses the change amount as is. |
| 0x09 | 0x09, byte delay, byte interval, byte count, sbyte delta, byte reverse | Sets a pitch bend. Uses the change amount with its sign inverted. |
| 0x0A | 0x0A | Disables pitch bend. |
| 0x0B | 0x0B, byte tempo | Sets the BGM tempo. |
| 0x0C | 0x0C, sbyte delta | Adds a value to the BGM tempo. |
| 0x0D | 0x0D, byte length, byte rate, sbyte depth | Sets vibrato without delay. |
| 0x0E | 0x0E | Disables vibrato. |
| 0x0F | 0x0F, byte length, byte rate, sbyte depth, byte delay | Sets vibrato with delay. |
| 0x10 | 0x10, byte adsr1, byte adsr2 | Sets the channel’s envelope (ADSR). |
| 0x11 | 0x11, sbyte left, sbyte right | Sets the DSP master volume. |
| 0x12 | 0x12, sbyte tuning | Sets the channel’s tuning value. |
| 0x13 | 0x13, sbyte transpose | Sets the channel’s transpose value. |
| 0x14 | 0x14, sbyte delta | Adds a value to the channel’s transpose value. |
| 0x15 | 0x15, sbyte feedback, sbyte left, sbyte right | Sets the echo feedback and volume, and enables echo. |
| 0x16 | 0x16 | Enables echo on the channel. |
| 0x17 | 0x17 | Disables echo on the channel. |
| 0x18 | 0x18, sbyte c0, sbyte c1, sbyte c2, sbyte c3, sbyte c4, sbyte c5, sbyte c6, sbyte c7 | Sets the echo FIR filter coefficients. |
| 0x19 | 0x19, byte clock | Sets the DSP noise frequency. |
| 0x1A | 0x1A | Switches the channel’s sound source to noise. |
| 0x1B | 0x1B | Switches the channel’s sound source back to the sample. |
| 0x1C | 0x1C, sbyte left, sbyte right, byte adsr1, byte adsr2 | Registers volume/ADSR preset 1. |
| 0x1D | 0x1D, sbyte left, sbyte right, byte adsr1, byte adsr2 | Registers volume/ADSR preset 2. |
| 0x1E | 0x1E, sbyte left, sbyte right, byte adsr1, byte adsr2 | Registers volume/ADSR preset 3. |
| 0x1F | 0x1F, sbyte left, sbyte right, byte adsr1, byte adsr2 | Registers volume/ADSR preset 4. |
| 0x20 | 0x20, sbyte left, sbyte right, byte adsr1, byte adsr2 | Registers volume/ADSR preset 5. |
| 0x21 | 0x21 | Writes volume/ADSR preset 1 to the DSP. |
| 0x22 | 0x22 | Writes volume/ADSR preset 2 to the DSP. |
| 0x23 | 0x23 | Writes volume/ADSR preset 3 to the DSP. |
| 0x24 | 0x24 | Writes volume/ADSR preset 4 to the DSP. |
| 0x25 | 0x25 | Writes volume/ADSR preset 5 to the DSP. |
| 0x26 | 0x26, byte delay, byte interval, byte count, sbyte delta | Sets a pitch bend that goes back and forth the same number of times. Uses the change amount with its sign inverted. |
| 0x27 | 0x27, byte delay, byte interval, byte count, sbyte delta | Sets a pitch bend that goes back and forth the same number of times. |
| 0x28 | 0x28, byte instrument, sbyte left, sbyte right | Sets the channel’s instrument and left and right volume. |
| 0x29 | 0x29, byte step | Starts a fade-out of the master volume and echo volume. |
| 0x2A | 0x2A, byte divider | Sets the driver’s operating period (timer 0 divider). |
| 0x2B | 0x2B | Switches to the mode where note lengths are specified in 16 bits. |
| 0x2C | 0x2C | Switches back to the mode where note lengths are specified in 8 bits. |
| 0x2D | 0x2D, ushort address0, ushort address1, ... | Moves to an address selected from an address table according to the conditional jump index. |
| 0x2E | 0x2E, byte index | Sets the conditional jump index. |
| 0x2F | 0x2F, byte length, byte rate, sbyte depth, byte delay | Sets a tremolo that varies the volume in a triangle wave. |
| 0x30 | 0x30 | Disables tremolo. |