# MAME as a detector (closed box, tier 5) MAME 0.285 (`/usr/games/mame`). Its `xbox` machine (source `microsoft/xbox.cpp`, driver status "preliminary", save states unsupported: `mame -listxml xbox`) has an "Intel Pentium III" device (short name `pentium3`) at 733,333,333 Hz, two AM9517A DMA controllers, a Motorola DSP56362 standing in for the APU's GP DSP at 10 MHz, an IDE hard disk and an ATAPI CD-ROM. Firmware by `mame -listroms xbox`: `mcpx_1_0.bin`, `mcpx_1_1.bin` (512 bytes each), four 1 MiB flash images (BIOS sets `bios0` 4134, `bios1` 3944, `bios2` 4034, `bios3` 4817), four 256 KiB ones (5101, 5530, 5713, 5838) and the DSP56362's `boot-362.bin`. All of them are the player's, found through `MAME_ROMPATH`; their SHA-1s are in xbox-python's census. **Closed box.** The source is never opened. Only the `// license:` lines were read (GitHub API, tag `mame0285`, 2026-11-26): `src/devices/cpu/i386/{i386.cpp,i386.h, x87ops.hxx,pentops.hxx}`, `src/mame/microsoft/xbox.cpp`, `src/mame/shared/{xbox.cpp, xbox_pci.cpp,xbox_nv2a.cpp}`, `src/devices/cpu/dsp563xx/dsp563xx.cpp` and `src/mame/sega/chihiro.cpp` all say **BSD-3-Clause**. By sources.md's per-file rule they would be "code OK (with notice)". This Phase 0 keeps them closed (decision 4). ## The recipe (run 2026-11-26) ```sh export MAME_ROMPATH="" python -I scripts/mame_trace.py --bios bios0 --start 0 --frames 2 --regs CR0 \ --out tests/mame_traces/xbox-bios0.trace # WINDOW 0.033333 s # STATE EIP=004024F1 # 20461122 instructions traced # RAM below 64 MiB: 20106749 # MCPX ROM window FFFFFE00+: 354373 python -I scripts/mame_trace.py --bios bios3 --start 0 --frames 2 \ --regs EAX,ESP,EFLAGS,CR0 --out tests/mame_traces/xbox.trace # WINDOW 0.033333 s # 12846755 instructions traced # MCPX ROM window FFFFFE00+: 7085820 # RAM below 64 MiB: 5760935 ``` The script writes `tests/mame_traces/trace.lua` and runs, in that git-ignored directory, ``` nice taskset -c 24-31 mame xbox -bios -rompath "$MAME_ROMPATH" -video none \ -sound none -nothrottle -noreadconfig -skip_gameinfo -debug -debugger none \ -autoboot_script trace.lua -seconds_to_run N ``` The Lua issues `trace ,maincpu,noloop,{tracelog "CR0=%08X ",CR0}` before `go` (start 0) and `trace off` after the given frames, counted with `emu.add_machine_frame_notifier` (held in a global, or it is collected). Each trace line is the register prefix, then MAME's address and disassembly, Intel syntax: ``` EAX=00000000 ESP=00000000 EFLAGS=00200000 CR0=60000010 FFFFFFF0: jmp ``` The first line is at the reset vector FFFFFFF0h with CR0 = 60000010h, as SDM vol. 3 Table 9-1 gives for the P6 family (EFLAGS shows bit 21, the ID flag, set where Table 9-1 says 00000002h: a MAME detail, noted, not judged). **The traces are Microsoft's code executing** (the MCPX boot ROM, then the flash's loaders and kernel), so they stay in `tests/mame_traces/` and only counts and the shape of a line are written here. ## What the two runs show (OBSERVED) - **BIOS 4134 (bios0) boots.** 354,373 instructions in the MCPX ROM window, then 20,106,749 in RAM in the remainder of the 1/30 s window; CR0 goes 60000010h → 60000011h (protected mode) → 00000011h (caches enabled) → 40000011h → 80010031h (paging, WP, NE): the kernel has paging on within two frames. **614 M instructions per emulated second**, so MAME charges about **1.19 cycles per instruction** at 733.33 MHz. - **BIOS 4817 (bios3) loops.** The trace alternates between the MCPX ROM window and low RAM 20 times in two frames, about 647,159 instructions per round, and CR0 never shows paging: a reset loop. 4817 is a flash for MCPX 1.1 (xboxdevwiki `Boot Process` r7377: TEA-verified FBL for kernels 4817 and later); MAME's `xbox` machine carries both MCPX images, and which one it maps for which BIOS set is not visible from outside. Not investigated further: a MAME configuration matter, not a CPU fact. - MAME's instruction rate is a model (the i386-family core charges table cycles), not a measurement of a Pentium III, and says nothing about the P6's IPC. ## MAME's state symbols for `pentium3` (from `cpu.state`, 2026-11-26) `EAX EBX ECX EDX ESI EDI EBP ESP EIP EFLAGS PC CURPC GENPC CURFLAGS CPL`, segment registers with their hidden parts (`CS CSBASE CSLIMIT CSFLAGS`, likewise `DS ES FS GS SS`), `GDTRBASE GDTRLIMIT IDTRBASE IDTRLIMIT LDTR LDTRBASE LDTRLIMIT LDTRFLAGS TR TRBASE TRLIMIT TRFLAGS`, `CR0 CR1 CR2 CR3 CR4`, `DR0-DR7`, `TR6 TR7`, `ST0-ST7 x87_CW x87_SW x87_TAG`, `XMM0-XMM7`, and 16-bit aliases (`~AX ~AL ...`). No MXCSR, no MSRs, no MMX names (they alias ST0-ST7). ## What MAME can and cannot decide - It **can** find differences over the boot path from reset with the player's firmware: instruction stream, registers, mode changes, the order of PCI configuration and I/O accesses (rung 5). - It **cannot** judge timing, x87 last bits, SSE approximations or undefined flags: it is an emulator. - One MAME process at a time, a few emulated frames at most: a two-frame trace is about 1 GB and took four minutes on one core.