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:

8FB8:
ld a,E0 ; select noise channel
outa (7E) ; write upper 4 bits
ld a,c
and 07
outa (7E) ; write lower 4 bits

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.

Micro Machines SGCs:
http://www.mediafire.com/?ih3vg1gdkzx66b8

For reference, here are the patches made:

;"correct" patch
8FB8:
ld a,c
and 07
or E0
outa (7E)
nop(x2)

; "incorrect" patch
8FB8:
ld a,E0
outa (7E)
nop(x5)

edited 3:59 PM EDT June 21, 2013
by Knurek at 5:07 PM EDT on June 21, 2013
For what it's worth, OffGao has a Twitter account, looks to be in use.

I've tried emailing him about some Human games HES playback bugs but didn't receive a reply, not sure if he ever received the message.


Go to Page 0

Search this thread

Show all threads

Reply to this thread:

User Name Tags:

bold: [b]bold[/b]
italics: [i]italics[/i]
emphasis: [em]emphasis[/em]
underline: [u]underline[/u]
small: [small]small[/small]
Link: [url=http://www.google.com]Link[/url]

[img=https://www.hcs64.com/images/mm1.png]
Password
Subject
Message

HCS Forum Index
Halley's Comet Software
forum source