AMPS - Ample Music Playback System

Discussion in 'Utilities' started by AURORA☆FIELDS, Apr 28, 2019.

  1. AURORA☆FIELDS

    AURORA☆FIELDS the cute one here Member

    Joined:
    Oct 7, 2011
    Messages:
    737
    Location:
    Finlandia
    [​IMG]

    AMPS
    is a sound driver I started developing in mid-2016, to be used for my hacks. I never found any use for it however. Instead, I kept developing it, if ever in the future I would need it. While I was working for this, Dual PCM was released, and with it, I made the driver work around it. After talking with MarkeyJester, I was allowed to use the future version of Dual PCM in the driver, the version which eventually became Dual PCM FlexEd. I worked on the driver every now and then for almost 2 more years, readying it for public release, and waiting for a Dual PCM release version along with it. You may have seen an early version of the driver in my hack, Achi, where it was used to power all the music related things.


    More about the driver

    AMPS is a sound driver based on Sound-Source, that runs on the Motorola 68000, designed to be used with ROM hacks and Sega Mega Drive software. Although similar to Sound-Source, AMPS is fundamentally different in many aspects. It is also heavily customized, RAM-efficient and cycle-efficient. AMPS is powered by Dual PCM FlexEd, meaning that you can use 2 DAC sample channels with pitch and volume control. AMPS was designed to be a well-documented driver with a lot of capabilities so that the music can sound better, and the program and music can interact with each other. To ensure this, AMPS has a very robust codebase built to allow future expansion and customized programming for program-specific circumstances.


    What features does AMPS have?
    • Highly optimized code, that will ensure that no time is wasted in processing the 68k-side code.
    • Lower RAM usage. The driver optimizes the RAM usage, so that it is easier to add into any program.
    • Various flags to control which features are enabled for AMPS. The user can customize the driver to fit their needs, saving RAM and processor cycles.
    • End user documentation with examples and helpful tools, and documented source code for easier modification.
    • Full support for Dual PCM FlexEd.
      • 2-channel PCM playback.
      • Volume and pitch control.
      • Reverse sample playback.
      • Looping sample support.
      • DMA quality loss prevention.
      • Simplistic sample filtering.
    • PCM sound effect channel and 2 music PCM channels.
    • PCM channels can choose between 2 modes; Sample mode where each note is the sample to be played, and pitch mode where each note changes the pitch instead.
    • Portamento effect for smoothly modulating from one note to another.
    • Full support for volume envelopes and modulation envelopes.
    • SMPS2ASM integration. This makes it possible to easily port music and allows for future expansion.
    • Universal sound bank for sound effects.
    • SSG-EG and LFO support.
    • Speed shoes tempo adjustment, and 2 tempo algorithms; overflow-based and tempo-based.
    • Toggleable 50hz "fix" for music.
    • Spindash sound effect support.
    • Special underwater mode. This allows for a cool underwater-esque effect for music and sound effects (as seen in Sonic 2 Recreation).
    • Customizable fading support. The driver supports multiple different types of fades, and they are user-defined, allowing for a huge variety of different ways to fade or manipulate channel volumes globally.
    • Better commands for using communications bytes for 2-way conversation between tracker files and the game code, and conditionally executing tracker code.
    • Continuous sound effects support. These are sound effects in Sonic 3 & Knuckles that instead of restarting, continue to play sound when the sound ID is played.
    • Music back-up support. This is used in Sonic games for the 1-up sound effect.
    • Sound driver debugging support. This feature allows the sound driver to alert the programmer when various errors or possible mistakes happen when playing tracker files. Very useful for finding out when something goes wrong with the sound driver.

    Why should you use AMPS over something else?

    As discussed already, AMPS provides a large set of features, while conserving CPU cycles and RAM usage. Furthermore, AMPS will be developed further with community feedback in mind, and with new features and optimizations. AMPS is also fully open-source, and can be modified for everyone's individual needs. The source code, while large and complicated, is well documented and open for suggestions. Additionally, since AMPS is built around Dual PCM FlexEd, its integration into the sound driver is deep, which allows the sound driver to reap all the benefits from using Dual PCM FlexEd. The improvements to the music and sound effect formats allow for better and more varied music to be made, especially when it comes to PCM channels. AMPS is also the only Sound-Source-based sound driver which makes it possible to integrate the music more deeply with gameplay or graphics of the host program, something which previously was not possible, or had to be custom built. AMPS has received a lot of attention to detail for its features and codebase.


    What the download contains

    The download contains a few things:
    • End-user technical documentation for AMPS, and the technical reference manual for Dual PCM FlexEd.
    • Depending on the package, either Sonic 1 implementation, Sonic 2 implementation, or files for the AMPS test program which helps debug music, and has a few custom goodies.
    • A folder containing a slightly customized version of Vladikcomper's error debugger. These customizations allow for scrolling menus.

    Few extra notes
    • We have a Discord server!
    • If you want to report a bug, or ask for help with an issue, please provide Aurora with enough information to go by, don't just ask why your assembler or the game is throwing up error messages. I need to know what you think is causing the issue, what you did before the error appeared, what you tried to do to fix it, and if applicable, the ROM, any music or sound effect files that are related. I may ask for more things if I can not figure out what is going on.
    • If you want to suggest a new feature or want me to change something, please also explain why, and how it will benefit the driver as a whole.
    • AMPS currently only supports ASM68K and AS. Because of the complexity of porting this to other assemblers, and limited free time, I am unable to provide a download for other assemblers at this time. If anyone is willing to help out in this regard, I am happy to offer the download here.
    • I have a life (surprising I know)
    • The safe mode is meant to be used only to debug for issues with songs, not for your release ROMs! The safe mode reduces performance and adds more memory usage for the sound driver, meaning that it is most effectively used only when necessary. You can use safe mode for releases without a problem, but it is not recommended.
    • The sound driver does use considerably more ROM space, than other drivers. This is a lot to do with the optimizations I've applied, and Dual PCM FlexEd. Unfortunately, there is not a lot I can do about this currently.

    Future plans

    I have a few things I wanna add in the future into AMPS. Here they are, in no specific order:
    • Clean up the source code more, and make it easier to modify.
    • Add support for PSG4 as a standalone channel.
    • Add support for special FM3 mode, along with dedicated trackers for each of them.
    • Add support for TL modulation and envelopes.
    • Improve underwater mode.
    • Few performance optimizations I have in mind.
    • Better support for volume filters.
    Follow the development of AMPS at its GitHub page!
    Come talk to other users and the devs on Discord!

    Credits
    • AURORA☆FIELDS - The creator and main programmer behind AMPS, and creator and porting of the example music.
    • MarkeyJester - The creator of Dual PCM FlexEd, help with documentation for Sonic 1's sound driver, helping with bug fixes, documentation, hardware testing, and creating the logo.
    • ValleyBell - Provided the code for underwater mode, and is the creator of SMPS Research Pack.
    • Vladikcomper - The creator of the error debugger used for AMPS, and for helping me learn about sound drivers.
    • LuigiXHero - Help with porting many new additions between branches.
    • Stardust Gear - Small additions and bug fixes.
    • Death Rapunzel - Help with bug fixes.
    • Nat The Porcupine - Help with the documentation and hardware testing.
    • FoxConED - Playtesting and suggestions, teaser video, hardware testing.
    • VAdaPEGA - Suggestions and helping with documentation.
    • Hyper - Helping with documentation.
    • Selbi - Help with the documentation.
    • Ozaleto - Help with testing.
    • Kurk - Help with testing.
    • SEGA & Sonic Team - Original Sound-Source 68k driver that AMPS is based upon.
    Sorry if I missed anyone, I realized I forgot keep notes of everyone who's helped, so I hope my memory doesn't fail me...
     
    Last edited: Jul 22, 2020
  2. EMK-20218

    EMK-20218 The Fuss Maker Exiled

    Joined:
    Aug 8, 2008
    Messages:
    1,069
    Location:
    Jardim Capelinha, São Paulo
    Nats... seriously, marry me. (just kidding)

    I need to use this. Although I'm not sure about how I could insert it in my hack or if it would even be compatible with it due to certain internal modifications that my hack's engine suffered accross the years. As for what did I read, it seems very flexible and seems to show a bunch of functions that would be very useful to me. I'm not sure if I'll be able to implement it with the very low ASM knowledge I have, but I'll give it a try. This is a real great present for music lovers like me. Thank you very much! :)
     
    Trickster and AURORA☆FIELDS like this.
  3. Nat The Porcupine

    Nat The Porcupine Well-Known Member Member

    Joined:
    Jun 23, 2017
    Messages:
    53
    Location:
    Pennsyltucky
    Alright, so I gave the driver a quick glance & I have to say that I'm very excited to play around with it. Nicely done, it was definitely worth the wait.
     
    Trickster likes this.
  4. AURORA☆FIELDS

    AURORA☆FIELDS the cute one here Member

    Joined:
    Oct 7, 2011
    Messages:
    737
    Location:
    Finlandia
    So, as I am working on the next release of AMPS, I realize something. To bring the best experience and compromise to everyone, I need to have more options for the user to fine-tune their driver to their liking. This presents a big problem: I will need considerably more time to test each configuration, along with the new features and changes... This will add a lot more time to development only focused on testing and fixing all the immediate bugs, and will make it more likely for bugs to be present in the driver upon release. Given I am going to college again in just over a week, I will have even less time to work on anything. Additionally, keeping documentation up-to-date will be difficult because of this. So what I am thinking is, as I release updates to Github for the driver, I could have you guys help me stress-test it, and report bugs back to me. I also need someone who is willing to re-write the documentation in a nicer format and keep it updated.

    So here is the deal, anyone wanting to help me with testing and bugfixes, you can download the latest source code from Github and play around with it. I will not provide installation instructions nor support for these versions, so use at your own risk! But I will take care of any bugs you report. Preferably, file an issue through the Github website itself on the repository, but you can also DM them to me directly if you don't have an account. I will credit you accordingly on the next release, and will have it out sooner.

    As far as writing documentation, I am afraid, I need someone who actually knows a thing or two about how sound drivers work. I do not have the time to essentially tell you what to write, so I would like that you do your research and I can nitpick what you have written and provide additional details. The documentation should be written in some nice looking format (as opposed to the dodgy solution with text files like currently), and from where you can copy code that preserves formatting (tabs etc). I will provide my help and guidance however, but you'll also need to be able to work independently in a reasonable timeframe.

    By the way, making some progress towards some of the new features currently, so that's something to look forward to.
     
  5. SMS Alfredo

    SMS Alfredo Compact Disc Enthusiast Member

    Joined:
    Sep 3, 2018
    Messages:
    27
    Location:
    Little Planet
    Not sure if this is the correct place to put this, but I have a bug in AMPS I would like to report.

    So, I am attempting to create a streamed song using 3 DAC samples strung together and repeated. The samples are long enough that they don't fit into the $7F range of waiting time. Normally this wouldn't be a problem, as adding more wait time afterwards usually works and the sample continues as long as I meant it to. However, it seems that in this driver, adding extra wait time beyond the initial one set by the sample itself does not work. Instead, for every extra value of wait time, the sample restarts itself. Not sure if this is how it acts in vanilla Sonic 1, but I know for certain this is not how it acted in the MegaPCM Driver.

    Here's the asm file if you want to try replicating the problem yourself.

    Hope this will be helpful.
     
  6. AURORA☆FIELDS

    AURORA☆FIELDS the cute one here Member

    Joined:
    Oct 7, 2011
    Messages:
    737
    Location:
    Finlandia
    I don't have access to the ASM file because of Google drive, however I think I know the issue. DAC channel is bit of a special case in Sonic 1, it does not act like a normal channel, it follows slightly different rules. I am not 100% clear on the rules but likely playing note, delay, delay will not restart a sample. AMPS adheres to the rules of FM and PSG channels, note, delay, delay causes 2 notes to play in succession. This is why the sHold flag exists, it skips a few steps in playing a note, notably the part where the note is restarted, resetting a few variables, and other channel-specific things. For DAC, this means that your sample will keep playing despite playing more delays. You want to add sHold before each additional delay beyond the initial delay.
     
  7. ValleyBell

    ValleyBell Well-Known Member Member

    Joined:
    Dec 23, 2011
    Messages:
    156
    On the DAC channel, note, delay, delay always plays 2 notes. In SMPS 68k/Sonic 1, the only difference to FM and PSG channels is, that the sHold flag doesn't work.
    Instead you're unable to stop a sample, because playing a rest doesn't do anything.

    You can have longer DAC samples by playing: note, delay, rest, delay, delay, ...
     
  8. AURORA☆FIELDS

    AURORA☆FIELDS the cute one here Member

    Joined:
    Oct 7, 2011
    Messages:
    737
    Location:
    Finlandia
    So, an update to AMPS. As you've no doubt seen during the contest week, I released AMPS in Sonic 2 to the SHC Expo. This has been something that has been requested from me for a long time, and I never really felt up to the task of porting AMPS to AS. However, because people asked me nicely and promised to help, I decided to go for it. Of course, as it turns out, porting it was a huge mess and some fundamental things about the driver had to change in order to suit a correct port. There are still some kinks to work out (I am really NOT having fun with AS at all), but I am confident that the current release of the driver works competently enough that I can release it for everyone to enjoy! That being said, this is a pre-release version and there may be severe bugs! Use at your own risk as they say. I will work over time to find and fix these issues, so I definitely suggest keeping up-to-date with the Github repo.

    Also, here is a quick rundown of the changes from previous AMPS versions:
    • PSG volumes are now 7-bit as opposed to 4-bit. This means you have to convert them in songs and sound effects, but it allows for far more intercompatibility with FM
    • There is support for FM6 channels. These can be enabled with simultaneously with DAC too, though DAC will always override FM6.
    • Fixed underwater mode algorithm
    • Support for modulation envelopes
    • Support for FM and DAC volume envelopes
    • Portamento flag
    • Support for backing up songs (such as the 1UP-jingle from Sonic games
    • Optimized YM command code which should make the driver noticeably faster to process
    • Fixed some SFX sounding wrong because of bad timings regarding YM writes (Dual PCM technically writes the cue too fast to YM, so some sounds are different as a result. Fixed by adding more "delay").
    • Updated register setup in such a way that the driver does not use d7 or a6 anywhere
    • Some other bugfixes or tiny feature not worth mentioning right now
    As you can see, AMPS has evolved quite far. The normal 68k version also has kept up with the AS version and should have parity with features. I still need help with bugtesting and documentation, as those are mostly the things left before I can do a full release. Unfortunately, as I don't have massive amounts of time, it may still take me a few months to get everything ready for a release without any help. Furthermore, I am running into some.... Limitations with AS to put it nicely. It does not like to cooperate with me on a few issues that I think are really gonna be a problem regarding full release. Solving that may take some time...

    Anyway, here is the repository link
     
    ProjectFM, Crash, Aier and 6 others like this.
  9. AURORA☆FIELDS

    AURORA☆FIELDS the cute one here Member

    Joined:
    Oct 7, 2011
    Messages:
    737
    Location:
    Finlandia
    I know I've half-promised AMPS for the new year, but because of real life stuff, I haven't been able to finish it. Its not far from being release-worthy, but some things still need to be worked out. Unfortunately, this real life situation is getting more complicated and I have less time to work on this, and because of coronavirus, now I have also less energy to work on things too. I am hoping to get this released ASAP, but there is absolutely no guarantee I will be able to. AMPS is pretty much ready to be used though, the official release will likely not be all that different from what you can see on Github. Please be patient as I work out this situation and add the finishing touches. It's unfortunate things like this happens, but real life comes first, always.
     
    Iso Kilo, Samey, EMK-20218 and 9 others like this.
  10. AURORA☆FIELDS

    AURORA☆FIELDS the cute one here Member

    Joined:
    Oct 7, 2011
    Messages:
    737
    Location:
    Finlandia
    It's here folks! The latest AMPS version. The first post has been edited with the new details, so be sure to have a look.

    A lot has changed since the last time. Because of a lot of people requesting it, there is now an AS port and a Sonic 2 branch. 1-up sounds work correctly again, a lot of optimizations have been done, volume envelopes are supported for DAC and FM, modulation envelopes are supported, and FM6 can be enabled as much channel (even while DAC is running! Though, no DAC sample must be played until FM6 can be heard). There are a few custom features, such as portamento and 7-bit PSG volume. A lot of the rough edges from the last version have been smoothed out, and few customizations has been added. Overall, if I can say so myself, its worth using the new version. It's much better than the first release, and there is now a comprehensive documentation included!
     
  11. AURORA☆FIELDS

    AURORA☆FIELDS the cute one here Member

    Joined:
    Oct 7, 2011
    Messages:
    737
    Location:
    Finlandia
    Here is the next version of AMPS. The post, again, has been updated.

    Again, a fair bit has changed. AMPS now uses a generator to assemble the sound drivers, so they're easy to update. Modulation has drastically been changed to further support Z80 versions, and plenty of bugs have been fixed. The documentation is updated to contain all this new information. You may have to edit your music in order to update to 2.1. See the changelog here:
    • sFreqOn and sFreqOff are no longer tracker commands.
    • New tracker commands: ssModFreq and sModReset.
    • Changes to sModAMPS: Only the <wait> and <step> parameters are loaded initially. This only makes a difference when note is held. The modulation parameters are not reset, which allows the user to change how modulation works mid-note without resetting the offset. In order for the old behaviour to work, sModReset can be used after sModAMPS is used. The <count> is also changed. Now, the value is subtracted before being checked, meaning value of $00 will not start by negating the <step>. Additionally, now it is treated as infinite, meaning modulation up and down is possible for unlimited time. If <count> is $01, the value initially is set to $01 instead of $00, making short modulations still possible. When <wait> is counting down, modulation frequency is still accounted for.
    • The frame a note is played, modulation, portamento and modulation envelope are all updated.
    • mfbNoPAL flag is used to check whether or not PAL mode is enabled, instead of checking for the region. The flag is updated based on song header and PAL region by dPlaySnd_Music.
    • Fixed a bug where DAC panning was not reset correctly for music channels, leading to issues with panning.
    • Fixed a bug with modulation envelopes not working as intended.
    • Added a new PSG frequency to match the PSG table exactly with Sound-Source Z80.
    • Added a new FM frequency to help with Sound-Source Z80.
    • Added a feature that allows easier integration with sound test engines.
    • Speed shoes tempo algorithm now works by running the sound driver twice when the timeout occurs. This also means speed shoes has its own timeout instead of using the main tempo.
    • AMPS Includer can list the names of all music and sfx tracks (not commands however!) now.
    Edit: Some stuff is still to come! Wait patiently! Also, portamento algorithm is changing in the next release to be more consistent with how Sound-Source games did it.
     
    Last edited: Jul 22, 2020
  12. AURORA☆FIELDS

    AURORA☆FIELDS the cute one here Member

    Joined:
    Oct 7, 2011
    Messages:
    737
    Location:
    Finlandia
    After a lot of work (and procrastinating), I've finally finished porting all the Sonic 3 & Knuckles music and sfx into AMPS! Both Sonic 3 and Sonic & Knuckles versions of the shared music are available, with the correct DAC and all. Also, the beta music is here too! Although these won't sound perfectly accurate to S3K (thank you, Sound-Source Z80), they sound as close as possible (I challenge you to find any differences =P). You of course need to tweak some of the settings, especially what flags are enabled, DAC, volume & modulation envelopes, and universal voices need to be ported over with any music or sound effect. The files are more or less provided "as is", with minor tweaks to make them play nice with AMPS, and a few major tweaks because again, Sound-Source. Here is a link to the archive containing all the data.

    Oh yeah and there is a Sonic 1 Github version too, I guess I never mentioned it? Go have a look~
     
    Last edited: Aug 12, 2020
    ProjectFM and DeltaWooloo like this.
  13. Nat The Porcupine

    Nat The Porcupine Well-Known Member Member

    Joined:
    Jun 23, 2017
    Messages:
    53
    Location:
    Pennsyltucky
    Hath Jeebus blessed thy project?

    Poking at Aurora's typos aside though, another thing that has not been mentioned as of yet is that I am now the co-maintainer of the driver, which means I will be assisting with squashing bugs that crop up & porting sound effects./music from more games such as S3D, Chaotix, Crackers & SCD to AMPS at some point in the future. Just thought I'd mention it; basically if you have an AMPS-related question & Aurora isn't online, you have another person you can ask.
     
    Last edited: Aug 12, 2020
  14. penPhobic

    penPhobic No laughing near the emerald! Member

    Joined:
    Dec 11, 2016
    Messages:
    57
    Location:
    Basement
    That's nice. Too bad, I cannot insert it because I got multiple errors such as "Replicated text too big". I'm talking about the macro file size.
     
  15. AURORA☆FIELDS

    AURORA☆FIELDS the cute one here Member

    Joined:
    Oct 7, 2011
    Messages:
    737
    Location:
    Finlandia
    I would like to know more details about what you did, what version did you use, assembler error screenshots, etc, because this is not something that has ever happened to me.
     
  16. penPhobic

    penPhobic No laughing near the emerald! Member

    Joined:
    Dec 11, 2016
    Messages:
    57
    Location:
    Basement
    Well, I just replaced all the S1 files with the S3K files and this old dissasm did not work.

    Failure1.png Failure2.png Failure3.png

    So into the GitHub version I guess.

    EDIT: Not even the GitHub version can make it.
     
    Last edited: Aug 12, 2020
  17. AURORA☆FIELDS

    AURORA☆FIELDS the cute one here Member

    Joined:
    Oct 7, 2011
    Messages:
    737
    Location:
    Finlandia
    Don't just replace all the files as is. You have to remember that ASM68K does not support the same files as AS does; These versions are based on the AS assembler. Look at how the Sonic 1 files and Sonic3K files work, and copy the parts that actually matter. In this case, you should be copying the values in assembler flags, in the macro.asm file, music, SFX, and DAC information in the Data.asm file, and make sure to only copy the voices in Voices.s2a. Again, these files contain some assembler directives that need to be kept intact. I guess its not self-evident, but as is right now, there is not much I can do about it. Maybe I ought to make a configuration file that can be safely copy-pasted in the future...
     
  18. penPhobic

    penPhobic No laughing near the emerald! Member

    Joined:
    Dec 11, 2016
    Messages:
    57
    Location:
    Basement
    I did exactly what you said. Still no success.

    Failure4.png

    Should I use the AS dissasm for now?

    (If I put the rs. w 0 on this closed bracket, same problem with different message "Missing closed brackets")
     
  19. AURORA☆FIELDS

    AURORA☆FIELDS the cute one here Member

    Joined:
    Oct 7, 2011
    Messages:
    737
    Location:
    Finlandia
    You're still definitely not dealing with the macro.asm file correctly. You should copy the file from the Sonic 1 version again, but replace these lines:
    Code:
    FEATURE_SAFE_PSGFREQ =    1    ; set to 1 to enable safety checks for PSG frequency. Some S3K SFX require this to be 0
    FEATURE_SFX_MASTERVOL =    0    ; set to 1 to make SFX be affected by master volumes
    FEATURE_MODULATION =    1    ; set to 1 to enable software modulation effect
    FEATURE_PORTAMENTO =    0    ; set to 1 to enable portamento effect
    FEATURE_MODENV =    0    ; set to 1 to enable modulation envelopes
    FEATURE_DACFMVOLENV =    0    ; set to 1 to enable volume envelopes for FM & DAC channels
    FEATURE_UNDERWATER =    1    ; set to 1 to enable underwater mode flag
    FEATURE_BACKUP =    1    ; set to 1 to enable back-up channels. Used for the 1-up sound in Sonic 1, 2 and 3K
    FEATURE_BACKUPNOSFX =    1    ; set to 1 to disable SFX while a song is backed up. Used for the 1-up sound
    FEATURE_FM6 =        1    ; set to 1 to enable FM6 to be used in music
    FEATURE_SOUNDTEST =    0    ; set to 1 to enable changes which make AMPS compatible with custom sound test
    with the ones from the Sonic 3K files. This is all that needs to change with this file, and then it should work correctly.
     
  20. penPhobic

    penPhobic No laughing near the emerald! Member

    Joined:
    Dec 11, 2016
    Messages:
    57
    Location:
    Basement
    Same issue, but not for this reason. I have problem with this:

    Code:
    ; ===========================================================================
    ; ---------------------------------------------------------------------------
    ; Sound driver RAM configuration
    ; ---------------------------------------------------------------------------
    
    dZ80 =        $A00000        ; quick reference to Z80 RAM
    dPSG =        $C00011        ; quick reference to PSG port
    
        rsset Drvmem        ; insert your sound driver RAM address here!
    mFlags        rs.b 1        ; various driver flags, see below
    mCtrPal        rs.b 1        ; frame counter fo 50hz fix
    mComm        rs.b 8        ; communications bytes
    mMasterVolFM =    __rs        ; master volume for FM channels
    mFadeAddr    rs.l 1        ; fading program address
    mSpeed        rs.b 1        ; music speed shoes tempo
    mSpeedAcc    rs.b 1        ; music speed shoes tempo accumulator
    mTempo        rs.b 1        ; music normal tempo
    mTempoAcc    rs.b 1        ; music normal tempo accumulator
    mQueue        rs.b 3        ; sound queue
    mMasterVolPSG    rs.b 1        ; master volume for PSG channels
    mVctMus        rs.l 1        ; address of voice table for music
    mMasterVolDAC    rs.b 1        ; master volume for DAC channels
    mSpindash    rs.b 1        ; spindash rev counter
    mContCtr    rs.b 1        ; continous sfx loop counter
    mContLast    rs.b 1        ; last continous sfx played
    mLastCue    rs.b 1        ; last YM Cue the sound driver was accessing
        if 1&(rs.w 0)
            rs.b 1        ; even's are broke in 64-bit values?
        endif            ; align data
    ; ---------------------------------------------------------------------------
    
    mBackUpArea =    __rs        ; this is where the area to be backed up starts
    mDAC1        rs.b cSize    ; DAC 1 data
    mDAC2        rs.b cSize    ; DAC 2 data
    mFM1        rs.b cSize    ; FM 1 data
    mFM2        rs.b cSize    ; FM 2 data
    mFM3        rs.b cSize    ; FM 3 data
    mFM4        rs.b cSize    ; FM 4 data
    mFM5        rs.b cSize    ; FM 5 data
        if FEATURE_FM6
    mFM6        rs.b cSize    ; FM 6 data
        endif
    mPSG1        rs.b cSize    ; PSG 1 data
    mPSG2        rs.b cSize    ; PSG 2 data
    mPSG3        rs.b cSize    ; PSG 3 data
    mSFXDAC1    rs.b cSizeSFX    ; SFX DAC 1 data
    mSFXFM3        rs.b cSizeSFX    ; SFX FM 3 data
    mSFXFM4        rs.b cSizeSFX    ; SFX FM 4 data
    mSFXFM5        rs.b cSizeSFX    ; SFX FM 5 data
    mSFXPSG1    rs.b cSizeSFX    ; SFX PSG 1 data
    mSFXPSG2    rs.b cSizeSFX    ; SFX PSG 2 data
    mSFXPSG3    rs.b cSizeSFX    ; SFX PSG 3 data
    mChannelEnd =    __rs        ; used to determine where channel RAM ends
    ; ---------------------------------------------------------------------------
    
        if FEATURE_BACKUP
    mBackUpLoc =    __rs        ; this is where the area for loading a backed up song starts
    mBackDAC1    rs.b cSize    ; back-up DAC 1 data
    mBackDAC2    rs.b cSize    ; back-up DAC 2 data
    mBackFM1    rs.b cSize    ; back-up FM 1 data
    mBackFM2    rs.b cSize    ; back-up FM 2 data
    mBackFM3    rs.b cSize    ; back-up FM 3 data
    mBackFM4    rs.b cSize    ; back-up FM 4 data
    mBackFM5    rs.b cSize    ; back-up FM 5 data
        if FEATURE_FM6
    mBackFM6    rs.b cSize    ; back-up FM 6 data
        endif
    mBackPSG1    rs.b cSize    ; back-up PSG 1 data
    mBackPSG2    rs.b cSize    ; back-up PSG 2 data
    mBackPSG3    rs.b cSize    ; back-up PSG 3 data
    
    mBackSpeed    rs.b 1        ; back-up music speed shoes tempo
    mBackSpeedAcc    rs.b 1        ; back-up music speed shoes tempo accumulator
    mBackTempo    rs.b 1        ; back-up music normal tempo
    mBackTempoAcc    rs.b 1        ; back-up music normal tempo accumulator
    mBackVctMus    rs.l 1        ; back-up address of voice table for music
        endif
    ; ---------------------------------------------------------------------------
    
        if safe=1
    msChktracker    rs.b 1        ; safe mode only: If set, bring up debugger
        endif
        if 1&(rs.w 0)
            rs.b 1        ; even's are broke in 64-bit values?
        endif            ; align data
    mSize =        __rs        ; end of the driver RAM
    Also, I cannot define the ALLARGS code as seen my post above.

    Here's what I'm talking about the ALLARGS code:

    Code:
    ; ===========================================================================
    ; ---------------------------------------------------------------------------
    ; Create volume envelope table, and SMPS2ASM equates
    ; ---------------------------------------------------------------------------
    
    volenv        macro name
        rept narg            ; repeat for all arguments
    v\name =    __venv            ; create SMPS2ASM equate
            dc.l vd\name        ; create pointer
    __venv =    __venv+1        ; increase ID
        shift                ; shift next argument into view
        volenv allargs            ; process next item
        endr
        endm
    ; ===========================================================================
    ; ---------------------------------------------------------------------------
    ; Create modulation envelope table, and SMPS2ASM equates
    ; ---------------------------------------------------------------------------
    
    modenv        macro name
        rept narg            ; repeate for all arguments
    m\name =    __menv            ; create SMPS2ASM equate
    
        if FEATURE_MODENV
            dc.l md\name        ; create pointer
        endif
    
    __menv =    __menv+1        ; increase ID
        shift                ; shift next argument into view
        modenv allargs            ; process next item
        endr
        endm
     
    Last edited: Aug 24, 2020