# Domains and speed ## Domains and channels | Domain | Contents | Clock (evidence) | | --- | --- | --- | | **C: main** | the 68000, ROM, work RAM, the decode PAL, inputs, the SNK I/O, the DIPs | 9 MHz (DOC) | | **V: video** | the K9 gate array's counters, sprite generator, text layer, palette | 6 MHz dots (MEASURED) | | **A: sound** | the Z80, ROM, RAM, YM3812 + YM3014, the uPD7759 and its ROM | 4 MHz; the uPD7759's own resonator (C2) | | Channel | Between | What crosses | | --- | --- | --- | | text and sprite RAM, palette RAM, with DTACK | C and V | CPU accesses, which wait for V (VDTACT, OBJDTACT) | | VBL (and VIC) on IPL | V to C | the frame interrupt | | command latch and its NMI one-shot | C to A | one byte, an NMI | | reply latch | A to C | one byte | **Sync points:** C-A at a latch write or read only; C-V at every video or sprite RAM access (the DTACK wait couples them per access), so C and V are stepped together in the order of record, and A runs apart up to the next latch access. **Memory kinds:** ROM (never written), work RAM (C only), video and sprite RAM (C and V), sound RAM (A only). No DMA, no code in RAM at boot: nothing for a cached interpreter to invalidate. ## Instructions per second - 68000: 9 MHz / about 12 cycles an instruction (system16-python OBSERVED 11.7-12.2 cycles in MAME for Sega's 68000 games; not measured here) = **0.75 M/s**. - Z80: 4 MHz / about 7 cycles = **0.57 M/s** (upper bound). - **Total about 1.3 M CPU instructions a second.** - YM3812: 4 MHz / 72 = 55,556 samples x 18 slots = **1.0 M slot steps**. uPD7759: a few thousand ADPCM samples a second (DS7759's 5-8 kHz rates). - Video: **6.0 M dots a second** (MEASURED 384 x 264 x 59.1856 = 6.0 M). ## Per tier (the no-JIT path) - **x-python (PyPy):** m68000-python runs 18.7-33.5 M instructions a second on PyPy (its docs/validation.md, as cited by system16-python): 25-45 times the 68000's need; the Z80 likewise. The per-dot video and the per-sample FM are the cost: expect near or below real time with sound on (HYPOTHESIS), as megadrive-python (16-21 frames a second with FM on PyPy). Reference boards are correct, not fast. - **x-rust:** m68000-rust about 134 M instructions a second natively and about 112 M under Node as WebAssembly (m68000-rust-fast README); z80-rust about 50 M. **Real time on desktop, phone (a tenth of desktop still ten times the CPU need) and browser with `recompile: none`.** - **x-rust-fast:** for run-ahead headroom only. **Threads** at the sound latch: possible, not needed. **Turbo / JIT:** not needed, the iPhone included.