joeylib2/scripts/run-dos.sh

26 lines
695 B
Bash
Executable file

#!/usr/bin/env bash
# Launch the built DOS example in DOSBox. Defaults to PATTERN.
#
# scripts/run-dos.sh # runs PATTERN
# scripts/run-dos.sh hello # runs HELLO
# scripts/run-dos.sh keys # runs KEYS
set -euo pipefail
prog=${1:-pattern}
repo=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
bin_dir=$repo/build/dos/bin
case $prog in
hello) file=HELLO.EXE ;;
pattern) file=PATTERN.EXE ;;
keys) file=KEYS.EXE ;;
*) echo "usage: $0 [hello|pattern|keys]" >&2; exit 2 ;;
esac
if [[ ! -f "$bin_dir/$file" ]]; then
echo "$bin_dir/$file not built. Run 'make dos' first." >&2
exit 1
fi
exec dosbox -c "C:" -c "$file" -c "pause" --exit "$bin_dir"