We've just updated MediaWiki and its underlying software. If anything doesn't look or work quite right, please mention it to us. --RanAS

N-SPC Engine/Nintendo/Koji Kondo/Prototype

From SnesLab
Revision as of 12:47, 14 October 2020 by KungFuFurby (talk | contribs) (Record build differences for Super Mario World and Pilotwings)
Jump to: navigation, search

Go back to N-SPC Engine

The Prototype variant was used in two games: Super Mario World and Pilotwings. They are the only versions of the code that clearly pre-date the source code version provided with the IS-Sound unit. From a sound effect programming point of view, it can also be considered a predecessor to five other games that post-date the source code: SimCity, Legend of Zelda - A Link to the Past/Zelda no Densetsu - Kamigami no Triforce, Star Fox/Star Wing, Super Mario All-Stars/Super Mario Collection and Super Mario: Yoshi Island/Super Mario World 2: Yoshi's Island.

Game Name Music Version VCMD Table Location ($DA and up) ROM Offset
Super Mario World 0.0 0x0F90, relative to 0x0EDC (all other versions)
0x0FC4, relative to 0x0F10 (Super Mario All Stars + Super Mario World)
0x0E8000 (all other versions)
0x4E8000 (Super Mario All-Stars + Super Mario World)
Pilotwings 0.1 0x1317, relative to 0x1263 (US and Japanese versions)
0x12B4, relative to 0x1200 (European version)
0x0C8000 (all versions)

The build difference between the standalone Super Mario World and its variant in Super Mario All-Stars is an extra command for $2141/$F5: $F0. This command zeroes out the echo volume DSP registers, keys off all notes, zeroes out several memory locations then activates and jumps to the IPL boot program. The copy itself used for the $FF command is stored at $FE00 rather than in the middle of the program.

The build difference between the other versions and the European version of Pilotwings is similar to Super Mario All Stars and Super Mario World, except it's more like a complete replacement since it changes the operation of the $FF command for $2141/$F5. The echo volume DSP registers are zeroed out, all notes are keyed off, the EON register is cleared, echo writes are disabled, then we activate and jump to the IPL boot program instead of using a variant of it embedded in the program.

Instrument Format

Compared to common N-SPC, this is mostly the same, except it is missing the pitch base fractional multiplier, and V0.0 doesn't have noise support. Otherwise, it's the same as before: four direct DSP register references, and the pitch base multiplier as following in byte order:

  • SRCN
    • In V0.1, if this value is above $7F, noise is used, and the lowest five bits contains the noise clock rate.
  • ADSR1
  • ADSR2
  • GAIN
  • Pitch Base Multiplier

Percussion Format

Percussion is stored separately from the instrument format in the prototype version, because its format is nearly identical to an instrument, but it contains an extra byte at the end that defines the note to play.

Voice Command Format

The IDs are different due to being an earlier version, and some VCMDs may not be defined yet. The ones that are used are listed below.

VCMD ID Description Arguments
$00 Phrase Termination/End of Subroutine
$01-$7F Note Duration xy
$80-$C5 Note
$C6 Tie
$C7-$CF Rest
$D0-$D9 Percussion
$DA Instrument xx
$DB Panning %xyzzzzz
$DC Panning Fade xx yy
$DD Pitch Slide to Note xx yy zz
$DE Vibrato On xx yy zz
$DF Vibrato Off
$E0 Master Volume xx
$E1 Master Volme Fade xx yy zz
$E2 Tempo xx
$E3 Tempo Fade xx yy
$E4 Global Absolute Transposition xx
$E5 Tremolo On xx yy zz
$E6 Tremolo Off
$E7 Volume xx
$E8 Volume Fade xx yy
$E9 Subroutine xx xx yy
$EA Vibrato Fade In xx
$EB Note Pitch Envelope To xx yy zz
$EC Note Pitch Envelope From xx yy zz
$ED Invalid (supposed to be Note Pitch Envelope Off)
$EE Fine Tune xx
$EF Echo Bits and Volume %xxxxxxxx yy zz
$F0 Echo Off
$F1 Echo Parameter Setup xx yy zz
$F2 Echo Volume Fade xx yy zz
$F3-$FF Invalid

Most of these essentially act identically to the common versions (refer back to the main page for info on those), but two of the VCMDs don't work properly: Note Pitch Envelope Off, which has a zeroed out pointer but the code does exist, and Tremolo On, which has a memory location definition bug for one of the parameters that conflicts with an internal value utilized by the tremolo, causing constant overwriting and making the command not work in general.