Sonic 2 Clone Driver v2

Discussion in 'Staff Projects' started by Clownacy, Aug 12, 2016.

  1. Clownacy

    Clownacy Negative Clownancy Staff

    Joined:
    Aug 15, 2014
    Messages:
    881
    Stop using this driver. It hasn't had a release since 2016 (it's been dead longer than it's been alive), it's a 68k driver so it murders your RAM and V-ints, and there are better drivers out there, like Flamedriver, KEH's driver, and AMPS.

    Sonic 2 Clone Driver v2

    version 2.7

    About
    So, what is the Sonic 2 Clone Driver v2?

    This is a heavily modified version of Sonic 1's sound driver, with a greater level of compatibility with music and sounds from other Sonic titles, along with numerous bugfixes, optimisations, and added features. However, to really understand the driver, you need to understand its history, and its ties (or lack thereof) to the original Sonic 2 Clone Driver.

    Both the original Sonic 2 Clone Driver and the Sonic 2 Clone Driver v2 are modified versions of Sonic 1's sound driver (modified early(?) SMPS 68k Type 1b), designed to act as total replacements of Sonic 2's sound driver (improved Z80 port of Sonic 1's driver).

    At the time of the original Sonic 2 Clone Driver's creation, working with Sonic 2's driver was considered extremely difficult, compared to Sonic 1's driver. This was down to several factors, such as the driver being designed for the Z80 sound coprocessor, which sported a language few were willing to learn, and many changes to the music format. Not helping matters was also the fact that the driver was largely unexplored and lacking documentation. In contrast to Sonic 1's documented, easy-to-understand driver, Sonic 2's driver just seemed unfeasible to use, even though it had additional features, such as added DAC samples and PSG envelopes. This pushed hackers away from hacking Sonic 2.

    One of the earlier efforts to counter this was the porting of Sonic 1's driver to Sonic 2. While this did help to ease the addition of custom music, compatibility with Sonic 2's original music and SFX was practically non-existent. Because of this, a hybrid was made, the original Sonic 2 Clone Driver, allowing access to Sonic 2's music, SFXs and DACs, while having the ease-of-use of Sonic 1's driver.

    That was the past, however. Over time, advancements in documentation and tools have made both drivers just as easy to use, and the need for something like the original Sonic 2 Clone Driver has diminished. Still, people continue to use the ancient thing, despite the fact that it wasn't really a feature-complete replica of Sonic 2's driver to begin with: missing PSG envelopes, incorrect music/SFX priorities, broken speed-up tempos, broken tempos in general, there were many problems with the original Sonic 2 Clone Driver that made the hacks that used it suffer. Today, simply sticking to Sonic 2's driver would be a better choice.

    This is why I made the Sonic 2 Clone Driver v2, an attempt at making as close a mimicry of S2's driver as possible: the aforementioned errors were corrected, and many more S2 elements were crammed in, in an effort to make the drivers near indistinguishable.

    The purpose of the Sonic 2 Clone Driver v2 has changed over its lifetime: while originally meant as a simple update to replace the original Sonic 2 Clone Driver, it no longer shares the same goals as its predecessor: while the original was made for ease-of-use, the Sonic 2 Clone Driver v2 exists for the sake of pushing the Mega Drive's hardware to its limit, by avoiding the biggest bottleneck: the Z80's limitations. Problem areas such as driver size and poor DAC quality can be avoided by not using a Z80-based driver such as Sonic 2's or even Sonic 3's. This allows a hack to push its sounds to the limit, without having to downgrade to the smaller feature pool of Sonic 1's original driver.


    So, what isn't the Sonic 2 Clone Driver v2?

    As said before, the Sonic 2 Clone Driver v2 is not meant for the purpose of making the process of adding custom music easier, rather, it's for those that wished to implement features that the Z80 would not allow, due to its limitations. One example can be seen in the hack Sonic 2 Recreation, a hack that was based on Sonic 2, but used a 68k-based driver (a heavily modified version of the original Sonic 2 Clone Driver) because a Z80-based driver would not allow all of the features needed. The Sonic 2 Clone Driver v2 uses Vladikcomper's Mega PCM, a custom DAC driver only available for 68k-based sound drivers. Mega PCM allows for greater playback quality and control. This is just one of the things possible when the sound driver is not entirely based on the Z80.

    Of course, 68k-based drivers have their downsides. Sonic 1's driver operates on the 68k, the main processor of the Mega Drive. Sonic 2's driver operates on the Z80, the sound co-processor. So, there's the obvious performance penalty on the 68k, and thus your hack's gameplay. It may not be much, but ask yourself, is it worth it? Are you going to make any good use of it? There is also the RAM requirement: Sonic 2's driver just uses the Z80's RAM. In contrast, Sonic 1's driver uses $5C0 bytes of the very RAM that has to be juggled with the level chunks, blocks, layout, decompression queues, camera RAM, and much more. Again, you can use that RAM for a million other things, so why use it on this? What would all that RAM and performance be going into? If your answer is just 'doing something that Sonic 2's driver can already do', then this driver is not for you.

    You need to know if your hack's goals justify the costs. Are you doing some Mega CD work that the Z80 can't handle? If you just want to have S3K music in your hack, go use S3K's driver (or better yet, a good version of S3K's driver), or a (modern) music-porting tool.

    That said, by using this driver, you acknowledge that if I find it being used just so you can use S3K music, I will call you out on it. =P

    Features
    • Enhanced Mega PCM - High-quality DPCM/PCM playback, with greater playback control. Now with DAC volume control
    • SMPS2ASM - Edit music and sounds in ASM, and port them with ease
    • Bugfixes - A lot of them. Sonic 1's, and even Sonic 2's, sound driver is a buggy mess, but you don't have to worry about that
    • Less HAX - Real support for music slots >=$E0
    • More HAX - Support for music slots <$80 (Git only)
    • Enough slots for up to $7C DAC samples for use by music or SFX
    • 'Delay on overflow' tempo algorithm. Allows for more accurate conversions of S2/S3K tempos than S1's 'delay on timeout' algorithm
    • Supports music and SFX from Sonic 1 and Sonic 2
    • Partially supports music and SFX from Sonic 3 & Knuckles, Sonic 3D Blast, Sonic Crackers, and Knuckles' Chaotix
    • All DACs (drum and voice samples) from S1, S2, S3K, S3D and Crackers
    • All PSG envelopes (PSG instruments) from S1, S2, S3K, S3D and Chaotix
    • All PWM samples from Chaotix
    • Support for special Sonic 2 sound driver features:
      • Spin Dash SFX support (rev increases in pitch)
      • Gloop SFX support (only plays every other time it's called)
      • StopSFX sound command (used by EHZ boss' propeller)
      • Runs at full speed on PAL consoles ("PAL mode")
      • Song-sensitive PAL mode (S2's drowning theme plays slower on PAL)
      • Absolute FM voice pointers - You can put your voices anywhere, even in a universal bank, like S3K
      • Support for negative track pointers - Within range, you can point to data before or after the song itself
      • More sound queues - Currently at 4, the same as Sonic 2. Sonic 1 only had 2 working ones, and a third broken one
    • Support for special Sonic 3 sound driver features:
      • PSG flags (reset, rest)
      • Universal Voice Bank
      • Continuous SFX system
      • FM voice TL output is decided by sign bit, increasing compatibility with certain voices
    • Support for special Knuckles' Chaotix sound driver features:
      • PWM playback

    Requirements
    • The following games and disassemblies are supported:
      • Sonic 2 - Git disassembly, Xenowhirl's 2007 disassembly
      • Sonic 1 - Git disassembly (AS branch)
    • Sound files must be in SMPS2ASM v0.2 (.asm) format; assembled (.bin) files are unsupported
    • This driver is designed for use with the AS Macro Assembler
    • Users of Xenowhirl's 2007 disassembly will need to update their copy of AS to get the driver to build properly. Just copy over Git's version of AS. Newer versions are broken
    • Obviously, in order to utilise PWM playback, your hack needs to be ported to the 32X

    Downloads
    The driver can be downloaded here.

    There is also a branch that uses the original (v1.1) Mega PCM, without my modifications, meaning it uses much less Z80 RAM, lacks volume control, and has higher playback speeds.

    In addition, there's a branch that uses Valley Bell's DAC driver, however, it is not public (for reasons that are obvious if you read its thread).

    Demonstration ROMs are available here (S1) and here (S2) (v2.5; outdated).

    Installation
    Sonic 2 Git disassembly
    Setting up your disassembly
    Let's start by removing the old S2 sound driver's files: Delete s2.sounddriver.asm and the contents of the sound folder.

    Inside the now-empty sound folder, extract the contents of the driver's zip/tar.gz file.

    Since we're working on an S2 disassembly, move the files and folders from the Sonic 2 files folder out to the sound folder. You can now delete the Sonic 1 files, Sonic 2 files, and Sonic 2 Xenowhirl files folders; we won't be needing them anymore. You can also delete the following files/folders, if you're not porting your hack to the 32X:

    Folders:
    • Chaotix music
    • PWM
    • Stub 32X
    Files:
    • Chaotix PWM Driver.bin
    • Sonic 2 Clone Driver v2 - PWM Driver.asm
    • Sonic 2 Clone Driver v2 - PWM Samples.asm
    • Sonic 2 Clone Driver v2 - Stub SH2.asm

    Now we need to update the disassembly's main build tool: s2p2bin. It performs a special function, where it compresses the sound driver. In vanilla Sonic 2, the entire sound driver is compressed using the Saxman compression. For the Sonic 2 Clone Driver v2, however, it should instead compress the DAC driver using the Kosinski compression. For Windows users, an alternate binary of the s2p2bin.exe is packaged with the driver, but for OSX/Linux users, source code is also available. You can find these in the Build tools folder. Windows users: copy the win32 folder over the original win32 folder in your disassembly's main folder. With that done, you can delete the Build tools folder. You can also delete the build_plus.bat/build_plus.sh files in your main disassembly folder, as those still use the old Saxman compression. From now on, just use build.bat.

    Replacing the old sound driver's code
    Now your disassembly has been fully set up for use with the Sonic 2 Clone Driver v2. Onto modifying your hack's code to use the driver.

    First, we'll include constants and the like for the driver: at the start of your disassembly (s2.asm), after the 'include "s2.macros.asm"', insert this:

    Code:
    ; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ; Sonic 2 Clone Driver v2 and SMPS2ASM
        include "sound/Sonic 2 Clone Driver v2 - Macros.asm"
        include "sound/Sonic 2 Clone Driver v2 - Sound IDs.asm"
        include "sound/Sonic 2 Clone Driver v2 - Compatibility.asm"
        include "sound/Sonic 2 Clone Driver v2 - RAM.asm"
        include "sound/Sonic 2 Clone Driver v2 - Constants.asm"
        include "sound/_smps2asm_inc.asm"
    Next we'll replace some old sound driver functions with new ones. Find JmpTo_SoundDriverLoad, and delete it and everything up to, but not including, PauseGame. Where that code used to be, insert this:

    Code:
        include "sound/Sonic 2 Clone Driver v2 - Functions.asm"
    Finally we'll replace the bulk of the old sound driver: find SoundDriverLoad, and delete everything from there until, but not including, ArtNem_Buzzer_Fireball. You can also remove the nearby 'align $1000'. After that, find 'cnop -Size_of_SEGA_sound, $8000', and delete everything until '; end of 'ROM''.

    In this new space, we'll add the Sonic 2 Clone Driver v2's code, with this:

    Code:
        include "sound/Sonic 2 Clone Driver v2.asm"
    There are still bits of the old driver's code that need removing. Find sndDriverInput, and delete it. Then delete every branch to it. Also, replace every instance of 'move.b #MusID_Pause,(Music_to_play).w' with 'SMPS_PauseMusic', and 'move.b #MusID_Unpause,(Music_to_play).w' with 'SMPS_UnpauseMusic'. Then remove the reference to movewZ80CompSize in the line just above EndOfRom.

    Finally, we need to make the game actually run the Sonic 2 Clone Driver v2: under VintRet, insert this:

    Code:
        SMPS_UpdateSoundDriver
    s2.constants.asm still contains some code for the old sound driver. Find the 'Music IDs', and delete everything up to '; 2P VS results screens'.

    While you're in s2.constants.asm, you should allocate some RAM to the Sonic 2 Clone Driver v2. By default, for Sonic 2, it needs $39B bytes. When you've found the RAM for the driver, give it the label 'Clone_Driver_RAM'.

    Sonic 2 Xenowhirl disassembly
    Setting up your disassembly
    Before we do anything, you'll need to update your disassembly's assembler, AS. The Sonic 2 Clone Driver v2 targets the version included in the Git disassembly. Windows users: copy asw.exe and the msg folder in the win32 folder to your disassembly's win32 folder.

    Now we can begin removing the old S2 sound driver's files: Delete s2.sounddriver.asm and the contents of the sound folder.

    Inside the now-empty sound folder, extract the contents of the driver's zip/tar.gz file.

    Since we're working on an S2 disassembly, move the files and folders from the Sonic 2 files folder out to the sound folder. Then do the same for the Sonic 2 Xenowhirl files folder. You can now delete the Sonic 1 files, Sonic 2 files, and Sonic 2 Xenowhirl files folders; we won't be needing them anymore. You can also delete the following files/folders, if you're not porting your hack to the 32X:

    Folders:
    • Chaotix music
    • PWM
    • Stub 32X
    Files:
    • Chaotix PWM Driver.bin
    • Sonic 2 Clone Driver v2 - PWM Driver.asm
    • Sonic 2 Clone Driver v2 - PWM Samples.asm
    • Sonic 2 Clone Driver v2 - Stub SH2.asm

    Now we need to update the disassembly's main build tool: s2p2bin. It performs a special function, where it compresses the sound driver. In vanilla Sonic 2, the entire sound driver is compressed using the Saxman compression. For the Sonic 2 Clone Driver v2, however, it should instead compress the DAC driver using the Kosinski compression. For Windows users, an alternate binary of the s2p2bin.exe is packaged with the driver, but for OSX/Linux users, source code is also available. You can find these in the Build tools folder. Windows users: copy the win32 folder over the original win32 folder in your disassembly's main folder.

    Replacing the old sound driver's code
    Now your disassembly has been fully set up for use with the Sonic 2 Clone Driver v2. Onto modifying your hack's code to use the driver.

    First, we'll include constants and the like for the driver: near the start of your disassembly (s2.asm), before '; start of ROM', insert this:

    Code:
    ; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ; Sonic 2 Clone Driver v2 and SMPS2ASM
        include "sound/Sonic 2 Clone Driver v2 - Macros.asm"
        include "sound/Sonic 2 Clone Driver v2 - Sound IDs.asm"
        include "sound/Sonic 2 Clone Driver v2 - Compatibility.asm"
        include "sound/Sonic 2 Clone Driver v2 - RAM.asm"
        include "sound/Sonic 2 Clone Driver v2 - Constants.asm"
        include "sound/_smps2asm_inc.asm"
    Next we'll replace some old sound driver functions with new ones. Find JmpTo_SoundDriverLoad, and delete it and everything up to, but not including, PauseGame. Where that code used to be, insert this:

    Code:
        include "sound/Sonic 2 Clone Driver v2 - Functions.asm"
    Finally we'll replace the bulk of the old sound driver: find SoundDriverLoad, and delete everything from there until, but not including, ArtNem_Buzzer_Fireball. You can also remove the nearby 'align $1000'. After that, find 'cnop -Size_of_SEGA_sound, $8000', and delete everything until '; end of 'ROM''.

    In this new space, we'll add the Sonic 2 Clone Driver v2's code, with this:

    Code:
        include "sound/Sonic 2 Clone Driver v2.asm"
    There are still bits of the old driver's code that need removing. Find sndDriverInput, and delete it. Then delete every branch to it. Also, replace every instance of 'move.b #-2,(Music_to_play).w' with 'SMPS_PauseMusic', and 'move.b #-1,(Music_to_play).w' with 'SMPS_UnpauseMusic'. Then remove the reference to movewZ80CompSize in the line just above EndOfRom.

    Finally, we need to make the game actually run the Sonic 2 Clone Driver v2: under VintRet, insert this:

    Code:
        SMPS_UpdateSoundDriver
    You should allocate some RAM to the Sonic 2 Clone Driver v2. By default, for Sonic 2, it needs $39B bytes. When you've found the RAM for the driver, give it the label 'Clone_Driver_RAM'.

    Sonic 1 Git disassembly
    Setting up your disassembly
    Let's start by removing the old S1 sound driver's files: Delete s1.sounddriver.asm and the contents of the sound folder.

    Inside the now-empty sound folder, extract the contents of the driver's zip/tar.gz file.

    Since we're working on an S1 disassembly, move the files and folders from the Sonic 1 files folder out to the sound folder. You can now delete the Build tools, Sonic 1 files, Sonic 2 files, and Sonic 2 Xenowhirl files folders; we won't be needing them anymore. You can also delete the following files/folders, if you're not porting your hack to the 32X:

    Folders:
    • Chaotix music
    • PWM
    • Stub 32X
    Files:
    • Chaotix PWM Driver.bin
    • Sonic 2 Clone Driver v2 - PWM Driver.asm
    • Sonic 2 Clone Driver v2 - PWM Samples.asm
    • Sonic 2 Clone Driver v2 - Stub SH2.asm

    Replacing the old sound driver's code
    Now your disassembly has been fully set up for use with the Sonic 2 Clone Driver v2. Onto modifying your hack's code to use the driver.

    First, we'll include constants and the like for the driver: at the start of your disassembly (sonic.asm), after the 'include "Macros.asm"', insert this:

    Code:
    ; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ; Sonic 2 Clone Driver v2 and SMPS2ASM
            include "sound/Sonic 2 Clone Driver v2 - Macros.asm"
            include "sound/Sonic 2 Clone Driver v2 - Sound IDs.asm"
            include "sound/Sonic 2 Clone Driver v2 - Compatibility.asm"
            include "sound/Sonic 2 Clone Driver v2 - RAM.asm"
            include "sound/Sonic 2 Clone Driver v2 - Constants.asm"
            include "sound/_smps2asm_inc.asm"
    Next we'll replace some old sound driver functions with new ones. Find SoundDriverLoad, and delete it and everything up to, but not including, 'include "_inc/PauseGame.asm"'. Where that code used to be, insert this:

    Code:
            include "sound/Sonic 2 Clone Driver v2 - Functions.asm"
    Finally we'll replace the bulk of the old sound driver: find SoundDriver, and replace this:

    Code:
    SoundDriver:    include "s1.sounddriver.asm"
    ...with this:

    Code:
            include "sound/Sonic 2 Clone Driver v2.asm"
    There are still bits of the old driver's code that need removing. Replace every instance of 'move.b #1,(v_snddriver_ram+f_stopmusic).w' with 'SMPS_PauseMusic', and 'move.b #$80,(v_snddriver_ram+f_stopmusic).w' with 'SMPS_UnpauseMusic'.

    Finally, we need to make the game actually run the Sonic 2 Clone Driver v2: under VBla_Music, replace this:

    Code:
            jsr    (UpdateMusic).l
    ...with this:

    Code:
            SMPS_UpdateSoundDriver
    Constants.asm still contains some code for the old sound driver. Remove Size_of_SegaPCM, Size_of_DAC_driver_guess, z80_dac3_pitch, z80_dac_status, and z80_dac_sample. Also, find the '; Sound driver constants', and delete everything up to '; VRAM data', as well as everything from '; Background music' to 'flg__Last'.

    Variables.asm contains some RAM-related stuff for S1's sound driver, which also needs removing. Delete everything from here:

    Code:
    ; =================================================================================
    ; From here on, until otherwise stated, all offsets are relative to v_snddriver_ram
    ; =================================================================================
    ...to here:

    Code:
    ; =================================================================================
    ; From here on, no longer relative to sound driver RAM
    ; =================================================================================

    Other Guides
    Optimising VBlank Routines (in Sonic 2)
    PCM playback quality is dragged down by unnecessary Z80 interruptions. Here, we'll see to removing these. Most of them are in V-Int, though there are notable instances elsewhere.

    First, search for this (if you're using the Git disassembly):

    Code:
        dma68kToVDP Sprite_Table_2,VRAM_Sprite_Attribute_Table,VRAM_Sprite_Attribute_Table_Size,VRAM


    Or this, if you're using the Xenowhirl disassembly:

    Code:
        dma68kToVDP Sprite_Table_2,$F800,$280,VRAM


    You should find it sandwiched between a stop and a start. Delete these first two. That covers H-Int

    Now, onto V-Int.

    • VintSub0 (if you haven't already deleted them while removing sndDriverInput)
    • loc_4C4, the other at loc_54A
    • Vint0_noWater
    • VintSub14
    • VintSub8, the other is at loc_748
    • Vint10_specialStage, the other at loc_86E
    • VintSubA, with the other way over above loc_9B8
    • VintSub1A
    • VintSubC, with the other being at loc_BD6
    • VintSub18
    • VintSub16
    • Do_ControllerPal (sub_E98 on Xenowhirl), the other at loc_EFE


    Now for the rest.

    • JoypadInit
    • ClearScreen
    • EndingSequence

    Extend + Enhance Sound Test
    Sonic 2 Git disassembly
    LEVEL SELECT SOUND TEST
    Go to LevSelControls_CheckLR and remove these two lines:

    Code:
        bcc.s    +
        moveq    #$7F,d0


    Then remove these three:

    Code:
        cmpi.w    #$80,d0
        blo.s    +
        moveq    #0,d0


    Then change this...

    Code:
        btst    #button_A,d1
        beq.s    +
        addi.b    #$10,d0
        andi.b    #$7F,d0
    
    +


    ...into this:

    Code:
        btst    #button_A,d1
        beq.s    +
        addi.b    #$10,d0
        bcc.s    +
        moveq    #0,d0
    
    +


    And remove this:

    Code:
        addi.w    #$80,d0

    OPTIONS SOUND TEST
    Go to OptionScreen_Controls, and change this...

    Code:
        btst    #button_A,d0
        beq.s    +
        addi.b    #$10,d2
        cmp.b    d3,d2
        bls.s    +
        moveq    #0,d2
    
    +


    ...into this:

    Code:
        cmpi.b    #2,(Options_menu_box).w
        bne.s    +
        btst    #button_A,d0
        beq.s    +
        addi.b    #$10,d2
        bcc.s    +
        moveq    #0,d2
    
    +


    Under that, remove this:

    Code:
        addi.w    #$80,d0


    Then go to OptionScreen_Choices, and change this...

    Code:
        dc.l ($80-1)<<24


    ...into:

    Code:
        dc.l ($FF<<24)

    Sonic 2 Xenowhirl 2007 disassembly
    LEVEL SELECT SOUND TEST
    Go to LevSelControls_CheckLR and remove these two lines:

    Code:
        bcc.s    +
        moveq    #$7F,d0


    Then remove these three:

    Code:
        cmpi.w    #$80,d0
        blo.s    +
        moveq    #0,d0


    Then change this...

    Code:
        btst    #button_A,d1
        beq.s    +
        addi.b    #$10,d0
        andi.b    #$7F,d0
    
    +


    ...into this:

    Code:
        btst    #button_A,d1
        beq.s    +
        addi.b    #$10,d0
        bcc.s    +
        moveq    #0,d0
    
    +


    And remove this:

    Code:
        addi.w    #$80,d0

    OPTIONS SOUND TEST
    Go to OptionScreen_Controls, and change this...

    Code:
        btst    #button_A,d0
        beq.s    +
        addi.b    #$10,d2
        cmp.b    d3,d2
        bls.s    +
        moveq    #0,d2
    
    +


    ...into this:

    Code:
        cmpi.b    #2,(Options_menu_box).w
        bne.s    +
        btst    #button_A,d0
        beq.s    +
        addi.b    #$10,d2
        bcc.s    +
        moveq    #0,d2
    
    +


    Under that, remove this:

    Code:
        addi.w    #$80,d0


    Then go to OptionScreen_Choices, and change this...

    Code:
        dc.l ($80-1)<<24


    ...into:

    Code:
        dc.l ($FF<<24)

    Sonic 1 Git disassembly
    LEVEL SELECT SOUND TEST
    In sonic.asm, go to LevelSelect and change this...

    Code:
            andi.b    #btnABC+btnStart,(v_jpadpress1).w ; is A, B, C, or Start pressed?


    ...into this:

    Code:
            andi.b    #btnB+btnStart,(v_jpadpress1).w ; is B or Start pressed?


    Then change this...

    Code:
            bne.s    LevSel_Level_SS    ; if not, go to    Level/SS subroutine


    ...into this:

    Code:
            beq.s    .checkB                ; if so, branch
            andi.b    #btnStart,(v_jpadpress1).w    ; is start pressed?
            beq.s    LevelSelect            ; if not, branch
            bra.s    LevSel_Level_SS            ; if so, go to    Level/SS subroutine
    
    .checkB:
            andi.b    #btnB,(v_jpadpress1).w    ; is B pressed?
            beq.s    LevelSelect        ; if not, branch
    
    .soundtest:


    After that, remove this line:

    Code:
            addi.w    #$80,d0


    Then delete these lines:

    Code:
            ; This is a workaround for a bug, see Sound_ChkValue for more.
            ; Once you've fixed the bugs there, comment these four instructions out
            cmpi.w    #bgm__Last+1,d0    ; is sound $80-$93 being played?
            blo.s    LevSel_PlaySnd    ; if yes, branch
            cmpi.w    #sfx__First,d0    ; is sound $94-$9F being played?
            blo.s    LevelSelect    ; if yes, branch
    
    LevSel_PlaySnd:


    After that, go to LevSel_SndTest, and change this...

    Code:
            andi.b    #btnR+btnL,d1    ; is left/right    pressed?


    ...into this:

    Code:
            andi.b    #btnA+btnC+btnR+btnL,d1    ; is left/right/A/C pressed?


    and remove this:

    Code:
            bhs.s    LevSel_Right
            moveq    #$4F,d0        ; if sound test    moves below 0, set to $4F


    And then change this...

    Code:
            btst    #bitR,d1    ; is right pressed?
            beq.s    LevSel_Refresh2    ; if not, branch
            addq.w    #1,d0        ; add 1    to sound test
            cmpi.w    #$50,d0
            blo.s    LevSel_Refresh2
            moveq    #0,d0        ; if sound test    moves above $4F, set to    0
    
    LevSel_Refresh2:


    ...into this:

    Code:
            btst    #bitR,d1    ; is right pressed?
            beq.s    LevSel_ButtonA    ; if not, branch
            addq.w    #1,d0        ; add 1    to sound test
    
    LevSel_ButtonA:
            btst    #bitA,d1    ; is A pressed?
            beq.s    LevSel_ButtonC    ; if not, branch
            addi.b    #$10,d0        ; add $10 to sound test
            bcc.s    LevSel_ButtonC    ; did the addition overflow?
            moveq    #0,d0        ; if so, set value to $00
    
    LevSel_ButtonC:
            btst    #bitC,d1    ; is C pressed?
            beq.s    LevSel_Refresh2    ; if not, branch
            subi.b    #$10,d0        ; subtract $10 from sound test
            bcc.s    LevSel_Refresh2
            cmpi.b    #$F0,d0
            beq.s    LevSel_Refresh2    ; do not set to 0 if already at 0
            moveq    #0,d0        ; if the subtraction overflowed, set value to $00
    
    LevSel_Refresh2:


    Now go to LevSel_DrawSnd, and remove this line:

    Code:
            addi.w    #$80,d0

    FAQ
    How do I use SMPS2ASM? (Windows users)
    It's a command line tool. The most basic setup you'll want is to get smps2asm.exe in a folder, in the same folder, have GHZ's music in .bin S1 format then hold Shift key and right-click in the Explorer window without anything selected, select "Open command window here", then input the following:

    smps2asm.exe -v 1 "GHZ.bin" "GHZ.asm" GHZ

    If you just enter "smps2asm.exe" you'll get an explanation of what these are: "-v" being driver version, and "1" the variable following it, which matches the driver which the file came from. After that is the input .bin filename, then the output .asm filename, and finally, the name the .asm file uses to identify itself. So labels such as the voices label are "GHZ_Voices".

    There are more settings that are worth using in other situations, like Offset for Z80 driver sound files.

    How do I play DAC samples during gameplay using Mega PCM?
    As Mega PCM's topic will tell you, you can play DPCM/PCM samples, not as part of the music, but during gameplay. As part of this driver's installation, a subroutine called 'SMPS_PlaySample' was added; we'll need to be using this.

    Using it is identical to using PlayMusic, and the others: simply put the ID of the sample you want to play in d0, then branch to SMPS_PlaySample, like so:

    Code:
        move.b    #dSega_S2,d0
        jsr    (SMPS_PlaySample).w

    Changelog
    12/08/2016 (dd/mm/yyyy)
    v2.7
    • Support for the 32X
    • Support for four PWM tracks
    • Fixed bug where Special SFX incorrectly mute PSG3 while it's being used by SFX (thanks, Markey)
    • Added proper volume cap check to DoFadeIn (thanks again, Markey)
    • Fixed bug where PSG 1&2 are not muted during SFX initialisation (Markey, stop, please)
    • Added a bugfix from S2's driver that stops cfStopTrack from altering the stack too much on DAC channels
    • Tried to reduce name collision with MegaPCM by adding a prefix to most labels
    • UpdateDAC has been restructured, so its stack usage is identical to FM and PSG (kind of undoing that last bugfix :( )
    • Made MegaPCM check that YM2612 isn't busy before enabling DAC (fixes muted drums at start of some songs)
    • SFX now properly update on the frame that a new song is played

    02/07/2016
    v2.6
    • New DPCM tables were ported from SMPS-Treasure, speeding up DPCM loop (unlike SMPS-Treasure, these tables are generated by the DAC driver during initialisation, so they don't waste ROM like the volume table)
    • Made Spin Dash toggleable, so its code isn't assembled if you're not using it
    • Fixed bug during song initialisation that caused the last two sound queues to be accidentally cleared
    • Ported S2's version of Sound_Play (zCycleQueue)
    • Music/SFX/SpecSFX data has been merged into 'metadata tables', simplifying their addition or modification (for example, the music metadata table contains the music's pointer, speed-shoes tempo, and playback flags)
    • Restored compatibility with official (flamewing's) SMPS2ASM
    • All tracks use zTrack.VoicePtr now (saves some RAM)
    • Overall RAM cleanup
    • Some Z80 access was made 'safe' (interrupt can't interrupt Z80 bus request, and accidentally deassert it)
    • Fixed OOZ oil slide SFX (was updating FM volume on a PSG channel)
    • Added check to prevent above bug from having any negative effects, just like S2's driver
    • A branch is available that uses the stock v1.1 MegaPCM

    18/01/2016
    v2.5
    • Fixed hanging notes on music that doesn't define all tracks
    • Optimised some track RAM write looping
    • Added missing S3/S3D PSG envelopes
    • Overhauled SMPS2ASM PSG defining
    • Slightly lowered pitch on all DAC samples
    • Updated SMPS2ASM
    • Renamed DAC_Entry arguments to not conflict with comments
    • Removed support for other drivers from _smps2asm_inc.asm (a pain to maintain)
    • Updated sound driver disassembly (track RAM is better-defined)
    • Made some 'move' instructions safer
    • Made disabled coordination flags safer
    • Removed old unused SMPS 68k Type 1a track pointers
    • Made SFX_SFXChannelRAM and SFX_BGMChannelRAM word-sized
    • Ported SMPS Z80's TL handling, fixing S3K DEZ1 (bit 7 lets it be changed by volume)
    • Added support for transposition division overflow, fixing S3D intro (S3D uses these)
    • Shrinked FM_Notes, to allow for negative transpositions
    • Removed ReverseFreqs. It was fun while it lasted, but I'm not about to waste time figuring out how to make a negative shrunken FM_Notes
    • Corrected smpsVcTotalLevel errors in OOZ, Ending, and Title Screen
    • Corrected smpsVcTotalLevel errors in SFX 55 and 5C (D5 and DC)
    • Corrected FM5 channel transposition in SFX BC (Spin Dash release)
    • Added 'readme.txt' files to 'music' and 'SFX' folders, detailing bugfixes made and where to find SMPS2ASM
    • Added URLs to Mega PCM's thread at start of Mega PCM files
    • Split PSG volume envelopes to 'Sonic 2 Clone Driver v2 - PSG Volume Envelopes.asm'
    • Split FM Universal Voice Bank to 'Sonic 2 Clone Driver v2 - FM Universal Voice Bank.asm'
    • Slightly reordered data at end of driver
    • Added option to not include FM Universal Voice Bank
    • Added option to not include certain games' PSG volume envelopes
    • Removed SetDuration_pea
    • Fixed cfSetPSGTone when it's run on FM track (forgot to advance the track pointer)
    • Enhanced SMPS2ASM to ignore S3-specific smpsFade
    • Reverted bugged optimisations to PSG volume envelopes (fixes VVZ2)
    • Added support for negative track pointers, fixing SFX CC (holy cow, another one I haven't noticed since v2.0)

    12/12/2015
    v2.4.2
    • Removed redundant instructions under .silencefm6
    • Removed WriteFMIorIIMain, and merged its function into the one thing that used it, like S2's driver
    • Fixed PSG noise channel not shutting up when a new song starts
    • Rewrote PauseMusic to be more like it was in S2's driver
    • Fixed Mega PCM DAC samples not pausing properly (holy shit this has been here since v2.0)

    05/12/2015
    v2.4.1
    • Added (proper, unlike S2!) fix for music interrupting SFX, causing distortion
    • Made .silencefm6 more like it was in S2's driver
    • Removed some instances where DAC is enabled with WriteFMI. Mega PCM can do that on its own
    • Allowed FM6 to enable itself, letting a song use both FM6 and DAC tracks (the channel itself alternates, so they can't run at the same time)
    • Removed some instances where DAC is disabled with WriteFMI. The above change means FM6 can do that on its own
    • Made PlaySega (68k mode) manually enable DAC

    01/12/2015
    v2.4
    • Added Vladikcomper's fix for interrupt crash, and optimisation of horizontal interrupts
    • Made Mega PCM assemble with the rest of the driver
    • Merged DAC_Table into Mega PCM source code
    • Split 'Sonic 2 Clone Driver v2.asm' from 'Sonic 2 Clone Driver v2 - Compatibility.asm', because of how constants are now generated
    • Added DAC volume control
    • Removed some excessive optimisation
    • Removed needless 'Clownacy |' comments
    • Removed pointless commented-out code
    • Rearranged constants and flags, allowing DAC ID constants to be used in your hack's code
    • Switched back to S1's Sega chant sample (S2's is just S1's with a bit cut off at the end)
    • Fixed mistake in Mega PCM's code I made at some point (an iy+3 was changed to iy+2, breaking panning)
    • Made everything case-sensitive-friendly

    09/07/2015
    v2.3
    • Made FadeOutSFX use d6 instead of d7, so that it doesn't conflict with Sound_PlayBGM
    • Optimised PSG envelopes with more efficient use of flags
    • Made previous version's bugs toggleable with Fix_DriverBugs
    • Added Valley Bell's Sega chant pan fix
    • Added Valley Bell's 0 FM track fix
    • Added Valley Bell's cfFadeInToPrevious PSG noise type fix
    • Added a (commented out) call to FadeOutSpecSFX in Sound_PlayBGM
    • Un-commented-out the calls under Sound_PlayBGM
    • S2-ified FadeOutSFX
    • Corrected StopSoundAndMusic comment
    • Improved cfFadeInToPrevious FM6 fix
    • Reduced RAM usage by employing a trick from S&K's driver: the SFX/special SFX share RAM with the 1up music backup
    • Switched to using 'STRUCT' to define track RAM
    • Defined driver RAM with phase/ds.b combo
    • Split v_1up_ram_copy into v_1up_ram_copy and v_1up_variables (variables now go after tracks)
    • As part of the SFX/track backup share, the playback control bytes of all tracks are separately backed-up
    • Made Sound_PlayBGM's extra life code clear the special SFX tracks' 'is playing' bit
    • Special SFX code above FMDACInitBytes now uses tst.b instead of tst.w
    • Moved v_special_voice_ptr back next to v_voice_ptr (RAM is dynamic now, so it can go here without wasting any RAM if unused)
    • Made continuous SFX RAM toggleable
    • Reduced zTrack size to $2E by changing LoopCounters from 4 bytes to 2 bytes, as S&K's driver has it
    • Reduced zTrack size to $2C with some track-specific RAM usage
    • FinishTrackUpdate no longer clears VolFlutter on non-PSG tracks
    • Removed now-useless label (loc_721B6)

    09/03/2015
    v2.2.6
    • Sonic 2-ifications
      • Added to FMUpdateTrack and PSGUpdateTrack the way S2's driver does
      • Made TrackSetRest no longer continue to FinishTrackUpdate
      • Fixed modulation on rests by adding a check to DoModulation (noticeable at start of ARZ's theme after it's looped)
      • Relocated a check in FMPrepareNote to occur a little earlier
      • Changed a reference to a locret in Sound_PlayBGM with one to .bgm_loadMusic, which should make it so that the extra life music can interrupt itself
      • Made .bgmnot1up clear v_fadeout_counter
      • .bmg_fmloadloop and .bgm_psgloadloop now set the 'track at rest' bit, avoiding hanging notes (noticable at start of DEZ's theme)
      • Optimised .silencefm6 using some S2 logic
      • Sound_PlaySFX no longer checks v_fadeout_counter
      • FadeOutMusic no longer calls FadeOutSFX
      • SpeedUpMusic and SlowDownMusic no longer set v_main_tempo_timeout
      • PSGSetVolume now corrects values that are >=$10
      • PSGSetFreq and .restpsg don't continue to FinishTrackUpdate
      • An 'add' in PSGSendVolume is replaced with an 'ori'
      • cfPanningAMSFMS has an additional check
      • Added a (commented out) call to FadeOutSFX in Sound_PlayBGM
    • .nospeedshoes no longer sets v_main_tempo_timeout to the header tempo. This is to avoid unintended tempo overflow on the first frame of playback, delaying the song by a frame. This also helps to prevent hanging notes (noticable at start of DEZ's theme)
    • Removed useless 'even' from under FMDACInitBytes
    • Removed last '0's from FMDACInitBytes and PSGInitBytes (were actually 'even's)

    03/03/2015
    v2.2.5.2
    • Added waitZ80 macro, for S1 compatibility
    • Added cfSendFMI
    • Replaced cfOpF9 with above
    • Added cfChanFMCommand
    • Added some flag documentation from S3K and flamewing's driver
    • Better-formatted Sonic 2 Clone Driver v2 - Compatibility.asm
    • Relocated DAC ID equates from _smps2asm_inc.asm to Sonic 2 Clone Driver v2 - Compatibility.asm
    • Made said IDs dynamic, in the same way as the music and SFXs
    • Corrected IDs to account for absent dHipHopHitKick3
    • Added id function to Sonic 2 Clone Driver v2 - Compatibility.asm

    21/02/2015
    v2.2.5.1
    • Updated SMPS2ASM

    27/12/2014
    v2.2.5
    • Updated to latest Git (fixing a newly-pointed-out bug along the way)
    • Merged all compatibility layers into s1.sounddriver.compatibility.asm
    • Moved v2.2.4.1b's toggles to s1.sounddriver.compatibility.asm
    • Reverted some dangerous 'moveq's to 'move.b's
    • Optimised a branch under PSGUpdateVolFX
    • Optimised a branch under VolEnv_Reset
    • Removed a branch under VolEnv_Off by moving it above the branch's target
    • Size-optimised MegaPCM, reducing the uncompressed binary's size from 210h to 1E5h
    • Added another nop instruction to waitYM (the beginning of S2's title screen theme plays a goofy note in Regen with just the one)
    • Optimised FMSetFreq by making it write directly from FM_Notes to zTrackFreq
    • Replaced the 'clr.b's under bgmnot1up with a faster moveq/move.b combination
    • Removed the redundant 'clr.b v_sndprio'
    • Optimised Sound_PlayBGM and Sound_PlaySpecial by making them write their voice pointers directly to v_voice_ptr/v_special_voice_ptr (old leftover from v2.1's longword voice pointer hack)
    • Optimised SpeedUpMusic, SpeedUpMusic_1up, SlowDownMusic and SlowDownMusic_1up with some register usage
    • Optimised some zTrackVolume(a5) usage under DoFadeOut
    • Optimised .bgm_psgloadloop by using an addq to skip the 'redundant' byte
    • Optimised Sound_ChkValue by removing the redundant check for Sound Commands
    • bsr -> bra in .specfmdone
    • Renamed all s1.sounddriver files and moved them to the sound folder
    • Changed which v_sndprio clear is used in Sound_PlayBGM (Sonic 2 uses the last one)
    • Added new waitYMspec macro that uses parameter as target for tst
    • Used above modification to optimise WriteFMI
    • Optimised cfSetPSGNoise with better register use
    • Rearranged files at end of driver (Mega PCM, PSGs, music, sounds, others) to put many within 'SoundIndex(pc)' range
    • Fixed oversight in cfNoteFillS3K (d1 isn't loaded if tempo divider = 1), increasing compatibility with S3K music
    • Added two missing S1 equates
    • Excluded nops from waitYM loop
    • Used more appropriate locret under FMNoteOn
    • Added S3K tweak to cfSetPSGTone and cfSetVoice

    17/10/2014
    v2.2.4.1b
    • Added several toggles to allow for Sonic 1 support

    15/10/2014
    v2.2.4.1
    • Optimised WriteFMI(I) with a nice trick I picked up from Ristar's driver
    • Optimised some writes to psg_input
    • Optimised all adda.x #x,aN to lea x(aN),aN
    • Optimised FM and PSG's .gotduration by replacing them with SetDuration_pea
    • Added a nop to WaitYM to avoid missed writes
    • Optimised PSG flags by reordering their checks in order of most-to-least common
    • Replaced a 'branch to rts' with an rts
    • Restored the music and SFXs to their 'as-of-2011' state. They shouldn't be modified in the first place
    • Added to _smps2asm_inc.asm to fix DAC typo

    06/10/2014
    v2.2.4
    • Fixed FM6 fade-in
    • Modified cfFadeToPrevious to work on FM and PSG tracks
    • Optimised some locrets (recycling!)
    • Annotated Vladikcomper's modified WriteFMI(I)
    • Removed a startZ80 that I missed back in v2.0
    • Renamed several constants to be more S1-like
    • Restored original local labels (With tweaks for compatibility)
    • Optimised lea Clone_Driver_RAM into .w
    • Optimised 68k version of PlaySega
    • Ported S3K's NoteFill
    • Optimised some 'bsr & bra' into 'pea & bra'
    • Further optimised the waitYM macro by using tst.b instead of btst
    • Optimised all btst #7 to tst
    • Even further optimised waitYM by moving ym2612_a0 to a register
    • Updated channel RAM addresses description
    • Optimised NoteFillUpdate

    13/09/2014
    v2.2.3.1
    • Moved troublesome PSG frequency
    • Reverted PSGPitchConvert to an earlier, more readable state

    11/09/2014
    v2.2.3
    • Added S3K's additional PSG frequencies
    • Added S3K's continuous SFX system
    • Split sound priorities and speedup tempos from main asm into s1.sounddriver.other.asm
    • Improved guide to update driver on H_Int when available

    14/08/2014
    v2.2.2.1
    • Made slight optimisation around the branch to TempoWait by removing the branch altogether :p
    • Optimised some lsl into add
    • Optimised some clr.l into move.l
    • Optimised some branches from .w to .s
    • Made a bunch of bsr.w into bsr.s
    • Fixed (my) error in _smps2asm_inc.asm that caused missing coordination flags to not be detected

    18/07/2014
    v2.2.2
    • Added fourth sound queue
    • Replaced all 'jsr's with 'bsr.w's, and 'jmp's with 'bra.w's
    • Made small optimisations under PBGM_BGMLoadMusic, PSGUpdate_NoteGoing, SetVoice_SendTL, UnpausedAllFM, FadeIn_FadedDone, FM_UpdateFreq
    • Renamed Snd_FadeOutSFX and Snd_FadeOutSFX2
    • Changed bcc into bhs under PSFX_TimerActive
    • Optimised some of the Spin Dash rev code
    • Optimised waitYM macro (nothing uses d2 afterwards, and bit instructions can affect memory)
    • Restored cfUnused1 (cfSetCommunication)
    • Removed Size_of_SegaPCM macro (unused leftover from 2.0 :p)
    • Fixed error made while removing Special SFX code under FadeOut_TrackPSG
    • Fixed (my) error in the smpsStopSpecial macro
    • Optimised some code around PSFX_SFXInitPSG (code was made less efficient back when I was trying to fix the $40+ index bug)
    • Fixed Sound_PlaySpecial (it didn't support absolute voice pointers, and also has the $40+ index bug)

    04/07/2014
    v2.2.1.2
    • Removed some 'jsr's that interfered with the Stack

    03/07/2014
    v2.2.1.1
    • Optimised PAL mode
    • Ported S2's PAL timer system
    • Made PAL_Audio_CountDown part of the Clone Driver's RAM

    01/07/2014
    v2.2.1
    • Removed 68k-freeze code in PlaySega, it has negative effects in Sonic 2
    • Added coordination flag cfSilenceStopTrack
    • Added coordination flag cfPlayDACSample
    • Added coordination flag cfPlaySound
    • Added coordination flag cfSetKey
    • Added coordination flag cfSetVolume
    • Added FMSilenceChannel
    • Removed two unused coordination flags
    • Redone PAL mode
    • Replicated S2's ability to force PAL slowness on certain songs

    29/06/2014
    v2.2
    • Rearranged indexes and data again, now they are all located after the driver's code
    • Reformatted PSGDoVolFX
    • Ported three new PSG flags, two are used by S3K's PSGs, the final is unused, but added for the sake of completion
    • Now using stock S3K PSGs instead of converted-to-S1 equivalents
    • Ported S1 & S2 PSGs
    • Added missing 'even' after the Universal Voice Bank
    • Optimised the unused coordination flags' code
    • Optimised some code under Sound_Play
    • Corrected some comments
    • Ported S3K's TempoWait, allowing full access to S3K-style tempos
    • Added S2 speedup tempos, converted to S3K tempos
    • Replaced the Original Clone Driver's modified S2 music with stock S2 music

    16/06/2014
    v2.1.3
    • Removed more Special SFX remnants, namely v_special_voice_ptr
    • Freed up a tiny amount of RAM by turning some byte-sized flags to bit-size. They are grouped under the RAM address 'misc_flags'. Flags include:
      • v_gloop_toggle
      • Spindash_LastSound_Flag
      • v_ring_speaker
      • f_updating_dac
      • f_fadein_flag
    • f_updating_dac and f_fadein_flag been changed to a bit, so their 'On' state isn't defined by being set to $80, but to 1
    • Removed f_fastmusic entirely, it's not even used in this version of the Community disasm. It's just v_1up_ram_copy's copy of f_speedup
    • Fixed typo in instruction under PSFX_NotSpinDashRev label
    • Rearranged RAM variables to group all unused RAM in one area ($19-$39)
    • Split music and sound 'include's from main asm file, allowing users to update their s1.sounddriver.asm without overwriting their custom music and sound 'include's
    • Done the above to the music and SFX pointers, also. Said pointers have also been moved to above their respective 'include's, for sake the of ease when updating
    • Added missing equate under Sound_PlaySpecial
    • Modified installation guide to feature a full-speed PAL audio fix, straight from MJ's Moonwalker

    20/04/2014
    v2.1.2
    • Relocated coordination flags from $E0+ to $FE+, as a result, there are now free DAC slots and a total of $7C DAC slots
    • Corrected S3/K/3D DAC order
    • Named all S3/K/3D/C DACs
    • Removed cfStopSpecialFM4

    19/04/2014
    v2.1.1
    • Compressed Mega PCM Z80 code, DAC tables are still uncompressed though
    • Readded Mega PCM .wav compatibility
    • Matched S2 DAC pitches to those in S2's driver, but they're still inaccurate, the snare seems to be BETWEEN 3 and 4
    • Added Crackers DACs
    • Fixed SMPS2ASM's dLowerEchoedClapHit entry

    15/04/2014
    v2.1
    • Relocated sound commands from $F9-$FD to $FB-$FF
    • Fixed priorities list not including the sound commands ($FB-$FF)
    • Adapted Sonic 2's feature of having the priorities system only apply to SFXs
    • Added Sound Flag $FA, StopSFX, now back from Sonic 2, and fully functional
    • Added S3+ PSG instruments
    • Added S3+ DAC samples
    • Added S3+ Universal Voice Bank
    • Modified _smps2asm_inc.asm to have an option for the Clone Driver v2, 'SonicDriverVer = 0'
    • Removed remainder of the Special SFXs ($D0-$DF), freeing up $60 bytes of RAM
    • Rearranged data and indexes:
      • Data (UniVoiceBank, PSG, Music, SFX) at bottom
      • Indexes (PSG, Music, SFX) at top
    • Music and SFXs use absolute (longword) pointers for their Voices, this is to allow UniVoiceBank support
    • Removed all 'Go_Index' nonsense, references are now direct
    • Made Sega PCM ID dynamic
    • Added Flag IDs

    01/04/2014
    v2.0.1
    • Removed unused SoundIndex entry
    • Removed redundant Sega PCM alignment
    • Fixed sound priority
    • Used constants to make sound group changing more accessible
    • Reworded >=$E0 sound bug explanation

    31/03/2014
    v2.0 (Initial release)
    • Ported to AS
    • Replaced local labels with unique labels
    • Added Hivebrain labels
    • Added Mega PCM
    • Applied 'Optimising Z80 Stops' guide
    • Added SMPS2ASM
    • Added S2 priorities
    • Added S2 DACs
    • Added S2 PSGs
    • Added Spin Dash support
    • Added Gloop support
    • Fixed bug causing sounds with an index entry of >=$40 to crash
    • Fixed v_playsnd3 to be fully usable
    • Replaced S1's music with the original Clone Driver's music
    • Replaced S1's sound effects with S2's sound effects
    • Relocated Silence value to $00
    • Extended starting sound slot from $81 to $01
    • Relocated MusicIndex to above music 'BINCLUDE's
    • Removed special SFX-related code
    • Relocated sound commands from $E0-$E4 to $F9-$FD

    Videos



    Credits

    Original Sonic 2 Clone Driver
    Varion Icaria - Puto's sound driver port
    Esrael - Tweaker's sound driver port, plus fixes for Puto's port, including a fix for the Sega sound
    Puto, Tweaker, StephenUK - Numerous fixes
    JMan2050 - Jman's PCM driver
    Valley Bell - $EC sound fix

    Sonic 2 Clone Driver v2
    Contributors to the sound driver disassemblies
    Valley Bell - General help, fixes for some bugs, SMPS Research Pack, inspiration
    Shobiz - Ported Spin Dash rev code
    Puto - Original 68k Sega chant playback code
    MarkeyJester - DAC fade-in fix, along with pointing several other bugs in S1's driver
    Cinossu - S1SMPS2ASM, the basis of SMPS2ASM
    Flamewing - SMPS2ASM core; pointing out S3K's additional PSG frequencies; his perfect-compression koscmp, used to compress Mega PCM
    Vladikcomper - Mega PCM, this fix
    Gardeguey - SH2 code used as the basis of the 'Stub SH2' program
    Clownacy - Go read the changelog =P
     
    Last edited: May 13, 2019
  2. Clownacy

    Clownacy Negative Clownancy Staff

    Joined:
    Aug 15, 2014
    Messages:
    881
    Nothisisn'tadoublepostshutup

    v2.7
    I'm gonna cut right to the chase.





    What's changed?
    • Support for the 32X
    • Support for four PWM tracks
    • Fixed bug where Special SFX incorrectly mute PSG3 while it's being used by SFX (thanks, Markey)
    • Added proper volume cap check to DoFadeIn (thanks again, Markey)
    • Fixed bug where PSG 1&2 are not muted during SFX initialisation (Markey, stop, please)
    • Added a bugfix from S2's driver that stops cfStopTrack from altering the stack too much on DAC channels
    • Tried to reduce name collision with MegaPCM by adding a prefix to most labels
    • UpdateDAC has been restructured, so its stack usage is identical to FM and PSG (kind of undoing that last bugfix :( )
    • Made MegaPCM check that YM2612 isn't busy before enabling DAC (fixes muted drums at start of some songs)
    • SFX now properly update on the frame that a new song is played

    So... yeah, PWM playback. I've gotten most of the ranting out of my system in the description of those YouTube videos, but I'll still list some details here (keep in mind, my terminology might be incorrect):

    The SH2-based PWM driver itself is ripped straight out of Knuckles' Chaotix. It software-mixes four PWM channels, with stereo panning support, and a maximum sample rate of 11025Hz (which is interpolated to 22050Hz). This puts it at a bit of a disadvantage over the stock DAC driver from the likes of S1, whose Snare sample has a rate of roughly 22kHz, and the driver fully supports it. In that top video, I actually had to downsample the Snare to get it to play at full speed, and there's a noticeable quality drop. I might be able to modify the driver to remove that limitation at some point, and maybe even add support for more than 4 channels, but for now the PWM driver is entirely vanilla.

    The PWM code can easily be 'plugged in' to an existing 32X project: on the SH2 side, the driver just needs to be called on every PWM interrupt, and the driver itself needs loading into the Cache on boot. To demonstrate this, I've included a 'stub SH2' program, based on Gardeguey's SH2 code (available as part of his Sonic 1 32X port), which only runs the PWM driver.

    As you can see in the top video, also included is rudimentary support for PWM SFX: simply call the SMPS_PlayPWMSample function, and you can play any sample you want, at any volume/pan you want, on any channel you want. Right now, there's no priority system, so make sure to not play an SFX on a channel the music is using.

    Also, yes, as the second video shows, Chaotix music can now be ported to the driver. But don't just use my driver because it's easy to port music to; it's 68k-based for crying out loud. Anyway, to dump Chaotix songs, I have a rough edit of SMPS2ASM here. A pre-converted set of Chaotix music is included with the driver.

    On a related note, I've had to expand SMPS2ASM's format to support PWM tracks, while maintaining backwards compatibility with non-32X songs:

    Standard SMPS2ASM header
    Code:
    Mus82_LZ_Header:
       smpsHeaderStartSong 1
       smpsHeaderVoice  Mus82_LZ_Voices
       smpsHeaderChan  $06, $03
       smpsHeaderTempo  $02, $06
    
       smpsHeaderDAC  Mus82_LZ_DAC
       smpsHeaderFM  Mus82_LZ_FM1,   $F4, $0C
       smpsHeaderFM  Mus82_LZ_FM2,   $E8, $0D
       smpsHeaderFM  Mus82_LZ_FM3,   $F4, $18
       smpsHeaderFM  Mus82_LZ_FM4,   $F4, $18
       smpsHeaderFM  Mus82_LZ_FM5,   $00, $12
       smpsHeaderPSG  Mus82_LZ_PSG1,   $D0, $02, $00, fTone_09
       smpsHeaderPSG  Mus82_LZ_PSG2,   $D0, $02, $00, fTone_09
       smpsHeaderPSG  Mus82_LZ_PSG3,   $00, $02, $00, fTone_04
    
    Expanded SMPS2ASM 32X header
    Code:
    DoorIntoSummer_Header:
       smpsHeaderStartSong 3
       smpsHeaderVoice  DoorIntoSummer_Voices
       smpsHeaderChan  $07, $03, $04
       smpsHeaderTempo  $01, $25
    
       smpsHeaderDAC  DoorIntoSummer_DAC
       smpsHeaderFM  DoorIntoSummer_FM1,   $00, $09
       smpsHeaderFM  DoorIntoSummer_FM2,   $0C, $10
       smpsHeaderFM  DoorIntoSummer_FM3,   $0C, $10
       smpsHeaderFM  DoorIntoSummer_FM4,   $00, $10
       smpsHeaderFM  DoorIntoSummer_FM5,   $00, $10
       smpsHeaderFM  DoorIntoSummer_FM6,   $00, $10
       smpsHeaderPSG  DoorIntoSummer_PSG1,   $F4, $00, $00, KCVolEnv_0C
       smpsHeaderPSG  DoorIntoSummer_PSG2,   $F4, $03, $00, KCVolEnv_0C
       smpsHeaderPSG  DoorIntoSummer_PSG3,   $23, $01, $00, KCVolEnv_02
       smpsHeaderPWM  DoorIntoSummer_PWM1,   $00, $99
       smpsHeaderPWM  DoorIntoSummer_PWM2,   $00, $AA
       smpsHeaderPWM  DoorIntoSummer_PWM3,   $00, $99
       smpsHeaderPWM  DoorIntoSummer_PWM4,   $00, $99
    First, there is the new smpsHeaderPWM (which just redirects to smpsHeaderFM, since they have the same variables), which is straight from Chaotix. And a new new feature, that isn't from Chaotix, is the added third value for smpsHeaderChan: the PWM track count. Chaotix was hardcoded to expect every song to have four tracks, which would be a pain to work around. Instead, a song has however many tracks you say it has. It's completely safe to leave the PWM count blank, instead of setting it to $00, like in a normal header. Support for removing the DAC track, however, has not been ported (in fact, the modified SMPS2ASM just inserts dummy DAC data into Chaotix dumps, for compatibility).

    Do note, I haven't tested this thoroughly on hardware, since I don't own a 32X myself. But if someone would like to test it for me, I'd appreciate it (don't mind that all levels but GHZ crash, I just stripped out a lot of other zones' data while porting). Emulators can be picky, too: the PWM's too quiet on Gens Rerecording (emulator bug?), and Gens/GS has a possible bug that causes the left speaker to be muted until the first PWM sample is played. I did get MarkeyJester to hardware-test for this specific bug (betcha didn't know what that ROM was for, at the time ;P), and it didn't seem to occur there, which is why I think these are all emulator things. Everything works fine in Kega, so there's that.

    To enable all this, the compatibility flags SMPS_IsOn32X and SMPS_EnablePWM have been added. SMPS_IsOn32X is separate because it fixes Mega PCM to work on the 32X, while SMPS_EnablePWM... enables PWM. Just in case you wanted to go the DOOM route, and be on the 32X, and not use the PWM for... some reason.

    For anyone who does use the 32X, you'll have to include more than one file this time: include "sound/Sonic 2 Clone Driver v2.asm" should still be done, and contains all the 68k and Z80 stuff. However, you will need to do 'include "sound/Sonic 2 Clone Driver v2 - PWM Driver.asm" and (if you're using the stub SH2 program) include "sound/Sonic 2 Clone Driver v2 - Stub SH2.asm", also. This is so the SH2 stuff and 68k/Z80 stuff can be moved around separately, to fit your bank layout.

    As for the Stub 32X program itself, its ROM address is defined as 'SH2_Start', its length is 'SH2_Length', and the entry points and VBRs are as follows:

    Code:
         dc.l SH2_Entry           ; Master SH2 initial PC
         dc.l s_EntryPoint         ; Slave SH2 initial PC
         dc.l SH2_Master           ; Master SH2 initial VBR address
         dc.l SH2_Slave           ; Slave SH2 intitial VBR address
    Aaaand... yeah. I think that's all.
     
    Last edited: Aug 13, 2016
  3. EMK-20218

    EMK-20218 Eduardo Knuckles Member

    Joined:
    Aug 8, 2008
    Messages:
    1,025
    Location:
    Jardim Capelinha, São Paulo
    I can't believe this is happening! It will be a very big pleasure to test it! This is brilliant!

    EDIT:
    I did everything the installation section shows, but when I tried to compile it I received these errors which I didn't figure a solution to.

    SN 68k version 2.53

    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - MACROS.ASM(119) : Error : Op-code not recognised
    smps_id function ptr,((ptr-offset)/ptrsize+idstart)
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SONIC.ASM(16) : Error : Could not open file 'C:\Users\Marcelo\Desktop\Jogos do EDUARDO\Hacks\Github DRIVER test\s1disasm-master\SOUND\SONIC 2 CLONE DRIVER V2 - SOUND IDS.ASM'
    include 'sound/Sonic 2 Clone Driver v2 - Sound IDs.asm'
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SONIC.ASM(17) : Error : Could not open file 'C:\Users\Marcelo\Desktop\Jogos do EDUARDO\Hacks\Github DRIVER test\s1disasm-master\SOUND\SONIC 2 CLONE DRIVER V2 - COMPATIBILITY.ASM'
    include 'sound/Sonic 2 Clone Driver v2 - Compatibility.asm'
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(4) : Error : Op-code not recognised
    smps_track struct dots
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(19) : Error : Expression must evaluate
    if smps_enablepwm
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(45) : Error : Op-code not recognised
    smps_track endstruct
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(50) : Error : Op-code not recognised
    smps_ram_variables struct dots
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(75) : Error : Expression must evaluate
    if smps_enablecontsfx
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(87) : Error : Op-code not recognised
    smps_ram_variables endstruct
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(92) : Error : Op-code not recognised
    smps_ram struct dots
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(95) : Error : Op-code not recognised
    v_music_dac_track: smps_track
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(97) : Error : Op-code not recognised
    v_music_fm1_track: smps_track
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(98) : Error : Op-code not recognised
    v_music_fm2_track: smps_track
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(99) : Error : Op-code not recognised
    v_music_fm3_track: smps_track
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(100) : Error : Op-code not recognised
    v_music_fm4_track: smps_track
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(101) : Error : Op-code not recognised
    v_music_fm5_track: smps_track
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(102) : Error : Op-code not recognised
    v_music_fm6_track: smps_track
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(106) : Error : Op-code not recognised
    v_music_psg1_track: smps_track
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(107) : Error : Op-code not recognised
    v_music_psg2_track: smps_track
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(108) : Error : Op-code not recognised
    v_music_psg3_track: smps_track
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(110) : Error : Expression must evaluate
    if smps_enablepwm
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(112) : Error : Op-code not recognised
    v_music_pwm1_track: smps_track
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(113) : Error : Op-code not recognised
    v_music_pwm2_track: smps_track
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(114) : Error : Op-code not recognised
    v_music_pwm3_track: smps_track
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(115) : Error : Op-code not recognised
    v_music_pwm4_track: smps_track
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(124) : Error : Op-code not recognised
    v_sfx_fm3_track: smps_track
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(126) : Error : Op-code not recognised
    v_sfx_fm4_track: smps_track
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(128) : Error : Op-code not recognised
    v_sfx_fm5_track: smps_track
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(132) : Error : Op-code not recognised
    v_sfx_psg1_track: smps_track
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(134) : Error : Op-code not recognised
    v_sfx_psg2_track: smps_track
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(136) : Error : Op-code not recognised
    v_sfx_psg3_track: smps_track
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(143) : Error : Op-code not recognised
    v_spcsfx_fm4_track: smps_track
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(147) : Error : Op-code not recognised
    v_spcsfx_psg3_track: smps_track
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(151) : Error : Op-code not recognised
    v_1up_psg2_track: smps_track
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(152) : Error : Op-code not recognised
    v_1up_psg3_track: smps_track
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(153) : Error : Expression must evaluate
    if smps_enablepwm
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(154) : Error : Op-code not recognised
    v_1up_pwm1_track: smps_track
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(155) : Error : Op-code not recognised
    v_1up_pwm2_track: smps_track
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(156) : Error : Op-code not recognised
    v_1up_pwm3_track: smps_track
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(157) : Error : Op-code not recognised
    v_1up_pwm4_track: smps_track
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(161) : Error : Op-code not recognised
    variables: smps_ram_variables
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(163) : Error : Op-code not recognised
    variables_backup: smps_ram_variables
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(171) : Error : Expression must evaluate
    if smps_gloopsfxbehaviour
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(174) : Error : Expression must evaluate
    if smps_enablespindashsfx
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(177) : Error : Expression must evaluate
    if smps_pushsfxbehaviour
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(180) : Error : Expression must evaluate
    if smps_enablecontsfx
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(184) : Error : Expression must evaluate
    if smps_enablespindashsfx
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(192) : Error : Op-code not recognised
    smps_ram endstruct
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(194) : Error : Expression must evaluate
    if mompass=1
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - RAM.ASM(195) : Error : Op-code not recognised
    message 'Sonic 2 Clone Driver v2 RAM size is $\{SMPS_RAM.len} bytes!'
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - CONSTANTS.ASM(15) : Error : Expression must evaluate
    smps_music_track_count = ((smps_ram.v_music_track_ram_end-smps_ram.v_music_track_ram)/smps_track.len)
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - CONSTANTS.ASM(16) : Error : Expression must evaluate
    smps_music_fm_dac_track_count = ((smps_ram.v_music_fmdac_tracks_end-smps_ram.v_music_fmdac_tracks)/smps_track.len)
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - CONSTANTS.ASM(17) : Error : Expression must evaluate
    smps_music_fm_track_count = ((smps_ram.v_music_fm_tracks_end-smps_ram.v_music_fm_tracks)/smps_track.len)
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - CONSTANTS.ASM(18) : Error : Expression must evaluate
    smps_music_psg_track_count = ((smps_ram.v_music_psg_tracks_end-smps_ram.v_music_psg_tracks)/smps_track.len)
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - CONSTANTS.ASM(19) : Error : Expression must evaluate
    if smps_enablepwm
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - CONSTANTS.ASM(20) : Error : Expression must evaluate
    smps_music_pwm_track_count = ((smps_ram.v_music_pwm_tracks_end-smps_ram.v_music_pwm_tracks)/smps_track.len)
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - CONSTANTS.ASM(23) : Error : Expression must evaluate
    smps_sfx_track_count = ((smps_ram.v_sfx_track_ram_end-smps_ram.v_sfx_track_ram)/smps_track.len)
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - CONSTANTS.ASM(24) : Error : Expression must evaluate
    smps_sfx_fm_track_count = ((smps_ram.v_sfx_fm_tracks_end-smps_ram.v_sfx_fm_tracks)/smps_track.len)
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - CONSTANTS.ASM(25) : Error : Expression must evaluate
    smps_sfx_psg_track_count = ((smps_ram.v_sfx_psg_tracks_end-smps_ram.v_sfx_psg_tracks)/smps_track.len)
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - CONSTANTS.ASM(27) : Error : Expression must evaluate
    smps_special_sfx_track_count = ((smps_ram.v_spcsfx_track_ram_end-smps_ram.v_spcsfx_track_ram)/smps_track.len)
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - CONSTANTS.ASM(28) : Error : Expression must evaluate
    smps_special_sfx_fm_track_count = ((smps_ram.v_spcsfx_fm_tracks_end-smps_ram.v_spcsfx_fm_tracks)/smps_track.len)
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - CONSTANTS.ASM(29) : Error : Expression must evaluate
    smps_special_sfx_psg_track_count = ((smps_ram.v_spcsfx_psg_tracks_end-smps_ram.v_spcsfx_psg_tracks)/smps_track.len)
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\SONIC 2 CLONE DRIVER V2 - CONSTANTS.ASM(31) : Error : Expression must evaluate
    smps_sound_queue_count = (smps_ram_variables.sound_queues_end-smps_ram_variables.sound_queues_start)
    C:\USERS\MARCELO\DESKTOP\JOGOS DO EDUARDO\HACKS\GITHUB DRIVER TEST\S1DISASM-MASTER\SOUND\_SMPS2ASM_INC.ASM(10) : Error : Op-code not recognised
    enum smpspitch10lo=$88,smpspitch09lo=$94,smpspitch08lo=$a0,smpspitch07lo=$ac,smpspitch06lo=$b8

    Too many errors, assembler aborting...
    Errors during pass 1 - pass 2 aborted
    Assembly completed.
    64 error(s) from 1259 lines in 0.0 seconds
     
    Last edited: Aug 29, 2016
  4. Clownacy

    Clownacy Negative Clownancy Staff

    Joined:
    Aug 15, 2014
    Messages:
    881
    s1disasm/master uses asm68k. As stated in the Requirements section, AS is required.

    Necro edit: I'm talking about the disassembly, not the folder. You know who you are.
     
    Last edited: Feb 17, 2017
    EMK-20218 likes this.
  5. LoganTheSonicPlayer

    LoganTheSonicPlayer Rom Hacker Trialist

    Joined:
    Oct 27, 2015
    Messages:
    3
    Location:
    South Island, Mobius
    I can never get this into a hack. Errors, errors, errors everywhere.
     
  6. TheStoneBanana

    TheStoneBanana The Bananaman Member

    Joined:
    Nov 27, 2013
    Messages:
    604
    Location:
    The Milky Way Galaxy
    Seems a little pointless to bump a thread just to say you can't get something working.
    If you would like some help, it would be a good idea to specify exactly what errors you're getting or examples of some so that people can lend you a hand.
     
    Ravenfreak likes this.
  7. Calvin

    Calvin DreamCast Enthusiast with a GameCube Member

    Joined:
    Mar 1, 2014
    Messages:
    245
    Location:
    $C800
    @LoganTheSonicPlayer:
    I made the mistake, too, but it's an easy fix.
    You're using the wrong assembler, need I mention that I was about to ask the same thing minutes ago.

    Also, I would recommend asking in the Basic Q&A Thread when threads haven't been touched in awhile.
    Keeps things a lot cleaner around here.
     
  8. Clownacy

    Clownacy Negative Clownancy Staff

    Joined:
    Aug 15, 2014
    Messages:
    881
    You say that as if it's somehow my fault. Is it my fault you bumped a near-year-old thread just to complain, too?
     
    Last edited: Aug 5, 2017
    KCEXE, Calvin and Natsumi like this.
  9. LoganTheSonicPlayer

    LoganTheSonicPlayer Rom Hacker Trialist

    Joined:
    Oct 27, 2015
    Messages:
    3
    Location:
    South Island, Mobius
    Huh, I didn't know until Clownacy told me that this was about a year old. Same thing has happened every time I tried to add this driver. I might just add the driver again just to get the error log.
     
  10. LazloPsylus

    LazloPsylus A Certain Scientific Railgun The Railgun

    Joined:
    Nov 25, 2009
    Messages:
    Location:
    Academy City
    ...There's dates on every post indicating when they were sent. Taking a few seconds to look would have avoided bumping this thread unnecessarily. Check before you post, please.
     
  11. Pacca

    Pacca Why succeed when you can profit off of failure? Member

    Joined:
    Jul 5, 2014
    Messages:
    1,149
    Location:
    Triton (Moon)
    Would it be possible to have priority DAC samples override FM6? I know they can't run side by side at once, but I'd rather have the one channel cut out for a bit then have sfx get stopped prematurely by the music.