add C64 ADSR macros, add gate bit to test/gate macro, untested fix of macro retrigger on 03xx command

This commit is contained in:
LTVA1 2023-10-25 21:28:29 +03:00
parent c0acd472ed
commit 1207eb1e32
5 changed files with 50 additions and 4 deletions

View file

@ -3008,11 +3008,12 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
} }
} }
// C64 1Exy compat // C64 1Exy and old version test bit macro compat
if (ds.version<186) { if (ds.version<186) {
for (int i=0; i<ds.systemLen; i++) { for (int i=0; i<ds.systemLen; i++) {
if (ds.system[i]==DIV_SYSTEM_C64_8580 || ds.system[i]==DIV_SYSTEM_C64_6581) { if (ds.system[i]==DIV_SYSTEM_C64_8580 || ds.system[i]==DIV_SYSTEM_C64_6581) {
ds.systemFlags[i].set("no1EUpdate",true); ds.systemFlags[i].set("no1EUpdate",true);
ds.systemFlags[i].set("newTestBitMacro",true);
} }
} }
} }

View file

@ -220,9 +220,32 @@ void DivPlatformC64::tick(bool sysTick) {
} }
if (chan[i].std.ex4.had) { if (chan[i].std.ex4.had) {
chan[i].test=chan[i].std.ex4.val&1; chan[i].test=chan[i].std.ex4.val&1;
if (newTestBitMacro)
{
chan[i].active = chan[i].std.ex4.val & 2;
if (!chan[i].active)
{
chan[i].keyOff = true;
chan[i].keyOn = false;
}
}
rWrite(i*7+4,(chan[i].wave<<4)|(chan[i].test<<3)|(chan[i].ring<<2)|(chan[i].sync<<1)|(int)(chan[i].active)); rWrite(i*7+4,(chan[i].wave<<4)|(chan[i].test<<3)|(chan[i].ring<<2)|(chan[i].sync<<1)|(int)(chan[i].active));
} }
if (chan[i].std.ex5.had) {
chan[i].attack = chan[i].std.ex5.val >> 4;
chan[i].decay = chan[i].std.ex5.val & 15;
rWrite(i * 7 + 5, (chan[i].attack << 4) | (chan[i].decay));
}
if (chan[i].std.ex6.had) {
chan[i].sustain = chan[i].std.ex6.val >> 4;
chan[i].release = chan[i].std.ex6.val & 15;
rWrite(i * 7 + 6, (chan[i].sustain << 4) | (chan[i].release));
}
if (sysTick) { if (sysTick) {
if (chan[i].testWhen>0) { if (chan[i].testWhen>0) {
if (--chan[i].testWhen<1) { if (--chan[i].testWhen<1) {
@ -396,7 +419,7 @@ int DivPlatformC64::dispatch(DivCommand c) {
break; break;
case DIV_CMD_PRE_PORTA: case DIV_CMD_PRE_PORTA:
if (chan[c.chan].active && c.value2) { if (chan[c.chan].active && c.value2) {
if (parent->song.resetMacroOnPorta || !chan[c.chan].inPorta) { if (parent->song.resetMacroOnPorta) {// || !chan[c.chan].inPorta) {
chan[c.chan].macroInit(parent->getIns(chan[c.chan].ins,DIV_INS_C64)); chan[c.chan].macroInit(parent->getIns(chan[c.chan].ins,DIV_INS_C64));
chan[c.chan].keyOn=true; chan[c.chan].keyOn=true;
} }
@ -675,6 +698,7 @@ void DivPlatformC64::setFlags(const DivConfig& flags) {
} }
keyPriority=flags.getBool("keyPriority",true); keyPriority=flags.getBool("keyPriority",true);
no1EUpdate=flags.getBool("no1EUpdate",false); no1EUpdate=flags.getBool("no1EUpdate",false);
newTestBitMacro = flags.getBool("oldTestBitMacro", false);
testAD=((flags.getInt("testAttack",0)&15)<<4)|(flags.getInt("testDecay",0)&15); testAD=((flags.getInt("testAttack",0)&15)<<4)|(flags.getInt("testDecay",0)&15);
testSR=((flags.getInt("testSustain",0)&15)<<4)|(flags.getInt("testRelease",0)&15); testSR=((flags.getInt("testSustain",0)&15)<<4)|(flags.getInt("testRelease",0)&15);

View file

@ -72,7 +72,7 @@ class DivPlatformC64: public DivDispatch {
unsigned char sidCore; unsigned char sidCore;
int filtCut, resetTime; int filtCut, resetTime;
bool keyPriority, sidIs6581, needInitTables, no1EUpdate; bool keyPriority, sidIs6581, needInitTables, no1EUpdate, newTestBitMacro;
unsigned char chanOrder[3]; unsigned char chanOrder[3];
unsigned char testAD, testSR; unsigned char testAD, testSR;

View file

@ -256,6 +256,18 @@ const char* c64SpecialBits[3]={
"sync", "ring", NULL "sync", "ring", NULL
}; };
const char* c64TestGateBits[3]={
"test", "gate", NULL
};
const char* c64AttackDecayBits[9] = {
"Decay 1", "Decay 2", "Decay 3", "Decay 4", "Attack 1", "Attack 2", "Attack 3", "Attack 4", NULL
};
const char* c64SustainReleaseBits[9] = {
"Release 1", "Release 2", "Release 3", "Release 4", "Sustain 1", "Sustain 2", "Sustain 3", "Sustain 4", NULL
};
const char* pokeyCtlBits[9]={ const char* pokeyCtlBits[9]={
"15KHz", "filter 2+4", "filter 1+3", "16-bit 3+4", "16-bit 1+2", "high3", "high1", "poly9", NULL "15KHz", "filter 2+4", "filter 1+3", "16-bit 3+4", "16-bit 1+2", "high3", "high1", "poly9", NULL
}; };
@ -6479,7 +6491,10 @@ void FurnaceGUI::drawInsEdit() {
} }
if (ins->type==DIV_INS_C64) { if (ins->type==DIV_INS_C64) {
macroList.push_back(FurnaceGUIMacroDesc("Special",&ins->std.ex3Macro,0,2,32,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,NULL,true,c64SpecialBits)); macroList.push_back(FurnaceGUIMacroDesc("Special",&ins->std.ex3Macro,0,2,32,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,NULL,true,c64SpecialBits));
macroList.push_back(FurnaceGUIMacroDesc("Test/Gate",&ins->std.ex4Macro,0,1,32,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,NULL,true)); //macroList.push_back(FurnaceGUIMacroDesc("Test/Gate",&ins->std.ex4Macro,0,1,32,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,NULL,true));
macroList.push_back(FurnaceGUIMacroDesc("Test/Gate",&ins->std.ex4Macro,0,2,32,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,NULL, true, c64TestGateBits));
macroList.push_back(FurnaceGUIMacroDesc("Attack/Decay", &ins->std.ex5Macro, 0, 8, 128, uiColors[GUI_COLOR_MACRO_OTHER], false, NULL, NULL, true, c64AttackDecayBits));
macroList.push_back(FurnaceGUIMacroDesc("Sustain/Release", &ins->std.ex6Macro, 0, 8, 128, uiColors[GUI_COLOR_MACRO_OTHER], false, NULL, NULL, true, c64SustainReleaseBits));
} }
if (ins->type==DIV_INS_AY || ins->type==DIV_INS_AY8930 || (ins->type==DIV_INS_X1_010 && !ins->amiga.useSample)) { if (ins->type==DIV_INS_AY || ins->type==DIV_INS_AY8930 || (ins->type==DIV_INS_X1_010 && !ins->amiga.useSample)) {
macroList.push_back(FurnaceGUIMacroDesc("AutoEnv Num",&ins->std.ex3Macro,0,15,160,uiColors[GUI_COLOR_MACRO_OTHER])); macroList.push_back(FurnaceGUIMacroDesc("AutoEnv Num",&ins->std.ex3Macro,0,15,160,uiColors[GUI_COLOR_MACRO_OTHER]));

View file

@ -587,6 +587,7 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
int clockSel=flags.getInt("clockSel",0); int clockSel=flags.getInt("clockSel",0);
bool keyPriority=flags.getBool("keyPriority",true); bool keyPriority=flags.getBool("keyPriority",true);
bool no1EUpdate=flags.getBool("no1EUpdate",false); bool no1EUpdate=flags.getBool("no1EUpdate",false);
bool newTestBitMacro = flags.getBool("newTestBitMacro", false);
int testAttack=flags.getInt("testAttack",0); int testAttack=flags.getInt("testAttack",0);
int testDecay=flags.getInt("testDecay",0); int testDecay=flags.getInt("testDecay",0);
int testSustain=flags.getInt("testSustain",0); int testSustain=flags.getInt("testSustain",0);
@ -649,11 +650,16 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
altered=true; altered=true;
} }
if (ImGui::Checkbox("New test bit macro behaviour (with gate bit) (compatibility)", &newTestBitMacro)) {
altered = true;
}
if (altered) { if (altered) {
e->lockSave([&]() { e->lockSave([&]() {
flags.set("clockSel",clockSel); flags.set("clockSel",clockSel);
flags.set("keyPriority",keyPriority); flags.set("keyPriority",keyPriority);
flags.set("no1EUpdate",no1EUpdate); flags.set("no1EUpdate",no1EUpdate);
flags.set("newTestBitMacro", newTestBitMacro);
flags.set("testAttack",testAttack); flags.set("testAttack",testAttack);
flags.set("testDecay",testDecay); flags.set("testDecay",testDecay);
flags.set("testSustain",testSustain); flags.set("testSustain",testSustain);