We've just updated MediaWiki and its underlying software. If anything doesn't look or work quite right, please mention it to us. --RanAS

Rebecca Heineman Engine/RPM Racing

From SnesLab
Jump to: navigation, search

Go back to Rebecca Heineman Engine

This is the earlier version that was used in one game, where the playback of music is done entirely on the SPC side.

The game in question is this:

Game Name VCMD Code Location ROM Offset
Radical Psycho Machine Racing/RPM Racing 0x0618 0x098000 (all versions)

The build sorting notes can be found here.

Communication with the SNES

All CPUIO registers have (mostly) the same set of commands. Each CPUIO register echoes the last value sent back to the SNES when it processes the command. The same command can be sent again by toggling the highest bit.

Command IDs

Command ID Description
%?00xxxxx
$00-$1F/$80-$9F
Play SFX
%?0100xxx
$20-$27/$A0-$A7
Play Sequence
%?0101000
$28/$A8
Main Volume Fade Out
$29-$7F/$A9-$FF Main Volume Fade In
%?1111111(CPUIO0 only)
$7F/$FF
Reset DSP Registers and Load New Data

Play SFX (Command $01-$1F/$80-$9F)

%?00xxxxx
  • %xxxxx is the SFX ID.

Each SFX merely consists of taking up one instrument slot.

Play Sequence (Command $20-$27/$A0-$A7)

%?0100xxx
  • %xxx is the sequence ID.

There is a limit of two sequences playing at once.

Main Volume Fade Out (Command $28/$A8)

Fades out the MVOL DSP registers to zero at a rate of 25/256 per timer 0 tick.

Main Volume Fade In (Command $29-$7F/$A9-$FF)

Fades in the main volume to $7F at a rate of 25/256 per timer 0 tick. The command doesn't actually function due to a bug in the implementation. Specifically, a byte in the main volume value (which is two bytes total) is made non-zero by the command code in order for the rest of the command to work, but the wrong byte is selected, causing a change so small that it doesn't even modify a MVOL DSP register value, then doing nothing afterwards.

Reset DSP Registers and Load New Data (Command $7F/$FF)

This command only works on the CPUIO0 register ($2140/$F4). Resets the DSP registers, then jumps to an IPL Boot ROM variant that is functionally identical to N-SPC/Kankichi's except for some smaller opcodes.

TODO document the transfer process (or refer to N-SPC's)

Instrument Format

Instruments are stored as eight byte entires as following:

xx yy zz zz aa bb cc dd
  • xx is a direct write to the VxVOLL DSP register.
  • yy is a direct write to the VxVOLR DSP register.
  • zz zz is a direct write to the VxPITCH DSP registers, stored in little endian.
    • For music, these values are only referenced for pitch when dd is $80 (otherwise it uses a pitch table).
    • For SFX, these values are always referred to.
  • aa is a direct write to the VxSRCN DSP register.
  • bb is a direct write to the VxADSR1 DSP register.
  • cc is a direct write to the VxADSR2 DSP register.
  • dd's purpose depends on whether it's being used for music or sound effects...
    • For music, it defines an offset to a tuning table. The tuning table entry itself consists of a single 16-bit value to multiply the pitch by.
    • For SFX, the byte is unused, and was either supposed to be gain or priority.

Voice Command Format

All sequences dynamically allocate their channels. SFX permanently deallocates one channel once they play on that channel.

VCMD ID Description Arguments
%x??yzzzz
$00-$FD
Note aa (bb)
$FE Jump xx xx
$FF End of Sequence

Note (VCMD $00-$FD)

%x??yzzzz aa (bb)
  • %x, if set, causes bb to define a delay afterwards.
  • %y, if set, keys off the note. Otherwise, the note is keyed on.
  • %zzzz is an instrument ID.
  • aa is the note. The default VxPITCH values are used if this is zero, or if the instrument has a tuning table offset of $80.
  • bb, only present if %x is set, defines a delay in timer 0 ticks.

Jump (VCMD $FE)

$FE xx xx

End of Sequence (VCMD $FF)

Terminates the sequence.