# SPDX-License-Identifier: MIT # Where the reference and its data are: sourced by every rung script. # # W65C02_PYTHON the w65c02-python checkout (default: ../w65c02-python beside # this repository). Its reference/ holds the fetched corpus, # test programs and captures (its scripts/fetch_references.py # and build_tools.py). # W65C02_PYTHON_PIN the commit it must be at (af0ad6b...: e49aceb plus the repin of # 6502-python after its history rewrite of 2026-11-21, same code): # the rungs refuse to judge against another revision unless # ALLOW_OTHER_PIN=1. # REFERENCE_PYTHON its interpreter (default: its own .venv-pypy). # SST_65X02 the SingleStepTests 65x02 checkout (default: its reference/src/65x02). # DORMANN_BUILT the assembled test programs (default: its reference/build/dormann). # DORMANN_FUNCTIONAL Dormann's NMOS functional test image. # CAPTURES the unpacked captures (default: its reference/build). # FOOT_CAPTURE George Foot's data-only capture (.bin.gz). ROOT=${ROOT:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)} W65C02_PYTHON=${W65C02_PYTHON:-"$ROOT/../w65c02-python"} W65C02_PYTHON_PIN=${W65C02_PYTHON_PIN:-af0ad6b9c34045ccea90ca0fd6b6a3ec29e3f703} REFERENCE_PYTHON=${REFERENCE_PYTHON:-"$W65C02_PYTHON/.venv-pypy/bin/python"} SST_65X02=${SST_65X02:-"$W65C02_PYTHON/reference/src/65x02"} DORMANN_BUILT=${DORMANN_BUILT:-"$W65C02_PYTHON/reference/build/dormann"} DORMANN_FUNCTIONAL=${DORMANN_FUNCTIONAL:-"$W65C02_PYTHON/reference/src/dormann/bin_files/6502_functional_test.bin"} CAPTURES=${CAPTURES:-"$W65C02_PYTHON/reference/build"} FOOT_CAPTURE=${FOOT_CAPTURE:-"$W65C02_PYTHON/reference/captures/foot-w65c02-dormann-data14.bin.gz"} export ROOT W65C02_PYTHON REFERENCE_PYTHON SST_65X02 DORMANN_BUILT DORMANN_FUNCTIONAL CAPTURES FOOT_CAPTURE export PYPY_GC_NURSERY=${PYPY_GC_NURSERY:-1M} # The reference must be at its pin, with a clean tree, for a lockstep verdict to mean anything. require_reference() { if [ ! -x "$REFERENCE_PYTHON" ]; then echo "no reference interpreter at $REFERENCE_PYTHON: set W65C02_PYTHON or REFERENCE_PYTHON" >&2 exit 2 fi local head head=$(git -C "$W65C02_PYTHON" rev-parse HEAD 2>/dev/null || echo unknown) if [ "$head" != "$W65C02_PYTHON_PIN" ] || [ -n "$(git -C "$W65C02_PYTHON" status --porcelain -- src 2>/dev/null)" ]; then if [ "${ALLOW_OTHER_PIN:-0}" != 1 ]; then echo "w65c02-python is at $head (or its src/ is modified); the pin is $W65C02_PYTHON_PIN" >&2 exit 2 fi echo "warning: judging against w65c02-python $head, not the pin" >&2 fi }