# Slots, cards, speaker, keyboard, game port ## The slots Eight slots on the II/II+ (slot 0 for the language card or firmware card), seven on the IIe (plus the auxiliary slot), none on the IIc. Each slot n gets (DOC: A2RM; UA2 ch. 6-7; A2ETRM ch. 6): - DEVICE SELECT': 16 addresses $C080 + $10n (the card's registers); - I/O SELECT': 256 bytes at $Cn00 (the card's own ROM; its boot code for a disk); - I/O STROBE': the shared $C800-$CFFF window; by convention a card enables its expansion ROM there when its $Cn00 space is accessed and every card releases it on an access to $CFFF; - IRQ', NMI', RDY, DMA', INH' (a card may inhibit the motherboard ROM: the firmware and language cards use it), RESET', the clocks (7M, Q3, PHASE 0/1) and, on slot 7 from Revision 1, the colour reference and sync (DOC: UA2 p. G-2). The board models a slot as a socket with those signals, called on every access to its ranges and once per cycle if the card asks (timers, a disk sequencer). Cards are board-side objects; none is a family core, except the chips they carry. | Card | Row | Chips | Notes | | --- | --- | --- | --- | | Language card / 16K RAM card | first, with the II+ | RAM, the PRE-WRITE logic | [memory.md](memory.md) | | Disk II controller (16- and 13-sector) | first | P5, P6, sequencer, register | [disk-ii.md](disk-ii.md) | | **Mockingboard** (Sweet Micro Systems: Sound I, Sound/Speech I, Sound II, A, C; Mockingboard D for the IIc) | second | two 6522 VIAs, two AY-3-8913 PSGs; optional SC-01 (Votrax) or SSI263 speech | MAME's default `apple2`/`apple2p` slot 4 is "Mockingboard Sound/Speech I" with `via1`, `via2`, `ay1`, `ay2` (OBSERVED: `mame -listdevices`); the SC-01's ROM `sc01a.bin` is in every MAME Apple set | | Thunderclock Plus | later | a clock chip (to be identified from the card's documentation, U13) | firmware `thunderclock plus rom.bin`, SHA-1 in census.md | | Super Serial Card, mouse card, 80-column cards (Videx Videoterm), RAMFactor, SCSI, CFFA | later | 6551 ACIA, a 6805 MCU (mouse), 6845 CRTC (Videx), ... | each needs its own ROM by SHA-1 | | Microsoft SoftCard | later | Z80 | `z80-python`; DMA and RDY ([cpu.md](cpu.md)) | ### The Mockingboard Each half is a 6522 VIA whose port B drives the AY's BDIR/BC1/reset lines and whose port A is the AY's data bus; the VIA's timer interrupts the CPU (DOC: to be read from the card's own manual; not yet pinned, U12). The AY-3-8913 is the AY-3-8910's die in a 24-pin package without I/O ports (ay8910-python claims.md: "the 8912 and 8913 are the 8910's die with fewer pins", GI's data sheet); ay8910-python exposes `AY8913`. The PSGs' clock is the slot's PHASE 0, so the 1.0205 MHz average with the long cycle: the board feeds the PSG one tick per CPU cycle (MAME lists the AYs at 1.02 MHz, OBSERVED). **The 6522 and the chip rule.** vectrex-python's Phase 0 (its `docs/via.md`) recommends a general `VIA6522` inside its board, "extracted to `mos6522-python` when a second machine is started", and lists the Apple II Mockingboard among the other users. This board is that second machine. Recommendation (open decision 4): whichever board reaches its VIA first builds it as `mos6522-python` (a family chip core with its own ladder: the data sheets, VICE's VIA test programs, mb-audit on this board), and both pin it. Tom Charlesworth's **mb-audit** tests VIA, AY and speech-chip behaviour and has been run on real Mockingboard and Phasor cards (its README's matrix); no licence is stated, so it is run, not copied (sources.md). ## The speaker and the cassette port - Any access to $C030-$C03F toggles the speaker's flip-flop; software makes all sound by timed toggles (DOC: A2RM; UA2 ch. 7). The board records toggles with their cycle; the host turns the edge list into samples (a producer). The speaker's analogue response (the coupling capacitor's decay when not toggled) is a host filter, named, not a hardware claim. - $C020-$C02F toggles the cassette output; from Revision 1 the speaker is no longer connected to it (DOC: UA2 p. G-2). The cassette input is an LM741 used as a threshold detector, read in bit 7 of $C060/$C068 (DOC: UA2 p. 7-12). Cassette loading is a later row. ## The keyboard - II/II+: a keyboard encoder (an MM5740 on the early keyboard; MAME models the later "new keyboard" with an AY-5-3600, OBSERVED) presents seven bits and a strobe at $C000; any access to $C010 clears the strobe (DOC: UA2 ch. 7; A2RM). Uppercase only; REPT key; CTRL-RESET on later keyboards (DOC: UA2 p. G-2). - IIe: an AY-3600 encoder with a keyboard ROM, auto-repeat, and the any-key-down flag in bit 7 of $C010 (DOC: A2ETRM ch. 2; UA2E ch. 7). The keyboard ROM is firmware (SHA-1 in census.md). - The host supplies key events with the cycle they happen on; the board latches them. International layouts are machine rows (MAME has `apple2ede`, `apple2euk`, ...). ## The game port - Four 558 timers, triggered together by any access to $C070-$C07F; each paddle input reads high in bit 7 of $C064-$C067 until its timer runs out, "22 microseconds per thousand ohms"; the 558's reset is not used, so a program must wait for the timers to finish before retriggering (DOC: UA2 p. 7-12). A 150K paddle at full turn is therefore about 3.3 ms (arithmetic from Sather's figure; the paddle's resistance range is a host setting). - Push buttons 0-2 in bit 7 of $C061-$C063; annunciators 0-3 at $C058-$C05F; the utility strobe at $C040 (DOC: A2RM; UA2 ch. 7).