# Protection: FD1089/FD1094, MC-8123 and the 8751 ## Hitachi FD1094 and FD1089 (encrypted 68000s) What is documented: - The **FD1094** is a 68000 in an epoxy block with a CR2032-type battery under a metal lid marked "HITACHI FD1094" and a Sega sticker (315-0197 on MacDonald's; the number changes per game). It runs only encrypted code, from the ROM area and from RAM alike (unencrypted code in tile RAM at 0x400000 does not run); the initial SP and PC are encrypted, the rest of the vector table is not (DOC CM16B §9). The key lives in battery-backed RAM; when the battery dies the CPU stops working (DOC CM18 "Overview"). - FD1094 modules can be **reprogrammed with any game's key**, whatever their label; **FD1089A and FD1089B** are two different schemes and only take keys of their own variant (DOC AHFD, tier 3: keys written into real modules and games run). - Different program revisions of one game use different, incompatible CPUs (DOC CM18 "Game List"). What is not documented anywhere permissive: the **decryption function itself** (how a key and the CPU's state turn each fetched opcode word into a plaintext one, and when the state changes). The public description is MAME's `fd1094.cpp`/`fd1089.cpp` (BSD-3-Clause by their `license:` lines; copyright Nicola Salmoria, Andreas Naive, Charles MacDonald), not opened here. The key ROMs in MAME's sets (`maincpu:key`, 8,192 bytes each in MAME's list, FD1089 and FD1094 alike) are dumps of real modules: Sega data, never committed. ## What the board needs from m68000-python Decryption applies to opcode fetches and not to data reads (the vector-table and RAM observations above, and the term "encrypted program code"). m68000-python already reports function codes on every bus access when the host asks (`function_codes=True`; its `_core.py`: `FC_USER_PROGRAM`, `FC_SUPERVISOR_PROGRAM`), so a board-side FD1094 can tell program reads from data reads without a change to the core. Whether the decryption state also changes on events the bus does not show (an interrupt acknowledge shows as FC 7; a reset the board sees; a special instruction would need an opcode hook) is part of U12. ## Decrypted sets against modelling the decryption | | Decrypted sets first | Model FD1089/FD1094 | | --- | --- | --- | | Coverage | 58 of 63 titles run on plain-68000 sets (census); the 72 MAME "bootleg of FD10xx set" machines are the encrypted sets' programs decrypted | all 297 | | Evidence | MAME's `goldnaxe1` and `goldnaxe1d` traces are identical for 43,030 instructions (OBSERVED): a decrypted set is the same machine to MAME's 68000 | the algorithm's only full source is MAME (open decision 3) | | Cost | nothing in the board | a key-driven opcode-fetch filter in the board, plus whatever state rule U12 finds | | Risk | a decrypted set is a program image someone produced, not the original ROMs; behaviour differences between the real FD1094 and a plain 68000 (timing of the decryption, any state-dependent cases) are invisible | the model can only be judged against MAME (tier 5) unless a real module is measured | **Recommendation** (open decision 4): decrypted sets first, the plain 68000 throughout; the FD1094/FD1089 model as a later milestone, in the board (it is a property of one chip used across Sega's boards: 16A, 16B, 18 and Out Run in the census; AHFD's guide adds System 24 and the X board), behind a socket on the 68000's program-fetch path. ## NEC MC-8123 (encrypted Z80) Six 16B sets (`aliensyn7`, `altbeast2`, `altbeast4`, `cencourt`, `shinobi3`, `shinobi4`) have an MC-8123: a Z80 in an epoxy block with a 3 V BR1125 battery and an MB3771 supply monitor; Shinobi's is marked "NEC MC-8123B 651", sticker 317-0054. A plain Z80-B with another 16B Shinobi's unencrypted sound program works in its place (DOC CM16B §9). MAME carries each set's key as `soundcpu:key`. Every MC-8123 set has a plain sibling, so the same recommendation applies: plain sets first. An MC-8123 model needs the Z80's opcode-fetch (M1) cycles told apart from data reads; z80-python's `read_m1` hook exists on its branch `m1-fetch-hook-rebased`, not on `main` (checked 2026-11-26). ## The Intel 8751 MCU **What it does** (DOC): on Pre-16 boards it is required to run: it holds the 68000 (/HALT on P3.0, /BERR on P3.1), drives the 68000's /IPL0-2 from P1.0-P1.2 (vblank as a level-4 autovector), takes vblank timing on /INT0 and a 68000-controlled interrupt on /INT1 (PPI PB6), and reaches the 68000's bus through latches: its 64 KB external space maps 68000 A15-A1 on its A15-A1 and 68000 A16 on its A0, plus four PAL bank bits on P1.3-P1.6 (CMP16). Body Slam's MCU halts the 68000, sets the palette, shows a warm-up counter (a ROM checksum, MacDonald thinks), then releases it, and later keeps a round timer at 0xFFC200 (CMP16). On 16B Tough Turf's MCU reads the inputs into work RAM and writes the sound latch; with it removed the game runs with no inputs and no sound; modifying the first 32-48 KB of ROM locks the board (DOC CM16B §9). On System 18 it has the I/O area, work RAM, the sound latch and program ROM, and can halt the 68000 (CM18). Clock: 8 MHz input; CMP16 says the Pre-16's has a divider and runs at 4 MHz, MAME runs every 8751 at 8 MHz (C1). **Consequences for the board**: the 8751 is a second bus master on the 68000's bus (with /HALT and bus latches), and the interrupt source of the 68000 on Pre-16 boards. That makes the MCU part of the CPU domain, not a peripheral behind a port ([domains-and-speed.md](domains-and-speed.md)). **The core**: an **mcs51-python** core (the chip rule: a CPU gets its own core; mcs48-python is a different architecture and says so in its README). MCS51 (Intel's manual) is its tier-2 judge: 12 oscillator periods a machine cycle, 4 KB EPROM, 128 bytes RAM, two timers, a serial port, and the 8751's program-memory lock bits. Its MAME device files are BSD-3 by their `license:` lines (i8051.cpp, mcs51ops.cpp, mcs51dasm.cpp), a tier-5 trace detector: MAME's 8751 ran 25,786 instructions in 3 frames of Golden Axe (OBSERVED). Users beyond this board in the family's notes: System 18 (the census), CPS-2's `gigaman2` bootleg (an 8051, cps2-python census).