# Start here: the Apple II family in one page Phase 0 notes for `apple2-python`. No emulator code exists yet. Every fact below names its source with a key from [sources.md](sources.md) and an evidence tag (methodology: DOC, OBSERVED, HYPOTHESIS, ...). "DOC: UA2 p. 3-13" means Sather's *Understanding the Apple II*, page 3-13 (page numbers read from the OCR layer's footers; ±1 page). Sather's books and Apple's manuals carry no licence: we cite them and copy nothing. ## The machines | Row | CPU | ROM and firmware | Memory | What is new | MAME driver | | --- | --- | --- | --- | --- | --- | | **Apple II** | NMOS 6502, 1.0205 MHz average | Integer BASIC + the old Monitor (no autostart) | 4-48K on the board; 16K language card in slot 0 optional | the base design: video scanner, slots, game port, cassette, speaker | `apple2` | | **Apple II+** (and Europlus, IIj-plus) | the same | Applesoft + the Autostart Monitor | 48K, language card common | "the only operational difference between the Apple II and the Apple II Plus is in firmware" (DOC: UA2 p. G-2) | `apple2p`, `apple2jp` | | **Apple IIe** (unenhanced) | NMOS 6502 | 16K of system ROM ($C100-$FFFF, with the $C3 and $C800 internal ROM), keyboard ROM, video ROM | 64K + auxiliary slot (80-column card, 64K extended card) | the MMU and IOU custom chips, auxiliary memory, 80 columns, double hi-res (Rev B board), soft-switch status reads, VBL readable at $C019 (DOC: A2ETRM ch. 2, 4; UA2E ch. 3, 5) | `apple2e` | | **Apple IIe enhanced** (and Platinum) | 65C02 | enhanced ROMs (MouseText) | as IIe | CPU and firmware only | `apple2ee`, `apple2ep` | | **Apple IIc** (ROM 255, 0, 3, 4) | 65C02 | 16K, later 32K banked ROM | 128K; memory expansion on ROM 3/4 | built-ins: IWM disk port, two serial ports, mouse, no slots; the IIe's MMU/IOU in a new form (DOC: A2CTRM) | `apple2c`, `apple2c0`, `apple2c3`, `apple2c4` | | **Apple IIc Plus** | 65C02 at 4 MHz with an accelerator and cache | 32K | 128K | accelerator, internal 3.5" drive | `apple2cp` | | **Apple IIgs** (ROM 00/01, 03) | 65C816 at 2.8 MHz | 128K / 256K | 256K-8M | Mega II (a whole IIe in one chip), FPI, VGC super hi-res, Ensoniq DOC sound, IWM, SCC, ADB: **a separate later board** ([iigs.md](iigs.md)) | `apple2gs`, `apple2gsr0`, `apple2gsr1` | Board revisions of the II matter to the picture: Revision 0 has no hi-res delay bit (no orange or blue), no colour killer in text, and no power-up reset; Revision 1 adds all three, Revision 7 replaces the 2513 character generator with a 2316B ROM, and the RFI revision narrows the sync pulses (DOC: UA2 pp. G-2..G-3). These are machine-row settings, not separate boards. ## Clocks and frames (II, II+, IIe) - One crystal: 14.31818 MHz (14M). 7M, the 3.579545 MHz colour reference, the 2 MHz RAS/CAS/Q3 signals and the CPU's PHASE 0 all derive from it (DOC: UA2 ch. 3, pp. 3-1..3-6). - **The CPU cycle is 14 periods of 14M, except one in 65, the long cycle, which is 16** (the colour reference must keep its phase from line to line, and 65 x 3.5 colour cycles is odd). So the CPU runs at 1.022727 MHz for 64 cycles and 0.894886 MHz for one; the average is 14.31818 x 65 / (65 x 14 + 2) = 1.0205 MHz (DOC: UA2 pp. 3-12, 3-18; Sather notes the Reference Manual's figure is rounded wrongly). - **A line is 65 CPU cycles (912 14M periods), 40 displayed and 25 blanked; a frame is 262 lines, 192 displayed and 70 blanked; 65 x 262 = 17,030 CPU cycles a frame, 59.92 Hz** (DOC: UA2 pp. 3-12..3-13). No interlace. OBSERVED: MAME 0.285's `apple2p` reaches CPU cycle 1,021,798 at the end of frame 60, 17,030 a frame within two cycles ([mame-oracle.md](mame-oracle.md)). - The 50 Hz Eurapple/Europlus presets the vertical counter so it counts 312 states (DOC: UA2 p. 3-13 and ch. 8). A machine-row setting. - RAM is shared: during PHASE 1 of every cycle the video scanner reads RAM, during PHASE 0 the CPU does (DOC: UA2 ch. 3, 5). **Nothing ever waits**: the CPU is never stalled by video, so the whole machine is cycle-deterministic from the 14M clock. ## The family pieces it uses | Piece | Repository | For | | --- | --- | --- | | NMOS 6502 | [6502-python](../../6502-python) `MOS6502`, pinned at `828b619` like the rest of the family | II, II+, IIe; every bus cycle, dummy reads included ([cpu.md](cpu.md)) | | 65C02 | [w65c02-python](../../w65c02-python) `G65SC02` row (GTE/NCR/VLSI parts; MAME's Apple IIe device has no bit instructions either) | enhanced IIe, IIc; the "old WDC/NCR" row it lists as U8 is this board's open question | | 65C816 | [65816-python](../../65816-python) | the IIgs, later | | AY-3-8913 | [ay8910-python](../../ay8910-python) `AY8913` | the Mockingboard's two PSGs | | 6522 VIA | none yet: vectrex-python plans it in its board, to be extracted as `mos6522-python` on a second consumer; the Mockingboard is that consumer ([peripherals.md](peripherals.md)) | the Mockingboard's two VIAs | | Z80 | [z80-python](../../z80-python) | the Microsoft SoftCard, a later row | New chips in this board, under the chip rule: the video generator (discrete logic on the II, the IOU on the IIe), the MMU, the Disk II controller and drive, the keyboard encoder, the 558 game-port timer, the IWM (IIc, IIgs, later). None is used by another family machine except the IWM (the Macintosh, outside the family's plans) and the 6522 above. ## Modelling level (charter axis B), proposed | Component | Level | Why | | --- | --- | --- | | 6502 / 65C02 | cycle (the cores' own) | every bus cycle is observable: a dummy read of $C0xx flips a soft switch | | Bus, soft switches, language card, MMU | cycle | switches change on a particular access, sometimes on the second of two (DOC: UA2 ch. 5) | | Video | cycle: one scanner fetch per CPU cycle, the 14 half-dots it shifts out | mode switches mid-line are visible (DOC: UA2 p. 3-17), and the floating bus returns the fetched byte | | Disk II controller | signal-ish: the logic state sequencer stepped at 2 MHz from the P6 PROM's contents | copy-protection and timing-sensitive loaders depend on it (DOC: UA2 ch. 9) | | Disk drive | per bit cell with the head position in quarter tracks; the MC3470's behaviour on weak or missing flux as a named model | WOZ images carry bit streams and timing (DOC: WOZ) | | Speaker, cassette | per CPU cycle toggles, mixed by the host | 1-bit sound is cycle-timed by software | | Mockingboard | cycle for the VIAs, the PSGs per ay8910-python | | | Keyboard, game port | functional with the timing that software sees (strobe, 558 time constants) | | | IIgs | to be decided in its own Phase 0 detail ([iigs.md](iigs.md)) | | ## The order to read 1. [cpu.md](cpu.md), [memory.md](memory.md), [video.md](video.md), [disk-ii.md](disk-ii.md), [peripherals.md](peripherals.md), [iigs.md](iigs.md). 2. [domains-and-speed.md](domains-and-speed.md). 3. [sources.md](sources.md), [provenance.md](provenance.md), [validation.md](validation.md), [mame-oracle.md](mame-oracle.md), [census.md](census.md). 4. [handoff-brief.md](handoff-brief.md): scope, names, unknowns, milestones, open decisions.