New version of the sound driver is available: grab v2a here.
New version of SMPS2ASM is available: grab v0.2 here.
New version of the song pack is available: grab v4a here.
Changes:
- driver: now with support for playing songs with 6 FM channels and no DAC channels;
- driver: universal voice bank (UVB) is now included in every music bank; while this reduces the space in banks, this allows much more freedom for expanding the sound driver;
- driver: UVB has been SMPS2ASM'ed;
- driver: all fixes and changes are now always on;
- driver: driver makes use of local labels (instead of nameless temporaries) and uses S2-style memory management for the z80 RAM (instead of hard-coding everything);
- driver: several new coordination flags and fixes based on other drivers from ValleyBell's research pack; specifically:
- meta CF $FF08 (smpsChanTempoDiv) which works like CF $E5 in S1/S2 drivers;
- meta CF $FF09 (smpsChanFMCommand) that allows sending FM commands to the appropriate YM2612 part for the current track;
- meta CF $FF0A (smpsNoteFill) that works like $E8 did in S1/S2 drivers;
- meta CF $FF0B (smpsPitchSlide) that allows you to do pitch slides (use smpsAlterPitch to set slide speed);
- meta CF $FF0C (smpsSetLFO) that lets you enable/disable the LFO and set AMS and FMS.
- meta CF $FF08 (smpsChanTempoDiv) which works like CF $E5 in S1/S2 drivers;
- SMPS2ASM: can now dump z80 banks given an offset to a pointer table within the bank;
- SMPS2ASM: simple dataflow analysis added to propagate key displacement changes throughout a track; this is used to fix the handling of the maximum-frequency PSG note (since it is different in S1/S2 and S3/S&K/S3D drivers);
- song pack: redumped all songs with the new SMPS2ASM;
- song pack: S3, S&K and S3D songs (and SFX for S&K) now have two versions: the 1:1 versions with unused data and the "optimized" versions without it; the optimized versions also have ALZ song fixed.
A warning: songs dumped with the new SMPS2ASM MUST be used with the "_smps2asm_inc.asm" file present on the sound driver file; earlier versions of the include file will fail. Moreover, I strongly recommend that you redump old songs so that they sound correct due to the PSG maximum-frequency note issue mentioned above.
To use the driver, you will need to either use the constants for zQueueVariables, zMusicNumber, zSFXNumber0 and zSFXNumber1 like what is descriped in Alriightyman's guide to use it in S2 or use the exported symbols for these constants to reference the correct z80 variables.
Edit: v3 is out. The changes are:
- Due to its effects in some S3, S&K and S3D songs, I undid the following bugfix:
- [bugfix] original S3/S&K/S3D driver could not correctly handle playing the sequence "<note>, <duration>, $80, <duration>, <duration>", and would play <note> again instead of a rest.
- S1 and S2 songs that were affected by the previous change got a new version that explicitly puts a $80 before the duration of each rest;
- The "_spms2asm_inc.asm" file now handles the differences in modulation flags that are explained in this post by ValleyBell;
- I have made a release of the SMPS2ASM tool.
For the SMPS2ASM tool, I am providing a Windows binary; for those of you that don't use Windows, I am also providing the source code; it is bundled with the source code of my S2 Special Stage editor, which you can nab here.
Edit: v2 is out. Now includes S3's B2/B3 DAC samples and corrects the Sonic 3 Miniboss and Knuckles songs to use it. Also features the ASM'ed version of the credits medley from Sonic 3 Collection prototype 0517.
Original post follows:
As I have been saying elsewhere, I have written a tool that converts a binary music or SFX file (in SMPS format) to an 'universal' ASM format. I was planning on releasing this some two weeks ago; the delay comes about as a result of having to find and fix sound driver bugs, followed by illness; so sorry about that.
The original idea for this kind of tool is Cinossu's (see his utility); I just made a better one that handles songs and SFX from Sonic 1, Sonic 2, Sonic 3, Sonic & Knuckles and Sonic 3D Blast. I will not be releasing the tool just yet: when I started writing it, I had no idea that the SMPS formats (coordination flags, mostly, but also DAC samples) changed so much between Sonic 1/2 and the others; I hacked them in, but my intention is to rewrite the tool so support for any given game is simply a matter of pointing it to a text file containing definitions.
But there is no reason people should be denied the fruits of it; specifically: this file. (edit: updated link) The contents are:
- All songs, SFX and DAC samples* from Sonic 1;
- all songs, SFX and DAC samples* from Sonic 2;
- all songs, SFX and DAC samples** and SFX from Sonic & Knuckles;
- all songs and DAC samples** from Sonic 3D Blast;
- all songs and DAC samples** from Sonic 3 that are not identical to songs from Sonic & Knuckles;
- _smps2asm_inc.asm, a file that does the bulk of driver conversion;
- 'Z80 Sound Driver.asm', a modified and improved version of the Sonic & Knuckles driver;
- all DAC samples from Sonic 2 (of which the Sonic 1 samples are a subset), Sonic & Knuckles and Sonic 3D Blast.
The included sound driver has tons of changes and fixes compared to the SVN version (some of which I will eventually optionally backport to SVN). They include:
- [enhancement] You can select which DAC groups to use;
- [enhancement] added a coordination flag for setting the tempo divider of a single track;
- [enhancement] added a coordination flag for setting note fill in the same way it is done in Sonic 1/2 drivers;
- [enhancement] added a coordination flag to send an FM command to the correct port (from Ristar);
- [enhancement] added all PSG tones (actually volume flutter) from Sonic 1/2 (the Sonic 1 flutters are a subset of the Sonic 2 flutters);
- [enhancement] removed unnecessary padding between songs;
- [bugfix] original S3/S&K/S3D driver could not correctly handle a rest followed by a 'no attack' coordination flag, followed by a note;
- [bugfix] fixed incorrectly handling of flag to set PSG noise (mainly, interactions with overriding SFX);
- [bugfix] original S3/S&K/S3D driver could not correctly handle playing the sequence "<note>, <duration>, $80, <duration>, <duration>", and would play <note> again instead of a rest.
As of this time, the driver is a drop-in replacement for the S&K disassembly; in the future, I will make edits to kram1024's tutorials to use this driver in Sonic 1 or Sonic 2 (unless kram1024 comes back and does it, as we were talking about before he disappeared).
The _smps2asm_inc.asm file is based off of one from Cinossu's tool; I revamped it and updated it to perform the bulk of the conversion. It handles different pointer formats, different IDs of DAC samples, handles the 12-semitone (1 octave) difference between PSG notes in S1/S2 versus S3/S&K/S3D, and does the bulk of coordination flag conversion. While this makes it trivial to convert songs and SFX in general, converting to Sonic 1 or Sonic 2 drivers is a lot harder (unless you are converting from Sonic 1 or Sonic 2) due to the lack of necessary coordination flags.
Please feel free to ask any questions that aren't clear after looking around in the driver (or which I failed to convey in this message...).
* = Sonic 1's DAC samples are a subset of Sonic 2's DAC samples.
** = Sonic 3's samples are a subset of those from Sonic & Knuckles. Sonic 3D Blast samples are composed of $1D out of the first $1E DAC samples from Sonic & Knuckles, plus two unique samples.


31