# Domains, channels and speed Charter, "Domains and channels" and "Capabilities"; emulator-lineage `docs/proposals/2026-11-jit.md` (accepted 2026-11-25: the no-JIT path first). ## Domains | Domain | Clock | Contains | | --- | --- | --- | | CPU | 20 MHz | the NVC and its bus decode, WRAM, the game pak, and the timer, pad, link port and wait controller (all on 20 µs ticks or bit clocks derived from the CPU's time: they stay in this domain) | | VIP drawing | its own engine; **clock unknown** (U6) | the per-halfword world walk writing the back frame buffers | | VIP display | 20 ms display frame | the LED scan per eye: reads the front frame buffer, the column table, BRTA-C/REST; raises FRAMESTART/LFBEND/RFBEND | | VSU | 5 MHz base, 41.7 kHz output | six channels, envelope, sweep, noise | ## Channels - **VIP memory** (shared): the CPU writes characters, maps, worlds, objects, palettes; the drawing engine reads them and writes the back buffers; the display reads the front buffers and the column tables. The CPU can also read and write the frame buffers (software rendering). - **VIP registers** (DPCTRL, XPCTRL, INTENB/INTCLR, FRMCYC, BRT/REST, CTA, SPT, palettes) and the VIP interrupt line (FE40). - **VSU registers**: write-only from the CPU (reads undefined). The VSU never talks back, so it is a **pure producer**: sound can be synthesised on another thread from a timestamped register-write log, with no synchronisation beyond the log (charter: pure producers). - **Interrupt lines** FE00-FE40 into the CPU; the **link port** to a peer board. Sync points: a CPU access to VIP memory or registers (the drawing engine may be mid-row); the VIP's interrupt edges; FCLK. The order of record (x-python): the CPU runs to the next VIP event (drawing step or display edge), then the VIP catches up to the CPU's time, at every VIP access. Memory kinds for a cached interpreter: ROM (never written), WRAM (CPU), VIP memory (CPU and VIP), game pak RAM (CPU); no DMA exists. ## Work per second - **CPU:** at most 20 M instructions/s (one per clock); MAME's own model ran 10.7 M/s in Mario's Tennis's WRAM clear (v810-python docs/mame-oracle.md). Need: ~11 M/s typical, 20 M/s ceiling. - **VIP drawing:** 384 x 224 pixels x 2 eyes = 172,032 pixels per game frame = 21,504 halfwords per eye, **43,008 halfword outputs per frame**, at most 50 game frames/s: 2.15 M halfwords/s. Each halfword walks the active worlds (up to 32; typical games use a handful): say 4-8 world evaluations of 8 pixels each, **9-17 M world-halfword steps per second**, more with affine worlds (per-pixel coordinate steps) and object worlds (objects intersecting the row group). HYPOTHESIS until a profile exists. - **VIP display:** 2 eyes x 96 column groups per frame at 50 Hz: negligible. - **VSU:** 41,700 samples/s x 6 channels: negligible. ## Does the no-JIT path reach real time? CPU: by v810-python's arithmetic, v810-rust (30-47 M/s native, 20-27 M/s wasm, HYPOTHESIS by analogy with sh2-rust) exceeds the 20 M/s ceiling on desktop and phone natively and the typical 11 M/s in a phone browser; -fast gives margin. VIP: 9-17 M simple steps per second is comfortable natively in Rust (each step is a few table lookups and shifts over 8 pixels); in a phone browser it competes with the CPU for one core. **Threads at the domain channels** solve that: the drawing engine reads VIP memory the CPU wrote before the frame started (games draw while the CPU prepares the next frame), so it can run on a second thread with conservative synchronisation at CPU writes to VIP memory, and the VSU runs from its log on a third. | Target | Verdict (HYPOTHESIS until measured) | | --- | --- | | Desktop native | real time at x-rust, single thread | | Phone, native app (no JIT) | real time at -fast single thread; threads for 2-frame run-ahead | | Browser (wasm), desktop | real time at -fast | | Browser (wasm), phone | -fast plus the VIP on a worker; run-ahead needs a cached interpreter for the CPU | `recompile: none` is enough on every target. Python (x-python) runs far below real time (roughly 1/100 for the CPU alone, less with the VIP): correctness only.