diff --git a/src/engine/fileOps.cpp b/src/engine/fileOps.cpp index d7b515402..c2dea0085 100644 --- a/src/engine/fileOps.cpp +++ b/src/engine/fileOps.cpp @@ -1062,10 +1062,11 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) { ds.systemFlags[0].set("dpcmMode",false); } - // C64 no key priority and reset time + // C64 no key priority, reset time and multiply relative if (ds.system[0]==DIV_SYSTEM_C64_8580 || ds.system[0]==DIV_SYSTEM_C64_6581) { ds.systemFlags[0].set("keyPriority",false); ds.systemFlags[0].set("initResetTime",1); + ds.systemFlags[0].set("multiplyRel",true); } // OPM broken pitch @@ -3034,11 +3035,12 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) { } } - // C64 original reset time + // C64 original reset time and multiply relative if (ds.version<187) { for (int i=0; ic64.dutyIsAbs) { chan[i].duty=chan[i].std.duty.val; } else { - chan[i].duty-=((signed char)chan[i].std.duty.val)*4; + if (multiplyRel) { + chan[i].duty-=((signed char)chan[i].std.duty.val)*4; + } else { + chan[i].duty-=chan[i].std.duty.val; + } } rWrite(i*7+2,chan[i].duty&0xff); rWrite(i*7+3,chan[i].duty>>8); @@ -199,10 +203,11 @@ void DivPlatformC64::tick(bool sysTick) { if (ins->c64.filterIsAbs) { filtCut=MIN(2047,chan[i].std.alg.val); } else { - // TODO: - // - why signed char? - // - add a mode in where it's not multiplied by 7 - dang it Delek - filtCut+=((signed char)chan[i].std.alg.val)*7; + if (multiplyRel) { + filtCut+=((signed char)chan[i].std.alg.val)*7; + } else { + filtCut+=chan[i].std.alg.val; + } if (filtCut>2047) filtCut=2047; if (filtCut<0) filtCut=0; } @@ -726,6 +731,7 @@ void DivPlatformC64::setFlags(const DivConfig& flags) { } keyPriority=flags.getBool("keyPriority",true); no1EUpdate=flags.getBool("no1EUpdate",false); + multiplyRel=flags.getBool("multiplyRel",false); testAD=((flags.getInt("testAttack",0)&15)<<4)|(flags.getInt("testDecay",0)&15); testSR=((flags.getInt("testSustain",0)&15)<<4)|(flags.getInt("testRelease",0)&15); initResetTime=flags.getInt("initResetTime",2); diff --git a/src/engine/platform/c64.h b/src/engine/platform/c64.h index 8b69782b5..5f7882c68 100644 --- a/src/engine/platform/c64.h +++ b/src/engine/platform/c64.h @@ -77,7 +77,7 @@ class DivPlatformC64: public DivDispatch { unsigned char sidCore; int filtCut, resetTime, initResetTime; - bool keyPriority, sidIs6581, needInitTables, no1EUpdate; + bool keyPriority, sidIs6581, needInitTables, no1EUpdate, multiplyRel; unsigned char chanOrder[3]; unsigned char testAD, testSR; diff --git a/src/gui/insEdit.cpp b/src/gui/insEdit.cpp index fafc3c4b6..35c7273f5 100644 --- a/src/gui/insEdit.cpp +++ b/src/gui/insEdit.cpp @@ -6033,8 +6033,8 @@ void FurnaceGUI::drawInsEdit() { if (ins->c64.dutyIsAbs) { dutyMax=4095; } else { - dutyMin=-96; - dutyMax=96; + dutyMin=-4095; + dutyMax=4095; } } if (ins->type==DIV_INS_STD) { @@ -6419,8 +6419,8 @@ void FurnaceGUI::drawInsEdit() { } if (ex1Max>0) { if (ins->type==DIV_INS_C64) { - int cutoffMin=-64; - int cutoffMax=64; + int cutoffMin=-2047; + int cutoffMax=2047; if (ins->c64.filterIsAbs) { cutoffMin=0; diff --git a/src/gui/sysConf.cpp b/src/gui/sysConf.cpp index 1968e1c7b..b286550ee 100644 --- a/src/gui/sysConf.cpp +++ b/src/gui/sysConf.cpp @@ -587,6 +587,7 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl int clockSel=flags.getInt("clockSel",0); bool keyPriority=flags.getBool("keyPriority",true); bool no1EUpdate=flags.getBool("no1EUpdate",false); + bool multiplyRel=flags.getBool("multiplyRel",false); int testAttack=flags.getInt("testAttack",0); int testDecay=flags.getInt("testDecay",0); int testSustain=flags.getInt("testSustain",0); @@ -662,11 +663,17 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl altered=true; } + if (ImGui::Checkbox("Relative duty and cutoff macros are coarse (compatibility)",&multiplyRel)) { + altered=true; + } + + if (altered) { e->lockSave([&]() { flags.set("clockSel",clockSel); flags.set("keyPriority",keyPriority); flags.set("no1EUpdate",no1EUpdate); + flags.set("multiplyRel",multiplyRel); flags.set("testAttack",testAttack); flags.set("testDecay",testDecay); flags.set("testSustain",testSustain);