# 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). This page proposes the ST's domains, channels and sync points, and shows the arithmetic. It is a proposal for the specification to confirm. ## Domains Crystals: the video/system crystal (32.084988 MHz PAL, 32.215905 MHz NTSC on the STE: STEADD) from which GLUE and the MMU make the 8 MHz CPU clock, the PSG's 2 MHz, the ACIAs' 500 kHz and (by MAME's device clocks) the FDC's 8 MHz; the MFP's 2.4576 MHz timer crystal (SVC); the keyboard's own MCU clock (4 MHz in MAME, 1 MHz E: HWSPEC 5.1). | Domain | Holds | Clock | Why | | --- | --- | --- | --- | | **C: main** | 68000, GLUE, MMU, Shifter, RAM, ROM, cartridge, DMA chip, Blitter, STE DMA-sound fetch and joypad ports, the MFP (bus side and, as a second clock inside C, its timers) | system crystal; MFP timers 2.4576 MHz | every part shares the MMU's 4-clock slots; the Shifter's input is RAM fetched in those slots; the MFP's interrupts and Timer B (DE) are tied to C's time. Tightly coupled: one domain | | **K: keyboard** | HD6301V1, its ROM and RAM, key matrix, mouse quadrature, joystick switches | own crystal | meets C only on a serial line at 7812.5 bit/s and a reset | | **F: floppy** | WD1772, the two drives (motor, index, head, rotating track) | 8 MHz from the system (locked to C) but its own schedule | meets C at the FF8604 register path through the DMA chip, DRQ into the DMA FIFO, INTRQ into the MFP, drive/side select from the PSG's port A | | **S: PSG synthesis** | the YM2149's tone, noise, envelope and DAC | 2 MHz from GLUE (locked) | a **pure producer**: register reads return the latched register values (and port inputs), never synthesis state, so the sound can be computed from a timestamped log of register writes beside C | | **A: STE audio output** | DAC, filters, LMC1992 | sample rate | a pure producer from the fetched samples and the Microwire commands | Optional split: the Blitter could be its own scheduling unit inside C, but it shares the bus cycle by cycle in 64-cycle turns; it stays in C. ## Channels and sync points | Channel | From -> to | Mechanism | Sync point | | --- | --- | --- | --- | | keyboard serial line | C (ACIA TX) <-> K (SCI RX/TX) | bits at 128 µs each (500 kHz / 64) | each bit edge, or conservatively each start bit: a byte every 1.28 ms is 10,250 CPU cycles of slack | | IKBD reset | C -> K | RESET pulse / ACIA break (IKBD 9.1) | the edge | | FDC registers | C <-> F | FF8604 via the DMA chip | every access | | FDC DRQ / data | F -> C | one byte per 32 µs at 250 kbit/s into the DMA FIFO | each DRQ (256 CPU cycles apart) | | FDC INTRQ | F -> C | MFP GPIP 5 | the edge | | drive and side select | C (PSG port A) -> F | port write | the write | | PSG register writes | C -> S | timestamped log | none needed (pure producer) | | DMA-sound samples, Microwire | C -> A | timestamped sample FIFO and command log | none needed | | MIDI, RS-232, printer | C <-> outside | ACIA, MFP USART, PSG port B | each byte | ## The JIT proposal's declarations - **Sync points**: the channel table, plus interrupt sampling by the 68000 (IPL changes from GLUE's HSYNC/VSYNC and the MFP) and by the HD6301. - **Memory kinds and writers**: ROM (TOS, cartridge): nobody. RAM (all of it, code and screen): the 68000, the DMA chip (floppy and hard-disk transfers), the Blitter (STE, Mega). The HD6301's 128-byte RAM: the HD6301 only, but loaded by the host through MEMORY LOAD (IKBD 9.24), and it **executes code from that RAM** (CONTROLLER EXECUTE). - **Timing as data**: m68000-python holds the 68000's per-instruction bus sequences; m6800-python the 6801's cycle table (the HD6301 table to come with the variant). - **Restricted semantics**: the CPU cores' business, not the board's. ## The arithmetic: steps per emulated second | Part | Rate | Steps a second | Basis | | --- | --- | --- | --- | | 68000 | 8.02 MHz, 8-14 clocks an instruction | **0.58-1.0 M instructions** | OBSERVED: MAME's TOS 1.04 boot ran 579,685 instructions in 8,016,226 cycles in its first second (13.8 clocks each, a boot full of memory loops); a game mix near 10 clocks with the ST's slot rounding: HYPOTHESIS | | HD6301 | 1 MHz E | **0.34 M instructions** | OBSERVED: 337,571 instructions in 999,367 E cycles, MAME, first second | | GLUE + MMU | per 8 MHz cycle | **8.0 M** cycle steps | HWSPEC; [video.md](video.md) | | Shifter | 8, 16 or 32 MHz pixel clock | **8 M pixels (low res) to 32 M (mono)**, or 0.5-2 M 16-pixel words | HWSPEC 3.2; a word-at-a-time model in the -fast tier | | MFP timers | 2.4576 MHz | 2.46 M ticks naively; a few thousand events with time-out scheduling | SVC | | YM2149 | 2 MHz input clock | **2.0 M** clocks (ay8910-python steps per input clock) | HWSPEC 4.1 | | WD1772 + drive | 250 kbit/s MFM | 0.5 M cells a second while the motor runs, 0 otherwise | WD177X | | ACIAs | 7.8 k + 31 k bits | negligible | HWSPEC | | STE DMA sound | up to 50,066 Hz stereo | 0.1 M samples | STEADD | | Blitter | up to half the bus | up to 4 M bus cycles while it runs | BLIT | **Totals**: about 1.3 M CPU instructions (68000 plus HD6301) and 10-12 M fine-grained chip steps (GLUE 8 M, PSG 2 M, FDC 0.5 M) per emulated second, plus 8-32 M pixels. Unlike the era-3 boards, **the CPUs are the small part**: the cost is the per-cycle GLUE/MMU and the Shifter, which the demos make necessary. ## What that means per tier (the no-JIT path) - **atarist-python** (PyPy): m68000-python runs about 33 M instructions a second on PyPy (its README), so the 68000 alone would be ~30x faster than real time; the per-cycle GLUE/Shifter is the bound. At a PyPy cost of roughly 0.1-0.5 µs per fine step (HYPOTHESIS: to measure at milestone 2), 10-20 M steps make 1-10 seconds per emulated second: a reference board, correct not fast, running TOS boots and test programs of a few hundred frames. - **atarist-rust**: the same steps compiled; tens of nanoseconds a step puts a second of emulation at roughly 0.2-0.6 s on one desktop core (HYPOTHESIS). Real time on desktop. - **atarist-rust-fast**: word-at-a-time Shifter output, event-scheduled MFP timers and GLUE counters (exact: the same per-cycle trace), m68000-rust-fast (x1.384 over m68000-rust, its memory notes), K and F on their own threads at the channels above, S and A as producers. Expected real time on phones and in the browser (wasm at 1.5-2x the native cost) **with `recompile: none`**: the 68000's ~1 M instructions a second need no cached interpreter, let alone a JIT (HYPOTHESIS until measured on a phone). - **atarist-rust-turbo**: only if run-ahead on weak devices needs it (catch-up GLUE, line-at-a-time Shifter where no register changes mid-line). Not planned. None of the step costs above is measured on an ST workload; they are placeholders for the board's own counts.