# The CPUs and every reuse decision The brief's rule: list each chip's existing family cores and what each would need (a socket, a variant, a fix) before proposing a new core. CPUs get their own core; other chips stay in the board until a second family board needs them. ## The CPUs: no new CPU core | Row | Part | Family core | Fit | | --- | --- | --- | --- | | Model A/B | MOS 6502A (NMOS, 2 MHz grade) | `6502-python`, package `sixfiveohtwo`, class `MOS6502` (origin/main `828b619`, the commit every board pins) | the same chip. Bus cycles exact against perfect6502 and SingleStepTests in that core's ladder | | Model B+ | 6512A | `6502-python` `MOS6502` | the 6512 is the 6502 with a two-phase clock input instead of the on-chip oscillator (pin-level; the instruction set and bus cycles are the 6502's); SMBP 5.1 says Acorn chose it for "more accurate timing of the logic circuitry". No row needed | | Master 128 (and Compact) | GTE G65SC12 | `w65c02-python`, class `G65SC02` ("GTE/CMD G65SC02 and G65SC12; NCR65C02; VLSI VL65NC02"; main `fca677f`) | **already judged on this machine**: its tier-1 evidence is logic-analyser captures of a real BBC Master's G65SC12 (David Banks's), replayed in lockstep, plus MAME's `bbcm` as a detector (its docs/mame-oracle.md). The Master Turbo's and the 65C102 co-processor's parts are Tube boards, later | ### What the board needs from the 6502 cores (the embedding contract) 1. **A per-cycle bus callback that may advance time before it returns**, so a slow (stretched) cycle can charge one or two extra 2 MHz periods and step the 1 MHz devices and the video inside it ([timing.md](timing.md)). Both cores call the host once per bus cycle (dummy reads included): **exists**. 2. **Interrupt lines the host drives, sampled where the chip samples them.** 6502-python polls "at the end of the second-to-last cycle, as the chip does" (`342b8dd`), and its CPUFrame has `note_stall` for RDY. On the BBC no RDY is used; the question is only **when, within a stretched cycle, an IRQ raised by a VIA counts** (the VIA's IRQ output changes on a 1 MHz edge that can fall inside the CPU's stretched cycle). The board will set the line at the device's time; the core must say whether a line set during a callback counts for that cycle's poll. To confirm against both cores' docs at milestone 1, and to judge with `O.VPOLL`/`O.VIA.I1`/`O.VIA.I2` (tier 1): if it needs a hook, the request goes upstream with that repro. 3. **SYNC (opcode fetch) visible to the host**, for the B+ shadow PAL and the Master's ACCCON E bit, which switch RAM by the address of the current opcode fetch ([memory-map.md](memory-map.md)). `w65c02-python` exposes `sync` and `fetch` inside its callbacks (MEASURED against captures); **`6502-python` at `828b619` does not** (grep of `src/` for `sync`: nothing). A host can infer it (the first read of each `step()` is the opcode fetch) except around interrupt entry, where the real chip's SYNC cycle is the one whose opcode is discarded. **Upstream request** (open decision 8): `6502-python` exposes `sync` as `w65c02-python` does; the B+ row is the first user, so it is not needed before row 2. 4. Reset and NMI inputs: exist in both. ## Chip by chip: family cores and what each needs | Chip | Family core today | Needs | Proposal | | --- | --- | --- | --- | | 6502A, 6512A | `6502-python` | SYNC for row 2 (request above) | pin `828b619` | | G65SC12 | `w65c02-python` `G65SC02` | nothing | pin `fca677f` | | SN76489 | `sn76489-python` `SN76489AN` (its one hardware capture is a BBC Micro's) | nothing; clock it at 4 MHz | pin `1379eff` ([sound.md](sound.md)) | | 6522 VIA (x2) | none; vectrex-python Phase 0 plans an in-board `VIA6522` to extract on the second user | **the BBC is the second user** | new chip core `mos6522-python` (open decision 1; [via6522.md](via6522.md)) | | 6845 CRTC | none; cpc-python's Phase 0 (tonight, `6336a4b`) keeps one in its board and lists the BBC as the candidate second user ("no repository": now there is) | the two boards' uses cover different corners (CPC: types 0-4, R/W quirks; BBC: interlace sync and video, light pen, cursor skew) | new chip core `crtc6845-python`, variant rows HD6845S, UM6845, UM6845R, MC6845 (and the CPC's ASIC types as CPC-only rows), interface per cpc-python's proposal (`clock()` per character; MA, RA, DISPEN, HSYNC, VSYNC, CURSOR out; LPSTB and the bus in) (open decision 2; [crtc6845.md](crtc6845.md)) | | SAA5050 | none | | board ([saa5050.md](saa5050.md)) | | Video ULA | none (Acorn custom) | | board | | Serial ULA | none (Acorn custom) | | board | | MC6850 ACIA | none | | board; `mc6850-python` on a second family user ([adc-serial-tape.md](adc-serial-tape.md)) | | uPD7002 | none | | board | | Intel 8271 | none | | board | | WD1770/1772 | none | | board; `wd177x-python` on a second family user (open decision 7; [discs.md](discs.md)) | | MC146818 RTC (Master) | none | | board (row 3) | | TMS5220 + TMS6100 (speech) | none | | socket, empty; a sound core if ever wanted (open decision 9) | | 74LS259 latch, ROM select latch, B+ PAL, Master ACCCON | glue | | board | No other family core (z80, m68000, mcs48, tms9918, ay8910, ym2151, ym2413, arm7tdmi, sh2, i8086, huc6280 ...) is used by rows 1-3. The Tube's second processors (Z80, 32016, 80186, ARM1) would reuse z80-python and others as boards of their own, much later.