dale-8a

CHIP-8 emulator in POSIX AWK
git clone git://git.luxferre.top/dale-8a.git
Log | Files | Refs | README | LICENSE

dale8a.sh (475B)


      1 #!/bin/sh
      2 # Use the default awk in your OS:
      3 AWKENGINE=awk
      4 # or uncomment one of these:
      5 #AWKENGINE="mawk -W posix"
      6 #AWKENGINE="gawk -P"
      7 #AWKENGINE="busybox awk"
      8 ESC=$'\x1b'
      9 STTYSTATE="$(stty -g)" # save the stty-readable state
     10 trap cleanup 2 15 # trap Ctrl+C (SIGINT) and SIGTERM
     11 cleanup() { # restore the state of stty and screen
     12   printf '%s' "${ESC}[?47l"
     13   stty "$STTYSTATE"
     14 }
     15 LANG=C $AWKENGINE -f tgl.awk -f dale8a.awk -v CLOCK_FACTOR=20 -- $1 # run the emulator
     16 cleanup