# Domains and speed Speed is trivial for this machine (era 1); this page is short on purpose. ## Domains and channels - **Main domain:** the main Z80, memory and banking, the uPD3301 and uPD8257 (the DMA holds the CPU's bus, so they share a clock and cannot be split), GVRAM, palette, the 8214, 8251, uPD1990A, keyboard, beeper, the main side of the disk link 8255. - **Disk-unit domain:** the second Z80 with its ROM and RAM, the uPD765A, the drives and the unit's 8255. **Channel: the cross-wired 8255 pair** (eight data lines each way plus the four handshake lines each way on port C). Nothing else connects them (YK-DISK; MAME's device tree puts every disk part under `pc80s31`). It is a clean domain split by construction: the two CPUs have separate crystals in principle (main 3.9936 MHz, unit 4.00 MHz in MAME, OBSERVED). The order of record steps both in one timeline at their own clocks, the channel being the only meeting point. - **Sound domain:** the OPN/OPNA. Channels: register writes and reads (44h-47h), the timer IRQ to the 8214 (level 4), the SSG's joystick port reads (inputs, main-side values). - **Picture producer:** pixels from the uPD3301's row buffers and attributes, GVRAM and the palette, fed by a per-line log. ## The need, with arithmetic - Main Z80: 3,993,600 T-states/s (8 MHz rows: 7,987,200). MAME's `pc8801mk2sr` trace: 25,562 instructions in 0.05 s, i.e. **511,000 instructions/s**, 7.8 T-states each including the waits MAME applies (OBSERVED). 8 MHz rows: about 1 M instructions/s. - Disk-unit Z80: 4,000,000 T-states/s; MAME's trace: 27,927 instructions in 0.05 s, **559,000 instructions/s** (OBSERVED; mostly the handshake poll loop on FEh, 128,442 reads of FEh in 3 s). - uPD3301/8257: 25 rows x 120 bytes = 3,000 DMA bytes per frame, about 180,000 bytes/s at 60 frames/s. - OPN: 55.5 kHz FM samples; OPNA the same plus rhythm and ADPCM. ## The no-JIT path Anchors (MEASURED in the family): colecovision-python (one 3.58 MHz Z80) 0.30-0.47 x real time on CPython, 0.60-2.9 x on PyPy; z80-rust-fast 344-397 M instructions/s. - **x-python:** two Z80s plus DMA and video: about 0.15-0.3 x real time on CPython, 0.4-1.5 x on PyPy (estimate). Tests and short runs. - **x-rust:** above real time on desktop, phone and browser (the CPUs need about 1.1 M instructions/s together, 0.3 % of z80-rust-fast's rate; the OPNA is the largest cost). - **x-rust-fast:** run-ahead and rewind with room. `recompile: none`. - **Threads** at the disk link channel are available (the cleanest domain boundary in the family's Z80 boards) but not needed for speed; the OPNA as a producer beside the main domain is the first candidate if a browser target measures short.