# Domains and speed Charter "Domains and channels" and capabilities (`recompile: native | wasm | none`); emulator-lineage `docs/proposals/2026-11-jit.md` (accepted: the no-JIT path first). Phase 0: estimates with their arithmetic; the measured inputs are named. ## Part 1: domains and channels | Domain | Time base | Parts | | --- | --- | --- | | **the console** | fCK = 11.0592 MHz (CPU at fCK/2 ... /32, LCDC/DMA at fCK/2 ... /16, sound and timers on fCK dividers) | sm8521-python core, internal RAM and ROM, kernel ROM, cartridges, VRAM, extend RAM, LCDC, DMA, sound, timers, watchdog, ports, buttons, touchscreen, UART | | (inside it) the sub-clock | 32.768 kHz | clock timer, the watchdog's sub-clock option; stepped from main-clock time at the exact ratio 337.5 (io.md) | One domain. The DMA steals the CPU's time while it HALTs (DS p. 37), the LCDC interrupt and V-blank flag are seen at cycles, the sound's direct D/A is written by the CPU at cycles: splitting any of these would put a sync point on every access. Era 1 in shape, although the chip is from 1997. Pure producers a later tier could move (none needed, see Part 3): the picture from the shown VRAM page; sound synthesis from register writes (SG0-2) and the SGDA write log. **Channels to the outside:** the UART (modem; a `SerialDevice` socket, sync at each byte), the buttons and touchscreen (sampled when the ports are read), the two cartridge slots. **Memory kinds** (for a cached interpreter, if ever): internal ROM (never written), kernel ROM and cartridge ROM (never written; mapped by MMU1-4, so a decoded-block cache keys on (MMU page, offset)); internal RAM 0000-03FF, extend RAM E000-FFFF (code possible: invalidate on write); VRAM (DMA- and CPU-written; code there would be odd). ## Part 2: instructions per second needed - **Ceiling:** 5,529,600 cycles/s at fCK/2, 2 cycles for the shortest instruction (NOP, DI: MAME; DS's 2-cycle memory access) -> **2.76 M instructions/s**. - **Observed** (MAME 0.285, the firmware alone; sm8521-python mame-oracle.md): 1,413,464 instructions in 2 s, 7.863 cycles each -> **0.71 M/s**. Games were not traced (the menu needs a stylus press). - The DMA moves up to 256 x 256 dots per transfer; a full page (160 x 200 dots, 8,000 bytes) per frame at 60 frames/s is 0.48 MB/s of rectangle work: cheap in any compiled tier. ## Part 3: does the no-JIT path reach real time? | Target | Estimate (`recompile: none`) | Need | Verdict | | --- | ---: | ---: | --- | | gamecom-python, PyPy | ~0.3-1 M/s (HYPOTHESIS: the family's 8-bit Python boards; lynx-python measured ~0.5 M/s on PyPy) | 0.71-2.76 M/s | about real time on the firmware's mix at best, 1/3-1/9 at the ceiling: a specification | | gamecom-rust, desktop native | 30-60 M/s (sm8521-python's brief: an SM85CPU transcription estimated from z80-rust ~50 M/s and w65c02-rust ~190 M/s) | 2.76 M/s | 10-20x real time | | phone native (no JIT), ~0.8x | 24-48 M/s | 2.76 M/s | 9-17x | | browser wasm, iPhone Safari, ~0.5x | 15-30 M/s | 2.76 M/s | 5-10x; run-ahead of 2 frames affordable | | ARM handheld (Cortex-A55), ~0.2x | 6-12 M/s | 2.76 M/s | 2-4x | **The plain transcription reaches real time on every target.** No `-fast`, cached interpreter, threads or recompilation are expected to be needed. Capabilities to declare: `recompile: none`, threads none; snapshots are small (1 KB internal RAM, 16 KB VRAM, the extend RAM (U1), registers), so run-ahead and rewind are cheap.