# The CPU: mcs48-python, and what this board needs from it ## State of the core (read 2026-11-26) [`../mcs48-python`](../mcs48-python) is **Phase 0 only**: three commits (975b1c5, 9a6af7b, 03328ff), documents and oracles, **no core code**. Its README says "Status: documents and oracles only". It has no `docs/status.md`; its status is the README and `docs/handoff-brief.md`. Its brief fixes a host contract and a six-rung ladder (datasheet unit tests; the full instruction set against Intel's manual; the T48 verification suite; two hardware measurements; a MAME lockstep on Donkey Kong's 8035; the UPI-41/42). It names the Videopac's Service Test Cartridge as an optional extra oracle. So **the board's first milestone waits on mcs48-python's rungs 1-4** (open decision 1). ## What the Odyssey 2 uses of the 8048 | Feature | Use on this board | In mcs48-python's contract? | | --- | --- | --- | | internal 1 KB ROM, `EA` low | the BIOS at 000h-3FFh | yes (internal ROM as host bytes, `set_ea`) | | external program memory via /PSEN | the cartridge at 400h-FFFh, both memory banks (`SEL MB0/MB1`) | yes (`read_program(addr12)`) | | `MOVX` | the 8244, external RAM, the EF9340/41, The Voice, all decoded by P1 | yes (`read_ext`/`write_ext`) | | `INS A,BUS` | the joysticks, put on the bus by the keyboard scanner (BORIS 5.0) | yes (`read_port(BUS)`) | | `OUTL`/`ANL`/`ORL P1`, `P2` | chip selects, bank bits, keyboard row select, luminance | yes | | `IN A,P2` | keyboard column and key flag (P2.4-P2.7) | yes, with the quasi-bidirectional port rule (written 1s read the pin) | | `INT` (level) | the 8244's IRQ: VBL, and horizontal and sound interrupts when enabled | yes (`set_int(level)`) | | `T1` as event counter (`STRT CNT`) | line interrupts: the counter counts blanking edges from the 8244 (BORIS 4.13, GUST 9.2) | **only as `read_t1()` polled**; see request R1 | | `JT1`/`JNT1` | VBLANK length test (GUST 13.5) | yes | | `T0`, `JT0`/`JNT0` | The Voice's LRQ through cartridge pin 1 (BORIS 7.4) | yes | | 8243 expander (`MOVD`, `ANLD`, `ORLD`) | G7400 only (MAME's device list for videopacp, jopac, odyssey3) | yes (`read_expander`/`write_expander`) | | the timer (`STRT T`), timer interrupt | used by cartridges (vector 404h in the cartridge, BORIS 6.1) | yes | ## Requests to raise on mcs48-python (fixes start upstream) - **R1. T1 sampled every machine cycle in counter mode.** The counter increments on a high-to-low transition of T1 seen at a fixed state of a machine cycle (MCS-48 UM). A polled `read_t1()` per instruction cannot place a line interrupt to the cycle. The core needs either a per-cycle hook (`tick(cycles)` callback before each machine cycle) or a `read_t1(cycle)` the core calls once per machine cycle while the counter runs. - **R2. The machine cycle of each bus strobe.** Its brief puts "state-time or bus-cycle timing" out of scope. This board needs at least the machine cycle (within the instruction) on which each /RD, /WR and /PSEN happens, because the 8244 sees the write at that moment (mid-line effects, the X/Y latch, collision reads). Proposed: every bus callback carries the cycle offset within the instruction, or the core advances a host-visible cycle counter before each access. - **R3. Python floor.** Its brief says "Python 3.12+"; the family floor is PyPy's (3.11 now). The brief predates that rule; raise it so the core does not use 3.12-only syntax. - **R4. Interrupt sampling point.** `INT` is sampled once per instruction at a defined cycle; with the 8244 clearing IRQ when its status is read, the exact sampling cycle decides whether a back-to-back interrupt re-enters. The core should document and test it (its rung 3's `int/` tests and the white-box `int_on_*` tests cover it). None of these changes the core's shape; R1 and R2 are the cycle-level hooks every board that hangs a video chip on an MCS-48 will want. ## Oracles for the CPU that this board brings - The **Service Test Cartridge** (`testcart`, 2 KB, SHA-1 e5e24c7f...17b1) and its Videopac+ version (`testcartpl`, 8 KB) from MAME's software list: Philips factory diagnostics, tier 2-3 as whole-machine checks. **Not in the local library** (census.md). - MAME's videopac/odyssey2 trace (docs/mame-oracle.md): a detector for the instruction stream with real BIOS code, including interrupts (the BIOS takes the external interrupt every frame), which mcs48-python's Donkey Kong trace lacks.