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
Revision as of 03:36, 17 March 2021 by KungFuFurby (talk | contribs) (→‎Voice Command Format: Adding VCMD format documentation)
Jump to: navigation, search

Go back to Rebecca Heineman Engine

NOTE: The following page is a stub, and is under construction.

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 Play SFX
%?0100xxx Play Sequence
%?0101000 Master Volume Fade Out
$29-$7F/$A9-$FF Master Volume Fade In
%?1111111 (CPUIO0 only) 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.

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

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

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

Fades in the master volume to $7F at a rate of 25/256 per timer 0 tick. The command doesn't acutally function due to a bug in the implementation. Specifically, a byte is made non-zero in order for the command to work.

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 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.