# Domains and speed Speed is trivial for this machine (era 1 in the charter's table); this page is short on purpose. ## Domains and channels - **Main domain:** Z80, memory, IPL switch, the CTC(s), the 8255②, CRTC and video memories, the MB8877A (polled; on the turbo served by the DMA, which is in the same domain because it steals the Z80's bus), the SIO. The PCG's dependence on the CRTC's raster position at each CPU access ties the CPU and the CRTC within each character clock, so they cannot be split. - **Sub-CPU domain (high-level):** the keyboard, clock, timers and cassette. Channel: the 1900h data byte with its busy/ready bit (1A01h bit 6) and the /INT line with its vector. Its responses are delayed by FITTED times (subcpu.md), so it is naturally a separate domain that meets the main one only at that port and that line. - **Sound domain:** the AY (channel: the 1B**h/1C**h writes; reads need only the register file and the joystick ports, which are main-side inputs) and the YM2151 (channel: 0700h/0701h writes; its status read for BUSY; no IRQ). Pure producers from a register-write log. - **Picture producer:** pixel composition from VRAM, palette and priority, fed by a per-line log of register changes. ## The need, with arithmetic - Z80: 4,000,000 T-states/s. At MAME's observed 6.0 T-states per instruction (IPL loops; game code is nearer 7-8), **500,000-670,000 instructions/s**. - CRTC: with the IPL's values (video.md) a frame is (R0 + 1) x ((R4 + 1) x (R9 + 1) + R5) = 56 x (32 x 8 + 2) = 14,448 character clocks; at MAME's 894.88 kHz that is 61.9 frames/s and **0.9 M character clocks/s** (OBSERVED arithmetic on MAME's figures; U3 for the real clock). - AY: 2 MHz / 8 = **250,000 steps/s** (ay8910-python steps per eight input clocks). - YM2151: 4 MHz / 64 = **62,500 samples/s** of 32 operator slots (2 M operator updates/s). - FDC: 31,250 bytes/s for 2D/2DD MFM at 250 kbit/s, 62,500 for 2HD. ## The no-JIT path Anchors (MEASURED in the family): colecovision-python, a 3.58 MHz Z80 board, runs at 0.30-0.47 x real time on CPython and 0.60-2.9 x on PyPy (colecovision-python docs/results.md); z80-rust-fast executes 344-397 M instructions/s on this machine (z80-rust-fast README), 500 times the X1's need. - **x-python:** about 0.2-0.4 x real time on CPython, 0.5-2 x on PyPy (estimate: more video work per frame than the ColecoVision, plus the OPM when fitted). Good for tests; the OPM core's own speed may dominate with the FM board in. - **x-rust:** above real time on desktop, phone and browser (the CPU need is 0.2 % of z80-rust-fast's rate; the OPM in Rust is the largest cost and still small). - **x-rust-fast:** run-ahead 1-2 and rewind with room to spare. `recompile: none`. - Threads: not needed. The sound producers and the picture producer could run beside the main domain if a weak browser target ever measures the need.