Rebecca Heineman Engine/RPM Racing: Difference between revisions
KungFuFurby (talk | contribs) (→Instrument Format: Document instrument format) |
(master volume -> main volume like the official docs) |
||
(6 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
Go back to [[Rebecca Heineman Engine]] | Go back to [[Rebecca Heineman Engine]] | ||
__TOC__ | __TOC__ | ||
Line 17: | Line 15: | ||
==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><br><tt>$00-$1F/$80-$9F</tt> || Play SFX | |||
|- | |||
|<tt>%?0100xxx</tt><br><tt>$20-$27/$A0-$A7</tt> || Play Sequence | |||
|- | |||
|<tt>%?0101000</tt><br><tt>$28/$A8</tt> || Main Volume Fade Out | |||
|- | |||
|<tt>$29-$7F</tt>/<tt>$A9-$FF</tt> || Main Volume Fade In | |||
|- | |||
|<tt>%?1111111</tt>(CPUIO0 only)<br><tt>$7F/$FF</tt> || 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. | |||
===Main 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. | |||
===Main Volume Fade In (Command <tt>$29-$7F</tt>/<tt>$A9-$FF</tt>)=== | |||
Fades in the main volume to <tt>$7F</tt> 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 <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. | |||
<br><br>''TODO document the transfer process (or refer to N-SPC's)'' | |||
==Instrument Format== | ==Instrument Format== | ||
Line 35: | Line 70: | ||
==Voice Command Format== | ==Voice Command Format== | ||
All sequences dynamically allocate their channels. SFX permanently deallocates one channel once they play on that channel. | |||
{| class="wikitable sortable" | |||
|- | |||
! VCMD ID !! Description !! Arguments | |||
|- | |||
|<tt>%x??yzzzz</tt><br><tt>$00-$FD</tt> || Note || <tt>aa (bb)</tt> | |||
|- | |||
|<tt>$FE</tt> || Jump || <tt>xx xx</tt> | |||
|- | |||
|<tt>$FF</tt> || End of Sequence || | |||
|} | |||
===Note (VCMD <tt>$00-$FD</tt>)=== | |||
<pre>%x??yzzzz aa (bb)</pre> | |||
* <tt>%x</tt>, if set, causes <tt>bb</tt> to define a delay afterwards. | |||
* <tt>%y</tt>, if set, keys off the note. Otherwise, the note is keyed on. | |||
* <tt>%zzzz</tt> is an instrument ID. | |||
* <tt>aa</tt> is the note. The default VxPITCH values are used if this is zero, or if the instrument has a tuning table offset of <tt>$80</tt>. | |||
* <tt>bb</tt>, only present if <tt>%x</tt> is set, defines a delay in timer 0 ticks. | |||
===Jump (VCMD <tt>$FE</tt>)=== | |||
<pre>$FE xx xx</pre> | |||
* <tt>xx xx</tt> is a [[little endian]] pointer indicating where to jump to. | |||
===End of Sequence (VCMD <tt>$FF</tt>)=== | |||
Terminates the sequence. | |||
[[Category:SPC Sound Engines]] | [[Category:SPC Sound Engines]] |
Latest revision as of 01:30, 21 May 2023
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
- xx xx is a little endian pointer indicating where to jump to.
End of Sequence (VCMD $FF)
Terminates the sequence.