mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-23 13:05:11 +00:00
parent
41c41859ed
commit
423f2f5069
5 changed files with 152 additions and 19 deletions
|
@ -477,13 +477,6 @@ void DivPlatformGenesisExt::tick(bool sysTick) {
|
||||||
if (chan[csmChan].active) { // CSM
|
if (chan[csmChan].active) { // CSM
|
||||||
writeMask^=0xf0;
|
writeMask^=0xf0;
|
||||||
}
|
}
|
||||||
/*printf(
|
|
||||||
"Mask: %c %c %c %c\n",
|
|
||||||
(writeMask&0x10)?'1':'-',
|
|
||||||
(writeMask&0x20)?'2':'-',
|
|
||||||
(writeMask&0x40)?'3':'-',
|
|
||||||
(writeMask&0x80)?'4':'-'
|
|
||||||
);*/
|
|
||||||
immWrite(0x28,writeMask);
|
immWrite(0x28,writeMask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -638,13 +631,6 @@ void DivPlatformGenesisExt::tick(bool sysTick) {
|
||||||
if (chan[csmChan].active) { // CSM
|
if (chan[csmChan].active) { // CSM
|
||||||
writeMask^=0xf0;
|
writeMask^=0xf0;
|
||||||
}
|
}
|
||||||
/*printf(
|
|
||||||
"Mask: %c %c %c %c\n",
|
|
||||||
(writeMask&0x10)?'1':'-',
|
|
||||||
(writeMask&0x20)?'2':'-',
|
|
||||||
(writeMask&0x40)?'3':'-',
|
|
||||||
(writeMask&0x80)?'4':'-'
|
|
||||||
);*/
|
|
||||||
writeMask^=hardResetMask;
|
writeMask^=hardResetMask;
|
||||||
immWrite(0x28,writeMask);
|
immWrite(0x28,writeMask);
|
||||||
writeMask^=hardResetMask;
|
writeMask^=hardResetMask;
|
||||||
|
@ -657,7 +643,6 @@ void DivPlatformGenesisExt::tick(bool sysTick) {
|
||||||
for (int i=0; i<4; i++) {
|
for (int i=0; i<4; i++) {
|
||||||
if (opChan[i].keyOn && opChan[i].hardReset) {
|
if (opChan[i].keyOn && opChan[i].hardReset) {
|
||||||
// restore SL/RR
|
// restore SL/RR
|
||||||
logV("eco: %d",extChanOffs);
|
|
||||||
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[i];
|
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[i];
|
||||||
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[i];
|
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[i];
|
||||||
immWrite(baseAddr+ADDR_SL_RR,(op.rr&15)|(op.sl<<4));
|
immWrite(baseAddr+ADDR_SL_RR,(op.rr&15)|(op.sl<<4));
|
||||||
|
|
|
@ -355,6 +355,9 @@ int DivPlatformYM2203Ext::dispatch(DivCommand c) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case DIV_CMD_FM_HARD_RESET:
|
||||||
|
opChan[ch].hardReset=c.value;
|
||||||
|
break;
|
||||||
case DIV_CMD_GET_VOLMAX:
|
case DIV_CMD_GET_VOLMAX:
|
||||||
return 127;
|
return 127;
|
||||||
break;
|
break;
|
||||||
|
@ -385,6 +388,9 @@ static int opChanOffsH[4]={
|
||||||
};
|
};
|
||||||
|
|
||||||
void DivPlatformYM2203Ext::tick(bool sysTick) {
|
void DivPlatformYM2203Ext::tick(bool sysTick) {
|
||||||
|
int hardResetElapsed=0;
|
||||||
|
bool mustHardReset=false;
|
||||||
|
|
||||||
if (extMode) {
|
if (extMode) {
|
||||||
bool writeSomething=false;
|
bool writeSomething=false;
|
||||||
unsigned char writeMask=2;
|
unsigned char writeMask=2;
|
||||||
|
@ -395,6 +401,12 @@ void DivPlatformYM2203Ext::tick(bool sysTick) {
|
||||||
writeMask&=~(1<<(4+i));
|
writeMask&=~(1<<(4+i));
|
||||||
opChan[i].keyOff=false;
|
opChan[i].keyOff=false;
|
||||||
}
|
}
|
||||||
|
if (opChan[i].hardReset && opChan[i].keyOn) {
|
||||||
|
mustHardReset=true;
|
||||||
|
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[i];
|
||||||
|
immWrite(baseAddr+ADDR_SL_RR,0x0f);
|
||||||
|
hardResetElapsed++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (writeSomething) {
|
if (writeSomething) {
|
||||||
immWrite(0x28,writeMask);
|
immWrite(0x28,writeMask);
|
||||||
|
@ -491,6 +503,7 @@ void DivPlatformYM2203Ext::tick(bool sysTick) {
|
||||||
|
|
||||||
bool writeNoteOn=false;
|
bool writeNoteOn=false;
|
||||||
unsigned char writeMask=2;
|
unsigned char writeMask=2;
|
||||||
|
unsigned char hardResetMask=0;
|
||||||
if (extMode) for (int i=0; i<4; i++) {
|
if (extMode) for (int i=0; i<4; i++) {
|
||||||
if (opChan[i].freqChanged) {
|
if (opChan[i].freqChanged) {
|
||||||
if (parent->song.linearPitch==2) {
|
if (parent->song.linearPitch==2) {
|
||||||
|
@ -517,12 +530,36 @@ void DivPlatformYM2203Ext::tick(bool sysTick) {
|
||||||
writeNoteOn=true;
|
writeNoteOn=true;
|
||||||
if (opChan[i].mask) {
|
if (opChan[i].mask) {
|
||||||
writeMask|=1<<(4+i);
|
writeMask|=1<<(4+i);
|
||||||
|
if (opChan[i].hardReset) {
|
||||||
|
hardResetMask|=1<<(4+i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!opChan[i].hardReset) {
|
||||||
|
opChan[i].keyOn=false;
|
||||||
}
|
}
|
||||||
opChan[i].keyOn=false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (writeNoteOn) {
|
if (writeNoteOn) {
|
||||||
|
writeMask^=hardResetMask;
|
||||||
immWrite(0x28,writeMask);
|
immWrite(0x28,writeMask);
|
||||||
|
writeMask^=hardResetMask;
|
||||||
|
|
||||||
|
// hard reset handling
|
||||||
|
if (mustHardReset) {
|
||||||
|
for (unsigned int i=hardResetElapsed; i<hardResetCycles; i++) {
|
||||||
|
immWrite(0xf0,i&0xff);
|
||||||
|
}
|
||||||
|
for (int i=0; i<4; i++) {
|
||||||
|
if (opChan[i].keyOn && opChan[i].hardReset) {
|
||||||
|
// restore SL/RR
|
||||||
|
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[i];
|
||||||
|
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[i];
|
||||||
|
immWrite(baseAddr+ADDR_SL_RR,(op.rr&15)|(op.sl<<4));
|
||||||
|
opChan[i].keyOn=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
immWrite(0x28,writeMask);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -378,6 +378,9 @@ int DivPlatformYM2608Ext::dispatch(DivCommand c) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case DIV_CMD_FM_HARD_RESET:
|
||||||
|
opChan[ch].hardReset=c.value;
|
||||||
|
break;
|
||||||
case DIV_CMD_GET_VOLMAX:
|
case DIV_CMD_GET_VOLMAX:
|
||||||
return 127;
|
return 127;
|
||||||
break;
|
break;
|
||||||
|
@ -408,6 +411,9 @@ static int opChanOffsH[4]={
|
||||||
};
|
};
|
||||||
|
|
||||||
void DivPlatformYM2608Ext::tick(bool sysTick) {
|
void DivPlatformYM2608Ext::tick(bool sysTick) {
|
||||||
|
int hardResetElapsed=0;
|
||||||
|
bool mustHardReset=false;
|
||||||
|
|
||||||
if (extMode) {
|
if (extMode) {
|
||||||
bool writeSomething=false;
|
bool writeSomething=false;
|
||||||
unsigned char writeMask=2;
|
unsigned char writeMask=2;
|
||||||
|
@ -418,6 +424,12 @@ void DivPlatformYM2608Ext::tick(bool sysTick) {
|
||||||
writeMask&=~(1<<(4+i));
|
writeMask&=~(1<<(4+i));
|
||||||
opChan[i].keyOff=false;
|
opChan[i].keyOff=false;
|
||||||
}
|
}
|
||||||
|
if (opChan[i].hardReset && opChan[i].keyOn) {
|
||||||
|
mustHardReset=true;
|
||||||
|
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[i];
|
||||||
|
immWrite(baseAddr+ADDR_SL_RR,0x0f);
|
||||||
|
hardResetElapsed++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (writeSomething) {
|
if (writeSomething) {
|
||||||
immWrite(0x28,writeMask);
|
immWrite(0x28,writeMask);
|
||||||
|
@ -513,6 +525,7 @@ void DivPlatformYM2608Ext::tick(bool sysTick) {
|
||||||
|
|
||||||
bool writeNoteOn=false;
|
bool writeNoteOn=false;
|
||||||
unsigned char writeMask=2;
|
unsigned char writeMask=2;
|
||||||
|
unsigned char hardResetMask=0;
|
||||||
if (extMode) for (int i=0; i<4; i++) {
|
if (extMode) for (int i=0; i<4; i++) {
|
||||||
if (opChan[i].freqChanged) {
|
if (opChan[i].freqChanged) {
|
||||||
if (parent->song.linearPitch==2) {
|
if (parent->song.linearPitch==2) {
|
||||||
|
@ -539,12 +552,36 @@ void DivPlatformYM2608Ext::tick(bool sysTick) {
|
||||||
writeNoteOn=true;
|
writeNoteOn=true;
|
||||||
if (opChan[i].mask) {
|
if (opChan[i].mask) {
|
||||||
writeMask|=1<<(4+i);
|
writeMask|=1<<(4+i);
|
||||||
|
if (opChan[i].hardReset) {
|
||||||
|
hardResetMask|=1<<(4+i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!opChan[i].hardReset) {
|
||||||
|
opChan[i].keyOn=false;
|
||||||
}
|
}
|
||||||
opChan[i].keyOn=false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (writeNoteOn) {
|
if (writeNoteOn) {
|
||||||
|
writeMask^=hardResetMask;
|
||||||
immWrite(0x28,writeMask);
|
immWrite(0x28,writeMask);
|
||||||
|
writeMask^=hardResetMask;
|
||||||
|
|
||||||
|
// hard reset handling
|
||||||
|
if (mustHardReset) {
|
||||||
|
for (unsigned int i=hardResetElapsed; i<hardResetCycles; i++) {
|
||||||
|
immWrite(0xf0,i&0xff);
|
||||||
|
}
|
||||||
|
for (int i=0; i<4; i++) {
|
||||||
|
if (opChan[i].keyOn && opChan[i].hardReset) {
|
||||||
|
// restore SL/RR
|
||||||
|
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[i];
|
||||||
|
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[i];
|
||||||
|
immWrite(baseAddr+ADDR_SL_RR,(op.rr&15)|(op.sl<<4));
|
||||||
|
opChan[i].keyOn=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
immWrite(0x28,writeMask);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -374,6 +374,9 @@ int DivPlatformYM2610BExt::dispatch(DivCommand c) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case DIV_CMD_FM_HARD_RESET:
|
||||||
|
opChan[ch].hardReset=c.value;
|
||||||
|
break;
|
||||||
case DIV_CMD_GET_VOLMAX:
|
case DIV_CMD_GET_VOLMAX:
|
||||||
return 127;
|
return 127;
|
||||||
break;
|
break;
|
||||||
|
@ -404,6 +407,9 @@ static int opChanOffsH[4]={
|
||||||
};
|
};
|
||||||
|
|
||||||
void DivPlatformYM2610BExt::tick(bool sysTick) {
|
void DivPlatformYM2610BExt::tick(bool sysTick) {
|
||||||
|
int hardResetElapsed=0;
|
||||||
|
bool mustHardReset=false;
|
||||||
|
|
||||||
if (extMode) {
|
if (extMode) {
|
||||||
bool writeSomething=false;
|
bool writeSomething=false;
|
||||||
unsigned char writeMask=2;
|
unsigned char writeMask=2;
|
||||||
|
@ -414,6 +420,12 @@ void DivPlatformYM2610BExt::tick(bool sysTick) {
|
||||||
writeMask&=~(1<<(4+i));
|
writeMask&=~(1<<(4+i));
|
||||||
opChan[i].keyOff=false;
|
opChan[i].keyOff=false;
|
||||||
}
|
}
|
||||||
|
if (opChan[i].hardReset && opChan[i].keyOn) {
|
||||||
|
mustHardReset=true;
|
||||||
|
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[i];
|
||||||
|
immWrite(baseAddr+ADDR_SL_RR,0x0f);
|
||||||
|
hardResetElapsed++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (writeSomething) {
|
if (writeSomething) {
|
||||||
immWrite(0x28,writeMask);
|
immWrite(0x28,writeMask);
|
||||||
|
@ -509,6 +521,7 @@ void DivPlatformYM2610BExt::tick(bool sysTick) {
|
||||||
|
|
||||||
bool writeNoteOn=false;
|
bool writeNoteOn=false;
|
||||||
unsigned char writeMask=2;
|
unsigned char writeMask=2;
|
||||||
|
unsigned char hardResetMask=0;
|
||||||
if (extMode) for (int i=0; i<4; i++) {
|
if (extMode) for (int i=0; i<4; i++) {
|
||||||
if (opChan[i].freqChanged) {
|
if (opChan[i].freqChanged) {
|
||||||
if (parent->song.linearPitch==2) {
|
if (parent->song.linearPitch==2) {
|
||||||
|
@ -535,12 +548,36 @@ void DivPlatformYM2610BExt::tick(bool sysTick) {
|
||||||
writeNoteOn=true;
|
writeNoteOn=true;
|
||||||
if (opChan[i].mask) {
|
if (opChan[i].mask) {
|
||||||
writeMask|=1<<(4+i);
|
writeMask|=1<<(4+i);
|
||||||
|
if (opChan[i].hardReset) {
|
||||||
|
hardResetMask|=1<<(4+i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!opChan[i].hardReset) {
|
||||||
|
opChan[i].keyOn=false;
|
||||||
}
|
}
|
||||||
opChan[i].keyOn=false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (writeNoteOn) {
|
if (writeNoteOn) {
|
||||||
|
writeMask^=hardResetMask;
|
||||||
immWrite(0x28,writeMask);
|
immWrite(0x28,writeMask);
|
||||||
|
writeMask^=hardResetMask;
|
||||||
|
|
||||||
|
// hard reset handling
|
||||||
|
if (mustHardReset) {
|
||||||
|
for (unsigned int i=hardResetElapsed; i<hardResetCycles; i++) {
|
||||||
|
immWrite(0xf0,i&0xff);
|
||||||
|
}
|
||||||
|
for (int i=0; i<4; i++) {
|
||||||
|
if (opChan[i].keyOn && opChan[i].hardReset) {
|
||||||
|
// restore SL/RR
|
||||||
|
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[i];
|
||||||
|
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[i];
|
||||||
|
immWrite(baseAddr+ADDR_SL_RR,(op.rr&15)|(op.sl<<4));
|
||||||
|
opChan[i].keyOn=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
immWrite(0x28,writeMask);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -374,6 +374,9 @@ int DivPlatformYM2610Ext::dispatch(DivCommand c) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case DIV_CMD_FM_HARD_RESET:
|
||||||
|
opChan[ch].hardReset=c.value;
|
||||||
|
break;
|
||||||
case DIV_CMD_GET_VOLMAX:
|
case DIV_CMD_GET_VOLMAX:
|
||||||
return 127;
|
return 127;
|
||||||
break;
|
break;
|
||||||
|
@ -404,6 +407,9 @@ static int opChanOffsH[4]={
|
||||||
};
|
};
|
||||||
|
|
||||||
void DivPlatformYM2610Ext::tick(bool sysTick) {
|
void DivPlatformYM2610Ext::tick(bool sysTick) {
|
||||||
|
int hardResetElapsed=0;
|
||||||
|
bool mustHardReset=false;
|
||||||
|
|
||||||
if (extMode) {
|
if (extMode) {
|
||||||
bool writeSomething=false;
|
bool writeSomething=false;
|
||||||
unsigned char writeMask=2;
|
unsigned char writeMask=2;
|
||||||
|
@ -414,6 +420,12 @@ void DivPlatformYM2610Ext::tick(bool sysTick) {
|
||||||
writeMask&=~(1<<(4+i));
|
writeMask&=~(1<<(4+i));
|
||||||
opChan[i].keyOff=false;
|
opChan[i].keyOff=false;
|
||||||
}
|
}
|
||||||
|
if (opChan[i].hardReset && opChan[i].keyOn) {
|
||||||
|
mustHardReset=true;
|
||||||
|
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[i];
|
||||||
|
immWrite(baseAddr+ADDR_SL_RR,0x0f);
|
||||||
|
hardResetElapsed++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (writeSomething) {
|
if (writeSomething) {
|
||||||
immWrite(0x28,writeMask);
|
immWrite(0x28,writeMask);
|
||||||
|
@ -509,6 +521,7 @@ void DivPlatformYM2610Ext::tick(bool sysTick) {
|
||||||
|
|
||||||
bool writeNoteOn=false;
|
bool writeNoteOn=false;
|
||||||
unsigned char writeMask=2;
|
unsigned char writeMask=2;
|
||||||
|
unsigned char hardResetMask=0;
|
||||||
if (extMode) for (int i=0; i<4; i++) {
|
if (extMode) for (int i=0; i<4; i++) {
|
||||||
if (opChan[i].freqChanged) {
|
if (opChan[i].freqChanged) {
|
||||||
if (parent->song.linearPitch==2) {
|
if (parent->song.linearPitch==2) {
|
||||||
|
@ -535,12 +548,36 @@ void DivPlatformYM2610Ext::tick(bool sysTick) {
|
||||||
writeNoteOn=true;
|
writeNoteOn=true;
|
||||||
if (opChan[i].mask) {
|
if (opChan[i].mask) {
|
||||||
writeMask|=1<<(4+i);
|
writeMask|=1<<(4+i);
|
||||||
|
if (opChan[i].hardReset) {
|
||||||
|
hardResetMask|=1<<(4+i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!opChan[i].hardReset) {
|
||||||
|
opChan[i].keyOn=false;
|
||||||
}
|
}
|
||||||
opChan[i].keyOn=false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (writeNoteOn) {
|
if (writeNoteOn) {
|
||||||
|
writeMask^=hardResetMask;
|
||||||
immWrite(0x28,writeMask);
|
immWrite(0x28,writeMask);
|
||||||
|
writeMask^=hardResetMask;
|
||||||
|
|
||||||
|
// hard reset handling
|
||||||
|
if (mustHardReset) {
|
||||||
|
for (unsigned int i=hardResetElapsed; i<hardResetCycles; i++) {
|
||||||
|
immWrite(0xf0,i&0xff);
|
||||||
|
}
|
||||||
|
for (int i=0; i<4; i++) {
|
||||||
|
if (opChan[i].keyOn && opChan[i].hardReset) {
|
||||||
|
// restore SL/RR
|
||||||
|
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[i];
|
||||||
|
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[i];
|
||||||
|
immWrite(baseAddr+ADDR_SL_RR,(op.rr&15)|(op.sl<<4));
|
||||||
|
opChan[i].keyOn=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
immWrite(0x28,writeMask);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue