diff --git a/src/engine/platform/genesis.cpp b/src/engine/platform/genesis.cpp index a10f135a2..e7533dec7 100644 --- a/src/engine/platform/genesis.cpp +++ b/src/engine/platform/genesis.cpp @@ -54,6 +54,10 @@ void DivYM2612Interface::clock() { } void DivPlatformGenesis::processDAC(int iRate) { + if (interruptSim>0) { + interruptSim--; + return; + } if (softPCM) { softPCMTimer+=chipClock/576; if (softPCMTimer>iRate) { @@ -594,6 +598,10 @@ void DivPlatformGenesis::fillStream(std::vector& stream, int sR } void DivPlatformGenesis::tick(bool sysTick) { + if (sysTick) { + interruptSim=interruptSimCycles*(useYMFM==0?4:1); + } + for (int i=0; i<(softPCM?7:6); i++) { if (i==2 && extMode) continue; chan[i].std.next(); @@ -1683,6 +1691,7 @@ void DivPlatformGenesis::reset() { flushFirst=false; dacWrite=-1; canWriteDAC=true; + interruptSim=0; if (softPCM) { chan[5].dacMode=true; @@ -1768,6 +1777,7 @@ void DivPlatformGenesis::setFlags(const DivConfig& flags) { noExtMacros=flags.getBool("noExtMacros",false); fbAllOps=flags.getBool("fbAllOps",false); msw=flags.getBool("msw",false); + interruptSimCycles=flags.getInt("interruptSimCycles",0); switch (chipType) { case 1: // YM2612 OPN2_SetChipType(&fm,ym3438_mode_ym2612); diff --git a/src/engine/platform/genesis.h b/src/engine/platform/genesis.h index e943c33ec..bd911d0ae 100644 --- a/src/engine/platform/genesis.h +++ b/src/engine/platform/genesis.h @@ -96,6 +96,9 @@ class DivPlatformGenesis: public DivPlatformOPN { int llePrevCycle; int lleOscData[6]; int dacShifter, o_lro, o_bco; + + int interruptSim; + int interruptSimCycles; unsigned char dacVolTable[128]; diff --git a/src/gui/sysConf.cpp b/src/gui/sysConf.cpp index 3eb5565c2..3f54a16e1 100644 --- a/src/gui/sysConf.cpp +++ b/src/gui/sysConf.cpp @@ -42,6 +42,7 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl } else { chipType=flags.getBool("ladderEffect",0)?1:0; } + int interruptSimCycles=flags.getInt("interruptSimCycles",0); bool noExtMacros=flags.getBool("noExtMacros",false); bool fbAllOps=flags.getBool("fbAllOps",false); bool msw=flags.getBool("msw",false); @@ -100,6 +101,13 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl altered=true; } } + + ImGui::Text(_("DAC interrupt simulation:")); + if (CWSliderInt(_("cycles##InterruptSim"),&interruptSimCycles,0,256)) { + if (interruptSimCycles<0) interruptSimCycles=0; + if (interruptSimCycles>256) interruptSimCycles=256; + altered=true; + } rightClickable if (altered) { e->lockSave([&]() { @@ -108,6 +116,7 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl flags.set("noExtMacros",noExtMacros); flags.set("fbAllOps",fbAllOps); flags.set("msw",msw); + flags.set("interruptSimCycles",interruptSimCycles); }); } break;