#!/bin/bash # One load-time transform run: the 68000 builds its own codebooks and palette # out of the RAW container header, on both CPU cores (ROADMAP P1+P2, FINDINGS # 53). # # tools/bench/load_run.sh [container] # # Both instruments run the same loadgate.bin over the same header bytes: # * MAME, which is the only one of the two with real PALETTE REGISTERS -- the # packed words are read back out of $E82000, not out of a RAM shadow, so # "the words reached the hardware" is part of what passes. # * px68k's C68K, which is exact to the cycle and counts BUS cycles, and is a # second opinion on the cost from a separately written cycle table. # Both outputs are compared byte-for-byte against tools/bench/dlxload.py, which # stays the reference: this code replaces where those transforms RUN, not what # they produce. set -e cd "$(dirname "$0")/../.." DLX=${1:-tmp/rc_fr_singe_scsi_span.dlx} PX68K=${PX68K:-$HOME/src/px68k} ITER=${DLX_LOAD_ITER:-40} tools/vasm/vasmm68k_mot -Fbin -o tmp/loadgate.bin src/player/loadgate.s > /dev/null python3 tools/bench/prep_load.py "$DLX" > tmp/prep_load.log cat tmp/prep_load.log # 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_LOAD_ITER=$ITER SDL_VIDEODRIVER=dummy stdbuf -oL timeout -k 5 180 \ mame x68000 -bios ipl10 -ramsize 2M -video soft -window -sound none \ -nothrottle -plugins -autoboot_script ../tools/bench/load.lua \ -seconds_to_run 30 > load_check.log 2>&1 ) # A run that never reached the dump must fail as that, not as a byte mismatch. grep -q "^\[LOD\] done" tmp/load_check.log || { echo "FAIL: the load rig did not finish -- no completion marker." tail -6 tmp/load_check.log; exit 1; } grep -a "^\[LOD\]" tmp/load_check.log | sed -n '/summary/,$p' | sed 's/\[LOD\] / /' python3 tools/bench/verify_load.py "$DLX" if [ -f "$PX68K/m68000/c68k.c" ]; then make -s -C tools/bench/c68k PX68K="$PX68K" 2>/dev/null for M in 4 1 2 7 3; do tools/bench/c68k/c68k_bench --code tmp/loadgate.bin --loadraw tmp/load_data.bin \ --loadmode $M --loaditer 1 --cb1 8192 --cb4 2048 \ $([ $M = 3 ] && echo "--loaddump tmp/load_c68k.bin") 2>&1 >/dev/null \ | grep -av arena | sed 's/\[C68K\] / /' done # The second core's bytes are held to the same standard as the first's. cmp -s tmp/load_c68k.bin tmp/load_out.bin || { echo "FAIL: the two CPU cores produced DIFFERENT load-time output."; exit 1; } echo " OK both CPU cores produced the same $(stat -c%s tmp/load_out.bin) B" else echo " SKIPPED: no px68k at $PX68K (set PX68K= to point at a checkout)" fi