md2teach/md2teach/make/launchEmulator
Jeremy Rand effa777037 Improve the pure text output of the converter. It now handles numbered and unnumbered lists. It adds a horizontal line for HR. Spacing is better between blocks. It no longer inserts a leading blank line at the top of the document.
I have extended the execution rule to put the resulting text file onto a disk image and launch an emulator so I can see the text file on the target machine.  This should make iteration easier.

Even though I am asking to print carriage returns in the output, I am getting line feeds.  Now sure what is doing the translation.  It could be the ORCA standard library (not likely) or Golden Gate (maybe).  I should next change to direct use of GS/OS for the writes and avoid the ORCA library anyway.
2021-04-21 00:00:01 -04:00

85 lines
1.5 KiB
Bash
Executable File

#!/bin/sh
TMPDIR="/tmp/a2gs_emulator.$$"
cleanupAndExit()
{
cd
if [ ! -z $PID ]
then
kill $PID 2> /dev/null
fi
rm -rf $TMPDIR
exit 0
}
createConfigTxt()
{
mkdir "$TMPDIR"
sed "s:^s7d1 *=.*$:s7d1 = $BOOTIMAGE:
s:^s5d1 *=.*:s5d1 = $DISKIMAGE:" < make/config.txt > "$TMPDIR/config.txt"
}
if [ $# -ne 2 ]
then
echo USAGE $0: diskimage bootimage
exit 1
fi
DISKIMAGE="$1"
if echo $DISKIMAGE | grep -v '^/' > /dev/null
then
DISKIMAGE="$PWD/$DISKIMAGE"
fi
BOOTIMAGE="$2"
if echo $BOOTIMAGE | grep -v '^/' > /dev/null
then
BOOTIMAGE="$PWD/$BOOTIMAGE"
fi
case "$EMULATOR" in
gsplus)
EMULATORPATH="$GSPLUS"
EMULATORARGS="$GSPLUSARGS"
EMULATORDIR="$TMPDIR"
createConfigTxt
;;
gsport)
EMULATORPATH="$GSPORT"
EMULATORARGS="$GSPORTARGS"
EMULATORDIR="$TMPDIR"
createConfigTxt
;;
mame)
EMULATORPATH="$MAME"
EMULATORARGS="$MAMEARGS -hard1 "$BOOTIMAGE" -flop3 "$DISKIMAGE""
EMULATORDIR="$MAMELIB"
;;
*)
echo Invalid emulator specified, \"$EMULATOR\"
exit 1
;;
esac
if [ ! -x "$EMULATORPATH" ]
then
echo Unable to find $EMULATOR at $EMULATORPATH
exit 1
fi
if [ ! -d "$EMULATORDIR" ]
then
echo Unable to find $EMULATOR library at $EMULATORDIR
exit 1
fi
cd "$EMULATORDIR"
# This magic ensure that clicking stop in Xcode results in the emulator terminating.
"$EMULATORPATH" $EMULATORARGS &
PID=$!
trap cleanupAndExit SIGTERM SIGINT SIGHUP EXIT
wait