#!/bin/bash # One frame-clock run: the 68000 derives its own 12 fps tick from the raster # (ROADMAP P3, FINDINGS 54). # # tools/bench/clock_run.sh [window-in-raster-frames] [fps] # # TWO MAME INVOCATIONS, and they are not interchangeable. The first leaves the # clock off and calibrates the cost of the gate's own loop; the second arms it. # The interrupt cost is the difference, so a run that reported only the second # would be reporting a number it cannot compute. See src/player/clockgate.s. # # Only MAME can run this: the frame clock is an MFP interrupt driven by the # CRTC's V-DISP output, and tools/bench/c68k has neither device. That is why # this stage has no second-core half, unlike load_run.sh. set -e cd "$(dirname "$0")/../.." WIN=${1:-3000} FPS=${2:-12} tools/vasm/vasmm68k_mot -Fbin -o tmp/clockgate.bin src/player/clockgate.s > /dev/null for ON in 0 1; do # stdbuf -oL: without it a long MAME run is unobservable until it exits, and # a run that is merely finishing looks exactly like one that is wedged (34.1). ( cd tmp && DLX_CLK_ON=$ON DLX_CLK_FPS=$FPS DLX_CLK_WIN=$WIN \ DLX_CLK_OUT=clock_$ON.txt SDL_VIDEODRIVER=dummy stdbuf -oL \ timeout -k 5 600 mame x68000 -bios ipl10 -ramsize 2M -video soft -window \ -sound none -nothrottle -plugins -autoboot_script ../tools/bench/clock.lua \ -seconds_to_run 240 > clock_$ON.log 2>&1 ) # A run that never reached the counts must fail as that, not as bad arithmetic. grep -q "^\[CLK\] done" tmp/clock_$ON.log || { echo "FAIL: the clock rig did not finish run ON=$ON -- no completion marker." tail -8 tmp/clock_$ON.log; exit 1; } done grep -a "^\[CLK\]" tmp/clock_1.log | sed -n '/window:/,/cadence/p' | sed 's/\[CLK\] / /' python3 tools/bench/clock_cost.py tmp/clock_0.txt tmp/clock_1.txt