# The cartridge port, cartridge types, the datasette and the user port ## The port The expansion port carries the full CPU bus (address, data, R/W, phi2, BA, DMA, IRQ, NMI, RESET, dot clock), the PLA's #ROML, #ROMH, #IO1, #IO2 select lines, and the cartridge's #EXROM and #GAME inputs to the PLA (PRG ch. 5 and the port pinout in appendix I; PLA 2.4). A cartridge therefore can map ROM at $8000/$A000/$E000, take the Ultimax mode, decode I/O 1 and I/O 2, raise NMI (freezers), stop the CPU through #DMA (REU, SuperCPU), and switch banks by writes to its I/O area. **Socket shape (proposed):** `CartridgeSlot` with per-half-cycle `read(addr, roml, romh, io1, io2)`, `write(...)`, `exrom`, `game`, `irq`, `nmi`, `dma` lines and a `clock()` hook for cartridges with their own state (timers, flash state machines). Each type is a small class; types are identified from the CRT header's hardware type or, for raw `.bin` dumps, from a table of SHA-1s. ## File formats - **CRT** (CCS64's format, extended and documented in the VICE manual 17.14; format facts only): a 64-byte header (signature "C64 CARTRIDGE ", header length, version, hardware type, EXROM, GAME, subtype, name) followed by CHIP packets (type ROM, RAM, Flash, EEPROM; bank; load address; size). The manual itself warns "a lot of files with wrong values exist in the wild", and that EXROM/GAME are to be trusted only for type 0. - **Raw ROM chips** (`.bin` and per-chip `.u1`/`.u2` names in No-Intro): the board's loader needs a SHA-1 table mapping each to its type and layout. ## What the No-Intro set needs (census.md) 297 CRT images: 227 generic (type 0: 178 16K, 77 8K, 26 Ultimax, 13 "off" across all types' headers), 21 Ocean type 1, 7 Westermann, 6 Magic Desk/Domark/HES Australia, 4 Action Replay, 4 Final Cartridge III, 3 Dinamic, 3 C64 Game System/System 3, 2 each of Rex Utility, Fun Play, Super Snapshot V5, Zaxxon, Warp Speed, and one each of Comal-80, Super Games, Epyx Fastload, Expert, Final Cartridge I, Magic Formel, Atomic Power, KCS Power Cartridge, Simons' BASIC: **22 hardware types** cover the set. 14 images are raw `.bin` (Action Replay Professional v3, Calc Result, Capture 2, Express Cartridge, IEEE-488, Magic Voice, Pagefox, Super Explode 5, Videomate), and five zips carry 14 `.d64` images and one `.t64` (The Expert's disks, Comal 80, Calc Result Advanced, Rechtschreiblöwe's three parts, Viking Raider). Header problems the loader must tolerate (census.py notes): 11 images declare a 16K CHIP but hold 8K (Alien Sidestep, Bug Crusher, The Expert, Facemaker, Fraction Fever, Jukebox, Kindercomp, Maze Man, Pipes, Tyler's Dungeons, Up for Grabs; the 16K-with-8K pattern), one uses the wrong $20 header length (Power Cartridge, which the VICE manual mentions as a known wrong value), and three zips hold a raw chip named `.crt` beside a proper one or alone (Centipede (1), Ms. Pac-Man, Clowns (MAX)). **EasyFlash** (type 32) and other modern types (GMod2/3, RGCD, Megabyter) are not in the No-Intro set; they matter for homebrew and the scene. EasyFlash's documentation is by its designer (skoe, Thomas Giesel, the PLA author): its licence is to check before use (sources.md, proposed row). Milestone order puts them after the No-Intro types. **Freezers** (Action Replay, Final Cartridge III, Super Snapshot, Expert, Atomic Power, KCS) raise NMI and switch to Ultimax mode to take over: they exercise the PLA, the NMI path and the VIC's view of ROMH. A detector: MAME's slot devices (`mame -listslots c64`, the `exp` slot), closed box. **MAME's software list** `hash/c64_cart.xml` (CC0-1.0, its header) names 465 cartridges with a `slot` feature per board type (magic_desk 14, rex 13, ocean 12, mach5 8, final 8, westermann 7, ...): **usable as data** (CC0) for the SHA-1-to-type table, cross-checked against CRT headers. ## The datasette and the user port - **Datasette (1530/C2N):** read line to CIA 1 FLAG, write from 6510 P3, sense on P4, motor on P5 (cpu-6510.md). `.tap` files are pulse-width streams; `.t64` is a container of program files (a loader convenience, not hardware). The No-Intro tape set is absent here (census.md); MAME's `c64_cass.xml` (CC0) lists 1,098 tapes. Tape turbo loaders are cycle-timed on the CIA and the CPU: a good late milestone. - **User port:** CIA 2 port B, PA2, SP/CNT, FLAG2, plus power and reset (PRG appendix I). RS-232 at TTL levels, parallel cables to drives (SpeedDOS-style loaders). A socket with no device until a test needs one.