# Domains, channels and speed Speed is trivial for this machine; this page is short on purpose. ## Domains | Domain | Parts | Clock | | --- | --- | --- | | **M** (the computer) | 6502, two PIAs, VIA, RAM/ROM, the video counters or the CRTC, the dot stream | one crystal: 8 MHz (static board) or 16 MHz (dynamic, CRTC boards) divided to the CPU's 1 MHz (video.md) | | **D** (each drive, when attached) | 2031: one 6502, two 6522s, the read/write logic. 2040-8250: a 6502 and a 6504 sharing RAM (one domain: tightly coupled), 6532s, 6530, 6522, the FDC logic | the drive's own crystal (MAME: the 2040 FDC at 16 MHz, the 8050 FDC at 6 MHz, the processors at 1 MHz) | | tape | a timestamped edge producer into PIA1 CA1 / VIA CB1 | none of its own | ## Channels - **IEEE-488** (M <-> each D): sixteen wired-AND levels (ieee488-drives.md). Software on both ends handshakes, so a domain only needs the other's line levels at the moment its CPU reads the port: the natural synchronisation point for threads. - **Video out** (M -> host): a pure producer of dots per line; **sound** (M -> host): the CB2 level over time; **keyboard and tape** (host -> M): levels and edges with timestamps. - `x-python` runs M and each D serially in one order of record: the computer's cycle, then each drive's cycles up to the same time, per CPU cycle (all clocks here are 1 MHz processors, so lockstep per microsecond is exact and simple). ## Instructions per second (arithmetic) - The computer: 1,000,000 cycles a second (both boards divide their crystal to 1 MHz: video.md). OBSERVED in MAME's `pet2001n` trace: 628,616 instructions in 1,919,997 cycles (3.05 cycles an instruction; three quarters of them a three-instruction loop at $E29D-$E2A1, about 159,000 times each, the reset-time memory test by its place in the run: HYPOTHESIS), so about **330,000 instructions a second**; `cbm8032`: 713,437 in 2,293,028 (3.21), about 311,000. - Video: one character fetch per cycle (40 columns) or two (80 columns), 8 M or 16 M dots a second at most. - A 2031 adds 1.0 M cycles (about 300,000 instructions); a 4040 or 8050 adds two 1 MHz processors: 2.0 M cycles (about 600,000 instructions, HYPOTHESIS: the same cycles per instruction). - Worst case attached (a PET with an 8050): about 3 M CPU cycles a second, under 1 M instructions. ## The no-JIT path `recompile: none` on every target. A Rust transcription of a 1 MHz 6502 board runs many times real time on a desktop; the family's NES, 2600 and Game Boy boards (several times this machine's work per second) already meet real time in the browser (wasm) and on phones without recompilation, so `pet-rust` alone (no `-fast`, no cached interpreter) is expected to meet real time on desktop, phone and browser, with or without a drive (HYPOTHESIS until measured; the family's numbers are in those boards' docs). Threads at the IEEE-488 channel are the only multi-core lever and are not needed. Python on PyPy: expected near or above real time for the computer alone (HYPOTHESIS), enough for its tests; with two drives attached, slower than real time, which the reference board accepts.