# Start here: the Atari Lynx as a board Gathered 2026-11-11. Sources are cited as: **Spec §n** = the Epyx/Atari "Lynx-Documentation" (the Handy specification; HTML in `reference/docs/epyx-html/`, the Rev P scan of 1989-08-09 in `reference/docs/`); **Appx 2** = its hardware address appendix (`hardware.html`); **LT** = drhelius' lynx-tests guides (`reference/src/lynx-tests/*.md`), which report real-hardware measurements. Tiers are in [validation.md](validation.md). ## The machine in one page | Part | What it is | | --- | --- | | Crystal | 16 MHz. One **tick** = 62.5 ns. Everything is counted in ticks. | | Mikey | Custom CMOS chip: a 65C02 cell (VTI), 512-byte boot ROM, 8 timers, 4 audio channels, video DMA + palette + LCD driver timing, UART (ComLynx), interrupt controller, bus controller, I/O port, cart address strobe/data. Lynx II boards carry the same functions (some labelled "Hayato"); stereo outputs added. | | Suzy | Custom CMOS chip: sprite engine (scale, stretch, tilt, 8 sprite types, collision buffer), 16x16 multiply / 32÷16 divide with accumulate, joystick and switches, cart data port, its own bus controller. It is a **bus master**: while it draws, the CPU is asleep. | | RAM | 64 KiB DRAM, shared by CPU, video DMA, refresh and Suzy. | | LCD | 160 x 102, 4 bits per pixel through a 16-entry 12-bit palette; refresh set by timers 0 and 2 (about 50 to 79 Hz in shipped software). | | Cart | Up to 2 x 512 KiB, read serially through an 8-bit shift register (page) + 11-bit counter; optional 93Cxx EEPROM and AUDIN banking on homebrew. See [cartridge.md](cartridge.md). | Chip rule: Mikey and Suzy exist only in the Lynx (I and II). No other machine in the family or planned near it (2600, 5200, 7800, the 8-bit computers, the Jaguar's Tom/Jerry) contains either chip or a piece of one: the Lynx timers, LFSR audio, sprite engine and math unit are not POKEY, TIA, MARIA or GTIA derivatives, and no arcade board used them. They stay inside this board, as modules with pin-shaped edges. The CPU cell is the exception by the family's standing rule: it lives in `w65c02-python`. ## Memory map (Appx 2) | Range | Contents | MAPCTL bit that replaces it with RAM | | --- | --- | --- | | `$0000-$FBFF` | RAM | | | `$FC00-$FCFF` | Suzy | bit 0 | | `$FD00-$FDFF` | Mikey | bit 1 | | `$FE00-$FFF7` | boot ROM | bit 2 | | `$FFF8` | reserved (RAM) | | | `$FFF9` | MAPCTL | always there | | `$FFFA-$FFFF` | vectors (ROM) | bit 3 | MAPCTL bit 7 = "sequential disable" (no 4-tick page-mode fetches); bits 4-6 reserved. Reset value 0 (everything overlaid, page mode on). The overlays apply to **CPU accesses only**: video DMA, refresh and Suzy always see 64 KiB of RAM (Appx 2). Both Mikey and Suzy receive writes to `$FFF9`; only Mikey answers reads, and Lynx I and Lynx II read back differently ([undocumented-behavior.md](undocumented-behavior.md) C3). Register lists with reset values are Appx 2 and are not repeated here. The blocks: Suzy `$FC00-$FC2F` sprite engine working registers (also the "Suzy SCB"), `$FC52-$FC6F` math, `$FC80-$FC83` sprite control, `$FC88` hardware revision, `$FC90` SUZYBUSEN, `$FC91` SPRGO, `$FC92` SPRSYS, `$FCB0` JOYSTICK, `$FCB1` SWITCHES, `$FCB2/3` RCART0/1, `$FCC0-$FCC4` LEDs, parallel port, Howie. Mikey `$FD00-$FD1F` timers 0-7 (BKUP, CTLA, CNT, CTLB), `$FD20-$FD3F` audio 0-3 (VOL, FEEDBACK, OUTPUT, SHIFT, BKUP, CTLA, CNT, OTHER), `$FD40-$FD44` attenuation and panning, `$FD50` MSTEREO, `$FD80/81` INTRST/INTSET, `$FD84-86` MAGRDY0/1 and AUDIN, `$FD87` SYSCTL1, `$FD88/89` revision, `$FD8A/8B` IODIR/IODAT, `$FD8C/8D` SERCTL/SERDAT, `$FD90` SDONEACK, `$FD91` CPUSLEEP, `$FD92` DISPCTL, `$FD93` PBKUP, `$FD94/95` DISPADR, `$FD9C-9E` test, `$FDA0-$FDAF` green, `$FDB0-$FDBF` blue/red. ## The CPU cell - **Which 65C02.** Spec §4: "a 65C02 cell imbedded in the Mikey IC", its instruction set "found in the VTI specification". Lynx I: the 65SC02 subset (no RMB/SMB/BBR/BBS; those 32 opcodes are NOPs). **Lynx II: RMB/SMB/BBR/BBS work.** This is measured: lynx-tests `cpu` test 7 prints "LYNX 1" or "LYNX 2" from exactly this difference (`reference/src/lynx-tests/cpu/tests.s:633-720`, `main.c:45-49`), and 42Bastian states the same (AtariAge thread 283383, pinned). No source found shows WAI or STP on either cell; whether `$CB` and `$DB` are 1-cycle NOPs is for the test ROM to say (C1). - **Not documented here**: the instruction set. `w65c02-python` owns it; this board needs the rows "Lynx I (65SC02)" and "Lynx II (bit ops)". - **Reset** fetches `$FFFC/D` from ROM (Spec §14.2); the ROM overlay is on, the video bus request off, Suzy disabled with bus grant asserted. - **Interrupts**: one maskable IRQ line from Mikey's interrupt controller (eight sources: timers 0-3, UART in timer 4's slot, timers 5-7). NMI exists on Lynx I Mikey as a debug pin (Howard board; Spec §4.1.4 says its path "contains clocked delays"); on most Lynx II boards the pin was reassigned to an LCD control (AtariAge thread 218756, pinned). The board ties NMI inactive. - **Cycle length is not uniform**: 4 or 5 ticks for memory, 5 to 20 for some Mikey registers, 9 to 15 for Suzy reads; the CPU is also paused by video DMA and refresh and stopped while Suzy owns the bus. All of [timing.md](timing.md) is about this. ## Suzy takes the bus The sequence software uses (Spec §4.3, §18, Appx "bus interplay"; LT sprite-performance "Inside Suzy"): 1. Write the list start to SCBNEXT, VIDBAS/COLLBAS etc.; SUZYBUSEN bit 0 = 1. 2. Write SDONEACK (`$FD90`, any value) to clear the previous "Suzy done". 3. Write SPRGO (`$FC91`) bit 0 = 1 (bit 2 = EVERON enable). Sprite-busy (SPRSYS read bit 0) is set at once, even if SUZYBUSEN is clear. 4. Write CPUSLEEP (`$FD91`). The CPU's bus request drops; Suzy takes the bus and runs. The CPU's clock is stopped: it executes nothing. 5. The CPU's bus request is set again by (a) Suzy's bus grant returning at the end of the list, or (b) **any enabled pending Mikey interrupt, whatever the CPU's I flag**. In case (b) the CPU runs the handler (or just continues, if I is set) while Suzy waits at her next safe point; software sleeps again until SPRSYS bit 0 clears. "Sleep is broken" (Spec §4.3, §16.1): the CPU stays asleep **only** while Suzy has the bus. CPUSLEEP with Suzy idle returns immediately. A pending Suzy-done that was never acknowledged makes every CPUSLEEP return immediately. These are tested on hardware by lynx-tests `sdoneack` (10 cases). Mikey's video DMA and refresh outrank both (priority video, refresh, CPU, Suzy): they request the bus from Suzy too, and Suzy yields at her next safe cycle, at most 40 ticks later (Spec §4.1.5). ## What the board needs from `w65c02-python` (interface request) *Answered* (2026-11-12): `w65c02-python`'s bus contract (its `docs/handoff-brief.md`, "The bus contract") gives every item below: one callback per cycle, `cpu.sync` / `cpu.fetch` / `cpu.opcode` readable inside it, `note_stall()` for a long callback, the rows `G65SC02` (Lynx I) and `Lynx2Cell` (Lynx II). The request is kept as the record of what was asked. 1. **One bus callback per CPU cycle, in chip order, dummy cycles included** (as `6502-python`'s `CPUFrame` does), and the callback must be able to tell an **opcode/operand fetch from a data access** (a `kind` argument or separate `fetch_byte` / `read_byte` / `write_byte` hooks). Page mode depends on that distinction and on nothing else the core knows. 2. **The core counts cycles, not time.** The board charges ticks inside the callback (4, 5, or a hardware-specific wait) and advances Mikey, Suzy and the display there. `step()` must not add time of its own. 3. **A hold that stops the CPU between cycles**: when the callback for the CPUSLEEP write returns, the board must be able to run Suzy and Mikey until a wake condition before the CPU performs its next cycle. Doing this inside the write callback (as famicom-python does DMA inside `read_byte`) is sufficient; no RDY pin model is needed. 4. **Level-sensitive IRQ sampled at the documented 65C02 point**, plus the CMOS particulars the tests check: CLI/SEI delay, D cleared on interrupt entry, BRK as two bytes, JMP (ind) page fix with its extra cycle, the 1-, 2- and 3-byte reserved NOPs with their cycle counts, and whether a 1-cycle NOP can be interrupted (lynx-tests `cpu` tests 1-8). 5. **Two variant rows**: Lynx I (bit opcodes are NOPs, with the NOP lengths the test expects: `$07 $EA` behaves as two instructions) and Lynx II (Rockwell bit ops, BBR/BBS with their zero-page read cycle). WAI/STP: provide a variant switch; default "not implemented" until C1 is settled. 6. Reset as 7 cycles reading the vector through the callback. ## Output - **Video**: a 160 x 102 frame of 12-bit colours (palette applied at the moment each 16-pen group is sent to the LCD, so palette writes mid-frame land where hardware puts them), plus the frame's measured period in ticks. The LCD's rotation is not a hardware state: it is a property of the cart, carried in the cart description for the frontend. - **Audio**: per-channel 8-bit signed outputs mixed per the stereo/attenuation registers into left and right, sampled on the board's tick timeline; resampling in the frontend. - **Input**: JOYSTICK, SWITCHES (pause, flip is software), the power buttons as machine events. ## Module shape (a suggestion) ``` src/lynx_python/ machine.py rows: lynx1, lynx2 (CPU variant, MAPCTL readback, stereo, power-on values) board.py the tick timeline, bus callbacks, bus ownership memory.py RAM, MAPCTL overlays, boot ROM mikey/ timers.py audio.py display.py uart.py irq.py ioport.py suzy/ sprites.py math.py inputs.py cartport.py cart/ loader.py (the one front door) lnx.py bll.py table.py eeprom.py bootrom.py BYO image by hash; the no-ROM path (see cartridge.md) ``` Mikey and Suzy import nothing from `board.py` (an import-boundary test), so a recorded bus trace can drive either alone.