From 87b172015ce02efa1a8d5a503ccb6a4e4c54caed Mon Sep 17 00:00:00 2001 From: tildearrow Date: Wed, 28 Aug 2024 17:07:05 -0500 Subject: [PATCH] fix 601x-604x --- src/engine/platform/arcade.cpp | 15 ++++++++++++++- src/engine/platform/genesis.cpp | 15 ++++++++++++++- src/engine/platform/ym2203.cpp | 15 ++++++++++++++- src/engine/platform/ym2608.cpp | 15 ++++++++++++++- src/engine/platform/ym2610.cpp | 15 ++++++++++++++- src/engine/platform/ym2610b.cpp | 15 ++++++++++++++- 6 files changed, 84 insertions(+), 6 deletions(-) diff --git a/src/engine/platform/arcade.cpp b/src/engine/platform/arcade.cpp index 74cfcc6e7..d46976bb0 100644 --- a/src/engine/platform/arcade.cpp +++ b/src/engine/platform/arcade.cpp @@ -762,7 +762,20 @@ int DivPlatformArcade::dispatch(DivCommand c) { break; } case DIV_CMD_FM_OPMASK: - chan[c.chan].opMask=c.value&15; + switch (c.value>>4) { + case 1: + case 2: + case 3: + case 4: + chan[c.chan].opMask&=~(1<<((c.value>>4)-1)); + if (c.value&15) { + chan[c.chan].opMask|=(1<<((c.value>>4)-1)); + } + break; + default: + chan[c.chan].opMask=c.value&15; + break; + } if (chan[c.chan].active) { chan[c.chan].opMaskChanged=true; } diff --git a/src/engine/platform/genesis.cpp b/src/engine/platform/genesis.cpp index 1b8707896..4bf56581e 100644 --- a/src/engine/platform/genesis.cpp +++ b/src/engine/platform/genesis.cpp @@ -1465,7 +1465,20 @@ int DivPlatformGenesis::dispatch(DivCommand c) { } case DIV_CMD_FM_OPMASK: if (c.chan>=psgChanOffs) break; - chan[c.chan].opMask=c.value&15; + switch (c.value>>4) { + case 1: + case 2: + case 3: + case 4: + chan[c.chan].opMask&=~(1<<((c.value>>4)-1)); + if (c.value&15) { + chan[c.chan].opMask|=(1<<((c.value>>4)-1)); + } + break; + default: + chan[c.chan].opMask=c.value&15; + break; + } if (chan[c.chan].active) { chan[c.chan].opMaskChanged=true; } diff --git a/src/engine/platform/ym2203.cpp b/src/engine/platform/ym2203.cpp index 2a19fea0f..c1774f4fc 100644 --- a/src/engine/platform/ym2203.cpp +++ b/src/engine/platform/ym2203.cpp @@ -1006,7 +1006,20 @@ int DivPlatformYM2203::dispatch(DivCommand c) { } case DIV_CMD_FM_OPMASK: if (c.chan>=psgChanOffs) break; - chan[c.chan].opMask=c.value&15; + switch (c.value>>4) { + case 1: + case 2: + case 3: + case 4: + chan[c.chan].opMask&=~(1<<((c.value>>4)-1)); + if (c.value&15) { + chan[c.chan].opMask|=(1<<((c.value>>4)-1)); + } + break; + default: + chan[c.chan].opMask=c.value&15; + break; + } if (chan[c.chan].active) { chan[c.chan].opMaskChanged=true; } diff --git a/src/engine/platform/ym2608.cpp b/src/engine/platform/ym2608.cpp index 046e20c20..825c3b5ac 100644 --- a/src/engine/platform/ym2608.cpp +++ b/src/engine/platform/ym2608.cpp @@ -1539,7 +1539,20 @@ int DivPlatformYM2608::dispatch(DivCommand c) { } case DIV_CMD_FM_OPMASK: if (c.chan>=psgChanOffs) break; - chan[c.chan].opMask=c.value&15; + switch (c.value>>4) { + case 1: + case 2: + case 3: + case 4: + chan[c.chan].opMask&=~(1<<((c.value>>4)-1)); + if (c.value&15) { + chan[c.chan].opMask|=(1<<((c.value>>4)-1)); + } + break; + default: + chan[c.chan].opMask=c.value&15; + break; + } if (chan[c.chan].active) { chan[c.chan].opMaskChanged=true; } diff --git a/src/engine/platform/ym2610.cpp b/src/engine/platform/ym2610.cpp index 038cbc807..d64b49569 100644 --- a/src/engine/platform/ym2610.cpp +++ b/src/engine/platform/ym2610.cpp @@ -1509,7 +1509,20 @@ int DivPlatformYM2610::dispatch(DivCommand c) { } case DIV_CMD_FM_OPMASK: if (c.chan>=psgChanOffs) break; - chan[c.chan].opMask=c.value&15; + switch (c.value>>4) { + case 1: + case 2: + case 3: + case 4: + chan[c.chan].opMask&=~(1<<((c.value>>4)-1)); + if (c.value&15) { + chan[c.chan].opMask|=(1<<((c.value>>4)-1)); + } + break; + default: + chan[c.chan].opMask=c.value&15; + break; + } if (chan[c.chan].active) { chan[c.chan].opMaskChanged=true; } diff --git a/src/engine/platform/ym2610b.cpp b/src/engine/platform/ym2610b.cpp index 8b12ca862..b5f555f58 100644 --- a/src/engine/platform/ym2610b.cpp +++ b/src/engine/platform/ym2610b.cpp @@ -1578,7 +1578,20 @@ int DivPlatformYM2610B::dispatch(DivCommand c) { } case DIV_CMD_FM_OPMASK: if (c.chan>=psgChanOffs) break; - chan[c.chan].opMask=c.value&15; + switch (c.value>>4) { + case 1: + case 2: + case 3: + case 4: + chan[c.chan].opMask&=~(1<<((c.value>>4)-1)); + if (c.value&15) { + chan[c.chan].opMask|=(1<<((c.value>>4)-1)); + } + break; + default: + chan[c.chan].opMask=c.value&15; + break; + } if (chan[c.chan].active) { chan[c.chan].opMaskChanged=true; }