qemu.sh 494 B

12345678910111213141516
  1. #!/bin/sh
  2. set -e
  3. FILE=$1
  4. [ -z "$FILE" ] && FILE=test1.lisp
  5. [ -r "$FILE" ] || (echo "cannot read file: $FILE"; exit 1)
  6. SIZE=$(wc -c "$FILE" | cut -d' ' -f1)
  7. QEMU="qemu-system-x86_64"
  8. QIMG="-drive file=../bin/sectorlisp.bin,index=0,if=floppy,format=raw -boot a"
  9. QMON="-monitor tcp:127.0.0.1:55555,server,nowait"
  10. trap 'echo quit | nc -N 127.0.0.1 55555' EXIT
  11. cat "$FILE" | tr '\n' '\r' | ./tcat | \
  12. $QEMU -display curses -net none $QMON $QIMG &
  13. PID=$!
  14. SECS=$((1 + SIZE * 40 / 1000))
  15. sleep $SECS