#!/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-win16-tilebank.sh - Tile-bank gate for the Win16 port: proves the # build loads the DOS bake (its stage is the same chunky 4bpp) exactly and # refuses a bank baked for any other target. # # Runs TILEBANK.EXE on Windows 3.11 under DOSBox (scripts/lib/win16Gate.sh) # from a scratch folder holding it and the DATA/tilebank its make staged # from the host gate's fixture (the port makes the program's own folder the # current directory). Its TILEBANK line in JOEYLOG.TXT must say PASS with # both hashes equal to the host gate's and every other target refused # (scripts/lib/tileBankGate.sh). # # Usage: scripts/verify-win16-tilebank.sh # Requires: a host cc, Windows on DOSBox (install.sh install emulator:win16); # build/win16/bin/TILEBANK.EXE and its DATA/tilebank (make win16). set -uo pipefail repo=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) source "$repo/scripts/lib/joeyEnv.sh" source "$repo/scripts/lib/tileBankGate.sh" source "$repo/scripts/lib/win16Gate.sh" label=verify-win16-tilebank TILEBANK_GATE=$label win16Need binDir=$repo/build/win16/bin dataDir=$(tileBankData "$binDir") lineSeconds=90 tileBankNeedBuild "$binDir/TILEBANK.EXE" "$dataDir" "make win16" tileBankReference work=$(mktemp -d -t joeylib-win16-tilebank.XXXXXX) cleanup() { win16Stop rm -rf "$work" } trap cleanup EXIT mkdir -p "$work/run/DATA" cp "$binDir/TILEBANK.EXE" "$work/run/" cp -r "$dataDir" "$work/run/DATA/tilebank" win16Stage "$work" "$work/run" TILEBANK.EXE win16Start "$work" log=$(tileBankAwaitLine "$work/run" "$lineSeconds" "$WIN16_GUARD") if [ -z "$log" ]; then echo "$label: FAIL - no TILEBANK line within ${lineSeconds}s" >&2 tail -5 "$work/dosbox.log" >&2 exit 1 fi tileBankJudge "$log"