From e29113c926cde76769f30787f23aea3a1a35ca89 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sun, 29 Oct 2023 03:04:55 -0500 Subject: [PATCH] C64: another tiny fix also document conversion approach --- papers/format.md | 21 ++++++++++++++++++++- papers/newIns.md | 21 ++++++++++++++++++++- src/engine/instrument.cpp | 9 +++++++-- 3 files changed, 47 insertions(+), 4 deletions(-) diff --git a/papers/format.md b/papers/format.md index 54082b532..7bf06da13 100644 --- a/papers/format.md +++ b/papers/format.md @@ -634,7 +634,9 @@ size | description 1 | osc sync 1 | to filter 1 | init filter - 1 | vol macro is cutoff + 1 | vol macro is cutoff (<187) or reserved + | - from version 187 onwards, volume and cutoff macros are separate. + | - if this is on and the version is less than 187, move the volume macro into the ALG one. 1 | resonance 1 | low pass 1 | band pass @@ -1122,6 +1124,23 @@ size | description - `val[14]`: loop - `val[15]`: global (not sure how will I implement this) +## C64 compatibility note (>=187) + +in Furnace dev187 the volume and cutoff macros have been separated, as noted above. +however, there's another change as well: a new, improved Special macro. + +if version is less than 187, you must convert these: +1. do not continue if ex4 is not a Sequence type macro! +2. move bit 0 of ex4 macro data into bit 3. +3. set bit 0 on all steps of ex4 macro to 1. +4. if ex3 is not a Sequence type macro, stop here. +5. if ex3 macro length is 0, stop here. +6. merge the ex3 macro (former Special) into ex4 (former Test). + - use the largest size (between ex3 and ex4). + - if the ex3 macro is shorter than the ex4 one, use the last value of ex3, and vice-versa. + +don't worry about loop or release... + # wavetable ``` diff --git a/papers/newIns.md b/papers/newIns.md index 34afe3b28..79a8fdba2 100644 --- a/papers/newIns.md +++ b/papers/newIns.md @@ -295,7 +295,9 @@ size | description 1 | flags 1 | - bit 7: dutyIsAbs | - bit 6: initFilter - | - bit 5: volIsCutoff + | - bit 5: volIsCutoff (<187) + | - from version 187 onwards, volume and cutoff macros are separate. + | - if this is on and the version is less than 187, move the volume macro into the ALG one. | - bit 4: toFilter | - bit 3: noise on | - bit 2: pulse on @@ -322,6 +324,23 @@ size | description | - bit 0-10: cutoff ``` +## C64 compatibility note (>=187) + +in Furnace dev187 the volume and cutoff macros have been separated, as noted above. +however, there's another change as well: a new, improved Special macro. + +if version is less than 187, you must convert these: +1. do not continue if ex4 is not a Sequence type macro! +2. move bit 0 of ex4 macro data into bit 3. +3. set bit 0 on all steps of ex4 macro to 1. +4. if ex3 is not a Sequence type macro, stop here. +5. if ex3 macro length is 0, stop here. +6. merge the ex3 macro (former Special) into ex4 (former Test). + - use the largest size (between ex3 and ex4). + - if the ex3 macro is shorter than the ex4 one, use the last value of ex3, and vice-versa. + +don't worry about loop or release... + # Game Boy data (GB) ``` diff --git a/src/engine/instrument.cpp b/src/engine/instrument.cpp index d2899d4ff..51c2422c1 100644 --- a/src/engine/instrument.cpp +++ b/src/engine/instrument.cpp @@ -3477,8 +3477,13 @@ void DivInstrument::convertC64SpecialMacro() { std.ex4Macro.val[i]=(std.ex4Macro.val[i]&1)?9:1; } - // merge ex3 into ex4 - if (std.ex3Macro.len>0) { + // merge ex3 into ex4 if viable to + if (std.ex3Macro.len>0 && !(std.ex3Macro.open&6)) { + if (std.ex4Macro.len>0 && std.ex4Macro.len=std.ex3Macro.len) { std.ex4Macro.val[i]|=(std.ex3Macro.val[std.ex3Macro.len-1]&3)<<1;