diff --git a/public/octatrack-modules/kits/0.1.1-experimental.mwrm b/public/octatrack-modules/kits/0.1.1-experimental.mwrm deleted file mode 100644 index 0ee97109f3..0000000000 Binary files a/public/octatrack-modules/kits/0.1.1-experimental.mwrm and /dev/null differ diff --git a/public/octatrack-modules/kits/0.1.2-experimental.mwrm b/public/octatrack-modules/kits/0.1.2-experimental.mwrm new file mode 100644 index 0000000000..0cb473bc10 Binary files /dev/null and b/public/octatrack-modules/kits/0.1.2-experimental.mwrm differ diff --git a/sdk/catalog.json b/sdk/catalog.json index e9593f8fbe..3386a12a94 100644 --- a/sdk/catalog.json +++ b/sdk/catalog.json @@ -234,7 +234,7 @@ }, { "id": "kits", - "version": "0.1.1-experimental", + "version": "0.1.2-experimental", "addedAt": "2026-11-16T21:00:00Z" }, { diff --git a/sdk/octatrack/modules/kits/README.md b/sdk/octatrack/modules/kits/README.md index fc5d94a96e..93a6d222f2 100644 --- a/sdk/octatrack/modules/kits/README.md +++ b/sdk/octatrack/modules/kits/README.md @@ -19,7 +19,7 @@ A Kit holds what a Part holds, and no more. Samples are referred to by slot numb | Reload the pattern's Kit as saved (KIT RELOADED) | FUNC+CUE | FUNC+CUE | | After a pattern paste: the pasted pattern plays a copy of its Kit in the next empty Kit | PART while STOP is still held | FUNC+MIDI while STOP is still held | | Save the Kit, copy it and the pattern to the next empty ones and play the copy | PTN+FUNC+RIGHT | PTN+FUNC+RIGHT | -| Copy, paste or clear another pattern of the current bank (paste or clear again: undo) | hold PTN, FUNC and its TRIG; REC, STOP or PLAY | the same | +| Copy, paste or clear another pattern of the current bank (the same paste or clear again, with no other copy, paste or clear between: undo) | hold PTN, FUNC and its TRIG; REC, STOP or PLAY | the same | In the LOAD KIT and SAVE KIT lists: diff --git a/sdk/octatrack/modules/kits/TESTING.md b/sdk/octatrack/modules/kits/TESTING.md index 61590166cc..71bd148655 100644 --- a/sdk/octatrack/modules/kits/TESTING.md +++ b/sdk/octatrack/modules/kits/TESTING.md @@ -1,5 +1,45 @@ # Kits testing +## Kits 0.1.2-experimental: the stale PTN+FUNC+TRIG undo, emulator only, 30 November 2026 + +**What was wrong (0.1.1 and octabam's module).** A PTN+FUNC+TRIG paste or clear repeated on the same pattern is an +undo: Kits writes stock's undo buffer (`0x460bf218`) back into the pattern. Kits remembered only the op and the pattern +of its last paste or clear, never that stock had refilled that buffer since. In OS 1.40C about two dozen routines +between `0x40026768` and `0x4002c166` write stock's undo record (`0x460c80f0`, `0x460c80f4`, `0x460c80f8`) and fill +the buffer: the pattern paste and clear through `0x40026ef0` (Kits' `kits_psnap` site), the others not through it. +So a stock pattern paste or clear (or another edit with an undo) between two Kits +ops made the "undo" write another pattern's bytes, its Part byte included, into the target. A bank change between +the two ops would do the same (the target was the pattern number only); not reproduced, see below. + +**The fix.** After its snapshot Kits keeps the CRC-32 of the undo buffer (its own `crc32`) and the target as +bank * 16 + pattern; a repeat undoes only when op, bank, pattern and CRC still match, else it pastes or clears again. +The pattern copy (`kits_pcopy`, stock's and Kits' own) forgets the pending undo, as stock's copy clears its own undo +record. A pattern trig pressed with PTN but without FUNC forgets PTN+FUNC+TRIG's target. Cost: two CRCs over 36,568 +bytes per paste or clear on the UI task (estimated 1 to 3 ms each, not measured). + +A first attempt that used stock's own undo check (`0x4002ba2c`, the repeat-is-undo of stock's FUNC+STOP and FUNC+PLAY) +was discarded: Kits' clear (eight `0x40039df4` track clears) leaves stock's undo record zeroed, so the control below +failed with it (run5 in the local log). + +**Build.** Source `fix/kits-stale-undo` on `main` `d5f759a98`. `npm run module:dev -- kits --build-only`: package +`84f4c5c89a98dce4…`, 11,340 bytes of code and data, 38,968 of bss, 319 relocations, 15 hooks, 15 stock-code sites. +Before: Kits 0.1.1 `c1cb63e5…`. + +**Emulator (`ot_emu --frame`, not hardware).** A development twin of base `724dba4cc` (`build_core.py` with the beta +flags and `--dev`, MAIN `276500fc…`), the TEMPLATE project, Kits installed alone with `device try --accept`. Bank A's +patterns 1-8 given trigs on tracks 1-4 (pattern n: steps 1-16 as `nnnn`), patterns 9-16 empty; each check read the +bank's 16 patterns, their Part bytes and Kits' state over the emulator's `peek`. Transport stopped. + +| Case | Steps | 0.1.1 `c1cb63e5` (30 Nov, run3) | 0.1.2 `84f4c5c8` (30 Nov, run6) | +| --- | --- | --- | --- | +| Clear | Kits clear A03; stock copy A05, paste A12; Kits clear A03 again | the undo ran and wrote A12's pre-paste snapshot into A03 (empty, so A03 stayed empty) | no undo: A03 cleared again, A12 untouched; the copy forgot the pending undo | +| Paste | copy A01, Kits paste onto A03; stock clear A06; Kits paste onto A03 again | A03 got A06's trigs and A06's Part byte (Part 3) | no undo (the buffer's CRC had changed): A03 got A01's trigs and Part 1 again | +| Control | Kits clear A04 twice, nothing between | trigs back | trigs back (undo) | + +**Not tested:** anything on a unit (the owner tests this exact build before it leaves draft); the bank case (the +TEMPLATE card has no bank B: `BANK`, `TRIG2` showed BANK UNAVAILABLE); a stock track or trig edit between two Kits ops +(covered by the CRC by reading, not run); the PTGT reset; the CRC's time on the ColdFire; playing transport; the MKI. + ## Kits 0.1.1-experimental on base 0.8: agent's run, 24 November 2026 Build: this branch with `main` `29c22d7a5` merged (base 0.8, with the Part Edit popup fixes of #1947). A development diff --git a/sdk/octatrack/modules/kits/kits.s b/sdk/octatrack/modules/kits/kits.s index b140a82df6..fc67239cc6 100644 --- a/sdk/octatrack/modules/kits/kits.s +++ b/sdk/octatrack/modules/kits/kits.s @@ -1097,6 +1097,7 @@ cpkit: lea %sp@(-8),%sp | ---- the pattern clipboard carries the pattern's Kit ---------------------- | 0x40026eb0 (pattern): the pattern copy (FUNC+REC), current bank. kits_pcopy: + clrl PUNDO_OP | a new copy: the next paste pastes (as stock) lea %sp@(-12),%sp movem.l %d0-%d1/%a0,%sp@ tstl READY @@ -1358,7 +1359,9 @@ kits_ptrig: movel %sp@(4),%d0 movel %d0,PTGT rts -9: movel %a2,%sp@- | displaced +9: moveq #-1,%d0 | a trig without FUNC: no target from an + movel %d0,PTGT | earlier PTN+FUNC+TRIG stays armed + movel %a2,%sp@- | displaced movel %d2,%sp@- movel %sp@(12),%d2 jmp 0x40056b34 @@ -1394,9 +1397,18 @@ inactive_op: addql #4,%sp lea T_PCOPY,%a0 bra.w 5f -1: cmpl PUNDO_OP,%d3 | the same op on the same pattern: undo +1: cmpl PUNDO_OP,%d3 | the same op on the same pattern of the same + bne.s 2f | bank, while stock's undo buffer still holds + moveq #0,%d0 | Kits' snapshot: undo. About two dozen stock + moveb CUR_BANK,%d0 | routines refill that buffer, most not through + lsll #4,%d0 | 0x40026ef0, so its CRC is the check, not a + addl %d2,%d0 | hook on one of them + cmpl PUNDO_T,%d0 bne.s 2f - cmpl PUNDO_T,%d2 + lea UNDOBUF,%a0 + movel #PSTRIDE,%d0 + bsr.w crc32 + cmpl PUNDO_SUM,%d0 bne.s 2f movel %d2,%sp@- pea UNDOBUF @@ -1404,18 +1416,26 @@ inactive_op: addql #8,%sp clrl PUNDO_OP lea T_UNDONE,%a0 - bra.s 5f + bra.w 5f 2: cmpil #1,%d3 bne.s 3f movel 0x460d0ffa,%d0 | paste: a pattern on the clipboard cmpil #14,%d0 - bne.s 4f + bne.w 4f 3: movel %d2,%sp@- | the target's undo snapshot pea 0x11 jsr 0x40026ef0 addql #8,%sp movel %d3,PUNDO_OP - movel %d2,PUNDO_T + moveq #0,%d0 + moveb CUR_BANK,%d0 + lsll #4,%d0 + addl %d2,%d0 + movel %d0,PUNDO_T | bank * 16 + pattern + lea UNDOBUF,%a0 + movel #PSTRIDE,%d0 + bsr.w crc32 + movel %d0,PUNDO_SUM cmpil #1,%d3 bne.s 10f movel %d2,%sp@- @@ -3822,7 +3842,8 @@ LASTPASTE: .long -1 | bank*16 + pattern of the last pattern paste FRIGHT_BUSY: .long 0 PTGT: .long -1 | PTN+FUNC+TRIG's target pattern PUNDO_OP: .long 0 -PUNDO_T: .long -1 +PUNDO_T: .long -1 | bank * 16 + pattern +PUNDO_SUM: .long 0 | CRC-32 of stock's undo buffer after the snapshot SAVEK: .long 0 V3MGEN: .long 0 V3MHAVE: .long 0 diff --git a/sdk/octatrack/modules/kits/octamod.module.json b/sdk/octatrack/modules/kits/octamod.module.json index 2a2e0699f9..d1bd8f07b1 100644 --- a/sdk/octatrack/modules/kits/octamod.module.json +++ b/sdk/octatrack/modules/kits/octamod.module.json @@ -3,7 +3,7 @@ "id": "kits", "key": "KITS", "name": "Kits", - "version": "0.1.1-experimental", + "version": "0.1.2-experimental", "category": "scenes", "author": { "github": "sambanks", diff --git a/src/catalog/module-documents.json b/src/catalog/module-documents.json index d968bbc518..2db17750ec 100644 --- a/src/catalog/module-documents.json +++ b/src/catalog/module-documents.json @@ -15290,7 +15290,7 @@ "id": "kits", "key": "KITS", "name": "Kits", - "version": "0.1.1-experimental", + "version": "0.1.2-experimental", "category": "scenes", "access": { "location": "PART (MKII) or FUNC+MIDI (MKI) from any page", diff --git a/src/community/module-changelogs/kits.json b/src/community/module-changelogs/kits.json index a7744051df..4be2c2aca8 100644 --- a/src/community/module-changelogs/kits.json +++ b/src/community/module-changelogs/kits.json @@ -1,4 +1,13 @@ [ + { + "version": "0.1.2-experimental", + "date": "2026-11-30", + "changes": [ + "Fixes a repeated PTN+FUNC+TRIG paste or clear filling the pattern with another pattern's trigs and Part after a stock copy, paste or clear in between.", + "Repeating the same paste or clear right away still undoes it. After another edit in between, the repeat pastes or clears again.", + "A new pattern copy means the next paste pastes, as on a stock Octatrack." + ] + }, { "version": "0.1.1-experimental", "date": "2026-11-21", diff --git a/src/engine/assets/octatrack-module-packages.json b/src/engine/assets/octatrack-module-packages.json index b070facd82..2861b2f6cc 100644 --- a/src/engine/assets/octatrack-module-packages.json +++ b/src/engine/assets/octatrack-module-packages.json @@ -691,7 +691,7 @@ "id": "kits", "octabam": true, "usbOnly": true, - "version": "0.1.1-experimental", + "version": "0.1.2-experimental", "abi": 8, "features": 129, "sites": 15, @@ -699,9 +699,9 @@ "fills": 0, "name": "Kits", "module": "9ea848b6", - "bytes": 13546, - "sha256": "c1cb63e556add9aaf39eea5bfcdafc1ece923b51d9723c49f5caf6fd215ed072", - "path": "octatrack-modules/kits/0.1.1-experimental.mwrm" + "bytes": 13654, + "sha256": "84f4c5c89a98dce47cb0e77cbf0d492d78dd83c71511990cd61e86818328f715", + "path": "octatrack-modules/kits/0.1.2-experimental.mwrm" }, { "id": "tuner",