71 lines
3.1 KiB
Bash
Executable file
71 lines
3.1 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-atarist-serial-slot.sh - JL_SERIAL_SLOT opens a Mega STe's other
|
|
# serial ports through Bconmap.
|
|
#
|
|
# A Mega STe, TT, or Falcon has serial ports besides the Modem port (its
|
|
# SCC's two, the TT its second MFP's), and TOS 2 and EmuTOS map the AUX
|
|
# device onto any of them with XBIOS Bconmap. JL_SERIAL_SLOT unit n maps
|
|
# AUX to Bconmap device 5 + n while the port is open (src/atarist/serial.c);
|
|
# unit 2 is SCC channel B (Modem 2). SERSLOT (examples/sertest built with
|
|
# -DSERTEST_DEVICE=JL_SERIAL_SLOT -DSERTEST_UNIT=2u) opens it and sends its
|
|
# banner. Hatari writes what SCC channel B sends to a file (--scc-b-out; it
|
|
# has no SCC input, so this is the sending side only) and what the Modem
|
|
# port sends to another (--rs232-out, which Hatari opens only along with an
|
|
# input, here an empty file):
|
|
#
|
|
# 1. Mega STe: the banner comes out of SCC channel B, and nothing out of
|
|
# the Modem port.
|
|
# 2. A plain ST, whose one port is the Modem port: unit 2 does not open,
|
|
# so nothing comes out at all.
|
|
#
|
|
# Usage: scripts/verify-atarist-serial-slot.sh
|
|
# Requires: hatari, EmuTOS (install.sh install emulator:atarist); SERSLOT.PRG
|
|
# (built here: make -f make/atarist.mk build/atarist/test/SERSLOT.PRG)
|
|
set -uo pipefail
|
|
repo=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
|
|
source "$repo/scripts/lib/joeyEnv.sh"
|
|
joeyNeed HATARI hatari
|
|
joeyNeed EMUTOS_IMG emutos
|
|
label=verify-atarist-serial-slot
|
|
prog=$repo/build/atarist/test/SERSLOT.PRG
|
|
banner="JLSERTEST-READY"
|
|
wall=90 # hard cap on Hatari, whatever happens to this script
|
|
runVbls=900 # EmuTOS boot + SERSLOT open and banner: ~600 frames
|
|
|
|
make -s -f "$repo/make/atarist.mk" "$prog" || {
|
|
echo "$label: FAIL - building SERSLOT failed" >&2
|
|
exit 1
|
|
}
|
|
work=$(mktemp -d -t joeylib-st-serslot.XXXXXX)
|
|
trap 'rm -rf "$work"' EXIT
|
|
|
|
# run MACHINE -- SERSLOT on MACHINE; SCC channel B's output in
|
|
# $work/MACHINE.scc, the Modem port's in $work/MACHINE.mfp.
|
|
run() {
|
|
mkdir -p "$work/$1"
|
|
cp "$prog" "$work/$1/"
|
|
: > "$work/$1.scc"
|
|
: > "$work/$1.mfp"
|
|
: > "$work/empty.in"
|
|
SDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=dummy timeout -s KILL "$wall" "$HATARI" \
|
|
--machine "$1" --tos "$EMUTOS_IMG" --harddrive "$work/$1" --gemdos-drive C \
|
|
--drive-a off --drive-b off --sound off --fast-forward on --run-vbls "$runVbls" \
|
|
--scc-b-out "$work/$1.scc" --rs232-in "$work/empty.in" --rs232-out "$work/$1.mfp" \
|
|
--auto 'C:\SERSLOT.PRG' > "$work/$1.log" 2>&1
|
|
}
|
|
|
|
fails=""
|
|
run megaste
|
|
grep -q "$banner" "$work/megaste.scc" || fails="${fails}Mega STe: no banner out of SCC channel B; "
|
|
[ -s "$work/megaste.mfp" ] && fails="${fails}Mega STe: the Modem port sent $(wc -c < "$work/megaste.mfp") bytes; "
|
|
run st
|
|
[ -s "$work/st.scc" ] || [ -s "$work/st.mfp" ] && fails="${fails}plain ST: unit 2 opened something; "
|
|
if [ -n "$fails" ]; then
|
|
echo "$label: FAIL - ${fails%; }"
|
|
exit 1
|
|
fi
|
|
echo "$label: PASS (Mega STe: JL_SERIAL_SLOT unit 2 sends on SCC channel B, not the Modem port; plain ST: no unit 2)"
|