Last active
October 9, 2021 08:29
-
-
Save lhz/f877f9f331d70bd79270cf111039241a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Reload program and label definitions into a running x64sc session | |
# Send command to emulator's remote monitor | |
send () { | |
echo "$1" | nc -N localhost 6510 >/dev/null | |
} | |
# Verify command line parameters | |
if test "$#" -lt 2; then | |
echo "Usage: $0 <program-file> <labels-file> [start-address]" | |
exit 1 | |
fi | |
PROGRAM=$1 | |
LABELS=$2 | |
ADDRESS=$3 | |
# Reset emulator | |
send "reset" | |
# Wait a bit for reset to finish when starting via RUN | |
# Assumes a kernal patched to bypass memory test | |
if ! test -n "$ADDRESS"; then sleep 0.1; fi | |
# Load new program file into memory | |
send "load \"$PROGRAM\" 0" | |
# Update labels | |
send "clear_labels" | |
send "load_labels \"$LABELS\"" | |
if test -n "$ADDRESS"; then | |
# Start using supplied address | |
send "g $ADDRESS" | |
else | |
# Start by issuing RUN command using keyboard buffer | |
send "f 0277 027a 52 55 4e 0d" | |
send "f 00c6 00c6 04" | |
fi | |
# Set breakpoint extracted from @break label | |
BREAKPOINT="$(grep "@break" $LABELS | head -1 | cut -d' ' -f2)" | |
if ! test -z "$BREAKPOINT"; then | |
send "break $BREAKPOINT" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment