mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-23 13:05:11 +00:00
Amiga: DMACON coalescing
This commit is contained in:
parent
4b708e98cf
commit
3ff3a9952a
2 changed files with 35 additions and 12 deletions
|
@ -170,7 +170,7 @@ testChannel:
|
|||
or.b (a2)+,d2
|
||||
lsl.l #8,d2
|
||||
or.b (a2)+,d2
|
||||
lea sampleData(pc),a0
|
||||
lea sampleData,a0
|
||||
add.l a0,d2
|
||||
lea chipBase,a0
|
||||
move.b d1,d0
|
||||
|
|
|
@ -404,6 +404,29 @@ void DivPlatformAmiga::tick(bool sysTick) {
|
|||
chan[i].keyOn=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsigned short dmaOff=0;
|
||||
unsigned short dmaOn=0;
|
||||
for (int i=0; i<4; i++) {
|
||||
if (chan[i].keyOn || chan[i].keyOff) {
|
||||
chWrite(i,6,1);
|
||||
dmaOff|=1<<i;
|
||||
}
|
||||
}
|
||||
|
||||
rWrite(0x96,dmaOff);
|
||||
|
||||
for (int i=0; i<4; i++) {
|
||||
double off=1.0;
|
||||
if (!chan[i].useWave && chan[i].sample>=0 && chan[i].sample<parent->song.sampleLen) {
|
||||
DivSample* s=parent->getSample(chan[i].sample);
|
||||
if (s->centerRate<1) {
|
||||
off=1.0;
|
||||
} else {
|
||||
off=8363.0/(double)s->centerRate;
|
||||
}
|
||||
}
|
||||
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
|
||||
//DivInstrument* ins=parent->getIns(chan[i].ins,DIV_INS_AMIGA);
|
||||
chan[i].freq=off*parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,true,0,chan[i].pitch2,chipClock,CHIP_DIVIDER);
|
||||
|
@ -413,7 +436,6 @@ void DivPlatformAmiga::tick(bool sysTick) {
|
|||
chWrite(i,6,chan[i].freq);
|
||||
|
||||
if (chan[i].keyOn) {
|
||||
rWrite(0x96,1<<i);
|
||||
if (chan[i].useWave) {
|
||||
rWrite(0x9a,(128<<i));
|
||||
chWrite(i,0,0);
|
||||
|
@ -423,7 +445,7 @@ void DivPlatformAmiga::tick(bool sysTick) {
|
|||
addWrite(0x200+i,i<<8);
|
||||
addWrite(0x204+i,chan[i].audLen);
|
||||
}
|
||||
rWrite(0x96,0x8000|(1<<i));
|
||||
dmaOn|=1<<i;
|
||||
} else {
|
||||
if (chan[i].sample>=0 && chan[i].sample<parent->song.sampleLen) {
|
||||
DivSample* s=parent->getSample(chan[i].sample);
|
||||
|
@ -454,7 +476,7 @@ void DivPlatformAmiga::tick(bool sysTick) {
|
|||
}
|
||||
}
|
||||
|
||||
rWrite(0x96,0x8000|(1<<i));
|
||||
dmaOn|=1<<i;
|
||||
if (s->isLoopable()) {
|
||||
int loopPos=(sampleOff[chan[i].sample]+s->getLoopStartPosition(DIV_SAMPLE_DEPTH_8BIT))&(~1);
|
||||
int loopEnd=(s->getLoopEndPosition(DIV_SAMPLE_DEPTH_8BIT)-s->getLoopStartPosition(DIV_SAMPLE_DEPTH_8BIT))>>1;
|
||||
|
@ -466,10 +488,6 @@ void DivPlatformAmiga::tick(bool sysTick) {
|
|||
chan[i].irLocL=0x400;
|
||||
chan[i].irLen=1;
|
||||
}
|
||||
if (dumpWrites) {
|
||||
addWrite(0x200+i,(chan[i].irLocH<<16)|chan[i].irLocL);
|
||||
addWrite(0x204+i,chan[i].irLen);
|
||||
}
|
||||
rWrite(0x9a,0x8000|(128<<i));
|
||||
} else {
|
||||
chWrite(i,0,0);
|
||||
|
@ -482,16 +500,21 @@ void DivPlatformAmiga::tick(bool sysTick) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (chan[i].keyOff) {
|
||||
rWrite(0x96,1<<i);
|
||||
}
|
||||
if (chan[i].keyOn) chan[i].keyOn=false;
|
||||
if (chan[i].keyOff) chan[i].keyOff=false;
|
||||
chan[i].freqChanged=false;
|
||||
}
|
||||
}
|
||||
|
||||
rWrite(0x96,0x8000|dmaOn);
|
||||
|
||||
for (int i=0; i<4; i++) {
|
||||
if ((dmaOn&(1<<i)) && dumpWrites) {
|
||||
addWrite(0x200+i,(chan[i].irLocH<<16)|chan[i].irLocL);
|
||||
addWrite(0x204+i,chan[i].irLen);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i<4; i++) {
|
||||
if (chan[i].writeVol) {
|
||||
chan[i].writeVol=false;
|
||||
|
|
Loading…
Reference in a new issue