69 lines
2.9 KiB
Bash
Executable file
69 lines
2.9 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-serial-scb.sh - X68000 RS-232C receive (and the mouse) under a
|
|
# per-line palette change: the SCB raster interrupt and the SCC together.
|
|
#
|
|
# The X68000 port honours the SCB by reloading the text plane's one palette as
|
|
# the beam scans (src/x68000/x68kRasterIsr.s). A palette change on every line
|
|
# keeps that interrupt at IPL 6 for the whole run, about one raster (31.8 us)
|
|
# a change plus two rasters of lead, and the SCC is IPL 5, so every byte that
|
|
# arrives in the run waits in the Z8530's receive FIFO. No handler can let the
|
|
# SCC in between the lines of such a run: a line has at most ~100 cycles spare
|
|
# after the reload and the SCC receive handler takes ~340, so receive is
|
|
# loss-free only while a run is shorter than the FIFO lasts at the line rate
|
|
# (see "Serial under a dense SCB" in claudeDocs/x68000_port.md for the limits
|
|
# and the measurements).
|
|
#
|
|
# This runs verify-x68000-serial-mouse.sh -- both streams byte-exact, the mouse
|
|
# corners and buttons, the pause and resume -- with examples/sermouse built
|
|
# for a dense SCB (stage lines 0 .. n-1 alternating between two palettes) at
|
|
# 9600, 19200 and 38400 baud, each with a run of back-to-back changes well
|
|
# inside what the gate's emulated FIFO survives (JOEY_Z80SCC_RX_FIFO=3, which
|
|
# holds two bytes in MAME 0.264's z80scc -- one fewer than the chip; the
|
|
# measured edge is 64, 16 and 8 lines passing, 96, 32 and 16 failing):
|
|
# 9600 baud 48 lines ~1.6 ms held a frame
|
|
# 19200 baud 16 lines ~0.6 ms
|
|
# 38400 baud 8 lines ~0.3 ms
|
|
#
|
|
# Usage: scripts/verify-x68000-serial-scb.sh
|
|
# Env: X68K_SERIAL_SCB_PORT first TCP port for the null_modem (default 6802;
|
|
# each rate takes the next)
|
|
# Requires: what verify-x68000-serial-mouse.sh requires, and the X68000
|
|
# toolchain (it builds its variants of examples/sermouse).
|
|
set -uo pipefail
|
|
|
|
repo=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
|
|
port="${X68K_SERIAL_SCB_PORT:-6802}"
|
|
|
|
# rate, back-to-back palette changes
|
|
runs="9600 48
|
|
19200 16
|
|
38400 8"
|
|
|
|
fail=0
|
|
skip=0
|
|
while read -r baud dense; do
|
|
echo "=== verify-x68000-serial-scb: $baud baud, $dense lines changing palette every line ==="
|
|
X68K_SERMOUSE_PORT="$port" X68K_SERMOUSE_BAUD="$baud" X68K_SERMOUSE_DENSE="$dense" \
|
|
bash "$repo/scripts/verify-x68000-serial-mouse.sh"
|
|
rc=$?
|
|
if [ "$rc" -eq 2 ]; then
|
|
skip=1
|
|
elif [ "$rc" -ne 0 ]; then
|
|
fail=1
|
|
fi
|
|
port=$((port + 1))
|
|
done <<< "$runs"
|
|
|
|
if [ "$fail" -ne 0 ]; then
|
|
echo "verify-x68000-serial-scb: FAIL" >&2
|
|
exit 1
|
|
fi
|
|
if [ "$skip" -ne 0 ]; then
|
|
echo "verify-x68000-serial-scb: SKIP - a prerequisite is missing (see above)" >&2
|
|
exit 2
|
|
fi
|
|
echo "verify-x68000-serial-scb: PASS (receive byte-exact and the mouse right under per-line palette changes at 9600, 19200 and 38400)"
|