diff --git a/changelog/2026-11-21-dsp-div-half-quotient.md b/changelog/2026-11-21-dsp-div-half-quotient.md new file mode 100644 index 0000000000..9fb286284a --- /dev/null +++ b/changelog/2026-11-21-dsp-div-half-quotient.md @@ -0,0 +1 @@ +The effects guide now explains how to get the integer quotient from the DSP's fractional divide when both operands are positive and in range. diff --git a/docs/module-guides/effects.md b/docs/module-guides/effects.md index 8de90b255c..88221a0419 100644 --- a/docs/module-guides/effects.md +++ b/docs/module-guides/effects.md @@ -150,6 +150,7 @@ Octabam's behaviour tests run through its DSP host and need a native toolchain ( - No `rep` anywhere in a DSP source (`npm run modules:check` refuses one in a module listed from 23 October 2026; `do #n,>label / / label:` is bit-identical and interruptible): a `rep` cannot be interrupted, so the host-port handlers that arm the ColdFire's DMA answer late. The audio crackles, a core's tracks go silent or ColdFire RAM is written out of place, on hardware only. A `do` loop is bit-identical. Keep dense X work out of the 8K memory blocks a DMA uses as well; both are in [OCTATRACK_HARDWARE_TRAPS.md](../OCTATRACK_HARDWARE_TRAPS.md#dsp-loader-dynamic-dsp-code). - `dsp56kDisassemble` prints a `DO` endpoint as the exclusive next-instruction address (`LA+1`); the encoded loop-address word is the inclusive last loop word. CFG/cycle tooling must use `pc < printed_endpoint`. Do not reprice existing effects by confusing the two representations. +- `div` is a fractional divide. For positive integers N and D, put N's high word in a1 and low word in a0, put D in x0 and clear carry (`andi #$fe,ccr`). After 24 `div x0,a` steps, a0 holds floor(N / (2D)). To get floor(N / D), shift N left once (`asl a`) or store 2N. This works only while the dividend, including after doubling, is smaller than the divisor when both are interpreted as fractions. Ghost Cut's tempo-synced loop lengths came out half as long until its table held 2N (measured in `dsp_host`). A module's own reference model compared sample for sample with `dsp_host` catches it. - The DSP assembler silently mis-encodes some instructions: [octabam's AGENTS.md](../../sdk/octabam/AGENTS.md). Disassemble what you assemble. - A knob rename or count change is a stored-data change. Stamp every project before anyone plays it. - A formatter overrides the count it sits beside; declare `formatter=` per slot.