# MAME 0.285 as a closed-box detector for the board MAME is GPL-2.0+ as a whole: run, never opened (charter, licences point 3). The main-CPU instruction trace recipe is in tlcs900h-python's `docs/mame-oracle.md`; this one logs the board's channels and takes a picture. | Item | Value | | --- | --- | | Machines | `ngp`, `ngpc` (`snk/ngp.cpp`); devices `maincpu` TMP95C061 @ 6.144 MHz, `soundcpu` Z80 @ 3.072 MHz, `t6w28` @ 3.072 MHz, `k1ge`/`k2ge` @ 6.144 MHz, `ldac`, `rdac`; screen 160x152, htotal 515, vtotal 199, 59.950237 Hz | | Inputs | `:Controls` (Up, Down, Left, Right, Button A, Button B, Option), `:Power` (Power On), listed by a Lua probe | | Script | `scripts/mame_run.py` | ## The recipe ```sh source # MAME_ROMPATH, NO_INTRO_DIR; MAME_LOCK queues MAME runs python -I scripts/mame_run.py --driver ngp --frames 600 \ --cart "Baseball Stars - Pocket Sports Series (Japan, Europe) (En,Ja).zip" ``` It runs `flock $MAME_LOCK nice taskset -c 24-31 mame [-cart ] -rompath $MAME_ROMPATH -video none -sound none -nothrottle -noreadconfig -skip_gameinfo -log -verbose -seconds_to_run N -autoboot_script run.lua -debug -debugger none`, where `run.lua` sets three watchpoints whose actions log and continue (`; g`): - main CPU writes to 0x00B0-0x00BF: `IO address data cycles`; - main CPU writes to 0x8000-0x80FF: `K address data cycles`; - Z80 writes to 0x4000-0x4001: `Z pc data cycles` (the Z80's cycle count); and a frame notifier that **presses the power button on frames 5-6** (without it the machine stays halted and blank, as ares's note says real hardware does), then takes a snapshot and exits at the last frame. ## Runs (2026-11-26) | Run | Frames | IO | K | Z | Picture | | --- | --- | --- | --- | --- | --- | | `ngpc`, no cartridge, no power press | 120 | 13 | 12 | 0 | white | | `ngpc`, no cartridge, power | 600 | 105 | 451 | 517 | white | | `ngpc`, Metal Slug 1st Mission, power | 600 | 105 | 451 | 517 | white | | `ngp`, Baseball Stars, power | 600 | 1,178 | 8,084 | 8 | the BIOS's first-boot language screen ("SELECT ONE / ENGLISH / JAPANESE") | - The NGP BIOS reached its setup screen (empty NVRAM: first boot). The NGPC runs stayed white at 10 s with identical write counts with and without a cartridge, so the NGPC BIOS did not get past an early stage under this recipe (power timing, NVRAM, or MAME): U13. Not chased further tonight (short runs only). - Early writes in every run: `B8 AA`, `B9 AA`, `B8 55`, `B9 AA`, `B8 AA`, `B9 AA`, `BC 00` (sound and Z80 control, see [sound.md](sound.md)); `K 8000 C0` (both K2GE interrupts on). - The NGPC BIOS's Z80 driver writes the PSG from pc 798 and 79A in pairs: first the volume-off bytes (`9F`, `BF`, `DF`), then volume steps (`9B`/`DB`, `92`/`D4`...) and tone period pairs from pc 74D/74E (`A8`, `07`): the boot sound plays, even though the picture stays white. The log records the Z80's pc, not which port; add `wpaddr` to tell left from right. - The cycles column of watchpoint lines is the CPU's `totalcycles` and is 0 for writes made before the first timeslice ends; use the instruction trace when exact times matter. ## Using it A detector, never a judge: the board's write log (same format) is compared with MAME's for the BIOS boot; pictures are compared by eye and by pixel at milestone exits; every difference is triaged against the documents first.