1
0
mirror of https://github.com/PDP-10/its.git synced 2026-02-02 15:01:04 +00:00

SHUTDN - Shut down ITS.

This commit is contained in:
Lars Brinkhoff
2018-06-18 11:42:37 +02:00
parent 5082e3b8dd
commit 7fe76db2d4
3 changed files with 225 additions and 0 deletions

220
src/bawden/shutdn.6 Executable file
View File

@@ -0,0 +1,220 @@
; -*- Midas -*-
title SHUTDN - Set ITS to shut down
a=:1
b=:2
c=:3
d=:4
e=:5
t=:6
tt=:7
x=:10
y=:11
z=:12
p=:17
..bch==:0,,-1
chttyi==:1
chttyo==:2
chdski==:3
%fr==:0,,525252
%fl==:1,,525252
call=:pushj p,
return=:popj p,
save==:push p,
rest==:pop p,
flose=:.lose %lsfil
slose=:.lose %lssys
pause=:.break 16,100000
tyi=:.iot chttyi,
tyo=:.iot chttyo,
quit=:call .
$quit: skipe debug
pause
.logout 1,
define bltdup org,len
move tt,[<org>,,<org>+1]
blt tt,<org>+<len>-1
termin
define syscall name,args
.call [setz ? .1stwd sixbit /name/ ? args(400000)]
termin
define conc foo,bar
foo!bar!termin
; JSP T,LOSE is like .LOSE %LSSYS(TT) or SLOSE (TT)
lose: syscall lose,[movei %lssys(tt) ? movei -2(t)]
slose
popj1: aos (p)
cpopj: return
datime"$$abs==:1
datime"$$in==:1
datime"$$out==:1
.insrt dsk:syseng;datime >
format"$$time==:1
format"datime==:datime"twdasc ; ~Q
format"time==:datime"twdasc ; ~:Q
format"date==:datime"twdasc ; ~@Q
format"$$pcode==:1
.insrt dsk:syseng;format >
outstr: syscall siot,[movei chttyo ? a ? b]
slose
return
define format &string&,args
call [
call $format
.zzz.==-1
irp arg,,[args]
save arg
.zzz.==.irpcnt
termin
hrroi a,[ascii string]
movei b,.length string
movni c,.zzz.+1
jrst format"format]
termin
$forma: save a
save b
save c
call @-3(p)
rest c
rest b
rest a
rest (p)
return
.vector pdl(lpdl==:100.)
usrvar: sixbit /OPTION/ ? tlo %opint\%opopc
sixbit /MASK/ ? move [%pipdl]
sixbit /OPTION/ ? movem a
lusrvar==:.-usrvar
go: move p,[-lpdl,,pdl-1]
.open chttyi,[.uai,,'tty ? setz ? setz]
slose
.open chttyo,[.uao\%tjdis,,'tty ? setz ? setz]
slose
move t,[-lusrvar,,usrvar]
syscall usrvar,[movei %jself ? move t]
slose
.scalar shutdn
.scalar mname
syscall sstatu,[movem shutdn ? repeat 5,[ ? movem mname]]
slose
.scalar time
syscall rqdate,[movem time]
slose
tlnn a,%opcmd
jrst nocmd
syscall open,[movsi %donrf\.uai ? movei chdski
[sixbit /SYS/] ? [sixbit /DOWN/] ? [sixbit /MAIL/]]
jrst nomail
.vector cmd(lcmd==:100.)
setzm cmd+0
bltdup cmd,lcmd
.break 12,[..rjcl,,cmd]
move d,[440700,,cmd]
.scalar dtime
call datime"asctwd
movem a,dtime
move b,time
call datime"timsub
caig a,5*60.
jrst badtim
format "~&Schedule ~S to go down at ~Q?",[mname,dtime]
tyi t
caie t,"y
cain t,"Y
jrst doit
quit
doit: move a,dtime
syscall rqdate,[movem b]
slose
call datime"timsub
caig a,5*60.
jrst badtim
imuli a,30.
skipn debug
.shutdn a,
format "~&Failed!"
quit
badtim: jumpl a,badtm1
format "~&~Q is too soon!",dtime
quit
badtm1: format "~&~Q has already passed!",dtime
quit
nomail: format "~&There is no SYS:DOWN MAIL"
quit
nocmd: skipge b,shutdn
jrst nocmd1
addi b,15.
idivi b,30.
move a,time
call datime"timadd
format "~&~S is going down at ~Q",[mname,a]
quit
nocmd1: aojl b,nocmd2
format "~&~S is not scheduled to go down.",mname
quit
nocmd2: format "~&~S is down!",mname
quit
intsv0==:t ; Save T
intsv9==:z ; Through Z
intsvn==:intsv9+1-intsv0
intctl==:400000+intsv0_6+intsvn ; control bits
intpc==:-<3+intsvn> ; INTPC(P) is PC before interrupt.
intdf1==:intpc-2 ; INTDF1(P) is .DF1 before interrupt.
intdf2==:intpc-1 ; INTDF2(P) is .DF2 before interrupt.
intrq1==:intpc-4 ; INTRQ1(P) are first word bits.
intrq2==:intpc-3 ; INTRQ2(P) are second word bits.
intac0==:intpc+1-intsv0 ; INTAC0+C(P) is C before interrupt.
tsint:
loc 42
-ltsint,,tsint
loc tsint
intctl,,p
ltsint==:.-tsint
dismis: setz ? sixbit /DISMIS/ ? movsi intctl ? setz p
cnst0:
constants
repeat <.-cnst0+77>/100, conc cnst,\.rpcnt,=:cnst0+.rpcnt*100
variables
debug: 0
patch::
pat: block 100.
epatch: -1 ; Make memory exist, end of patch area
ffaddr:
ffpage==:<ffaddr+1777>_-12
end go