# The CPUs, and what the board needs from each core No new CPU core is needed for the II, II+, IIe or IIc. This page lists, per model, the family core and row to pin, what the board needs from it, and what the board itself owns. The chip rule (CPUs get their own core) is already met for every CPU here. ## Reuse first: the family cores | Model | Part on the board | Family core and row | Pin proposed | Status of the core | | --- | --- | --- | --- | --- | | II, II+, IIe (unenhanced) | NMOS 6502 (MOS, Synertek, Rockwell second sources) | `6502-python` (`sixfiveohtwo.MOS6502`) | `828b619` (origin/main, the commit a2600-, a5200-, a7800-, w65c02- and 65816-python pin; the local branch `main` in that repository is stale) | all 256 opcodes, every bus cycle, SingleStepTests 2.56 M of 2.56 M, Dormann and Clark pass (its README) | | IIe enhanced, IIe Platinum, IIc | 65C02 (NCR, GTE, later Rockwell and WDC parts) | `w65c02-python` `G65SC02` row: 178 opcodes, no bit instructions, no `WAI`/`STP` | its HEAD `fca677f` (lynx-python pins `af0ad6b`; same code) | rungs 0-8 pass; captured G65SC12 and R65C02 lockstep 0 mismatches; MAME `apple2ee` lockstep 1,177,619 instructions, no register or written byte differs (its docs/status.md) | | IIc Plus | a 4 MHz 65C02 behind an accelerator | `w65c02-python`, row to be decided (U3 in the brief) | | | | IIgs | 65C816 | `65816-python` | at its board's Phase 0 | rungs 0-5 pass (its README) | | SoftCard (a slot card) | Z80 | `z80-python` | a later row | | **The 65C02 row.** w65c02-python's start-here.md says the Apple IIc's and enhanced IIe's 65C02s (NCR, GTE, early WDC parts of 1984-85) are its `G65SC02` row "plus, on WDC's own early parts, possibly `WAI`/`STP`: not researched (U8)", and that MAME's "WDC W65C02" device used by `apple2ee` and `apple2c` has neither bit instructions nor `WAI`/`STP` (OBSERVED there; this Phase 0 confirmed the device name with `mame -listdevices apple2ee`: "WDC W65C02 @ 1.02 MHz"). Apple's IIc manual tells programmers not to use the Rockwell bit instructions (to verify in A2CTRM before citing; U4). Proposal: the board's machine rows name `G65SC02` for both, and the row's open question (U8 there) is raised upstream only if an Apple program is found that executes `$CB`/`$DB` or a bit instruction. **The NMOS row's undocumented opcodes.** Some Apple software (copy protection, demos) executes undocumented opcodes. `MOS6502` has all 256 with per-chip `ane_constant` and `lxa_constant` settings ($EE default; famicom-python needed $FF for its CPU). Which constants the Apple II's 6502s show is unknown (U5); the second-source parts (Synertek, Rockwell) may differ from MOS's. No source in hand says. ## What the board needs from the core 1. **Every bus cycle, in order, dummy accesses included.** Apple soft switches act on any access to their address, read or write, so a dummy read flips them: an NMOS `STA $C08x,X` makes a dummy read before its write, a read-modify-write on NMOS writes twice, and on the 65C02 those dummy cycles land on different addresses (w65c02-python timing.md; mb-audit's "false-read addressing modes", sources.md). The language card's write enable counts two successive reads (DOC: UA2 p. 5-29, "PRE-WRITE"); "ASL $C081,X" enables it in one instruction because an NMOS read-modify-write, absolute indexed without page crossing, makes two reads and two writes of the computed address; DOS 3.3 starts a disk write with `STA $C08F,X`, whose double access to $C0EF first starts the sequencer's write loop and then stores the first byte one sequencer clock later; `STA $C0EF` would be one clock out of step and the data refused (DOC: UA2 p. 4-22). Both cores already present every cycle to the host's `read_byte`/`write_byte` callables, one call per cycle. 2. **The host owns time.** The core counts CPU cycles; the board converts a cycle to 14M time (14 periods, or 16 for the long cycle at horizontal count 0), advances the video scanner, the Disk II sequencer (two steps per CPU cycle, see [disk-ii.md](disk-ii.md)) and the cards inside each bus callback, then performs the access. famicom-python's "each bus callback is one CPU cycle" design is the model. 3. **IRQ as a level** from the slots (Mockingboard VIAs, the mouse card, serial cards; the IIe's and IIc's built-in sources), NMI rarely (some cards). The cores' request API (`request_maskable_interrupt`, `clear_maskable_interrupt`, NMI latch) and their poll at the end of the second-to-last cycle are what is needed. 4. **RDY and DMA.** A slot card may pull RDY and DMA' to take the bus (the Z80 SoftCard does; DOC: UA2 pp. 4-14..4-15: DMA can only be done during PHASE 0). On the NMOS 6502 RDY does not stop a write cycle, so a DMA card waits for a read. The cores' `note_stall` (built for the NES's DMA) lets a host stretch a read; whether that is enough for a SoftCard row is checked when that row is built. 5. **Reset.** The II+'s power-up reset and CTRL-RESET; the 65C02's reset stack cycles are captured in w65c02-python (G65SC02 row: three stack writes). ## What the board owns The long cycle, the bus decode (RAM, ROM, $C0xx soft switches, slot I/O select and device select, the $C800 expansion-ROM strobe, the floating bus), the IIe's MMU and IOU, the IIc+'s accelerator and its slow-down on I/O, the IIgs's FPI cycle stretching (later). None of these goes into a core.