# The MAME recipe (run 2026-11-26, MAME 0.285) MAME is a closed box here: run, never read (tonight's rule; its ST files are BSD-3-Clause by their `license:` lines, [sources.md](sources.md)). It is a detector, tier 5, and for the ST a weak one: every ST-family driver is marked **`status="preliminary" emulation="preliminary" savestate="unsupported"`** (`mame -listxml st`, `megast`, `ste`, `megaste`). ## Devices (`mame -listdevices st`) `m68000` MC68000 @ 8.02 MHz; `mmu` "Atari ST MMU"; `video` "Atari ST Video" @ 32.08 MHz; `screen` @ 16.04 MHz; `mc68901` MFP @ 4.01 MHz; `mc6850_0`, `mc6850_1` with `acia_clock` @ 501.32 kHz; `ikbd` with `cpu` "Hitachi HD6301V1" @ 4.00 MHz; `ym2149` @ 2.00 MHz; `wd1772` @ 8.02 MHz with two 3.5" DD drives; `cartslot`; `centronics`; `rs232`; MIDI in and out. The STE (`ste`) replaces `video` by `videox` "Atari STe Video ASICs" and adds `lmc1992` and `stb` (Blitter); the Mega ST adds `stb` and `rp5c15`; the Mega STE adds `rp5c15` and `z8530`. Clocks from `-listxml st`: CPU 8,021,247 Hz, YM2149 2,005,311 Hz; screen htotal 1024, vtotal 313, 50.052709 Hz. No DMA chip or GLUE device is listed by name (MAME folds them into its MMU and video devices: OBSERVED only from the device list). ## Romsets `st.zip` (TOS 0.99, 1.0, 1.02, 1.04), the country sets, `megast`, `ste`, `megaste`, and `st_kbd.zip` (the IKBD's 4 KB ROM, shared by all) under `$MAME_ROMPATH`; all 30 sets present ([census.md](census.md)). BIOS choice by `-bios tos099|tos100|tos102|tos104` on `st`, `tos106|tos162|tos206` on `ste`, `tos205|tos206` on `megaste`. ## The commands (as run) ```sh python -I scripts/mame_trace.py --snap 12 # 2.8 s wall; blank (white) picture python -I scripts/mame_trace.py --snap 30 # still blank at 30 s of TOS 1.04 python -I scripts/mame_trace.py --driver ste --snap 30 # black: palette writes unmapped python -I scripts/mame_trace.py --frames 3 # 68000 trace, 25,190 instructions python -I scripts/mame_trace.py --frames 60 # 579,685 instructions, 10 s wall python -I scripts/mame_trace.py --frames 60 --cpu ikbd # 337,571 HD6301 instructions ``` Seven MAME runs in all (the six above and a first IKBD trace that came back empty because of a register name: Traps), one at a time, under `nice` and `taskset -c 24-31`. What the script passes: `-rompath $MAME_ROMPATH -homepath -video none -sound none -nothrottle -noreadconfig -skip_gameinfo -log -seconds_to_run N -autoboot_script run.lua`, and when tracing `-debug -debugger none`. The Lua script sets the debugger's visible CPU, issues `trace T.trace,,noloop,{logerror "...",,totalcycles}`, sets `wpset` watchpoints on the video, DMA, PSG, MFP and ACIA registers (68000 only), and stops by counting frames in a frame notifier. ## Findings - **TOS 1.04 boots in MAME** (OBSERVED from the trace and log): the RAM probe ("ram banks 512/512 configured 2048/2048", then "512/512", as HWSPEC 2.2's algorithm writes 0Ah first); the cartridge check (unmapped reads of FA0000/FA0002 from FC0030); the palette loaded (777, 700, 070, ... at cycles 468-800); the video base set to 0F8000 at cycle 4,483,432; the MFP programmed (vector register 48h; Timer C at 200 Hz: [mfp.md](mfp.md)); "Video mode: 60Hz" on the US row. - **But no picture**: the snapshots at 10 s and 30 s are a uniform white frame on `st` (1,278-byte PNGs); the STE's snapshot at 30 s is black and its log shows every palette write as "unmapped program memory write to FF8240 ...": MAME 0.285's STE video does not decode the palette. MAME cannot serve as a picture detector for this board today. - **IKBD**: reset vector F000, 999,367 E cycles in about one emulated second (E = 1 MHz). Its log shows the MCU reading unmapped addresses 8A20 and 010B (MAME's model of the IKBD's external bus: OBSERVED, meaning unknown). - **Instruction rates**: 68000 13.8 clocks an instruction in the first second of boot; HD6301 2.96 E cycles an instruction ([domains-and-speed.md](domains-and-speed.md)). ## Traps met - MAME's 68000 debugger has no `a7` symbol (use `sp`); the HD6301 has `s`, not `sp`. A bad symbol makes the trace command fail silently (an empty trace). - The US TOS sets 60 Hz, so frame counts are at 60 Hz (`--rate`); the 50 Hz screen in `-listxml` is MAME's start-up value. - The floppy sound samples are missing (harmless log noise); ALSA's MIDI sequencer cannot open (harmless). ## Output `reference/mame/-/` (git-ignored): `run.log` (trace lines, watchpoint lines `W addr size data cycles`, MAME's log), `snap//*.png`, `stdout.txt`.