joeylib2/scripts/verify-x68000-display.sh

37 lines
1.5 KiB
Bash
Executable file

#!/usr/bin/env bash
# Part of JoeyLib, Copyright (c) 2026 Scott Duensing, under the MIT License.
# See LICENSE.md for license information.
# SPDX-License-Identifier: MIT
#
# verify-x68000-display.sh - the X68000's present, checked on the text-plane
# page it draws. UBER's golden hashes are of the stage; a present that leaves
# stale rows on screen passes them. This page flips: each present draws into
# the page not shown, which holds the frame before last, from the union of
# two frames' dirty bands. UBER built with UBER_PROBE runs its X68000 display
# row (op_probeX68kDisplayCheck): a battery of draws, each presented and the
# drawn page compared with the stage's planes (jlX68kProbeDisplayMismatch in
# src/x68000/hal.c). The total must be 0.
#
# Usage: scripts/verify-x68000-display.sh
# Exit: 0 PASS, 1 FAIL
# Requires: MAME and the X68000 firmware (install.sh install emulator:x68000),
# the library built (make x68000).
set -uo pipefail
repo=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
label=verify-x68000-display
log=$repo/build/x68000/joeylog.txt
rm -f "$log"
if ! X68K_BENCH_CFLAGS="-DUBER_PROBE -DUBER_FRAMES=1" "$repo/scripts/bench-x68000.sh" > /dev/null 2>&1; then
echo "$label: FAIL - the UBER_PROBE run did not finish" >&2
exit 1
fi
line=$(grep "UBER-PROBE: x68kDisplay" "$log" 2>/dev/null)
if [[ "$line" == *" PASS (mismatch=0)" ]]; then
echo "$label: PASS - ${line#UBER-PROBE: }"
exit 0
fi
echo "$label: FAIL - ${line:-no x68kDisplay line in its log}" >&2
exit 1