# Domains and speed Read with the charter's "Domains and channels" and "Capabilities", and the accepted JIT proposal (emulator-lineage `docs/proposals/2026-11-jit.md`: the no-JIT path first). The Amiga is not in that proposal's family table; this page proposes its row. Everything here is a proposal for the specification to confirm. ## Domains One crystal (28.37516 MHz PAL, 28.63636 MHz NTSC; HRM3 pdf367) drives the 68000 (/4), the colour clock (/8) and, through the 68000, the E clock (/40) for the CIAs. So the machine's core is **one locked clock**, and its chips meet on every chip-RAM slot. | Domain | Holds | Clock | Why | | --- | --- | --- | --- | | **M: main** | 68000, Agnus (beam, slots, Copper, Blitter), Denise's registers and collision logic, Paula (interrupts, audio state machines, disk DMA, UART), both CIAs, chip and slow RAM, ROM | 7M (the crystal / 4) | every one of them meets the others on the chip bus at CCK granularity: a mid-instruction register write changes a pixel, a DMA slot stalls the CPU. Tightly coupled: the charter's advice is one domain | | **D: drive** | the floppy mechanism: motor, head position, the rotating track as bit cells (from ADF/IPF), index | its own (300 rpm, 2 µs cells) | a separate mechanism with its own speed; meets M only through Paula's data line and the CIA lines (floppy.md) | | **K: keyboard** | the keyboard: a functional protocol model, or the 6500/1 MCU on 6502-python | its own (3 MHz resonator in MAME) | its own processor and clock; meets M only at CIA-A's serial port | Producers that may run beside M from `-fast` on (pure, from logs M writes): | Producer | Input | Caveat | | --- | --- | --- | | **picture** | Denise's register writes and the BPLxDAT/SPRxDAT words, timestamped by slot | CLXDAT is read back by the CPU: either collisions stay in M (they need the same pixel pipeline, so this doubles Denise's work) or every CLXDAT read is a sync point that waits for the producer to reach that slot. Proposal: collisions in M first, measured | | **sound** | each channel's (sample, volume, time) stream and the filter bit | none: nothing is read back | ## Channels | Channel | From -> to | Mechanism | Sync point for | | --- | --- | --- | --- | | disk read data | D -> M | MFM bit cells into Paula (DSKBYTR, disk DMA, DSKSYNC) | while disk DMA or DSKBYTR polling is active; otherwise only the index pulse | | index pulse | D -> M | CIA-B FLAG | its time (a computable schedule while the motor runs) | | drive status | D -> M | CIA-A PA2-PA5 (/CHNG, /WPRO, /TK0, /RDY, and the ID shift) | every read of CIA-A PRA | | drive control | M -> D | CIA-B PB0-PB7 (step, direction, side, select, motor) | every write of CIA-B PRB | | disk write data | M -> D | Paula's write stream | while writing | | keyboard data | K -> M | KCLK on CNT, KDAT on SP, into CIA-A's shift register | each bit edge | | keyboard handshake | M -> K | CIA-A SP driven low by software for >= 85 µs (HRM3 pdf266) | the write that drives it | | picture | M -> producer | Denise register log | CLXDAT read (if collisions move) | | sound | M -> producer | channel output log | none | ## The JIT proposal's four declarations - **Sync points:** the channel table above, plus interrupt sampling by the 68000 (IPL from Paula). Inside M, every chip-bus access is observable, as in era 1. - **Memory kinds and writers** (what invalidates cached decoding): | Memory | Kind | Written by | | --- | --- | --- | | Kickstart ROM | ROM | nobody | | chip RAM | RAM; code lives here (Kickstart loads everything into it on an A500) | the 68000, the **Blitter**, **disk DMA** (trackloaders DMA code straight into chip RAM), and nothing else (the Copper writes only registers; audio, sprite and bitplane DMA only read) | | slow (trapdoor) RAM | RAM, code lives here | the 68000 (no DMA reaches it: U3) | | fast RAM (expansion rows) | RAM | the 68000 | - **Timing as data:** m68000-python holds the 68000's per-instruction clocks and bus sequence; the slot table (agnus.md) is the chip set's timing data. - **Restricted semantics:** applies to m68000-python and, if run, the keyboard's 6502 core; not to the board. ## The arithmetic: work per emulated second (PAL A500) Clocks (HRM3): 7M = 7,093,790 Hz; CCK = 3,546,895 Hz; E = 709,379 Hz. Check: 3,546,895 / 227 CCKs a line = 15,625 lines a second = 312.5 x 50, so a **PAL line of 227 CCKs** is consistent with the documented clocks (U1 narrowed to the NTSC long/short alternation and to whether a PAL line is ever 228). | Unit | Rate | Work | | --- | ---: | --- | | 68000 | 7.09 M clocks; at a typical 8-12 clocks an instruction (HYPOTHESIS: no Amiga workload measured), **0.6-0.9 M instructions**; ceiling 1.77 M (4-clock instructions, no contention) | one `step()` each plus a slot catch-up per chip access | | Agnus slots | **3.55 M** slots (227 x 15,625) | decide the owner of every slot; most lines also run bitplane and sprite fetches | | bitplane DMA | up to 80 slots a line in the display (1.0 M words at most a second) | reads into Denise | | Copper | at most one instruction per 4 slots (MOVE): 0.9 M ceiling, typically a few hundred a frame | | | Blitter | at most one word per 2 slots (A-D copy, 4 clocks): 1.77 M ceiling, in the slots it gets | minterm, shift, mask, fill per word | | Denise | **14.19 M** hires pixel times (4 per CCK), of which about 640 x 256 x 50 = 8.2 M visible for a hires PAL picture, 4.1 M lores | pixel composition and collision test per pixel | | Paula audio | 4 channels clocked by the CCK: 14.2 M channel-ticks if stepped naively; event-driven, a period of >= 124 CCKs means <= 28,900 sample events a second per channel | | | disk | 0.5 M bit cells a second while the motor runs | shift into Paula, sync compare | | CIAs | 2 x 709,379 = 1.42 M E ticks if stepped naively; event-driven, timers and TOD are cheap | | | keyboard MCU (if run) | 3 MHz, about 0.75-1 M 6502 instructions (HYPOTHESIS: 3-4 clocks each), mostly an idle loop | | So per emulated second the board does roughly **0.7 M CPU instructions, 3.5 M slot decisions and 4-14 M pixel operations**. The CPU is a small share; the custom chips' per-slot and per-pixel work is the cost, as the brief expected. ## What that means per tier (estimates, to be replaced by measurements) The nearest family board is the Mega Drive (a 7.67 MHz 68000 plus a VDP of about the same pixel rate, plus a Z80 and FM): megadrive-python runs **10-20 frames a second on PyPy** with sound, about a third of real time or less (its README), and megadrive-rust runs 246-376 fps natively (4.1-6.3 x real time), unoptimised (its README). - **amiga-python (PyPy):** expect the same order, **1/3 to 1/6 of real time** (HYPOTHESIS by analogy). A reference board, correct not fast (Aubrey's rule): Kickstart to its insert-disk screen (about 600 PAL frames) in one to three minutes, vAmigaTS cases (each a few frames) in seconds. That is enough for every gate. A per-pixel Denise in Python is the risk: if it dominates, the specification computes a line's pixels from the line's fetched words and register-change list (still exact), not pixel by pixel through a generic loop. - **amiga-rust:** by analogy with megadrive-rust, **4-6 x real time native**; as WebAssembly roughly half of that (the family's other boards: a2600-rust-fast 5.7-6.7x native against 5.0-5.4x as wasm). - **amiga-rust-fast:** the family's -fast forks win x1.1-x1.9; with domains D and K and the sound producer on threads, **6-10 x native, 3-6 x in a desktop browser**. - **Phones:** single-thread performance of a recent phone is roughly a third to a half of this desktop's (HYPOTHESIS; play-gb and play-md measure it on devices): -fast at 2-5x native and 1-3x in a phone browser. Real time on phones is likely with `-fast`; run-ahead of one or two frames (Aubrey's habit) doubles or triples the cost, which is where `-turbo`'s whole-line paths (a Denise line drawn at once when no register changes inside it, Agnus slot runs with no CPU access) would be built. **The no-JIT path reaches real time on desktop and desktop browser at `-fast`; on phones it is expected at `-fast` and needs `-turbo` for run-ahead.** A JIT buys nothing here: the 68000 is under a million instructions a second and a small share of the work. Proposed capability: **`recompile: none`** on every target. No cached interpreter is needed for the 68000 (m68000-rust-fast already exceeds the need many times over).