47 lines
1.4 KiB
Bash
Executable file
47 lines
1.4 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Launch the built Atari ST example in Hatari. Defaults to PATTERN.
|
|
# Hatari autostarts the .PRG via the --auto flag; EmuTOS
|
|
# (toolchains/emulators/support/emutos-512k.img) provides the TOS ROM
|
|
# since the Ubuntu hatari package does not bundle one.
|
|
#
|
|
# scripts/run-atarist.sh # runs PATTERN.PRG
|
|
# scripts/run-atarist.sh hello # runs HELLO.PRG
|
|
# scripts/run-atarist.sh draw # runs DRAW.PRG
|
|
#
|
|
# Argument is any built example name (case-insensitive); the script
|
|
# upper-cases it and appends .PRG, then checks the file exists.
|
|
|
|
set -euo pipefail
|
|
|
|
if [[ $# -gt 1 ]]; then
|
|
echo "usage: $0 [example-name]" >&2
|
|
exit 2
|
|
fi
|
|
|
|
prog=${1:-pattern}
|
|
repo=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
|
|
bin_dir=$repo/build/atarist/bin
|
|
file=${prog^^}.PRG
|
|
|
|
tos=$repo/toolchains/emulators/support/emutos-512k.img
|
|
|
|
if [[ ! -f "$bin_dir/$file" ]]; then
|
|
echo "$bin_dir/$file not built. Run 'make atarist' first." >&2
|
|
if compgen -G "$bin_dir/*.PRG" > /dev/null; then
|
|
echo "available examples in $bin_dir:" >&2
|
|
ls "$bin_dir"/*.PRG | xargs -n1 basename >&2
|
|
fi
|
|
exit 1
|
|
fi
|
|
if [[ ! -f $tos ]]; then
|
|
echo "TOS ROM missing: $tos" >&2
|
|
echo "run ./toolchains/install.sh (EmuTOS should have been staged)." >&2
|
|
exit 1
|
|
fi
|
|
|
|
# Hatari's --auto needs the target on a mounted GEMDOS drive.
|
|
exec hatari \
|
|
--tos "$tos" \
|
|
--harddrive "$bin_dir" \
|
|
--gemdos-drive C \
|
|
--auto "C:\\$file"
|