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) {
for (int i=0; i<ds.systemLen; i++) {
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("newTestBitMacro",true);
}
}
}

View file

@ -220,9 +220,32 @@ void DivPlatformC64::tick(bool sysTick) {
}
if (chan[i].std.ex4.had) {
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));
}
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 (chan[i].testWhen>0) {
if (--chan[i].testWhen<1) {
@ -396,7 +419,7 @@ int DivPlatformC64::dispatch(DivCommand c) {
break;
case DIV_CMD_PRE_PORTA:
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].keyOn=true;
}
@ -675,6 +698,7 @@ void DivPlatformC64::setFlags(const DivConfig& flags) {
}
keyPriority=flags.getBool("keyPriority",true);
no1EUpdate=flags.getBool("no1EUpdate",false);
newTestBitMacro = flags.getBool("oldTestBitMacro", 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);

View file

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