Rebecca Heineman Engine/RPM Racing: Difference between revisions
KungFuFurby (talk | contribs) (→Instrument Format: Document instrument format) |
KungFuFurby (talk | contribs) (→Communication with the SNES: Adding sound driver commands) |
||
Line 17: | Line 17: | ||
==Communication with the SNES== | ==Communication with the SNES== | ||
''TODO | 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=== | |||
{| class="wikitable sortable" | |||
|- | |||
! Command ID !! Description | |||
|- | |||
|<tt>%?00xxxxx</tt> || Play SFX | |||
|- | |||
|<tt>%?0100xxx</tt> || Play Sequence | |||
|- | |||
|<tt>%?0101000</tt> || Master Volume Fade Out | |||
|- | |||
|<tt>$29-$7F</tt>/<tt>$A9-$FF</tt> || Master Volume Fade In | |||
|- | |||
|<tt>%?1111111</tt> (CPUIO0 only) || Reset DSP Registers and Load New Data | |||
|} | |||
===Play SFX (Command <tt>$01-$1F</tt>/<tt>$80-$9F</tt>)=== | |||
<pre>%?00xxxxx</pre> | |||
* <tt>%xxxxx</tt> is the SFX ID. | |||
Each SFX merely consists of taking up one instrument slot. | |||
===Play Sequence (Command <tt>$20-$27</tt>/<tt>$A0-$A7</tt>)=== | |||
<pre>%?0100xxx</pre> | |||
* <tt>%xxx</tt> is the sequence ID. | |||
There is a limit of two sequences playing at once. | |||
===Master Volume Fade Out (Command <tt>$28</tt>/<tt>$A8</tt>)=== | |||
Fades out the MVOL DSP registers to zero at a rate of 25/256 per timer 0 tick. | |||
===Master Volume Fade In (Command <tt>$29-$7F</tt>/<tt>$A9-$FF</tt>)=== | |||
Fades in the master volume to <tt>$7F</tt> 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 <tt>$7F</tt>/<tt>$FF</tt>)=== | |||
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== | ==Instrument Format== |
Revision as of 03:23, 17 March 2021
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
TODO record this down