From 3d7079226f353e264fdaa72e24d2c455e1957029 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Fri, 8 Nov 2024 02:47:51 -0500 Subject: [PATCH] OPN: implement phase reset macro on ExtCh --- src/engine/platform/genesisext.cpp | 12 ++++++++++-- src/engine/platform/ym2203ext.cpp | 12 ++++++++++-- src/engine/platform/ym2608ext.cpp | 12 ++++++++++-- src/engine/platform/ym2610bext.cpp | 12 ++++++++++-- src/engine/platform/ym2610ext.cpp | 12 ++++++++++-- 5 files changed, 50 insertions(+), 10 deletions(-) diff --git a/src/engine/platform/genesisext.cpp b/src/engine/platform/genesisext.cpp index ee8caa53e..3ff9fc53c 100644 --- a/src/engine/platform/genesisext.cpp +++ b/src/engine/platform/genesisext.cpp @@ -468,6 +468,16 @@ void DivPlatformGenesisExt::tick(bool sysTick) { int hardResetElapsed=0; bool mustHardReset=false; + if (extMode && !noExtMacros) for (int i=0; i<4; i++) { + opChan[i].std.next(); + + if (opChan[i].std.phaseReset.had) { + if (opChan[i].std.phaseReset.val==1 && opChan[i].active) { + opChan[i].keyOn=true; + } + } + } + if (extMode) { bool writeSomething=false; unsigned char writeMask=2; @@ -494,8 +504,6 @@ void DivPlatformGenesisExt::tick(bool sysTick) { } if (extMode && !noExtMacros) for (int i=0; i<4; i++) { - opChan[i].std.next(); - if (opChan[i].std.vol.had) { opChan[i].outVol=VOL_SCALE_LOG_BROKEN(opChan[i].vol,MIN(127,opChan[i].std.vol.val),127); unsigned short baseAddr=chanOffs[2]|opOffs[orderedOps[i]]; diff --git a/src/engine/platform/ym2203ext.cpp b/src/engine/platform/ym2203ext.cpp index 09198e8d4..eeae96957 100644 --- a/src/engine/platform/ym2203ext.cpp +++ b/src/engine/platform/ym2203ext.cpp @@ -395,6 +395,16 @@ void DivPlatformYM2203Ext::tick(bool sysTick) { int hardResetElapsed=0; bool mustHardReset=false; + if (extMode && !noExtMacros) for (int i=0; i<4; i++) { + opChan[i].std.next(); + + if (opChan[i].std.phaseReset.had) { + if (opChan[i].std.phaseReset.val==1 && opChan[i].active) { + opChan[i].keyOn=true; + } + } + } + if (extMode) { bool writeSomething=false; unsigned char writeMask=2; @@ -421,8 +431,6 @@ void DivPlatformYM2203Ext::tick(bool sysTick) { } if (extMode && !noExtMacros) for (int i=0; i<4; i++) { - opChan[i].std.next(); - if (opChan[i].std.vol.had) { opChan[i].outVol=VOL_SCALE_LOG_BROKEN(opChan[i].vol,MIN(127,opChan[i].std.vol.val),127); unsigned short baseAddr=chanOffs[2]|opOffs[orderedOps[i]]; diff --git a/src/engine/platform/ym2608ext.cpp b/src/engine/platform/ym2608ext.cpp index 63e204b58..15038de14 100644 --- a/src/engine/platform/ym2608ext.cpp +++ b/src/engine/platform/ym2608ext.cpp @@ -423,6 +423,16 @@ void DivPlatformYM2608Ext::tick(bool sysTick) { int hardResetElapsed=0; bool mustHardReset=false; + if (extMode && !noExtMacros) for (int i=0; i<4; i++) { + opChan[i].std.next(); + + if (opChan[i].std.phaseReset.had) { + if (opChan[i].std.phaseReset.val==1 && opChan[i].active) { + opChan[i].keyOn=true; + } + } + } + if (extMode) { bool writeSomething=false; unsigned char writeMask=2; @@ -449,8 +459,6 @@ void DivPlatformYM2608Ext::tick(bool sysTick) { } if (extMode && !noExtMacros) for (int i=0; i<4; i++) { - opChan[i].std.next(); - if (opChan[i].std.vol.had) { opChan[i].outVol=VOL_SCALE_LOG_BROKEN(opChan[i].vol,MIN(127,opChan[i].std.vol.val),127); unsigned short baseAddr=chanOffs[2]|opOffs[orderedOps[i]]; diff --git a/src/engine/platform/ym2610bext.cpp b/src/engine/platform/ym2610bext.cpp index d8a986e3c..035c87cf7 100644 --- a/src/engine/platform/ym2610bext.cpp +++ b/src/engine/platform/ym2610bext.cpp @@ -416,6 +416,16 @@ void DivPlatformYM2610BExt::tick(bool sysTick) { int hardResetElapsed=0; bool mustHardReset=false; + if (extMode && !noExtMacros) for (int i=0; i<4; i++) { + opChan[i].std.next(); + + if (opChan[i].std.phaseReset.had) { + if (opChan[i].std.phaseReset.val==1 && opChan[i].active) { + opChan[i].keyOn=true; + } + } + } + if (extMode) { bool writeSomething=false; unsigned char writeMask=2; @@ -442,8 +452,6 @@ void DivPlatformYM2610BExt::tick(bool sysTick) { } if (extMode && !noExtMacros) for (int i=0; i<4; i++) { - opChan[i].std.next(); - if (opChan[i].std.vol.had) { opChan[i].outVol=VOL_SCALE_LOG_BROKEN(opChan[i].vol,MIN(127,opChan[i].std.vol.val),127); unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[orderedOps[i]]; diff --git a/src/engine/platform/ym2610ext.cpp b/src/engine/platform/ym2610ext.cpp index 16f0f02e8..c4472f597 100644 --- a/src/engine/platform/ym2610ext.cpp +++ b/src/engine/platform/ym2610ext.cpp @@ -416,6 +416,16 @@ void DivPlatformYM2610Ext::tick(bool sysTick) { int hardResetElapsed=0; bool mustHardReset=false; + if (extMode && !noExtMacros) for (int i=0; i<4; i++) { + opChan[i].std.next(); + + if (opChan[i].std.phaseReset.had) { + if (opChan[i].std.phaseReset.val==1 && opChan[i].active) { + opChan[i].keyOn=true; + } + } + } + if (extMode) { bool writeSomething=false; unsigned char writeMask=2; @@ -442,8 +452,6 @@ void DivPlatformYM2610Ext::tick(bool sysTick) { } if (extMode && !noExtMacros) for (int i=0; i<4; i++) { - opChan[i].std.next(); - if (opChan[i].std.vol.had) { opChan[i].outVol=VOL_SCALE_LOG_BROKEN(opChan[i].vol,MIN(127,opChan[i].std.vol.val),127); unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[orderedOps[i]];