SN76489 bug in NEZplug++ 0.9.4.8 + 3 + 22.10b by kingshriek at 3:54 PM EDT on June 21, 2013
While doing a SGC rip of Micro Machines, I found a bug in how NEZplug++ emulates the SN76489 (Sega Master System/Game Gear PSG chip). Specifically, it does not handle the noise channel latching mechanism properly. When writing to the noise channel, Micro Machines does the following:
That is, the noise channel write is done in two steps. In the first write, bit 7 is high. This means that the channel that is selected (in this case, the noise channel) is latched as the current channel (data is written to the channel here also but it just gets replaced in the next write). In the next write, bit 7 is clear. This means that the write goes to the currently latched channel (the noise channel). nezplug++ is ignoring this second write completely. See http://www.smspower.org/Development/SN76489#SN76489RegisterWrites for how this is supposed to work. It even mentions Micro Machines specifically.
I put together 3 SGCs do demonstrate the problem. "Micro Machines.sgc" is a direct rip with no code patches. "Micro Machines correct.sgc" is a rip with the above code sequence patched to work around the nezplug++ error. "Micro Machines incorrect.sgc" is a rip with the second noise channel write ignored (identical in playback to "Micro Machines.sgc" in the current nezplug++). Both "Micro Machines.sgc" and "Micro Machines correct.sgc" should sound identical in a player that handles the noise channel latching correctly. Try these 3 SGCs in foo_gep for comparison.