YM2612: surprise addition

This commit is contained in:
tildearrow 2024-07-06 12:28:56 -05:00
parent 71f67b4d40
commit 221bc23955
3 changed files with 22 additions and 0 deletions

View file

@ -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<DivDelayedWrite>& 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);

View file

@ -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];

View file

@ -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;