S-SMP: Difference between revisions

From SNESdev Wiki
Jump to navigationJump to search
m (→‎BRR Samples: see links)
(→‎DSP Registers: voice registers)
Line 8: Line 8:


== DSP Registers ==
== DSP Registers ==
TODO
 
A DSP register can be selected with $F2, after which it can be read or written via $FE. Often it is useful to load the register address into A, and the value to send in Y, so that ***MOV $F2, AY*** can be used to do both in one 16-bit instruction.
 
=== Voices ===
 
There are 8 voices, numbered 0 to 7. Each voice X has 10 registers in the range $X0-$X9.
 
{| class="wikitable"
! Name
! Address
! Bits
! Notes
|-
! VOL (L)
! $X0
| style="text-align: right" | <tt style="white-space: nowrap">SVVV VVVV</tt>
| Left channel volume, signed.
|-
! VOL (R)
! $X1
| style="text-align: right" | <tt style="white-space: nowrap">SVVV VVVV</tt>
| Right channel volume, signed.
|-
! P (L)
! $X2
| style="text-align: right" | <tt style="white-space: nowrap">LLLL LLLL</tt>
| Low 8 bits of sample pitch.
|-
! P (H)
! $X3
| style="text-align: right" | <tt style="white-space: nowrap">xxHH HHHH</tt>
| High 6 bits of sample pitch.
|-
! SCRN
! $X4
| style="text-align: right" | <tt style="white-space: nowrap">SSSS SSSS</tt>
| Selects a sample source entry from the directory (see DIR below).
|-
! ADSR (1)
! $X5
| style="text-align: right" | <tt style="white-space: nowrap">EDDD AAAA</tt>
| ADRS enable (E), decay rate (D), attack rate (A).
|-
! ADSR (2)
! $X6
| style="text-align: right" | <tt style="white-space: nowrap">LLLR RRRR</tt>
| Sustain level (L), sustain rate (R).
|-
! GAIN
! $X7
| style="text-align: right" | <tt style="white-space: nowrap">0VVV VVVV</tt><br/> <tt style="white-space: nowrap">1MMV VVVV</tt>
| Mode (M), value (V).
|-
! ENVX
! $X8
| style="text-align: right" | <tt style="white-space: nowrap">0VVV VVVV</tt>
| Reads current 7-bit value of ADSR/GAIN envelope.
|-
! OUTX
! $X9
| style="text-align: right" | <tt style="white-space: nowrap">SVVV VVVV</tt>
| Reads signed 8-bit value of current sample wave multiplied by ENVX, before applying VOL.
|}
 
==== ADSR ====
 
This controls an Attack-Decay-Sustain-Release envelope that automatically adjusts the sample's envelope volume (ENVX) over time.
 
* ***E***: 1 to enable ADSR envelope, otherwise uses GAIN directly.
* ***A***: Attack speed. $F for instant.
* ***D***: Decay speed, time to decay from full volume to the sustain level after the initial attack.
* ***L***: Sustain level.
* ***R***: Sustain release, speed of decay to 0 after note off.
 
==== GAIN ====
 
This register has 5 modes:
 
* <tt>0VVV VVVV</tt> sets ENVX directly.
* <tt>110V VVVV</tt> Linear slide up to 100% volume with rate V.
* <tt>111V VVVV</tt> Bent-line (fast to 75%, then slower to 100%) slide up with rate V.
* <tt>100V VVVV</tt> Linear slide down to 0% volume with rate V.
* <tt>101V VVVV</tt> Exponential slide down to 0% volume with rate V.
 
=== Global ===


== Instruction Set ==
== Instruction Set ==

Revision as of 06:30, 14 September 2022

The SPC700 is the CPU portion of the S-SMP processor used to run the sound and music of the SNES. It is an 8-bit CPU with capabilities similar to the 6502.

Memory Layout

TODO

Registers

TODO

DSP Registers

A DSP register can be selected with $F2, after which it can be read or written via $FE. Often it is useful to load the register address into A, and the value to send in Y, so that ***MOV $F2, AY*** can be used to do both in one 16-bit instruction.

Voices

There are 8 voices, numbered 0 to 7. Each voice X has 10 registers in the range $X0-$X9.

Name Address Bits Notes
VOL (L) $X0 SVVV VVVV Left channel volume, signed.
VOL (R) $X1 SVVV VVVV Right channel volume, signed.
P (L) $X2 LLLL LLLL Low 8 bits of sample pitch.
P (H) $X3 xxHH HHHH High 6 bits of sample pitch.
SCRN $X4 SSSS SSSS Selects a sample source entry from the directory (see DIR below).
ADSR (1) $X5 EDDD AAAA ADRS enable (E), decay rate (D), attack rate (A).
ADSR (2) $X6 LLLR RRRR Sustain level (L), sustain rate (R).
GAIN $X7 0VVV VVVV
1MMV VVVV
Mode (M), value (V).
ENVX $X8 0VVV VVVV Reads current 7-bit value of ADSR/GAIN envelope.
OUTX $X9 SVVV VVVV Reads signed 8-bit value of current sample wave multiplied by ENVX, before applying VOL.

ADSR

This controls an Attack-Decay-Sustain-Release envelope that automatically adjusts the sample's envelope volume (ENVX) over time.

  • ***E***: 1 to enable ADSR envelope, otherwise uses GAIN directly.
  • ***A***: Attack speed. $F for instant.
  • ***D***: Decay speed, time to decay from full volume to the sustain level after the initial attack.
  • ***L***: Sustain level.
  • ***R***: Sustain release, speed of decay to 0 after note off.

GAIN

This register has 5 modes:

  • 0VVV VVVV sets ENVX directly.
  • 110V VVVV Linear slide up to 100% volume with rate V.
  • 111V VVVV Bent-line (fast to 75%, then slower to 100%) slide up with rate V.
  • 100V VVVV Linear slide down to 0% volume with rate V.
  • 101V VVVV Exponential slide down to 0% volume with rate V.

Global

Instruction Set

Official instruction names and syntax for SPC-700 instruction were provided by Sony. However, because of its architectural similarity to 6502, some prefer to rename and remap them using a 6502 style syntax. Both are provided here.

SPC-700 Instruction Set
Instruction 6502-Style Opcode Bytes Cycles Flags Notes
TODO

IPL Boot ROM

TODO

BRR Samples

TODO (See Links section below.)

See Also

Links