# Handoff: build `arcadia2001-python`, the Emerson Arcadia 2001 board ## Context you are inheriting The family's shape: chips are cores, boards compose cores; CPUs get their own core; a non-CPU chip used by one machine stays in its board; never copy a file between repositories, pin the sibling by commit. Read the charter (emulator-lineage `docs/charter.md`), then [start-here.md](start-here.md). Era 1 in the charter's table: one clock domain, cycle level everywhere; Python runs the tests, Rust plays. The CPU core does not exist yet: **s2650-python** is in Phase 0 beside this repository (its brief: `../s2650-python/docs/handoff-brief.md`). Build it to its rung R2 first; this board's M1 needs R1-R2 and the PAUSE pin. Boards to model this one on: **odyssey2-python** and **channelf-python** (early consoles with a video chip that owns the bus), **a2600-python** (dot-exact video). Read in order: [README.md](../README.md), [start-here.md](start-here.md), [memory-map.md](memory-map.md), [uvi.md](uvi.md), [machines-and-cartridges.md](machines-and-cartridges.md), [vc4000-and-pvi.md](vc4000-and-pvi.md), [sources.md](sources.md), [validation.md](validation.md), [mame-oracle.md](mame-oracle.md), [census.md](census.md). Then `python -I scripts/fetch_references.py --ocr` (8 files, ~5 MB; the PVI sheet needs OCR). Read the UVI sheet's figures 5 and 7 (the two register maps) from the PDF itself: the OCR of those tables is poor. ## Decided by Aubrey (standing rules) - Name `arcadia2001-python`, package `arcadia2001_python`. Local, no remote, until he says. - Bring your own cartridges; nothing of Emerson's or Signetics' in the repository. - Python floor = PyPy's (3.11); reference boards are correct, not fast; sound may be less exact than pictures; smoke lists before sweeps. ## Package and classes (proposed) ``` arcadia2001_python/ machine.py # rows: arcadia (NTSC, 2622), arcadia-pal (2621); clone names map to them console.py # build(machine, cartridge) -> Arcadia bus.py # the memory map and mirrors (memory-map.md), the I/O instructions' value uvi.py # Uvi: external RAM sector, internal registers, character and object # generators, colour precedence, collisions, DMA sequencer (PAUSE), # sound, A/D cartridge.py # std (2/4/6/8 KB), golf, 12 KB: mapping by size and slot type sockets.py # controllers (keypad matrix, pots), console buttons savestate.py # whole-machine states naming the cartridge by hash ``` ## Embedding contract with s2650-python Bus callbacks per external operation; PAUSE (the UVI raises it before each DMA line; the CPU stops at the end of its instruction and floats the bus); SENSE wired to vertical blank; FLAG observed (colour inversion); INTREQ and the INTACK vector byte if the UVI interrupt is used (U1); extra clock periods returned by the board for contention (U4). ## The chip rule | Chip | Users | Proposal | | --- | --- | --- | | 2650 / 2650A | Arcadia family, VC 4000 family, Elektor, Zaccaria, CVS, Malzak, Nintendo conversions | new core `s2650-python` (Phase 0 done) | | 2637 UVI | Arcadia family only | stays in this board | | 2636 PVI | VC 4000 family, Elektor; Zaccaria, CVS, Malzak arcade boards | in a sibling board `vc4000-python`; extract `s2636-python` when an arcade board arrives (decision 3) | | 2621/2622 USG | timing only | constants in `machine.py` | ## Milestones | # | Milestone | Judge (tier) | Exit | | --- | --- | --- | --- | | M1 | bus and mirrors, UVI register file and external RAM sector, frame timing (262 lines), SENSE, the DMA/PAUSE sequence, character display mode 0, cartridges `std` 2/4 KB | UVI (2), GUIDE (3); MAME (5) | Escape's first 3 frames: instruction stream equal to MAME's trace and the UVI-window writes equal in order, each difference named; its screen drawn | | M2 | objects, colours and precedence, mode 1, graphics mode, 26-row mode, SH scrolling, collisions | UVI (2) | 10 smoke cartridges' title screens, every pixel difference with MAME triaged | | M3 | inputs (keypad matrix, pots, console buttons), sound | UVI (2) | the smoke list playable from scripted input; audio compared with MAME, U6-U8 FITTED | | M4 | 6 KB, 8 KB split, 12 KB and golf cartridges; the PAL row | GUIDE (3); UVI timing (2) | every No-Intro image boots to a title screen (smoke sweep only when ready); the PAL row runs 312 lines | | M5 | save states, the I/O-instruction value, power-on state policy | | a save state loads into a fresh machine and continues identically | ## Unknowns (U) and conflicts (C) | # | Unknown | Best source now | | --- | --- | --- | | U1 | the UVI's interrupt output and its use | GUIDE ("branches to 0003") | | U2 | power-on contents of RAM and the UVI | GUIDE: "any state" | | U3 | what REDC/REDD/REDE read on the Arcadia | none | | U4 | contention for CPU accesses outside the DMA lines | GUIDE: unknown | | U5 | the UVI's collision rules for invisible elements | none (GUIDE's rule is for the PVI) | | U6 | the noise generator | UVI (behaviour only) | | U7 | the tone frequency formula's clock | UVI fig. 5 (N, 7 bits) | | U8 | output levels of the 8 loudness steps | none | | U9 | controller differences between clones | none | | U10 | 6 KB, 12 KB and golf mapping | GUIDE's loading table | | U11 | bit splits in figures 5 and 7 where the OCR is unreadable | the PDF itself | | # | Conflict | Sides | Proposal | | --- | --- | --- | --- | | C1 | PAL Arcadia machines | UVI timing table: 312 lines PAL; MAME 0.285: every one of the 32 machines at 60 Hz, 262 lines | follow the UVI sheet; a PAL row | | C2 | NTSC vertical blank length | GUIDE: 20 lines (an inference from the UVI manual); UVI timing table and USG | read USG's figures; one constant, FITTED until settled | ## Domains and speed **Domains and channels.** One domain: the UVI takes the bus from the 2650 by PAUSE for whole lines and both run from one crystal (3.579545 MHz NTSC: UVI clock; CPU = /4). Sound is a pure producer of the UVI's sound bytes (stamped writes to the external RAM bytes FD/FE), so it can run beside the CPU on a thread from `-fast` on. Input is read at register-read time. **Instructions a second.** 895,000 clock periods a second / 9.7 periods an instruction (this phase's Escape trace: 44,745 / 4,605) = **~92,000 instructions a second**, fewer during the DMA lines. Video: 227 UVI clocks a line (HC > 227 hides an object) x 262 x 60 = **3.57 M dots a second** if drawn per dot; the display is 128 pixels wide in 16 characters, so per character cell: 16 x 262 x 60 = **~250,000 cell jobs a second**, or **15,720 line jobs** (262 x 60) with a mid-line write log. **The no-JIT path.** - *Python (PyPy)*: a z80-python-class 8-bit core does 2-3 M instructions a second: ~25 x the need. Per-line rendering with a write log (~16 k lines a second) keeps the video cheap; per-dot rendering at 3.6 M dots a second would be the bottleneck. Desktop PyPy real time is likely with per-line drawing. - *Rust -fast*: hundreds of millions of instructions a second: real time on desktop, phone and browser (WASM) with no cached interpreter and no threads. `recompile: none`. ## Open decisions for Aubrey (each with a recommendation) 1. **First machine.** Recommend the NTSC Emerson Arcadia 2001 first; one PAL row (Hanimex / MPT-03 group) at M4; the other 30 clone names map to those two rows until a difference is sourced. 2. **Order of work.** Recommend s2650-python to rung R2 before this board's M1 (the board cannot run without the core), then the two in parallel. 3. **VC 4000: row or sibling.** Recommend a sibling board `vc4000-python` (with the Elektor TVGC as a row), started after this board's M3; the PVI stays inside it until a Zaccaria or CVS arcade board needs it (then `s2636-python`). Reasons in [vc4000-and-pvi.md](vc4000-and-pvi.md). 4. **WinArcadia.** Its source is published with no licence. Recommend asking James Jacobs (Amigan Software) whether he would license it or share his hardware test notes; meanwhile, run only (emu-tools-gpl), never read or redistributed. 5. **sources.md rows**: proposed in the Phase 0 report (Signetics sheets, GUIDE, WB, MAME's GPL drivers vs BSD slots and s2636, WinArcadia unlicensed). 6. **Wikimedia's client rule.** Wikimedia asks automated clients to send contact details in the User-Agent; the family does not send personal details. Recommend fetching Wikibooks pages only by hand or through a generic, honest client name, and accepting that some pages stay unpinned.