-
-
Notifications
You must be signed in to change notification settings - Fork 100
Expand file tree
/
Copy pathtry.sh
More file actions
executable file
·69 lines (59 loc) · 1.47 KB
/
Copy pathtry.sh
File metadata and controls
executable file
·69 lines (59 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env bash
# try.sh - demonstrate IOCCC entry 2005/sykes
#
# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it
# this way allows us to have the user specify a different compiler in an easy
# way.
if [[ -z "$CC" ]]; then
CC="cc"
fi
make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
mode=0
# menu - show menu and prompt for input
menu()
{
echo "(0) Run demo" 1>&2
echo "(1) Show Easter egg" 1>&2
echo "(2) Play chess" 1>&2
echo "(3) Run test-suite" 1>&2
echo "(4) Run pet.rom with -1" 1>&2
echo "(5) Run IOCCC best emulator" 1>&2
echo "(Q) Quit" 1>&2
echo "NOTE: you have to hit ctrl-c or whatever your interrupt combination is to" 1>&2
echo "exit the program to continue here." 1>&2
read -rp "Make your selection: " mode
}
while true; do
# print menu and get item to run
menu
echo 1>&2
case "${mode}" in
0) # demo
printf "LOAD \"DEMO\"\nRUN\n" | ./sykes pet.rom 6
;;
1) # show old Easter egg
echo "WAIT 6502,12" | ./sykes pet.rom 6
;;
2) # chess
./sykes chess 6
;;
3) # test mode
make test
;;
4) # -1
./sykes pet.rom -1
;;
5) # best emulator of IOCCC 2005
printf "LOAD \"PET\"\nRUN\n" | ./sykes pet.rom 6
;;
q|Q)
exit 0
;;
*) continue
;;
esac
# this echo is for a quirk when pressing ctrl-c and showing the menu again
echo 1>&2
done