Hi there. I've been messing around with the MSU-1 patch, and despite its issues, it's a really nice patch that would be a shame for it to go to waste. I'd be willing to help fix some of its flaws, as I've got some ASM knowledge, and I have an SD2SNES, so I can test it out on that in addition to BSNES V070.
Anyway, I'm going to respond to a few things that you said in your previous post while I'm here.
1. Just because SMW loads the value of $1DFB into $2142 during NMI doesn't mean that you necessarily have to hijack that part for your patch to work. As long as $1DFB/$2142 keeps its value, you can hijack some other part of the ROM for your patch to work, as long as it's somewhere where it can be read every frame. Plus, given how inefficient the code is for determining what songs to loop and what music bank to use when loading songs, your code is wasting a lot of time in NMI, which is what is causing the screen flickering and the black bars. Even if you optimized the code, you're still wasting NMI time, as the NMI shouldn't be used for anything aside from VRAM related stuff (I could be wrong about that, though. If I am, someone correct me, please).
Since I'm using AddmusicK in my hack, which NOPs out that area your patch hijacks, I put the hijack to the MSU-1 code inside of AddmusicK's patch.asm file right before it jumps back to the start of the main game loop, and it works without any of the issues that Vitor Vilela described in the removal log. For SMW hacks that don't use AddmusicK, you could put a JML at $008075 to the MSU-1 code, then at the end of your code, store a zero to $10, then JML to $00806B and it should work fine. For hacks that use AddmusicK, the hijack could go here in patch.asm:
JSL $04EF40 ; JSL to MSU-1 code
JML $00806B ; Return. TODO: Detect if the ROM is using the Wait Replace patch.
2. The expanded area is the area in the ROM beyond the first 512 KB when SMW is expanded. Specifically, ROM banks 0-F are within the first 512 KB, so you'll want your patch to point to a ROM bank after that.
3. The code for deciding whether a track should loop can either be shrunken down into either way that Vitor Vilela suggested or you could alternately set it so that every track loops, but the loop point for the songs that aren't meant to loop simply loop in a completely silent part of the music file. As for the code for checking the song bank, that code can be shrunken down in the same way that the other code could be shrunken down. In addition, none of that code is necessary if AddmusicK has been used on the ROM, so you could add a define and some code for asar/xkas that stops that code from being inserted if the user sets the define to a certain value.
Additional 1: It'd be nice if you could find a way to force non-MSU-1 songs to play for certain song numbers that the user can define regardless of whether or not an MSU-1 song is playing. This could have some useful applications, where besides having the normal music play in case there is no MSU-1 song to take its place, more creative SMW hackers that don't mind that this will only work in BSNES/SD2SNES could use the MSU-1 audio and the SPC7000 music in conjunction in interesting ways (for example, instead of music, the MSU-1 could be used to play custom sound effects, like voice clips, if the MSU-1 uses a different RAM address than $1DFB to determine what to play, though as these sound effects are technically music, only one can play at a time. Meanwhile, the SPC7000 is handling the music and the other sound effects).
Additional 2: One idea to solve the volume issue is if you were to use an unused RAM address that never gets cleared, you could hijack some code during the start up of SMW, and have it check to see if the player is holding select or some other button, and if they are, load a certain value to the unused RAM address. Then, when the MSU-1 is switching songs, it will add the value of the unused address to the value from a 256 byte table indexed with the value of $1DFB (though there should be some code that will prevent the value from overflowing) so that the songs will be louder until SMW is reset. This might not be the most elegant solution to this, but it would be one way to fix the volume issue between BSNES V070 and SD2SNES by giving the player the option to make the songs louder if they're playing on SD2SNES. Plus, as a bonus, that table I mentioned earlier would give the user the ability to customize the volume of each song so that the volume of every song used is consistent without having to modify the .pcm files.
Additional 4: AddmusicK does have a few incompatibilities with this patch, so it'd be great to fix these considering that a lot of people play hacks in ZSNES and SNES9x and addmusicK is currently the primary tool used to insert custom music in SMW. It'd be a good idea for anyone using the MSU-1 patch to include non MSU-1 custom music in their hack in case the people playing the hack aren't using BSNES/SD2SNES, so making this patch work with AddmusicK would be a good idea
In addition, as a bit of feedback, you should probably include some information about the XML file that comes with the patch, as that file can cause glitches if the defines in that file don't match up with the ones the ROM uses. For example, in the file, you have the SRAM size parameter set to 2000 and the map address set to 70:0000-1fff. That's fine if the SMW hack has 8 KB of SRAM or less, but what if it actually uses 16 KB or more like mine does? BSNES will assume that the ROM has 8 KB of SRAM regardless of how much it's actually set to use, and if you have something that uses SRAM address beyond that 8 KB like the VWF dialogues patch, which uses a little over 32 KB of SRAM for its functions, then this is going to cause problems. Likewise, under the ROM tag, you have the banks set to 00-6f:8000, which will also cause problems if someone puts ROM data in banks 70-7D like I did in my hack. Plus, this would likely cause even more problems for anyone using SA-1 in addition to this patch. I think this is something you should probably mention in the .doc file you included.
Mario's Strange Quest V1.6
Yoshi's Inside Story (on hold)
Yoshi's Strange Quest V1.3
/ V1.3.1 Beta 4.6
/ Latest Test Build (Mario & Yoshi's Strange Quests)
My WIP SMW/SMAS+W disassembly
Yoshifanatic's Discord Server
: A place for fans of my stuff and/or Yoshi to chat with others.