From bc32809ecb7ad3cce6765f57e11bc9599474daa7 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Fri, 21 Jan 2022 04:27:00 -0500 Subject: [PATCH] fix #46 --- src/engine/platform/ay.cpp | 12 +++++++----- src/engine/playback.cpp | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/engine/platform/ay.cpp b/src/engine/platform/ay.cpp index 50e58703c..32a923aff 100644 --- a/src/engine/platform/ay.cpp +++ b/src/engine/platform/ay.cpp @@ -207,11 +207,13 @@ int DivPlatformAY8910::dispatch(DivCommand c) { break; } case DIV_CMD_STD_NOISE_MODE: - chan[c.chan].psgMode=(c.value+1)&7; - if (isMuted[c.chan]) { - rWrite(0x08+c.chan,0); - } else if (chan[c.chan].active) { - rWrite(0x08+c.chan,(chan[c.chan].outVol&15)|((chan[c.chan].psgMode&4)<<2)); + if (c.value<16) { + chan[c.chan].psgMode=(c.value+1)&7; + if (isMuted[c.chan]) { + rWrite(0x08+c.chan,0); + } else if (chan[c.chan].active) { + rWrite(0x08+c.chan,(chan[c.chan].outVol&15)|((chan[c.chan].psgMode&4)<<2)); + } } break; case DIV_CMD_STD_NOISE_FREQ: diff --git a/src/engine/playback.cpp b/src/engine/playback.cpp index 1e13b1a9d..10af75995 100644 --- a/src/engine/playback.cpp +++ b/src/engine/playback.cpp @@ -354,7 +354,7 @@ bool DivEngine::perSystemPostEffect(int ch, unsigned char effect, unsigned char case DIV_SYSTEM_AY8930: switch (effect) { case 0x12: // duty on 8930 - dispatchCmd(DivCommand(DIV_CMD_STD_NOISE_MODE,ch,0x10+effectVal)); + dispatchCmd(DivCommand(DIV_CMD_STD_NOISE_MODE,ch,0x10+(effectVal&15))); break; case 0x20: // mode dispatchCmd(DivCommand(DIV_CMD_STD_NOISE_MODE,ch,effectVal&15));