# MAME 0.285 as a detector MAME is an emulator (tier 5): it finds differences, it does not decide them. Binary `mame` `0.285 (unknown)`. Its files for this machine carry `license:BSD-3-Clause` (`nintendo/gb.cpp` Anthony Kruize, Wilbert Pol; `bus/gameboy/mdslot.cpp` Vas Crabb; `bus/gameboy/rom.cpp` Vas Crabb, Wilbert Pol; `video/gb_lcd.cpp`, `cpu/lr35902/lr35902.cpp` Wilbert Pol; `sound/gb.cpp` Wilbert Pol, Anthony Kruize: first 300 bytes read 2026-11-26 at tag `mame0285`). By the Phase 0 brief they are a **closed box** here all the same: run, never read (whether to read them, as the family reads other BSD MAME files, is decision 6). ## What MAME says it runs (`mame -listxml`, 2026-11-26) | Machine | Description | CPU | Screen | ROMs | | --- | --- | --- | --- | --- | | `megaduck` | Mega Duck / Cougar Boy (1993; "Welback Holdings (Timlex International) / Creatronic / Videojet / Cougar USA") | Sharp LR35902, 4,194,304 Hz | LCD 160 x 144, 59.732155 Hz | none | | `mduckspa` | Super Quique / Mega Duck (Spain), Cefa Toys, 199? | same | same | `megaducksp.bin` 512 KB; `81x00.bin` not dumped | Devices: "DMG PPU", "LR35902 APU", "Mega Duck Cartridge Slot", "Mega Duck Flat ROM Cartridge", "Mega Duck Banked ROM Cartridge". MAME has no German Super Junior machine. ## The recipe (run) ```sh MAME_ROMPATH=... python -I scripts/mame_trace.py --cart "$NO_INTRO_DIR/Welback - Mega Duck/Armour Force (World).zip" --seconds 3 ``` runs in a fresh `tests/mame_traces/-/` (git-ignored): ``` mame megaduck -cart -homepath -video none -sound none -nothrottle -noreadconfig -skip_gameinfo -debug -debugger none -log -seconds_to_run N -autoboot_script trace.lua ``` `trace.lua` installs write taps on `$FF00-$FFFF` (`IOW`) and `$0000-$7FFF` (`BANKW`) and issues `trace cpu.trace,,noloop,{logerror "%X %X %d\n",pc,sp,totalcycles}`. **Gotcha (found 2026-11-26):** in MAME's debugger expressions on this CPU, `a`-`f`, `af`, `bc`, `de` (and `b@pc`) parse as hex numbers or fail, not as the LR35902's registers: an action naming `hl` or `b@pc` silently logs nothing. Only PC, SP and `totalcycles` are logged; the mnemonics come from MAME's own `cpu.trace`. Probe runs are in `trash/`. `totalcycles` counts T-cycles (4,194,304 a second). A 3-second run takes about 19 s wall time (`nice`, `taskset -c 24-31`, one MAME at a time) and writes ~20 MB. ## Run 2026-11-26 (`tests/detectors/mame-megaduck-armourforce-2026-11-26.txt`) Armour Force (World), MD2, 3 emulated seconds: **1,119,253 instructions, 12,639,332 T-cycles, 11.29 T-cycles (2.82 M-cycles) per instruction**; no `halt`, no `stop` executed. First trace line PC `0`, SP `0`; MAME's first instructions `di; jp $0200; ld sp,$DEFF`. I/O written (address x count): `FF00` x510 (joypad), `FF01`, `FF02` (serial), `FF0F`, `FF10` x2 (LCDC), `FF12`/`FF13` x170 (SCY/SCX), `FF14`/`FF15` x2 (OBP0/OBP1), `FF1A` x170 (OAM DMA), `FF1B` x2 (BGP), `FF45` x1 (NR52), HRAM `FF80-FFD7` (the DMA routine copied in), `FFFF` x2. Every one of these is a Duck address in registers.md; none is a DMG-only address. Bank writes: `$0001` = 1 x170 and = 2 x171 (it switches the 16 KB bank twice a frame). No sound register beyond NR52 was written in these 3 seconds. ## What MAME can and cannot decide - **Can detect:** a board that runs a Duck game differently (PC flow, I/O and bank writes, pictures); which registers and banks the games touch. - **Cannot decide:** anything about Duck silicon: it runs its DMG devices, so its timing is its DMG model's, and agreement with gameboy-python would show two DMG models agreeing, not that the Duck is a DMG (U1). It cannot judge the laptops (no German machine; the Spanish one's peripheral ROM is undumped).