# The MAME recipe (run 2026-11-26, MAME 0.285) MAME is run as a closed box (tier 5, a detector). One process at a time, short runs. ## Devices (`mame -listdevices`) - `dkong`: `maincpu` Zilog Z80 @ 3.07 MHz; `dma8257` Intel 8257 @ 3.07 MHz; `soundcpu` Fujitsu MB8884 @ 6.00 MHz; `discrete`; latches `ls175.3d`, `ls259.6h`, `virtual_p2`; `screen` @ 6.14 MHz; `gfxdecode`, `palette`, `mono`, `watchdog`. - `dkongjr`: as `dkong` with `ls174.3d` and three 74LS259s (`ls259.4h`, `.5h`, `.6h`). - `radarscp`: as `dkong`; `radarscp1` adds `m58819` and `tms` (M58817 @ 640 kHz) and `virtual_p1`. - `dkong3`: `maincpu` Z80 @ 4.00 MHz; `z80dma` @ 3.07 MHz; `rp2a03a`, `rp2a03b` (each with `nesapu`) @ 1.78 MHz; three latches. - `-listxml dkong`: `rotate="270"`, 256 x 224, 60.606061 Hz, pixclock 6144000, htotal 384, vtotal 264, vbend 16, vbstart 240. Same for `dkongjr`, `dkong3`, `radarscp`. ## Commands ```sh python -I scripts/mame_trace.py --skip 600 --frames 3 # 3 frames of attract, after 10 s python -I scripts/mame_trace.py --frames 30 # from reset python -I scripts/mame_trace.py --snap 10 # untraced, PNG at frame 600 ``` The Lua traces `:maincpu` (`pc,af,bc,de,hl,sp,iff1,totalcycles,beamy`) and watches writes to the DMA (`wpset 7800,10,w`), the tune latch (7C00), the sound latch (7D00-7D07) and the control latch (7D80-7D87). The sound CPU's own recipe (tag `:soundcpu`, a coin inserted from Lua to wake it) is mcs48-python's `docs/mame-oracle.md`; it was not rerun tonight. ## Runs made tonight | Run | Result | | --- | --- | | `--snap 10` | `reference/mame/dkong-snap/snap/dkong/0000.png` | | `--skip 600 --frames 3` | 15,871 lines; per frame: NMI entry at 0x0066 on line 240 (three of three); 7D84 = 0 on line 240 and = 1 near line 32-37; DMA programmed on line 241 (7808 = 0x53; channel 0 address 0x6900, count 0x4180; channel 1 address 0x7000, count 0x8180); 7D85 = 0 then 1 (line 242) then 0 (line 258); no tune or sound-latch writes in this attract window | ## Traps - `error.log` lands in the working directory (renamed `run.log`), with a byte-order mark. - The sound CPU idles without input; mcs48-python inserts a coin from Lua to see it work. - `noloop` hides tight loops; time comes from `totalcycles`.