emu.sh (621 bytes)
1 #!/bin/sh 2 # emu.sh IMAGE -- run the Z80 image in z80pack cpmsim, console on TCP 127.0.0.1:$PORT. 3 # Prints the emulator PID. The kernel waits for a connection before it prints its banner. 4 set -e 5 CPMSIM=${CPMSIM:-${Z80PACK:-$HOME/src/z80pack}/cpmsim/cpmsim} 6 PORT=${PORT:-4455} 7 IMG=$(cd "$(dirname "$1")" && pwd)/$(basename "$1") 8 RUN=/tmp/z80emu-$PORT # cpmsim reads ./conf/net_server.conf 9 mkdir -p "$RUN/conf" 10 printf '1 0 %s\n' "$PORT" > "$RUN/conf/net_server.conf" # console 1, no telnet, TCP port 11 cd "$RUN" 12 # -x loads the image (Mostek header: load at 0000). 13 "$CPMSIM" -x "$IMG" </dev/null >"$RUN/log" 2>&1 & 14 echo $!