# CPU cores: what the Amiga needs, and the reuse table ## Reuse first: every chip against the family's existing cores | Chip | Family core today | What it needs for the Amiga | Proposal | | --- | --- | --- | --- | | **MC68000** (A500, A1000, A2000, A500+, A600, CDTV) | **m68000-python** (public, v0.1.0, `55d3d60`), with m68000-rust and m68000-rust-fast | per-access stalls from Agnus, VPA/E-clock data cycles for the CIAs, the RESET pulse, autovectored interrupts, bus errors stay outside its contract (below) | pin it; raise two requests upstream (below) | | MC68EC020 (A1200), 68030 (A3000), 68040 (A4000) | none (m68000-python's claims exclude the 68010 and later) | a new CPU core | out of scope until an AGA row; a future `m68020-python` would be its own Phase 0 (open decision 8) | | MOS 6500/1 (6570-036) keyboard MCU, 3 MHz in MAME | **6502-python** (`sixfiveohtwo`, NMOS 6502, bus-cycle exact) | the 6500/1's on-chip ROM, 64 bytes of RAM, four ports and a 16-bit counter: a small board-side wrapper | a functional keyboard first (the serial protocol, HRM3 ch. 8); run the real MCU later on 6502-python (open decision 6) | | 8520 CIA x 2 | none (no 6526 either) | — | stays in the board (cia.md) | | Agnus, Denise, Paula | none | — | stay in the board; their other users would be Amiga-derived machines only (CDTV, CD32, and MAME's Amiga-based arcade drivers: `arsystems.cpp` Arcadia, `cubo.cpp`, `alg.cpp` American Laser Games, `mquake.cpp`, `upscope.cpp`), all of which would pin amiga-python | | Gary (A500 address decode), Gayle (A600/A1200), Akiko (CD32), Lisa/Alice (AGA) | none | — | board rows; Akiko and the CDTV's CD controller only with their rows | ## What the Amiga needs from m68000-python Read against its README ("Reference-core boundary") and docs/claims.md, v0.1.0: 1. **Stalls inside an instruction (have).** Every chip-RAM and custom-register access waits for a free DMA slot. The core runs a whole instruction per `step()`, but inside each bus callable `cpu.step_clocks` says at which clock of the step the access ends, and "the host adds its own stall clocks to the total" (README). The board keeps a running stall total during the step, so each access's true time is start + `step_clocks` + stalls so far; before answering, it runs Agnus's slot table up to that time (catch-up inside the callable). This gives per-access exactness without changing the core. The strength of `step_clocks` is "Provisional" in claims.md (MAME's lineage, the SingleStepTests gate): **the Amiga's chip-RAM contention will be the first real test of where each access falls inside an instruction**, and any disagreement with vAmigaTS's real-Amiga screenshots is raised on m68000-python, not patched here. 2. **The CPU's slot alignment (board).** A 68000 bus cycle is 4 clocks; Agnus grants 2-clock slots. Whether a CPU access that becomes ready on an odd 7M clock loses a clock before it can start, and which slot parity it may use (C1), is board logic fed by `step_clocks`. 3. **CIA accesses: VPA/E-clock cycles (request).** CIA reads and writes are 6800-style synchronous cycles whose length depends on the E-clock phase. The core models this phase only for the autovector acknowledge (`_e_clock_wait`, from the host's running clock; MAME's rule, "T3, MAME's rule alone" in timing.md). For data accesses the board can add the wait itself as a stall (the same E-phase arithmetic), so nothing is strictly required upstream; but the rule should live in one place. **Request 1:** an optional hook or documented helper so a host can mark an access as VPA and get the same E-clock wait the acknowledge uses. 4. **Autovectored interrupts (have).** Paula drives IPL with levels 1-6 and the 68000 takes autovectors with the E-clock-synchronised acknowledge (timing.md: 44 clocks becomes 49-58 by E phase). The `acknowledge(level)` keyword returning `AUTOVECTOR` covers it. 5. **RESET (have).** Kickstart's RESET instruction: `reset_devices()` sees the pulse; the board resets CIAs and custom chips there (which ones: U28). 6. **TAS (have).** HRM3 forbids it on the Amiga; `tas_write` exists if software uses it anyway (what the A500 does with the write: U5). 7. **Bus errors (outside the core's contract, acceptable).** claims.md: "Bus errors matter to Amiga and Atari ST system software", and the frame contents are not claimed. An A500 has no bus-error source in normal operation (no MMU, no bus timeout on the chip bus: HYPOTHESIS, U30); expansion and accelerator rows might. **Request 2 (low priority):** none now; record that an Amiga row with a bus-error source would make the frame contents matter. 8. **Prefetch and self-modifying code (have).** The core keeps the two-word prefetch queue; copy protections and demos that modify the next instruction depend on it. The speed budget is generous: m68000-python runs about 33 M instructions a second on PyPy (its README, 2026-09-25), while an A500's 68000 executes well under 1 M a second (domains-and-speed.md). The cost of the board is the chip set, not the CPU. ## The keyboard The A500 keyboard is a separate device with its own MCU (MOS 6570-036, a 6500/1; census: SHA-1 `83b21d0c...`), talking to CIA-A's serial port with a clock line (KCLK on CNT) and a data line (KDAT on SP), with a handshake pulse from the Amiga ("at least 85 microseconds for operation with all models of Amiga keyboards", HRM3 pdf266) and a power-up and resync protocol (HRM3 ch. 8, pdf~266-275). A functional model of that protocol is enough for every program that reads the keyboard through CIA-A; running the MCU's own ROM on 6502-python is the cycle-level option, a domain of its own (domains-and-speed.md).