# Domains, channels and speed Charter, "Domains and channels" and "Capabilities"; emulator-lineage `docs/proposals/2026-11-jit.md` (accepted: the no-JIT path first). ## Domains All of the PC-FX's chips run from one crystal family (21.47727 MHz and its divisions: the CPU, the VDCs' and HuC6261's dot clocks, the PSG's 3.58 MHz, the timer's /15), so the domains below are scheduling units on one locked clock (charter: "sometimes parts on one locked clock that can still be scheduled apart"), except the CD drive. | Domain | Clock | Contains | | --- | --- | --- | | CPU | 21.48 MHz | the V810, main RAM, BIOS ROM, backup memory, interrupt controller, timer, pads | | Video | dot clock (~5.37 or ~7.16 MHz, HuC6261) | HuC6261 timing and mixing, VDC A, VDC B, KING backgrounds, Rainbow output | | KING DMA | the KING's clock | KRAM transfers: SCSI to KRAM, KRAM to ADPCM, KRAM to Rainbow | | Sound | PSG 3.58 MHz, ADPCM up to ~32 kHz | HuC6230 PSG, ADPCM decode, CD-DA mix | | CD drive | its own MCU and crystal | the SCSI target, seek and read timing, CD-DA source | ## Channels - **I/O ports** of every chip (the CPU's only path to them) and the **A/B memory windows** (the same ports as memory). - **KRAM** (shared by the CPU's KRAM port, the background fetch, and the three DMA clients; the KING arbitrates) and **each VDC's VRAM** (the CPU through the VDC's port, the VDC's own fetch and DMA). - **Pixel streams** into the HuC6261 (VDC A, VDC B, KING BG0-3, Rainbow): one direction, per dot. - **The SCSI bus** between the KING and the drive; **CD-DA** from the drive to the HuC6230. - **Interrupt lines** into the controller (levels 8-15) and its INTV outputs to the CPU. Sync points: any CPU port access to a video or KING register; KRAM accesses; raster interrupts (VDC RCR, KING 44h); SCSI phase changes. Order of record: the CPU runs to the next event; the video and DMA domains catch up on access. Memory kinds: BIOS ROM (never written), main RAM (CPU only: the KING cannot reach it, T15), KRAM and VRAM (not code), backup RAM (CPU). **Code runs only from RAM and ROM that only the CPU writes**, so a cached interpreter for the V810 never needs to watch DMA. ## Work per second - **CPU:** at most 21.5 M instructions/s; MAME's own model ran 13.3 M/s during the BIOS boot (v810-python docs/mame-oracle.md). Need: ~13 M/s typical, 21.5 M/s ceiling. - **Video:** 320 x 240 dots (the 7 MHz mode, upper bound) x 60 frames = 4.6 M dots/s, each composed from up to 2 VDC layers x (BG + sprites), 4 KING backgrounds and the Rainbow, with priority, chroma key and blending: say **7-8 sources x 4.6 M = 32-37 M source-dot evaluations/s** at the worst, about a third of that in 256-wide modes with few layers (HYPOTHESIS until profiled). Rotation on one KING layer adds a per-dot affine step. - **Rainbow:** a full-screen motion picture is a JPEG-like decode of 256 x 240 x up to 30 frames/s (hypothesis for its frame rate): about 1.8 M pixels/s of IDCT work, modest in Rust. - **Sound, CD:** negligible. ## Does the no-JIT path reach real time? CPU: v810-rust at 30-47 M/s native, 20-27 M/s wasm (HYPOTHESIS by analogy with sh2-rust; v810-python's brief) clears 21.5 M/s natively and the typical 13 M/s in a browser. Video: 32-37 M source-dots/s is the heaviest part of the machine and competes with the CPU on one core. Threads at the declared channels help most here: the video domain consumes port writes and memory the CPU produced, and is a near-pure producer of pixels (it answers the CPU only through status registers, raster interrupts and VRAM/KRAM reads), so it can run on a second core behind conservative synchronisation at those points; line- level catch-up (turbo) cuts the per-dot cost when nothing changes mid-line. | Target | Verdict (HYPOTHESIS until measured) | | --- | --- | | Desktop native | real time at x-rust with video on a second thread; -fast single-threaded | | Phone, native app (no JIT) | -fast with video on its own thread | | Browser (wasm), desktop | -fast with a video worker | | Browser (wasm), phone | at the edge: -fast, a video worker, turbo's whole-line paths, a cached interpreter for the CPU; run-ahead doubtful | `recompile: none` reaches real time on desktop and native phone; the phone browser is the target to measure first. Python runs far below real time: correctness only.