1
0
mirror of https://github.com/PDP-10/its.git synced 2026-01-11 23:53:12 +00:00
This commit is contained in:
Lars Brinkhoff 2024-06-13 12:50:32 +02:00
parent dc2f5a1740
commit 1849815e6a
4 changed files with 62 additions and 19 deletions

View File

@ -1,3 +1,7 @@
bell_msg ""
msgminwait 0
msgwait 1
# Make F9 the new command key.
bindkey -k k9 command
escape ""

View File

@ -9,6 +9,8 @@
# Short-Description: PiDP-10 emulator
### END INIT INFO
verbose=message
HOME="/home/lars/src/its2"
MCHN="$HOME/build/mchn/PT"
TOOLS="$HOME/tools"
@ -17,16 +19,24 @@ PID="$HOME/pidp10.pid"
action="$1"
fail() {
message() {
echo "$1" 1>&2
}
fail() {
message "$1"
exit 1
}
expect() {
text="$1"
timeout="${2:-10}"
i=0
while :; do
grep -q "$text" "$LOG" && return
sleep 0.5
grep -q "$text" "$LOG" && return 0
i=`expr $i + 1`
test $i -ge $timeout && return 1
sleep 1
done
}
@ -42,11 +52,13 @@ case "$action" in
status)
status_screen || fail "PiDP-10 is down."
status_emulator || fail "PiDP-10 is down."
echo "PiDP-10 is up." 1>&2
message "PiDP-10 is up."
;;
start)
cd "$HOME"
$verbose "Starting PiDP-10 screen."
screen -c "$MCHN/pidp10.screen" -dmS pidp10
$verbose "Starting DSKDMP."
screen -S pidp10 -X logfile flush 1
screen -S pidp10 -X select 0
screen -S pidp10 -X title "SIMH control console"
@ -56,13 +68,30 @@ case "$action" in
screen -S pidp10 -X logfile "$LOG"
screen -S pidp10 -X log on
screen -S pidp10 -X title "KA10 console teletype"
expect "DSKDMP"
screen -S pidp10 -X log off
rm -f "$LOG"
screen -S pidp10 -X logfile "$HOME/ka10.log"
screen -S pidp10 -X log on
if expect "DSKDMP"; then
$verbose "Starting ITS."
screen -S pidp10 -X stuff "ITS\r"
screen -S pidp10 -X stuff "\033G"
if expect "IN OPERATION" 20; then
$verbose "ITS in operation."
screen -S pidp10 -X log off
rm -f "$LOG"
screen -S pidp10 -X log on
screen -S pidp10 -X logfile "$HOME/ka10.log"
exit 0
else
fail "ITS failed to start."
fi
else
fail "DSKDMP not started."
fi
# Something failed, shut everything down.
if status_emulator; then
kill `cat "$PID"` 2>/dev/null; sleep 1
status_emulator && kill -9 `cat $PID` 2>/dev/null
fi
screen -S pidp10 -X quit
;;
stop)
cd "$HOME"
@ -71,25 +100,32 @@ case "$action" in
screen -S pidp10 -X select 1
screen -S pidp10 -X logfile "$LOG"
screen -S pidp10 -X log on
$verbose "Shutting down ITS."
"$TOOLS/chaosnet-tools/shutdown" its
expect "NOT IN OPERATION"
expect "SHUTDOWN COMPLETE"
expect "NOT IN OPERATION" || fail "ITS failed to shut down."
$verbose "ITS not in operation."
expect "SHUTDOWN COMPLETE" 60 || fail "ITS failed to shut down."
$verbose "ITS shutdown complete."
screen -S pidp10 -X log off
rm -f "$LOG"
screen -S pidp10 -p0 -X stuff "\034"; sleep 1
screen -S pidp10 -p0 -X stuff "quit\r"; sleep 1
screen -S pidp10 -X quit
$verbose "Quitting KA10 emulator."
screen -S pidp10 -X select 0
screen -S pidp10 -X stuff "\034"; sleep 1
screen -S pidp10 -X stuff "quit\r"; sleep 1
if status_emulator; then
$verbose "Emulator still running; forcibly killing it."
kill `cat "$PID"` 2>/dev/null; sleep 1
status_emulator && kill -9 `cat $PID` 2>/dev/null
fi
rm -f "$PID"
$verbose "Stopping PiDP-10 screen."
screen -S pidp10 -X quit
;;
restart)
$MCHN/pidp10.sh stop
$MCHN/pidp10.sh start
;;
*)
echo "Unknown action: $action" 1>&2
message "Unknown action: $action"
;;
esac

View File

@ -1,4 +1,4 @@
set console wru=034
#set console wru=034
set cpu its
set cpu 1024k
set cpu idle

View File

@ -112,4 +112,7 @@ while test -n "$1"; do
done
tools/sims/BIN/pdp10-ka out/pdp10-ka/run
exit 0
#pid=$!
#echo $pid > pidp10.pid
#wait $pid
#exit 0