Author Topic: MSU-1 Check State bug (affects both PRO and OG models)  (Read 1120 times)

0 Members and 1 Guest are viewing this topic.

Offline MHzBurglar

  • Newbie
  • *
  • Posts: 24
  • Karma: +1/-0
    • View Profile
MSU-1 Check State bug (affects both PRO and OG models)
« on: March 18, 2020, 04:14 AM »
Hi Everyone,

I'm not sure how to best get a hold of Ikari, so I'm hoping that posting this here will be a good start :)

I recently encountered a bug in firmware version 1.10.3 while playing the MSI-1 version of A Link to the Past on my SD2SNES Pro where the fanfare that plays after beating a boss and collecting a crystal gets stuck in a constant loop (playing the fanfare over and over and over again) instead of playing the next track (Zelda's lullaby) while talking to the maiden inside the crystal.  I tested this same scene on the OG SD2SNES, and it has a similar issue but it will skip the fanfare entirely and skip straight to the Zelda's lullaby theme.  In both cases, the event where Link holds the crystal above his head while the fanfare plays is skipped entirely and the maiden appears the second Link touches the crystal.

This issue is not present on bSNES and SNES9X, and appears to only affect SD2SNES cartridges.

I contacted Conn, the author of this MSU-1 patch, and he provided some great insight into what the game is doing at the time.  The game is supposed to check the MSU-1 audio state when grabbing the crystal to see if the fanfare MSU-1 track (track 19) is playing, and once it has finished, start playing Zelda's Lullaby (track 26.)  While the Fanfare is playing, Link will stay still and hold the crystal, and the maiden isn't supposed to appear until the fanfare track ends.  Conn tested this by replacing the fanfare PCM with a longer song, and on bSNES Link stood there with the crystal the whole time.  On the SD2SNES, it didn't matter what PCM file was used for the fanfare and the 'holding the crystal' routine was skipped entirely.

I tested this on some older firmware versions on my SD2SNES OG and Pro carts, and this ASM routine actually used to work correctly in past firmware.  It was broken in firmware versions up to 0.1.7b, but was fixed in 0.1.7c and worked as long as the in-game hook was disabled.  It was also fine in 0.1.7d, but was broken again with the release of 0.1.7e and remains broken up through the current firmware version.  Since the working firmware version predates 1.10.1, it's impossible to play the game correctly on the Pro model cart.

Conn also provided the ASM code for this routine as well.  I'm unfortunately not experienced with ASM programming or the SNES CPU/MSU-1 "chip", but I hope it will be useful in troubleshooting the issue.  Here's what he sent me:

Here is what I assume being the problem you may want to report to ikari:

Code: [Select]
22edeb lda $2000 [082000] A:0853
22edee and #$10 A:08b2
22edf0 bne $edf6
The code checks whether the msu track is still playing (this fanfare is set to non-loop). As soon it is not running anymore, the game continues. Somehow the firmware does not get this code, so it assumes the msu doesn't play anymore (at least this is my assumption).
The status port has the following bit layout:
7 6 5 4 3 2 1 0
Data busy Audio busy Audio repeat Audio playing Track missing Revision

The revision part will be equal to 1, unless a new version of the MSU1 specification is released, which may add more features. A common usage for the status port is to lock the SNES CPU after setting an audio track or specifying a seek target on the MSU1 Data file. This is a rather important step to include if you’re aiming to support the MSU1 in hardware. The “track missing” bit is set if, after seeking to a given audio track, that track is found to be unavailable. This allows selectively falling back to SPC700 sound.

You see that bit 4 (and #$10) is the audio playing flag

I hope that this makes its way to the SD2SNES/FXPak team, as I'd love to see a fix in a future firmware version.  If any additional testing or data is needed, I'm more than happy to provide it wherever possible.