#!/bin/sh # m6809-python: produce a MAME 0.285 instruction trace of a Williams 6809E game. # # scripts/mame_trace.sh [game] [seconds] [workdir] # # Defaults: robotron, 20 emulated seconds, ./mame-work. Output in the work # directory: .trace (MAME disassembly) and error.log (register log, see # docs/mame-oracle.md). ROMs are used in place; nothing is copied. set -eu GAME=${1:-robotron} SECONDS_TO_RUN=${2:-20} WORK=${3:-mame-work} MAME=${MAME:-/usr/games/mame} ROMPATH="${ROMPATH:-${MAME_ROMPATH:?set MAME_ROMPATH (or ROMPATH) to the MAME non-merged ROM folder}}" SCRIPT=$(cd "$(dirname "$0")" && pwd)/mame_trace.lua mkdir -p "$WORK" cd "$WORK" rm -f error.log "$GAME.trace" "$MAME" "$GAME" \ -rompath "$ROMPATH" \ -homepath "$PWD/mame-home" \ -video none -sound none -nothrottle -noreadconfig -skip_gameinfo \ -debug -debugger none -log \ -seconds_to_run "$SECONDS_TO_RUN" \ -autoboot_script "$SCRIPT" echo "instructions: $(grep -cE '^[0-9A-F]+( [0-9A-F]+){8}( [0-9]+){3}$' error.log)"