Skip to content

Commit

Permalink
Making note of driver bug, as well as adding a bugfix to the bugfix
Browse files Browse the repository at this point in the history
that removes the unnecessary code.
  • Loading branch information
flamewing committed Sep 9, 2015
1 parent ac96638 commit 5a8e0f8
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions Sound/Z80 Sound Driver.asm
Expand Up @@ -2321,8 +2321,10 @@ zGetSFXChannelPointers:
else
ld a, 1Fh ; a = 1Fh (redundant, as this is the first instruction of the function)
call zSilencePSGChannel ; Silence channel at ix
ld a, 0FFh ; Command to silence PSG3/Noise channel (zSilencePSGChannel should do it...)
ld (zPSG), a ; Silence it (zSilencePSGChannel should do it...)
; The next two lines are here because zSilencePSGChannel does not do
; its job correctly. See the note there.
ld a, 0FFh ; Command to silence Noise channel
ld (zPSG), a ; Silence it
ld a, c ; a = channel identifier
; The next 5 shifts are so that we can convert it to a table index
srl a
Expand Down Expand Up @@ -4314,9 +4316,17 @@ zSilencePSGChannel:
or a ; Is it an actual PSG channel?
ret p ; Return if not
ld (zPSG), a ; Silence this channel
if fix_sndbugs
cp 0DFh ; Was this PSG3?
ret nz ; Return if not
else
; This does not work as intended: since this function is called when
; a new channel is starting, this bit will almost inevitably be 0
; and the noise channel will not be silenced.
bit 0, (ix+zTrack.PlaybackControl) ; Is this a noise channel?
ret z ; Return if not
ld a, 0FFh ; Command to silence PSG3/Noise channel
endif
ld a, 0FFh ; Command to silence Noise channel
ld (zPSG), a ; Do it
ret
; End of function zSilencePSGChannel
Expand Down

0 comments on commit 5a8e0f8

Please sign in to comment.