# Protection: the M72's i8751 and the V35 Software Guard Two unrelated schemes. Neither is a cipher the board computes: one is a second CPU with its own program, the other a lookup table inside the CPU. ## The M72's i8751 (Battle Chopper, Image Fight, Legend of Hero Tonma, Ninja Spirit) **What MAME shows (OBSERVED, closed box).** 15 m72.cpp sets carry an `mcu` CPU, "Intel 8751" at 8 MHz; 13 have the 4 KB internal ROM dumped (`*_c-pr-*.ic1` in the `mcu` region), 2 conversions (`dbreedm72`, `dkgensanm72`) do not, and MAME simulates those in driver code, which this repository does not read. One bootleg (`imgfightjb`) has an "Intel 80C31" with an external ROM. On the MCU sets the V30 sees a 4 KB window at B0000-B0FFF and the MCU sees the same memory at C000-CFFF of its external data space: MAME's device list names an `mb8421_mb8431_16` (Fujitsu MB8421/MB8431 dual-port RAM, 16-bit wide on the V30 side). The MCU also has external-data handlers at 0000-0002. **What the hardware is (DOC, MCS51).** An 8751 is an 8051 with 4 KB of EPROM: 12 oscillator periods per machine cycle, so at 8 MHz 0.667 M machine cycles per second; 256-byte opcode map; two timers, a UART, four 8-bit ports; external data through MOVX on P0/P2 with /RD and /WR. MAME's map exposes its internal SFRs 80h-FFh (`internal_direct` space), consistent with MCS51. **What it does on the board: unknown here (U6).** MAME's trace of `nspirit`'s MCU (frames 901-903) shows it busy for the whole frame, 8,064 instructions in 12,116 machine cycles, which looks like a polling loop on the shared RAM. Whether it also drives the sample DAC (the handlers at external data 0000-0002 suggest a port to the sound side) is to be found by running the dumped program in the core, not from MAME's source. **Core.** An i8751 is a CPU: the chip rule gives it a core. `system16-python` already proposed **mcs51-python** (System 16A/16B/18: 21 sets). This board adds 4 parents and 13 dumped sets (and the 80C31 bootleg), so the core has two family consumers before it is written. Recommended: one Phase 0 for mcs51-python before the `m72-mcu` row (open decision 4). The dual-port RAM stays in the board (a 4 KB array with two ports and, on the MB8421, mailbox interrupts at its top two locations: U7, check the Fujitsu data sheet when the row is built). ## The V35 Software Guard (M92 and M107 sound CPUs; M90 and late-M72 main CPUs) **The mechanism (DOC, VDB91 µPD70337 "V35 Software Guard" and µPD70327 "V25 Software Guard").** NEC sold V25/V35 variants with a mask-programmed, user-defined 256-entry translation table between the prefetch queue and the instruction register. In security mode "only the first byte of each opcode is decoded, and subsequent bytes are passed directly from the prefetch unit to the execution unit"; the N/S pin, sampled at reset, selects the mode, and two added instructions, **BRKS** and **BRKN**, switch to security and normal mode under software control (with stated clock counts, 56 + 10T [44 + 10T] for BRKS); "the V35 Software Guard does not support internal ROM". Performance is identical in both modes. The M92 board capture names the sound CPU "V35S" (M92DOC `audio_cpu.kicad_sch`). **Which sets (OBSERVED, our own reading of the ROM bytes through MAME's mapping; `scripts/reset_bytes.py`).** An untranslated V30/V33/V35 program here begins with FAh (DI) or EAh (far jump) at FFFF0h: all 51 V30 and all 48 V33 main CPUs do. Of the 65 V35 CPUs, 62 begin with another byte: | Board | V35 CPUs | First byte not FAh/EAh | | --- | --- | --- | | M92 (sound) | 40 | 40 | | M107 (sound) | 6 | 6 | | M90 (main) | 14 | 13 (`dicegame` is plain) | | M72 with V35 (main) | 5 | 3 (`kengo`, `kengoj`, `ltswords`; `cosmccop` and `gallop` are plain) | The translated first bytes fall into 17 distinct values. Sets sharing a value share a first plain instruction under one table, which suggests (HYPOTHESIS) one mask part used across games: for example 39h groups Gunforce's sound CPU with Kengo's main CPU, B1h groups Blade Master's and Cross Blades' sound CPUs with Dynablaster's and Bomberman's main CPUs, E3h groups Hook's and Gunforce 2's sound CPUs with Quiz F1's main CPU. The real number of distinct tables is U9. **Where the tables come from.** Each table is a fact about a mask-programmed chip; no manufacturer document lists them. MAME carries them in `src/mame/irem/irem_cpu.cpp` (BSD-3-Clause by its `license:` line, read 2026-11-26 at tag `mame0285`; the rest of the file is not opened). Three ways to get them, none taken in Phase 0 (open decision 5): 1. **Read the BSD-3 file** for the tables only, credited with its notice: legally clean (sources.md's "code OK (with notice)" for BSD MAME files), but the batch brief holds MAME closed. 2. **Measure MAME as a closed box**: write each of the 256 byte values into the sound CPU's RAM and ask the debugger to disassemble it (`dasm`); the decoded first byte is the table entry. A closed-box measurement (tier 5), about 256 debugger commands per table, no source opened. 3. **Derive them ourselves** from the ROMs: the plain V35 program on `dicegame`, `cosmccop` and `gallop`, the shared sound driver across sets, and the instruction boundaries (only first bytes are translated) give a statistical attack; slow and uncertain. **Board model.** The translation is inside the CPU, so it belongs to the NEC core as a V35 variant's input: `opcode_table: bytes | None` (256 entries, None = normal mode), the N/S pin level at reset, and BRKS/BRKN. The table itself is per-set data the board's machine table supplies, identified by the set's SHA-1s, never shipped as game data. Open questions for the core: whether prefixes count as "the first byte of each opcode" (U10), and whether interrupt vectors and macro-service fetches are translated (U11).