joeylib2/scripts/run-atarist.sh

44 lines
1.3 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 keys # runs KEYS.PRG
set -euo pipefail
prog=${1:-pattern}
repo=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
bin_dir=$repo/build/atarist/bin
case $prog in
hello) file=HELLO.PRG ;;
pattern) file=PATTERN.PRG ;;
keys) file=KEYS.PRG ;;
joy) file=JOY.PRG ;;
sprite) file=SPRITE.PRG ;;
audio) file=AUDIO.PRG ;;
*) echo "usage: $0 [hello|pattern|keys|joy|sprite|audio]" >&2; exit 2 ;;
esac
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
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"