# Protection: MCUs, a HuC6280 behind a mailbox, custom I/O chips, encryption Data East protected its 16-bit games four different ways over eight years. The first two are programs (a CPU and a dumped program: emulate the CPU and run the dump); the last two are custom logic with no document (model from observation, tag everything). ## 1. The i8751 (Karnov family, dec0's Heavy Barrel, Bad Dudes, Birdie Try, Bandit) - 16 machines; every original set carries its 4 KB i8751 program, dumped (MAME region `mcu`; `drgninjab`'s and `karnovjbl`'s are `nodump`, bootlegs). The Chelnov bootlegs use an i8031 with an external ROM. - The part (DOC: MCS51): 8 MHz crystal, 12 clocks a machine cycle (666,667 machine cycles a second), 4 KB internal EPROM, 128 bytes of RAM, four ports. OBSERVED: 17,495 instructions in 34,815 machine cycles over 3 frames of Bad Dudes (1.99 machine cycles an instruction); the 68000 writes the MCU's ports 1 and 3 (MAME's log lines `dec0_mcu_port1_w`, `port3_w`). - The handshake (which latches, which interrupt, who waits) is U11. MAME's model is the only detector; the MCU's own program is the judge of what it expects, once mcs51-python runs it. - **Core**: `mcs51-python`, proposed by system16-python and wanted by segasys1-python and irem-python: this board is its fourth consumer (decision 5). ## 2. The HuC6280 behind an MB8421 (Robocop, Hippodrome / Fighting Fantasy) - MAME: a HuC6280 tagged `sub` at 1.342 MHz, and a "Fujitsu MB8421 8-bit Dual-Port SRAM with Interrupts" tagged `dem01` (OBSERVED). JTCOP calls the core for these games "jtcop" and lists "HuC6280 | 10 kB BRAM | protection" and "HuC6280 | 1 kB | firmware". - **The program is a 512-byte bipolar PROM** (`en_24_mb7124e.a2` in MAME's `robocop` set, region `sub`; OBSERVED). OBSERVED: 15,580 HuC6280 instructions in 3 frames, starting at logical FE00 (the top of the 64 KB logical space, where a 512-byte PROM mapped at the top of the last page would sit: HYPOTHESIS). - The mailbox (DOC: FSRAM91): 2 KB shared; a write to 7FE by one port interrupts the other, a write to 7FF interrupts back; reading clears. [memory-map.md](memory-map.md) has the rules. - The 1.342 MHz figure is 21.47727 MHz / 16 (HYPOTHESIS: a 21.477 MHz crystal is not on the Sly Spy sheets; Robocop's board has not been traced in any source found). U10. - **Core**: huc6280-python (pinned), plus the on-die timer and IRQ controller (decision 4). The PSG is idle here (HYPOTHESIS). ## 3. Sly Spy's custom (`SLY_SPY_49` on JTSLY) A custom on the 68000's decode sheet, among the address-decode PALs. MAME's `secretag` sets run with no extra CPU, so MAME models it as logic (OBSERVED: no device). Its behaviour is U19: observe it from MAME traces (writes and reads in its window) and the schematic's wiring. ## 4. The DECO 104 and DECO 146 (deco16, 1990-95) - MAME: "DECO 104 Protection" (36 machines in scope) and "DECO 146 Protection" (28); their log lines on Caveman Ninja name an XOR register and a sound latch inside the chip (OBSERVED: "[:ioprot] LOAD XOR REGISTER 0000 ffff", "LOAD SOUND LATCH: 779d"). The 146's MAME file lists Charles MacDonald as a copyright holder beside David Haywood: his research reached MAME; no public document of his on it was found (his site is set aside by its robots.txt, [sources.md](sources.md)). - These chips sit on the 68000's bus as an I/O window (inputs, DIP switches, the sound latch and protection reads that return scrambled or computed values: HYPOTHESIS, widely described). Their logic is U20. Routes: (a) observe from MAME (every read of the window with the value returned) as a detector; (b) read MAME's BSD-3-Clause `deco104.cpp`/`deco146.cpp` as facts with notice (decision 9: the brief keeps MAME closed for now). - The out-of-scope ARM boards use the same two chips, so a model built here is reused there. ## 5. Encryption | What | Evidence | Status | | --- | --- | --- | | Graphics ROMs scrambled by the tilemap chip variants 56, 74, 141 | MAME's device name "DECO 55 / 56 / 74 / 141"; MAME's `decocrpt.cpp` (Nicola Salmoria) by its name | which sets, and the bit and address permutations: U21 | | 68000 program encryption ("DECO 102") | MAME's `deco102.cpp` (Nicola Salmoria) by its name | which sets: U21 | | The brief's "DECO 66" | not in MAME 0.285's device list for any in-scope set | U21 | Decryption is a pure function of the ROM data and an address, run once at load. Choices: a model in the board from observation (detect: decrypted bytes form valid 68000 code and sensible tiles), or the BSD-3 MAME files read as facts (decision 9). Until then, the first milestones use unencrypted sets: every dec0 set and the early deco16 ones. ## Bootleg protection 68705R3/U3 MCUs on dec0 bootlegs, AT89C52 / 87C52 (MCS-51 family) and a PIC16C57 on the `tumbleb` boards. Out of scope until the originals run.