diff --git a/papers/format.md b/papers/format.md index c346dfee2..23bac80aa 100644 --- a/papers/format.md +++ b/papers/format.md @@ -25,6 +25,7 @@ furthermore, an `or reserved` indicates this field is always present, but is res the format versions are: +- 60: Furnace dev60 - 59: Furnace dev59 - 58: Furnace dev58 - 57: Furnace dev57 @@ -228,7 +229,11 @@ size | description 1 | fms 1 | ams 1 | operator count (always 4) - 3 | reserved + 1 | OPLL preset (>=60) or reserved + | - 0: custom + | - 1-15: pre-defined patches + | - 16: drums (compatibility only!) + 2 | reserved --- | **FM operator data** × 4 1 | am 1 | ar diff --git a/src/engine/engine.h b/src/engine/engine.h index 68c003160..f0ef1833a 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -37,8 +37,8 @@ warnings+=(String("\n")+x); \ } -#define DIV_VERSION "dev59" -#define DIV_ENGINE_VERSION 59 +#define DIV_VERSION "dev60" +#define DIV_ENGINE_VERSION 60 enum DivStatusView { DIV_STATUS_NOTHING=0, diff --git a/src/engine/instrument.cpp b/src/engine/instrument.cpp index 57e9cbf47..fa5564c93 100644 --- a/src/engine/instrument.cpp +++ b/src/engine/instrument.cpp @@ -40,9 +40,9 @@ void DivInstrument::putInsData(SafeWriter* w) { w->writeC(fm.fms); w->writeC(fm.ams); w->writeC(4); // operator count; always 4 + w->writeC(fm.opllPreset); w->writeC(0); // reserved w->writeC(0); - w->writeC(0); for (int j=0; j<4; j++) { DivInstrumentFM::Operator& op=fm.op[j]; @@ -325,7 +325,11 @@ DivDataErrors DivInstrument::readInsData(SafeReader& reader, short version) { fm.fms=reader.readC(); fm.ams=reader.readC(); fm.ops=reader.readC(); - reader.readC(); + if (version>=60) { + fm.opllPreset=reader.readC(); + } else { + reader.readC(); + } reader.readC(); reader.readC(); diff --git a/src/engine/platform/opll.cpp b/src/engine/platform/opll.cpp index d941a8d77..205030753 100644 --- a/src/engine/platform/opll.cpp +++ b/src/engine/platform/opll.cpp @@ -88,13 +88,13 @@ void DivPlatformOPLL::acquire_nuked(short* bufL, short* bufR, size_t start, size printf("write: %x = %.2x\n",w.addr,w.val); regPool[w.addr&0xff]=w.val; writes.pop(); - delay=84; + delay=21; } else { //printf("busycounter: %d\n",lastBusy); //w.addr=rand()&0x3f; OPLL_Write(&fm,0,w.addr); w.addrOrVal=true; - delay=12; + delay=3; } } @@ -267,7 +267,7 @@ void DivPlatformOPLL::tick() { } if (chan[i].keyOn) { //immWrite(0x28,0xf0|konOffs[i]); - immWrite(0x20+i,(chan[i].freqH)|(chan[i].active<<4)); + immWrite(0x20+i,(chan[i].freqH)|(chan[i].active<<4)|0x20); chan[i].keyOn=false; } } @@ -657,9 +657,9 @@ void DivPlatformOPLL::setFlags(unsigned int flags) { } else if (flags==2) { chipClock=8000000.0; } else if (flags==1) { - chipClock=COLOR_PAL*4.0/5.0; + chipClock=COLOR_PAL*1.0/5.0; } else { - chipClock=COLOR_NTSC; + chipClock=COLOR_NTSC/4.0; } rate=chipClock; }