;;;-*-Midas-*-

TITLE RIP Device -- replaces MLDEV for ITS machines that have passed away.

a=1
b=2
c=3
d=4
e=5

t=10
tt=11

p=17

call=pushj p,
return=popj p,
jcall==jrst
save=push p,
rest=pop p,

;;;Channels
boj==b

define syscall name,args
	.call [setz ? sixbit /name/ ? args(400000)]
termin

lpdl==100.
.vector pdl(lpdl)
.vector twenty(20)

go:	move p,[-lpdl,,pdl-1]
	move tt,[-2,,[	.roption,,a
			.rsuppr,,b
			]]
	.suset tt
	jumpl b,goset
	tlo a,%opojb
	.suset [.soption,,a]
	tlne a,%opddt
	 .value [asciz ""]
goset:	.open boj,[10\.bio,,'boj]
	 done			;he went away?
	move tt,[-12.,,args]
	.call jobcal
	 done			;he went away?
	tlne t,60000		;close? (?)
	 done
	jrst @opntbl(t)

opntbl:	offset -.
%joopn::	dna			;.open
%joiot::	urk			;.iot (?)
%jolnk::	dna			;mlink
%jorst::	urk			;.reset (?)
%jorch::	urk			;.rchst (?)
%joacc::	urk			;.access (?)
%jornm::	dna			;.fdele (delete or rename)
%jorwo::	urk			;.fdele (renmwo) (?)
%jocal::	urk			;.call (?)
	offset 0

urk:	jfcl
	 .lose

dna:	movsi t,%enadv
	.call joberr
	 done			;perhaps he punted
	done

.vector args(12.)

jobcal:	setz			;obtain arguments, aobjn in TT,
	sixbit /jobcal/		; <bits>,,<opcode> returned in T
	movei boj
	move tt
	setzm t

joberr:	setz			;error return, <ercode>,,0 in T
	sixbit /jobret/
	movei boj
	setz t

done=:call .
	.logout			;Only die if toplevel
	jfcl
	 .hang

cnstnts:
constants

variables

end go
