# 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). Era 2 in the charter's table: several CPUs, still cycle-lockstep; `-fast` needed only for headroom. Everything here is a proposal for the specification to confirm. ## Domains (dec0) | Domain | Holds | Clock | Why | | --- | --- | --- | --- | | **M: main** | 68000, work RAM, program ROM, the three BAC06 register/RAM windows, palette RAM, sprite RAM, the I/O and control registers | 20 MHz / 2 (JTSLY) | the 68000 owns this bus | | **V: video** | BAC06 x3, MXC06 and its line buffers, the priority PROM, the colour DAC | 12 MHz, pixel clock 6 MHz | runs on its own crystal; meets M only through the shared VRAM/palette/sprite RAM and the vblank interrupt | | **S: sound** | the 65C02 or HuC6280, sound ROM and 2 KB RAM, YM2203, YM3812, MSM6295 | 1.5 / 3 MHz (from the 12 MHz crystal: HYPOTHESIS) | its own CPU; meets M through one latch and one interrupt | | **P: protection** | the i8751 with its internal ROM and RAM; or the HuC6280 sub with its PROM | 8 MHz / 12; 1.342 MHz | its own CPU; meets M through ports/latches, or the MB8421 | deco16 boards: M (68000 plus the DECO 104/146 window, which answers M's reads directly), V (DECO 55 x1-2, DECO 52 x1-2, ACE), S (HuC6280, YM2151, YM2203, MSM6295 x2); Thunder Zone's second 68000 is a fifth domain meeting M through its shared RAM. V shares one crystal family with S on dec0 (12 MHz) and with nobody else; M's 20 MHz crystal is separate (JTSLY). One timeline in a common unit (the least common multiple of the 20 and 12 MHz crystals: 60 MHz ticks, 6 per 68000 cycle at 10 MHz, 5 per BAC06 clock) converts exactly; the specification states it. ## Channels (where domains meet) | Channel | From -> to | Mechanism | Sync point for | | --- | --- | --- | --- | | VRAM, palette and sprite RAM windows | M <-> V | 68000 reads and writes into the BAC06 RAMs (240000-24DFFF), the palette (310000, 314000), sprite RAM (FFC000) | every access (V reads them per dot or per line; M may read back) | | sprite DMA | M -> V | the copy of sprite RAM into the MXC06's buffer (`368917K9`, JTSLY; triggered from 30C0xx: HYPOTHESIS) | the trigger's time | | vblank interrupt | V -> M | IPL from V's line counter | the edge: M must not run past it | | sound latch + interrupt | M -> S | write latch, raise S's NMI or IRQ | the write's time | | MCU ports / latches | M <-> P | 68000 writes and reads, 8751 port pins, an interrupt either way (U11) | every access | | MB8421 | M <-> P | 2 KB dual-port RAM, mailbox interrupts at 7FE/7FF (FSRAM91) | every access; the two mailbox writes are the hot ones | | audio out | S -> host | sample FIFO | none: a pure producer | ## Sync points and invalidation (the JIT proposal's declarations) - **Sync points**: the channel table plus interrupt sampling on each CPU. - **Memory kinds and writers**: | Memory | Kind | Written by | | --- | --- | --- | | 68000 program ROM, sound ROM, graphics ROMs, PROMs, i8751 EPROM, the HuC6280's PROM | ROM | nobody | | 68000 work RAM | RAM, code possible | the 68000 | | BAC06 / DECO 55 RAM, palette, sprite RAM | RAM, never code | the 68000, the sprite DMA | | sound RAM (2 KB) | RAM, code possible (rare) | the sound CPU | | MB8421 | RAM, code impossible (the HuC6280 runs from its PROM) | both ports | - **Timing as data**: m68000-python, huc6280-python, w65c02-python and 6502-python carry per-instruction bus timing; the 8751's is 1, 2 or 4 machine cycles of 12 clocks (MCS51). ## The arithmetic: instructions per second Rates per instruction are OBSERVED in MAME 0.285 over 3 frames ([mame-oracle.md](mame-oracle.md)). | Processor | Clock | Rate per instruction | Instructions a second | | --- | --- | --- | --- | | 68000 (dec0) | 10 MHz | 13.9 cycles (`robocop`), 13.8 (`baddudes`) | 10 M / 13.9 = **0.72 M** | | 68000 (deco16) | 12-14 MHz | 11.7 cycles (`cninja` at 12 MHz) | 12 M / 11.7 = **1.03 M**; at 14 MHz 1.20 M; Thunder Zone's two: 2.4 M | | 65C02 (sound) | 1.5 MHz | 2.8 cycles (a polling loop) | **0.54 M** (27,792 in 3 frames x 57.44 / 3) | | HuC6280 (Robocop protection) | 1.342 MHz | 4.5 | **0.30 M** | | HuC6280 (dec0 sound, `midres`) | 2 MHz (MAME) | 6.8 | **0.29 M** | | HuC6280 (deco16 sound, `cninja`) | 4.03 MHz | 4.8 | **0.83 M** | | HuC6280 (Act-Fancer main) | 7.16 MHz | 5.3 | **1.3-1.4 M** (its frame rate not checked: 57.4 or 60 Hz) | | i8751 | 8 MHz / 12 = 0.667 M machine cycles | 1.99 machine cycles | **0.34 M** | | YM2203 | 1.5 MHz | about 20.8 k samples, 3 FM channels x 4 operators + SSG | 0.25 M operator steps | | YM3812 | 3 MHz | about 41.7 k samples, 18 operator slots | 0.75 M operator steps | | YM2151 (deco16) | 3.58 MHz | 55.9 k samples, 32 operator slots | 1.79 M operator steps | | MSM6295 x 1-2 | 1 and 2 MHz | 7.6 k and 15.2 k samples, 4 voices | under 0.1 M | | video | 6 MHz dots | 384 x 272 x 57.44 | 6.0 M dots, 3.53 M visible pixels; 4 layers (3 BAC06 + sprites) = 14.1 M layer-pixel steps at the most | **A dec0 board** (Robocop): 0.72 + 0.54 + 0.30 = **1.56 M CPU instructions a second**, plus about 1 M FM operator steps and 6 M dots. Bad Dudes: 0.72 + 0.54 + 0.34 = 1.60 M. **A deco16 board** (Caveman Ninja): 1.03 + 0.83 = **1.86 M**, plus about 2 M FM operator steps (YM2151 + YM2203) and two DECO 55s (four playfields) and the sprites. Thunder Zone: about 3.2 M. Act-Fancer: 1.3-1.4 + 0.54 = about 1.9 M. ## What that means per tier (desktop, phone, browser) - **deco16-python** (PyPy): m68000-python runs 18.7-33.5 M instructions a second on PyPy (system16-python's domains-and-speed.md, citing m68000-python's validation.md), huc6280-python 18.5 M warmed (6.2 M in a fresh process: huc6280-rust's README), 6502-python 33-45 M (6502-python validation.md, 0.2.0 on PyPy). Against 1.6-1.9 M CPU instructions a second that is 10-20 times the need: the CPUs are not the cost. Per-dot video (three BAC06s and a sprite chip at 6 M dots) and per-clock FM are. The nearest precedents: pcengine-python (one HuC6280, a VDC at a similar dot rate, a PSG) and megadrive-python (16-21 frames a second on PyPy with FM, close to 60 without, its README via system16-python). Expect below real time with FM, near it without (HYPOTHESIS until the board runs). Reference boards are correct, not fast (Aubrey's rule). - **deco16-rust**: m68000-rust 134 M instructions a second natively, about 112 M as WebAssembly under Node 22 (m68000-rust-fast README); huc6280-rust 121 M natively. That is over 60 times the CPUs' need in a browser; a phone at a tenth of a desktop core still has six times the need. **The plain transcription reaches real time on desktop, phone and browser** for the CPUs; video and FM are the budget, as on play-pce (3 to 4 times real time on a phone for the PC Engine reference boards under Node, its README) and play-md. - **deco16-rust-fast**: for headroom only (run-ahead of 1-2 frames, Aubrey's habit, doubles or triples the work). Threads at the channels above are possible (S and P meet M at one latch or one dual-port RAM) but not needed; keep the serial order unless a phone says otherwise. - **Turbo / JIT**: not needed. `recompile: none` on every target, the iPhone included. The no-JIT path (Rust -fast, then a cached interpreter, then threads at the channels) is not even needed past its first step.