FANCO v5 — simple sounds, SID versus native SIREN ================================================ SID remains useful because one compact control register selects waveforms, gate, sync and ring, and two bytes describe an entire ADSR envelope. Native SIREN is more explicit: it separates waveform selection, modulation, four envelope segments and mixer routing. That costs more setup bytes but enables instruments/effects the SID interface cannot describe. A simple sustained saw near A4, using the SID façade: .sound on .org 0x1000 mov.w [0x40], 0x1d44 ; raw SID frequency, approximately 440 Hz mov.b [0x45], 0 ; short attack/decay mov.b [0x46], 0xf0 ; full sustain, short release mov.b [0x44], 0x21 ; saw + gate The actual v3/v5 assembler emits 25 instruction bytes for these four stores. This excludes the image header, default CPU-register segment and any following wait/play loop. .sound on supplies initial master volume. Turn it off with mov.b [0x44], 0x20. A later note needs only the frequency word and the waveform/gate byte; keep the envelope settings initialized. A native saw using generator 3 and an explicit mixer entry: .sound on .org 0x1000 mov.w [0x130], 0x8000 ; native musical pitch: A4 mov.b [0x132], 4 ; saw waveform bit mov.b [0x133], 0x80 ; neutral shape mov.b [0x137], 255 ; envelope stage 1 target mov.b [0x139], 255 ; envelope stage 2 target (hold) mov.b [0x13f], 0x50 ; sustain stage 2 enabled mov.w [0x200], 0x78a3 ; source 3, gain 1930/4095, centered by default mov.b [0x134], 1 ; gate on, no modulation These eight stores emit 50 instruction bytes. Unwritten time/release fields are zero: native attack/release is immediate, unlike the SID's short nonzero attack/release. Both examples make a sustained saw; they are NOT advertised as sample-identical envelopes. Add native time fields when you want a particular transition. Adjacent fields can be written with word stores or copied as a reusable 16-byte instrument patch. After initialization, native note changes likewise need only two stores: mov.w [0x130], 0x8200 ; B4 (two semitones above A4) mov.b [0x134], 1 ; preserve source/mode bits if modulation is in use Turn it off with mov.b [0x134], 0. To retrigger while already held, send gate off then on; writing the same held gate does not retrigger a note. Phase restart is independent: bit 3 of word 70 enables hard phase restart for generator 3. Clear it for legato/free-running oscillator phase. Mix the interfaces rather than choosing an engine ------------------------------------------------ You can keep a SID voice's compact frequency/AD/SR writes and add native phase modulation, self-feedback, stereo pan or a send to shared reverb. The additional generator need not be in the audible mixer: its envelope still changes the modulation strength over time. A native CONTROL write packs gate/source/method, so preserve the gate bit when changing routing. An old frequency write changes frequency, not the native mixer/effects. An old waveform/control write DOES intentionally change waveform/gate. This byte comparison is a manual assembler measurement, not a new test suite. It supports retaining SID for simple sounds; native configuration is worth its extra setup when the extra musical controls are needed. For all raw offsets and combination/shape rules, read SOUND.txt. Exact native parameter access (added without moving 0100/0200 banks) ----------------------------------------------------------------- For generators 0–2, native code can use the same raw frequency, 12-bit pulse width and ADR rates as the factory configuration without writing 0040–005F. Example sustained saw near A4: .version 5 .sound on .org 0x1000 mov.w [0x72], 1 ; generator 0: raw PAL frequency format mov.w [0x74], 1 ; generator 0: independent SID-clocked LFSR mov.w [0x2fa], 0xf000 ; AD=00, SR=F0; preserves custom segment bank mov.w [0x100], 0x1d44 ; same exact raw frequency as the SID example mov.b [0x103], 128 ; neutral native phase shaping after factory seed mov.b [0x102], 4 ; native saw waveform mov.b [0x104], 1 ; gate on The noise-model write is unnecessary for a saw-only instrument, but keeps the same oscillator/noise behavior if the patch later selects noise. Subsequent exact pulse updates use 02F4; phase-ring uses native method 6. These are field-wise inputs to the common generator kernel, not a SID register forwarding wrapper. Full custom segmented/exponential envelopes remain available via 0107–010F; writing them selects segmented mode again. The earlier 25-versus-50-byte example compares two different setup styles, not equal complete song output. An equal-output comparison must also align event sample offsets and include all code, lookup tables and music data. Current audio updates are 48 kHz sample-quantized, not 120 MHz cycle-accurate.