# MAME 0.285 as a closed-box detector for the TLCS-900/H MAME is GPL-2.0+ as a whole; its NGP and TLCS-900 source is not opened (charter, licences point 3). The binary is run; its outputs are read. | Item | Value | | --- | --- | | Binary | `/usr/games/mame`, 0.285 (installed) | | Machines | `ngp` and `ngpc` (`snk/ngp.cpp` per `-listxml`); `maincpu` "Toshiba TMP95C061 @ 6.14 MHz", `soundcpu` Z80 @ 3.07 MHz | | Firmware | `ngp.zip` / `ngpc.zip` from `$MAME_ROMPATH` (SHA-1s in ngp-python docs/census.md) | | Script | `scripts/mame_trace.py` | ## Register symbols Listed from the device's state table with a Lua probe (2026-11-26): `PC`, `CURPC`, `GENPC`, `CURFLAGS`, `XWA0`-`XWA3`, `XBC0`-`XBC3`, `XDE0`-`XDE3`, `XHL0`-`XHL3`, `XIX`, `XIY`, `XIZ`, **`XSSP` and `XNSP`**, `DMAS0`-`3`, `DMAD0`-`3`, `DMAC0`-`3`, `DMAM0`-`3`. The 900/H has no normal stack pointer (H1 CPU900H-1); MAME's table carries the 900's. No `SR` or `INTNEST` symbol was listed. ## The run ```sh source # MAME_ROMPATH; MAME_LOCK to queue MAME runs python -I scripts/mame_trace.py --driver ngpc --frames 3 ``` which runs, wrapped in `flock $MAME_LOCK nice taskset -c 24-31`: ```sh mame ngpc -rompath $MAME_ROMPATH -homepath reference/mame/ngpc-cpu -video none -sound none \ -nothrottle -noreadconfig -skip_gameinfo -log -seconds_to_run 5 \ -autoboot_script run.lua -debug -debugger none ``` with `run.lua` issuing `trace T.trace,:maincpu,noloop,{logerror "T %X ... %d\n",pc,curflags, xwa0,xbc0,xde0,xhl0,xix,xiy,xiz,xssp,totalcycles}` and exiting after 3 frames. ## Result (2026-11-26) - 66,779 trace lines in `run.log`, last at cycle 307,454 (3 x 102,485 = 307,455: the frame is 515 x 199 cycles of 6.144 MHz). Wall time about 1 s. - First lines: `FF204A ei 7` at cycle 0, `FF204C ld (WDMOD),..` at 3, `FF204F` at 8, `FF2052` at 13: `EI` cost 3 and `LD (#8),#` 5, the **900/H** state counts (HB CPU900H-158, -164), not the 900's. XSSP is 0x100 at reset, as the manual says for XSP. - MAME's disassembler names the BIOS's first SFR writes `WDMOD`, `WDCR`, `IIMC` (TMP95C061 names); whether the NGP SoC's registers sit at the same addresses is U3. - Instruction mix (the `T.trace` disassembly): `jr` 26,577, `cp` 13,290, `inc` 13,288, `bit` 13,288, `ld` 207: the BIOS polls in a tight loop most of these frames. ## Using it A detector for rung 4: run the core on the same BIOS from reset with the same inputs and compare `pc` and registers line by line; the cycle column compares state totals. Every difference is triaged against Toshiba's pages; MAME's states are its opinion. A real trace of interest (a game) needs a cartridge and the power button (ngp-python's `scripts/mame_run.py` shows how).