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: Difference between revisions

From SnesLab
Jump to: navigation, search
(→‎Voice Command Format: Adding VCMD format documentation)
(master volume -> main volume like the official docs)
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
Go back to [[Rebecca Heineman Engine]]
Go back to [[Rebecca Heineman Engine]]
'''NOTE: The following page is a stub, and is under construction.'''
__TOC__
__TOC__


Line 24: Line 22:
! Command ID !! Description
! Command ID !! Description
|-
|-
|<tt>%?00xxxxx</tt> || Play SFX
|<tt>%?00xxxxx</tt><br><tt>$00-$1F/$80-$9F</tt> || Play SFX
|-
|-
|<tt>%?0100xxx</tt> || Play Sequence
|<tt>%?0100xxx</tt><br><tt>$20-$27/$A0-$A7</tt> || Play Sequence
|-
|-
|<tt>%?0101000</tt> || Master Volume Fade Out
|<tt>%?0101000</tt><br><tt>$28/$A8</tt> || Main Volume Fade Out
|-
|-
|<tt>$29-$7F</tt>/<tt>$A9-$FF</tt> || Master Volume Fade In
|<tt>$29-$7F</tt>/<tt>$A9-$FF</tt> || Main Volume Fade In
|-
|-
|<tt>%?1111111</tt> (CPUIO0 only) || Reset DSP Registers and Load New Data
|<tt>%?1111111</tt>(CPUIO0 only)<br><tt>$7F/$FF</tt> || Reset DSP Registers and Load New Data
|}
|}


Line 45: Line 43:
There is a limit of two sequences playing at once.
There is a limit of two sequences playing at once.


===Master Volume Fade Out (Command <tt>$28</tt>/<tt>$A8</tt>)===
===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.
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>)===
===Main 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.
Fades in the main 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.
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>)===
===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.
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)
<br><br>''TODO document the transfer process (or refer to N-SPC's)''


==Instrument Format==
==Instrument Format==
Line 78: Line 76:
! VCMD ID !! Description !! Arguments
! VCMD ID !! Description !! Arguments
|-
|-
|<tt>%x??yzzzz</tt> || Note || <tt>aa (bb)</tt>
|<tt>%x??yzzzz</tt><br><tt>$00-$FD</tt> || Note || <tt>aa (bb)</tt>
|-
|-
|<tt>$FE</tt> || Jump || <tt>xx xx</tt>
|<tt>$FE</tt> || Jump || <tt>xx xx</tt>

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

End of Sequence (VCMD $FF)

Terminates the sequence.