OPN(A/B/2/B-B): fix absolutely everything
This commit is contained in:
parent
3d4f2cfa13
commit
2fa51e482a
16 changed files with 89 additions and 489 deletions
|
|
@ -32,4 +32,65 @@
|
|||
#define ADDR_FB_ALG 0xb0
|
||||
#define ADDR_LRAF 0xb4
|
||||
|
||||
#define PLEASE_HELP_ME(_targetChan) \
|
||||
int boundaryBottom=parent->calcBaseFreq(chipClock,CHIP_FREQBASE,0,false); \
|
||||
int boundaryTop=parent->calcBaseFreq(chipClock,CHIP_FREQBASE,12,false); \
|
||||
int destFreq=NOTE_FNUM_BLOCK(c.value2,11); \
|
||||
int newFreq; \
|
||||
bool return2=false; \
|
||||
if (_targetChan.portaPause) { \
|
||||
if (parent->song.oldOctaveBoundary) { \
|
||||
if ((_targetChan.portaPauseFreq&0xf800)>(_targetChan.baseFreq&0xf800)) { \
|
||||
_targetChan.baseFreq=((_targetChan.baseFreq&0x7ff)>>1)|(_targetChan.portaPauseFreq&0xf800); \
|
||||
} else { \
|
||||
_targetChan.baseFreq=((_targetChan.baseFreq&0x7ff)<<1)|(_targetChan.portaPauseFreq&0xf800); \
|
||||
} \
|
||||
c.value*=2; \
|
||||
} else { \
|
||||
_targetChan.baseFreq=_targetChan.portaPauseFreq; \
|
||||
} \
|
||||
} \
|
||||
if (destFreq>_targetChan.baseFreq) { \
|
||||
newFreq=_targetChan.baseFreq+c.value; \
|
||||
if (newFreq>=destFreq) { \
|
||||
newFreq=destFreq; \
|
||||
return2=true; \
|
||||
} \
|
||||
} else { \
|
||||
newFreq=_targetChan.baseFreq-c.value; \
|
||||
if (newFreq<=destFreq) { \
|
||||
newFreq=destFreq; \
|
||||
return2=true; \
|
||||
} \
|
||||
} \
|
||||
/* check for octave boundary */ \
|
||||
/* what the heck! */ \
|
||||
if (!_targetChan.portaPause) { \
|
||||
if ((newFreq&0x7ff)>boundaryTop && (newFreq&0xf800)<0x3800) { \
|
||||
if (parent->song.fbPortaPause) { \
|
||||
_targetChan.portaPauseFreq=(boundaryBottom)|((newFreq+0x800)&0xf800); \
|
||||
_targetChan.portaPause=true; \
|
||||
break; \
|
||||
} else { \
|
||||
newFreq=((newFreq&0x7ff)>>1)|((newFreq+0x800)&0xf800); \
|
||||
} \
|
||||
} \
|
||||
if ((newFreq&0x7ff)<boundaryBottom && (newFreq&0xf800)>0) { \
|
||||
if (parent->song.fbPortaPause) { \
|
||||
_targetChan.portaPauseFreq=newFreq=(boundaryTop-1)|((newFreq-0x800)&0xf800); \
|
||||
_targetChan.portaPause=true; \
|
||||
break; \
|
||||
} else { \
|
||||
newFreq=((newFreq&0x7ff)<<1)|((newFreq-0x800)&0xf800); \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
_targetChan.portaPause=false; \
|
||||
_targetChan.freqChanged=true; \
|
||||
_targetChan.baseFreq=newFreq; \
|
||||
if (return2) { \
|
||||
_targetChan.inPorta=false; \
|
||||
return 2; \
|
||||
}
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue