# Cartridges: the port, the protection handshake, the mappers Sources: KH "Cartridge pinout", "Cartridge Hardware", "Mappers" (tier 3, measured, and the logic-analyser capture `reference/docs/gamate_bus.png`, tier 1 for what it shows); CC65 `libsrc/gamate/header.s`, `cfg/gamate.cfg`; MAME's CC0 software list `hash/gamate.xml` (slot types); the census (census.md). ## The port (KH) 38 staggered contacts, pins 1-5 and 36 not connected: A0-A15 (pins 6-16 and 27-31, in KH's scrambled order), D0-D7, R/W, phi2 (2.2165 MHz, 50 % duty), /CE (low at 6000-DFFF while phi2 high, ~220 ns), /PERIPHERAL (low at 2000-3FFF while phi2 high), /RST (pullable to reset a UMC unit; a diode blocks it on Bit Corp units), audio in (left channel only), VCC, GND. Each cartridge holds a ROM and a protection/mapper chip. ## The protection handshake (KH, every cartridge) 1. The BIOS sends "BIT CORPORATION" to 6000h bit 2, 9 writes per character: 8 bits MSB first, then a 0 bit. 15 characters, **135 writes**. 2. The BIOS reads 6000h 8 times; the chip returns **47h MSB first on bit 1**. 3. After the 8th read the chip **unlocks the ROM** at 6000-DFFF. 4. The BIOS checks 47h, then "COPYRIGHT BIT CORPORATION" at 6005-601D, then a 16-bit sum of 7000-7FFF against the word at 6000/6001 (LSB first); any failure is an endless loop reading 6000-60FF. Then the logo, then `JMP 6020h`. Evidence: DOC (KH). OBSERVED: MAME's traces show exactly 135 writes to 6000 at boot with both BIOSes. Census: **all 62 cartridge images carry the string and a correct sum** of ROM 1000-1FFF (CPU 7000-7FFF in the fixed bank), so the rule is the BIOS's and the dumps satisfy it. Unknown: what cart space reads as before unlock (only bit 1 is specified; U15); whether the chip answers anywhere in 6000-7FFF (KH suspects so; U16); the bit-in timing (which write edges count; U17). ## Mappers (KH; MAME's list names the same three) | Kind | Rule (KH) | Images (census, MAME slot) | | --- | --- | --- | | plain | ROM flat at 6000-DFFF (6000 -> ROM 0000) | 35: one 16 KB (Cube Up), 34 x 32 KB | | banked ("all 64 K and up except the 4-in-1") | 6000-9FFF = ROM 16 KB bank 0, fixed; A000-DFFF = a selectable 16 KB bank, bank 0 at reset; games write C000 to switch ("I suspect C000-DFFF") | 26: 9 x 64 KB, 6 x 128 KB, 2 x 256 KB, 9 x 512 KB | | 4-in-1 | as banked, and the first window is selectable by a write to 8000 (8000-9FFF suspected); both bank 0 at reset | 1 (128 KB) | Unknowns: the bank register's width and which data bits it takes (512 KB needs 5 bits; U18); the exact write decode (U16); how a 16 KB plain image fills 32 KB (mirroring is the natural reading; U19); whether bank writes need the unlock first (U15). These are settled by reading the games' bank writes (a MAME trace with the `CW` tap: `scripts/mame_trace.py` prints them), never by guessing. The 3-second Insect War run of 2026-11-26 showed no bank writes, only the 135 handshake writes (whether it got past the BIOS logo in 3 s was not established), so a longer run, with a pad press, is the first job of milestone M4.