                      
administrative routine  16 july 1971

dd2=163	/origin of core 7 C-lists
cc=303
bc=307
uc=313
dc=317
fdf=327
udf=330
rds=331
ubs=332
frp=333
cpp=334
qqt=336

c7=40000	/core 7

nuf>>40<<=20	/size of core 7 C-list
nqu>>40<<=44	/number of queues and enters

/process words

di1=6	/dia word
prn=7	/process ring
prq=11	/process queue
prs=13	/scheduling word

cms=6630	/origin of computation blocks
ffs=105	/file capability offset

dimension cmp(1),prc(1)
dimension ac(3)
io=ac+1
w=ac+2
dimension cpd(1),pdl(40)
pde=pdl+40
dimension t(1),t0(1),t1(1),t2(1),t3(1),t4(1),t5(1),t6(1),t7(1),t8(3)

/C-list indices used>>40<<.
/ 0-17 - entered process capabilities
/20-37 - disowned objects
/40-44 - ID sphere for consoles 2-6, if logged in
/62-66 - top level typewriters, consoles 2-6
/73    - scratch for fcl
/74    - console switches
/75    - scratch for login (call button)
/76    - scratch for garbage collector
/77    - queue

/cores used>>40<<.
/0 - program
/1 - attachment to own core 0 (for bashing C-list)
/2 - attachment to other cores 0 (ditto, set up by fcl)
/3 - attachment to ID (for login)
/4 - attachment to core 7

/flag 4 used for grant
/flags 5,6 used by rmv







                >>13<<d                                
/computation words

pss=11	/scheduling word
aw1=pss+1	/assignment word
bp1=13	/location of breakpoint
bp2=bp1+1	/proceed count
bp3=bp2+1	/instruction under breakpoint
ilr=bp3+1	/illegal instruction return
imr=ilr+1	/illegal memory reference return
sup=imr+1	/superior sphere
spe=sup+1	/fault entry to superior
be1=spe+1	/break enable
clw=be1+1	/chain of procs waiting to enter
con=clw+1	/pointer back to console
prh=con+2	/process hoard

define die
	jmp .
terminate














































                >>13<<5                                
/initial C-list
0/	repeat 62,0
/typewriters
62,	.z=740502	repeat 5,.z	.z>>40<<=.z+101
	repeat 5,0
74,	740002	/console switches
	0
	0
77,	340000+qqt+2-prq	/queue

100,	stf 1	/ivk
101,	jmp atm	/meta instruction
102,	jmp .	/ill inst in adm rt
103,	ivk 74	/wait for login/logout job
	jmp lgl-3

105,
frd1,	sd1+10	/free drum1 field list
nfd1,	0	/no. of drum fields on drum 1
ncd1,	0	/no. of core fields on drum 1
frd2,	sd2
nfd2,	0
ncd2,	0
113,
sd1,	repeat 10,add 1	/locked fields
	repeat 10,.+1
	sd1+23
sd1+21,	add 1
	add 1
	.+1
	.+2
sd1+25,	add 1
	repeat 51,.+1
	0
213,sd2,	repeat 77,.+1
	0





























                >>13<<s                                /login/logout processor

lgl-3,	iam
	eem
	dac new
lgl,	lac new
	xor old
	CAIM|
	jmp lgn
	SII
	A>>06<<IAI
	xor old
	dac old
	A>>06<<IX
	law 37
	rir 7s
	ril 1s
	SAA
	spi i
	jmp .-3
	dap vv1	/console number+36
	sal 4s	/xnuf
	add (dd2-40xnuf
	dac t99	/core 7 C-list
	law i 36
	add vv1
	rar 3s
	dip t99	/console no.
	TXP
	jmp on	/login
noc,	lac vv1
	mta 204	/delete ID and user
	jmp lgl

lgn,	lac old
	jmp 103






























                >>13<<,                                
on,	lac vv1
	lxr (ivk 44 ide
	XMAI	/entry address
	mta 302	/create ID
	jmp noc
	lio (030000
	law 52
vv1,	ivk	/attach it
	die
	mta 1
	cla
	lio (250000
	mta 104	/read a copy of ID
	jmp .-1
	law 412	/create a process for ID
	xct vv1
	jmp noc
	law idp	/initialize process state
	mta
	law 132
	lio (1
	xct vv1
	die
	lac (403572	/turn on PRL for ID
	xct vv1
	lac vv1
	sub (ivk 35
	ior (740000
	aam
	dac (i 75	/create call button
	lio (7577
	law 632
	xct vv1	/share it to ID
	die
	lac vv1
	sub (ivk 40-2
	ral 6s	/console no.
	ior (50000
	mta
	lac (306572
	xct vv1	/create twr
	jmp noc	/too bad
	sza
	die
	lac vv1
	sub (ivk-i
	TAX
	law 7777
	and i 0
	ior (c7
	TAX
	lac t99
	dap i con	/give ID a core 7 C-list
	dip i aw1
	lio (100
	law 14
	mta
	lac (302572
	xct vv1	/create user for ID






                >>13<<>>34<<                                	jmp noc
	law 7777
	A>>06<<IA
	ior (c7
	TAX
	lac t99
	dap i con	/give user a core 7 C-list
	dip i aw1
	law 32
	xct vv1	/start ID running
	jmp lgl























































                >>13<<f                                
/entry from ID
ide,	SXX	/console 6 entry
	SXX	/5
	SXX
	SXX
	swp
	sas (13
	die
	isp z
	jmp idr
	law 40
	A+XA
	mta 204	/delete ID
	lai
	mta 204	/flush e.p.c.
idz,	law i 1
	adm z
	qit

idr,	lai
	lok
	dap . 2
	law 51
	ivk	/restart
	jmp idz	/depends on process chain working

z,	add-2

/initial process state for ID

idp,	0	102	0
	0	0	0

old,	0
dimension new(1),t99(1)






























                >>13<<(                                
/queue and enter list

frq,	qqf+15.
qqf,	1	/microtape controller queue
	1	/adm rt queue
	1	/microtape enter
	1	/adm rt enter
	1	/ditto
	repeat 5,2	/typewriters
	repeat 5,1	/ditto
qqf+15.,	repeat nqu-16.,.+1
	0

/file list

frf,	fff	/free files
fff,	repeat 0,.+1
	0

/sphere list

frc,	ccf+2
ccf,	1	/adm rt
	1	/tape controller
	repeat 14,.+1
	0

/hardware device table

iif,	0
	1	/drum A
	1	/drum B
	repeat 15,0
iif+20,	1	/microtape unit control
	1	/microtape data control
	repeat 55,0
iif+77,	1	/microtape motion control

/microtape table

mtu,	repeat 4,0

rdr,	0	/reader
pch,	0	/punch

/tables to rotate translation word

r1,	ril 3s	ril 6s	ril 9s
	rir 6s	rir 3s
r2,	nop















                >>13<<g                                
aqr,	lac ac	/arq processor
	lxr (cod-cde
	sad i cde
	jmp arf
	SXXP
	jmp .-3
	TAI>P
	cmi
	law flexo  q 
	A~II
	law i 7
	A>>06<<IP
	jmp ill
	law 7	/q1 to q7
	A>>06<<IAP|
	jmp ill
	sub (10
	TAX
	SAA|
	ral 1s
	SXXP
	jmp .-2
	lxr cmp
	lio ac
	spi i
	jmp pq
mqn,	stf 4	/dismiss
	cma
	and i aw1
	jmp ppr
pq,	lio i aw1	/assign
	cmi
	A>>06<<IAI
	and xaw
	sza
	jmp no	/can't
	lai
	ior i aw1
ppr,	lia
	xor i aw1
	xor xaw
	dac xaw
	dio i aw1
	szf 4
	jmp no
yes,	law i 1
	adm t0
no,	lac t0
	TAP
	jmp rts
	jmp rtm

arf,	lac i cdm
	dac . 2
	lxr cmp
	jmp .

cod,	flexo  ax
	flexo  sx






                >>13<<                                 	-flexo   x
	-flexo   q
cde,	jmp pax
	jmp sax
	jmp max
	jmp mq
cdm,



























































                >>13<<f                                
/+ax
pax,	ZIP

/+sx
sax,	lio (400000
	jsp dxr	/crock
	lac xrw
	TAAP
	A>>06<<IP
	jmp .+2
	jmp no
	SAA
	A>>05<<II
	law 200
	adm i aw1
	dio xrw
	jmp yes

/-x
max,	law no

dxr,	dap drx	/dismiss external reg., XR >>20<< sphere
	law i 200
	and i aw1
	sad i aw1
	jmp drx
	dac i aw1
	law i 1
	adm xrw
	sad (400000
	dzm xrw
drx,	jmp .
xrw,	0	/ext. reg. word

/-q
mq,	law no

dxe,	dap dxx	/dismiss external eq., XR >>20<< sphere
	lac i aw1
	xor xaw
	dac xaw
	law i 177
	and i aw1
	dac i aw1
dxx,	jmp .

xaw,	0	/external assignment word


















                >>13<<>>76<<                                
/create capability

cra,	0
	dac t8
	lio io
	dio t8+1
	jdp chc
	lac i 0
	TAIP|
	jmp ca2
	sas t2	/not free
	jmp cay
	SXX	/asked for zero
	idx t2
	sad cls
	jmp cay	/full
	lac i 0
	TAIP
	jmp .-6
ca2,	lac t2
	dac ac
	adm clp
	jmp i cra

rtz,	cli
cay,	dio io
	jmp rtm

/find capability in low 6 bits of AC
/of sphere in cmp
/return pointer in AIX
chc,	0
	and (77
	dac t2
	law 7777
	and cmp
	jdp fcl
	sub t2
	TA>
	jmp ill	/index exceeds C-list size
	lac t2
	add clp
	TAAIX
	jmp i chc





















                >>13<<3                                
/meta instructions and ivks
/transmitted word = 0 for arq, 1 for arq i,
/20>>40<<<T>>40<<<77 for meta
/T = capability index for ivks

atm,	iam
	eem
	TAX
	isp f
	ivk 177	/enter queue
	TXA
	dio t0
	dap enp	/entered process capability
	ior (10000
	TAX
	law 7777
	and i 0
	ior (c7
	dac prc	/7pointer to process
	TAX
	sad i prn+1
	jmp ill	/process has been abandoned
	lac i 5
	dac cmr	/0pointer to sphere
	ior (c7
	dac cmp	/7pointer to sphere
	TAX
	lio i con
	law 51
	spi
	jmp enp	/sphere is stopped, have process continue
	lio (ac
	law 11
	xct enp	/read live registers

	law 77
	and t0
	szf 1
	jmp iv2	/ivk
	sas (1
	sza i
	jmp aqr	/arq
mtb,	law i 20	/meta
	add t0
	TAAX>P
	jmp ill
	sub (mte-mtl
	sma
	jmp ill	/illegal number
	lac i mtl
	dac mtc
	lxr cmp
	lac ac
mtc,	0
rta,	dac ac
rtm,	lio (ac	/return, no skip
	law 31
	xct enp
	law 71






                >>13<<>>32<<                                enp,	ivk
	law i 1
	adm f
	SA>>40<<>
	ivk 277	/release queue
	qit

ill,	law 111	/cause illegal instruction
	jmp enp
f,	add-2
























































                >>13<<>>76<<                                
mtl,	lac i ilr	/read ill inst ret
	dac i ilr	/set  ill inst ret
	lac i imr	/read ill mem ref ret
	dac i imr	/set  ill mem ref ret
	jmp m24
	jmp m25
	jmp m26
	jmp m27
	jmp m30
	jmp ill
	jmp m32
	jmp m33
	jmp m34
	jmp m35
	jmp m36
	jmp m37
	jmp m40
	jmp m41
	jmp m42
	jmp m43
	jmp m44
	jmp m45
	jmp m46
	jmp m47
	jmp m50
	jmp m51
	jmp m52
mte,





































                >>13<<0                                
/mta 204 - release capability

m24,	jdp chc
	lac i 0
	dzm i 0
	sza
	jdp rmv
	jmp rtm

/mta 205 - detach

m25,	and (070000
	ral 6s
	sza i
	lac ac
	and (7
	dac t4
	sub (6
	sma
	jmp rts	/if illegal, ok
	lac cmp
	dac t0
	add t4
	dac t2
	TAX
	law i 3777
	and i 1
	sza
	jmp rtm	/is a real core, fail
	jsp exm
	jdp dtc
rtl,	jsp lxm
rts,	lio (ac	/return, skip
	law 31
	xct enp
	law 131
	jmp enp




























                >>13<<h                                
/mta 206 - read memory bound

m26,	law i 6
	dac t3
	dzm t1
	dzm t2
rd1,	lac t2
	adm t2
	law i 3777
	lio i 1
	sni
	jmp rd3
	A>>06<<IP
	isp t1	/real core
	idx t2	/attachment
rd3,	SXX
	isp t3
	jmp rd1
	lac t1	/memory bound
	rar 6s
	ior t2	/attachments
	jmp rta

/mta 207 - set memory bound

m27,	and (070000
	ral 6s
	sza i
	lac ac
	and (7
	dac t5
	sza
	sub (7
	spa
	jdp smb
	jmp rtm
	jmp rts




























                >>13<<>>60<<                                
/mta 300 - create drum field

m30,	jdp cra
	lac t8
	spa
	jmp 30b
	lac nfd1
	sub nfd2
	jdp gaf
	idx i nfd1
	lai
	add (050000-sd1
cap,	jda gcp	/put capability in AC into io and C-list
	jmp .+6	/and bump count
	law 377
	and i 0	/ref count
	sad (377
	jmp rtz	/too big
	idx i 0
	lac gcp
	dac io
	aam
	dac clp
	szf i 4
	jmp rts
	jdp xch	/finish up grant
	lac t8+1
	rar 6s
	jdp chc
	lac i 0
	dzm i 0
	jdp rmv
	jmp rts

/get an absolute field, read-only
30b,	rar 6s
	and (177
	add (040000
	jmp cap


























                >>13<<o                                
/get a drum field
/if A >>40<<< 0, try to use drum 1
/return pointer in I

gaf,	0
	TA>>40<<<
	law frd2-frd1	/try drum 2
	TAX
	lac i frd1
	TAP|
	law frd2-frd1	/full, try the other drum
	A~XX
	lac i frd1
	TAIP|
	jmp rtz	/too bad
	aam
	lac i frd1
	aam
	dzm i frd1
	dac i frd1
	jmp i gaf












































                >>13<<>>32<<                                
/mta 302 - create sphere

m32,	jdp cra
	lac cmr
	dac cmq
	lac frc
	sza i
	jmp rtz	/can't
	mul (30>2
	lai
	add (cms-ccfx30
	dac cmr
	dac cmr+1
	lxr (c7
	A>>05<<XX
	add (clw-prq
	dac iss+clw
	lac t8+1
	and (077777
	dac iss+spe
	law iss
	dap .+1
	lac	/set up initial state
	dac i 0
	idx .-2
	SXX
	sas (lac iss+30
	jmp .-5
	law 1
	dac t5	/initial memory bound
	jdp smb
	jmp rtz
	lac cmr
	ior (250000
	lxr frc
	lio i 0
	dzm i 0
	dio frc
	jmp cap

/initial sphere state

iss,	666666
repeat 6,0
cmr,	0
cmr+1,	0
	0
	4000
	-0
	0
	0
	-0
	-0
cmq,	0
iss+spe,	0
	0
iss+clw,	.-prq
iss+con,	400000
	0






                >>13<<-                                iss+prh,	0
	-30	/hack
































































                >>13<<1                                
/mta 303 - create queue

m33,	jdp cra
	jdp crq
	add (340000
	dac io
	sub (340000
	dac i prq+1	/initialize it
	lio t8+1
	TII<
	CII=
	lai
	dac i prq
	lac io
	jmp cap

/create queue,twr,enter
/object index in IO, object 0pointer-prq in AC
/7pointer-prq in XR

crq,	0
	lac frq
	TAIXP|
	jmp rtz	/can't get one
	lac i 0
	dzm i 0
	dac frq
	law i qqf
	A+IAI
	sal 1s
	add (qqt-prq
	lxr (c7
	X>>05<<AX
	jmp i crq

m34,	jmp ill

/mta 305 - create file

m35,	jdp cra
	lac frf
	sza i
	jmp rtz
	mul (3
	scr 1s
	lai
	add (ffs+540000-fffx3
	lxr frf
	lio i 0
	dzm i 0
	dio frf
	jmp cap













                >>13<<g                                
/mta 306 - create IO device

m36,	jdp cra
	lac t8
	ral 6s
	and (7
	TAX
	law 7700
	and t8
	rar 6s
	xct i .+1
	jmp 36a
	jmp 36c
	jmp 36d
	jmp 36e
	jmp 36f
	jmp 36g
	jmp ill
	jmp 36b

36a,	TAX	/microtape
	law i 4
	A+X>>40<<>	/skip if bad unit
	lac i mtu
	X>>20<<AP
	jmp rtz	/not available
	ior (740200
	jmp cap

36c,	and (1	/buttons
	ior (740000
	jmp cap

36e,	lio rdr	/reader
	A>>20<<IAP
	jmp rtz
	aam
	dap (c7 rds
	rcr 1s
	rar 5s
	A+XX
36d,	lac (740006	/clock
	A+XA
	jmp cap

36f,	lio pch	/punch
	TIP
	jmp rtz
	jmp 36d

36g,	lio (7	/typewriter
	AMI<
	jmp rtz	/>>40<<> 7
	lxr (-2
	A+XIX>P
	jmp rtz	/<2
	law 377
	and i qqf+10.
	sas (1






                >>13<<8                                	jmp rtz	/in use already
	lai
	mul (101
	scr 1s
	lai
	add (701202
	jmp cap

36b,	TAAX
	lio i iif
	sni i
	jmp rtz	/not available
	ior (600000
	jmp cap

/mta 307 - create entry

m37,	jdp cra
	jdp crq
	lac cmr
	dac i prq
	lac t8+1
	and (077777
	dac i prq+1
	law 7500
	A>>05<<IA
	ral 6s
	jmp cap






































                >>13<<f                                
/mta 400 - read capability

m40,	jdp chc
	lac i 0
	jmp rta

/mta 401 - exchange capabilities

m41,	jdp chc
	dac t1
	lac ac
	rar 6s
	jdp chc
	lac i 0
	aam
	lio t1
	aam
	dac t1
	dio i 0
	jmp rtm













































                >>13<<>>34<<                                
/mta 402 - turn PRL off

m42,	lxr cmp
	lac (200000
	adm i con
	ral 2s
	sma
	jmp 42d	/already off
	lac cmr
	jdp fcl	/set up c0 C-list
	jdp fud
	lac cmr	/clear C-list
	ior (240000
	jda gcp
	die
	dio t8
	dzm t8+1
	jmp .+3

	lac gcp
	jdp rmv
	stf 5
	lxr (t8
	jdp ssr	/uses t8+2
	jmp .-5	/delete capability
/cmr is now clobbered
	lxr cmp
	lac (-100000
	adm i con
42b,	law 7777	/clear prl bit from all processes
	and i prn
	ior (c7
	sad cmp
	jmp 42d
	TAX
	lac (-010000
	and i 4
	dac i 4
	jmp 42b
42d,	lxr cmp
	lac (-200000
	adm i con
	law clw-prq
	add cmr
	mta 101
	jmp rtm



















                >>13<<x                                
/exchange c0 (attached by clp) with c7 (if any)
/of sphere in cmp

fud,	0
	lxr cmp
	law 7777
	and i con
	sza i
	jmp i fud	/no c7 C-list
	ior (c7
	dac t3
	nam
	lio i clp
	lac i t3
	dac i clp
	dio i t3
	idx t3
	idx clp
	sas (020000+nuf
	jmp .-7
	iam
	jmp i fud











































                >>13<<9                                
/mta 403 - turn on PRL

m43,	lxr cmp
	lac (200000
	adm i con
	ral 2s
	spa
	jmp 42d	/already on
	jsp exm
	lxr cmp
	lac (100000
	adm i con
43b,	law 7777	/turn on PRL for each process
	and i prn
	sad cmr
	jmp 43c
	ior (c7
	TAX
	lac (010000
	ior i 4
	dac i 4
	jmp 43b

43c,	law 43f
	dac ct1
	lac cmr
	dac t
	lxr cmp
	lio i 1
	xor i 1
	and (3777
	xor i 1
	dac i 1
	law 3777
	A>>06<<IA
	jmp ct2	/force off attachments (too bad)
43f,	jsp lxm
	lac cmr
	jdp fcl
	lxr (020000	/=clp
	dzm i 0	/clear c0 C-list
	SXXA
	sas (020100
	jmp .-3
	jdp fud	/copy c7 C-list
	jmp 42d



















                >>13<<n                                
/mta 404 - count items in C-list

m44,	lac cmr
	jdp fcl
	sza i
	jmp ill	/no C-list
	lxr clp
	adm clp
	dzm ac
	lac i 0
	sza
	idx ac
	SXXA
	sas clp
	jmp .-5
	jmp rtm

/mta 405 - share with self

m45,	lac cmr
	dac cmp
	jmp c61











































                >>13<<k                                
/mta 406 - read hoard
m46,	dzm t0
m46+1,	jsp exm
	lxr cmp
	lac i prh
	TAAI>
	jmp n46
	ZI
	SII
	ior (c7
	TAX
	lac i 0
	sza
	jmp .-5
n46,	lac cmr
	dac cmq
	jmp c45+5

/mta 407 - set hoard
m47,	law i 2
	dac t0
	jmp m46+1

n47,	lac ac
	spa
	law 0	/minimum hoard
	lxr cmp
	AMII>>40<<<
	jmp p47
q47,	SII>>40<<<
	jmp rtl
	lac i prh
	spq
	jmp r47
	dac t0	/decrease hoard
	ior (c7
	dac t1
	aam
	lac t1
	dac i prh
	aam
	lac (c7 frp
	aam
	dac t1
	lac t0
	aam
	dac (c7 frp
	jmp q47

r47,	law i 1	/increase debt
	A+IA
	adm i prh
	jmp rtl

p47,	lac i prh
	sma
	law 0
	A+IA>>40<<<
	jmp .+3






                >>13<<c                                	dac i prh	/decrease debt
	jmp rtl
/increase hoard
/A = no. of procs needed from pool
	CAI
	lac i prh
	spa
	law 0
	dac t1
	aam
	lac (c7 frp
	sza i
	jmp rlt	/too bad
	ior (c7
	TAX
	lac i 0
	SIIP
	jmp .-6
	lio t1
	dio i 0
	aam
	lio (c7 frp
	lxr cmp
	dio i prh
	aam
	dac (c7 frp
	jmp rtl

/mta 500 - assign and deassign random system crocks

m50,	dzm t0
	ral 6s
	and (7
	TAX
	lac i m5t
	dac .+4
	law 177
	and ac
	lxr cmp
	0
m5t,	jmp pq
	jmp mqn
	jmp sax
	jmp pax
	jmp max
	jmp ill
	jmp ill
	jmp ill


















                >>13<<f                                
/mta 501 - disown

m51,	lac (010020
	dac t1
m51+2,	law 0
	aam
	sad t1
	jmp p51
	idx t1
	sas (010040
	jmp m51+2
	jmp rtz	/too bad

p51,	lac t1
	xor io
	and (77
	xor io
	dac io
	law cms	/adm rt
	dac cmp
	jmp c65

/mta 502 - claim

m52,	law 7700
	and io	/index in adm rt
	lio (2000
repeat 2,AMIA<M
	jmp rtz
	law cms
	dac cmp
	jmp c67

































                >>13<<v                                
iv2,	jdp chc
	dio clp	/pointer to capability
	lio i 0
	law 7777
	A>>06<<IAP|
	jmp ill
	dac cmq	/low 12 bits of capability
	TIA
	rcl 3s
	TIX
	lac ac
	rcr 3s
	xct i .+1

	jmp ill	/0
	jmp ill	/1
	jmp ifs	/2 - sphere
	jmp ifq	/3 - queue
	jmp ill	/4
	jmp ill	/5
	jmp ill	/6
	jmp ift	/7 - entry, typewriter

ifs,	rar 1s	/sphere ivk
	sma
	die
	and (77
	TAX
	lac cmr
	dac cmp	/sphere executing the ivk
	lac cmq
	dac cmr	/0pointer to sphere
	ior (c7
	dac t1	/7pointer to sphere
	law 60
	A>>06<<XP|
	jmp ill
	law 17
	A>>06<<XX
	law 14
	XMA<
	jmp ill
	xct i .+1
	jmp c41	/412 - create process
	jmp c43	/432 - delete process
	jmp c45	/452 - count processes
	jmp ill
	jmp ill
	jmp ill
	jmp c55	/552 - subjugate
	jmp c57	/572 - execute meta
	jmp c61	/612 - reverse share
	jmp c63	/632 - share
	jmp c65	/652 - reverse grant
	jmp c67	/672 - grant










                >>13<<d                                c41,	jdp crp
	jmp rtm
	lac (377776
	dac t0	/to skip
	jmp c45+1

c43,	lio io
	dio t4
	jdp dlp
	jmp rtm
	jmp rts

/count processes
c45,	dzm t0
c45+1,	jsp exm
	lac cmq
	ZIP
	SII
c45+5,	ior (c7
	TAX
	law 7777
	and i prn
	sas cmq
	jmp .-6
	isp t0
	jmp n47
	dio ac
	isp t0
	jmp rtl	/from c41
rlt,	jsp lxm
	jmp rtm

c55,	lxr t1
	lac i spe
	sma
	jmp rtm	/already has a superior
	lac cmp
	dac i sup
	lac io
	and (077777
	dac i spe
	lac cmr
	ior (250000
	aam
	dac clp
	law clw-prq
	add cmr
	mta 101
	jmp rts

c57,	lac ac
	ral 9s
	ior (70
	lia
	rar 3s
	A>>06<<IA
	and (77
	dac t0	/code number
	lac w
	dac ac	/new AC






                >>13<<                                 	lac cmr
	ior (c7
	dac cmp
	jmp mtb






























































                >>13<<>>15<<                                
xch,	0	/sigh
	lac cmr
	lio cmp
	dac cmp
	dio cmr
	jmp i xch

c67,	stf 4
c63,	jdp xch
	jmp c61

c65,	stf 4
c61,	lac io
	jdp cra	/check receiver
	jdp xch
	lac io
	rar 6s
	jdp chc
	lac i 0
	dac gcp	/capability to be moved
	TAIP|
	jmp rtz	/nothing there
	rcl 4s
	sas (17	/entry
	sad (5	/sphere
	jmp c6e
	sas (3
	jmp c6x
	szf i 4	/entered process capability
	jmp rtz	/can't share e.p.c.
	dzm i 0	/delete old copy explicitly
	clf 4	/because rmv would restart ent. proc
c6x,	jdp xch
	lac ac	/index in receiver
	jdp cra
	lac gcp
	jmp cap

c6e,	lac (-i	/remove master bit
	and gcp
	dac gcp
	jmp c6x























                >>13<<x                                
ifq,	lio t0	/queue ivk
	sir 6s	/variant
	A>>20<<IAP|
	SIA
	sas (3
	jmp ill
	jdp rqp	/read population
	jmp rta

/read population of queue in cmq
rqp,	0
	jsp exm
	lac cmq
	ior (c7
	TAX
	lio i prq
	spi
	jmp rqx
	cli
rqm,	law 7777
	and i prq
	sas cmq
	jmp rql
rqx,	dio t
	jsp lxm
	lac t
	jmp i rqp

rql,	ior (c7
	TAX
	SII
	jmp rqm

































                >>13<<>>37<<                                
/type 7 ivk
ift,	aam
	lio clp
	dio t7	/capability word
	ril 3s
	lac ac
	TI>P
	jmp ifi	/entry
	and (3400	/typewriter
	rar 8s
	lio t0
	sir 6s	/variant
	A>>20<<IAP|
	SIA
	sad (11
	jmp twi	/deny write pmt
	sas (12
	jmp ill
	jdp crq	/create inferior
	SAA
	dac i prq+1
	add (400000-1
	dac i prq
	lac t7	/superior
	ral 6s
	dip i prq+1
	ral 6s
	rcl 6s
	lac (710000
	A>>05<<IA
	jmp cap

twi,	lac t7
	and (-i
twx,	aam
	dac clp
	jmp rtm

ifi,	rcr 6s
	sza
	jmp ill
	lac t7
	rar 6s
	rcl 6s
	jmp twx




















                >>13<<>>16<<                                /translate capability word in AC into object pointer
/if object pointer exists, return it in IO, XR, tt0, and skip
/F5 is on if capability is being deleted

gcp,	0
	dap gpx
	cli
	lac gcp
	rcl 3s
	law 7777
	and gcp
	TIIX	/type of capability
	rir 3s
	dio >>56<<tt0
	lio gcp
	xct i .+1
	jmp gs0
	jmp gs1
	jmp gs2
	jmp gs3
	die
	jmp gs5
	jmp gs6
	jmp gs7

gs0,	ril 5s	/drum field
	TI<M
	jmp gpx	/read-only field
	add (sd1
	jmp ssy

gs1,	szf i 5	/entered process
	jmp gpx
	lac gcp
	aam
	dac (010076
	law 111
	ivk 76	/cause ill inst
	jmp gpx

gs2,	ril 5s
	szf 5
	TI<M
	jmp .+5
	lxr (c7
	A>>05<<XX
	cli>>05<<cmi
	dio i spe
	sub (cms-ccfx30
	mul (1
	div (30
	die
	sni i
	die
	jmp ssy

gs3,	add (prq-qqt	/queue
	mul (1
	div (2
	die






                >>13<<a                                	sni i
	die
	jmp gs71

gs5,	sub (ffs-fffx3	/file
	mul (1
	div (3
	die
	sni i
	die
	jmp ssy

gs6,	and (77	/hardware device
	add (iif
	jmp ssy

gs7,	ril 3s
	TI<M
	jmp gs70	/twr
	rcr 6s
	ril 6s
	sza i
	jmp gs8
	sas (02
	jmp gs74
	law 3	/microtape
	A>>06<<IA
	A~IP
	die
	add (mtu
	jmp ssy

gs74,	lio gcp	/entry
	ril 5s
	szf 5
	A>>20<<I<M
	jmp gs71
	ril 1s	/deleting master entry
	lxr (c7 qqt
	X+IX
	dzm i 0
	jmp gs71

gs70,	sar 6s	/typewriter
	dzm tt0
gs71,	lio (nqu
	AMI<
	die
	add (qqf
	jmp ssy

gs8,	law i 10	/special device
	A+I>
	jmp gpx	/buttons, call button, clock
	law rdr-11	/reader or punch
	A+IA
ssy,	adm tt0
	TAXI
	idx gpx
gpx,	jmp .






                >>13<<r                                
/get sub-object, <XR> (top of stack) has object pointer,
/<XR+1> has index of sub-object, initially 0, gets advanced to
/next one, skips if sub-object not available, pushes sub-object
/F5 >>20<< remove it

ssr,	0
	TXXA
	dac >>56<<xrs
	lac i 0
	cli
	rcl 3s
	TIX	/type
	rar 3s	/pointer
	xct i .+1

	jmp sb0	/0 - drum field or twr
	jmp ssx	/1 - entered process
	jmp sb2	/2 - sphere
	jmp ssx	/3 - queue
	die
	jmp ssx	/5 - file
	jmp ssx	/6 - hardware device
	jmp ssx	/7 - entry

sb0,	sub (qqf
	lxr xrs
	TAI<M	/skip if drum field
	sas i 1	/skip if 0th sub-object
	jmp ssx
	law 377
	aam
	and i 0	/ref count
	sza 5
	jmp ssx	/don't get sub-object yet
	idx i 1
	sil 1s
	lxr (c7 qqt
	X+IX
	law i 7777	/get superior twr
	and i 1
	ral 6s
	lia
	add (qqf
	A>>20<<IP	/skip if no superior
	jmp sb8
ssx,	idx ssr	/sub-object not available
	lxr xrs
	jmp i ssr

















                >>13<<d                                
sb2,	mul (30>2
	lai
	add (cms-ccfx30
	jdp fcl
sbb,	lxr xrs
	lac i 1
	sub cls
	sma
	jmp ssx
	idx i 1
	sub (1
	add clp
	TAX
	lac i 0
	sza i
	jmp sbb
	szf 5	/sub-object in AC
	dzm i 0
	jda gcp
	jmp sbb
sb8,	law 2
	add xrs
	sad (pde
	die	/stack overflow
	TAX
	dio i 0	/sub-object pointer
	jmp i ssr






































                >>13<<l                                
/remove reference to capability given in AC
/must have already been removed from C-list

rmv,	0
	stf 5
	jda gcp
	jmp i rmv
	lxr (pdl
	dio i 0

/begin mark phase

	clf 6
	clf 5
	law 377
	aam
	and i 0
	sza i
	die	/count=0
gm1,	law 400
	aam
	adm i 0	/mark it
	and (177400
	sza i
	die	/mark overflow
	sas (400
	jmp gm2	/seen it before
	dzm i 1	/first time
	lac (177777
	aam
	and i 0	/clear P
	aam
	dac i 0
gm3,	jdp ssr
	jmp gm1
gm2,	law pdl	/pop
	X~AP|
	jmp gg1	/empty, begin check phase
	law i 2
	X+AX
	jmp gm3
























                >>13<<>>13<<                                
/set P for every descendent of an external reference
/F6 >>20<< this is a descendent of an ext ref

gg1,	aam	/check B
	lio i 0
	TIA>P
	jmp gg9	/P[B] already on, return
	and (177777
	rcr 8s
	ril 8s	/mark in AC, count in IO
	AMII>>40<<<
	die	/mark > count
	szf 6
	jmp gg2	/must turn on P
	sza i
	jmp gg9	/checked already, return
	spi
	stf 6	/this has ext ref
gg2,	aam
	lac i 0
	szf 6
	ior (400000	/turn on P
	and (-177400	/clear mark field
	aam
	dac i 0
	dzm i 1	/sub-object index
gg5,	jdp ssr	/get sub-object
	jmp gg1	/recurse
gg9,	law pdl	/pop
	X~AP|
	jmp gg6	/finished
	law i 2
	A+XX
	aam
	lac i 0
	clf 6
	spa
	stf 6	/restore
	jmp gg5


























                >>13<<g                                
/delete everything with P off
/don't delete an object until all refs to it have been deleted

gg6,	law i 1
	aam
	adm i 0	/decrease count
	spa	/check P
	jmp gk9+1	/it has external references,
		/or is already on stack
	ior (400000	/can delete it
	aam
	dac i 0
	dzm i 1
gk0,	stf 5
	jdp ssr	/find and erase a sub-object
	jmp gg6	/recurse
	law 377	/all sub-objects are now gone
	aam
	and i 0
	aam
	dac i 0
	sza
	jmp gk9+1	/count |= 0 yet
	lac i 0
	TXI
	dio cpd	/save XR

/delete object in AC

	dac tt0
	cli
	rcl 3s
	TIX
	rar 3s
	mul i gzz
	scr 1s
	lai
	add i gyy
	aam
	dac (010076
	law 7777
	and tt0
	xct i .+1
	jmp gq0
	die
	jmp gk2
	jmp gk3
	die
	jmp gk5
	jmp gk6
	jmp gk7














                >>13<<n                                
gk2,	TAXI	/sphere
	lac frc
	dac i 0
	dio frc
	law 12
	ivk 76	/stop
	aam
	lac (010076
	and (7777
	dac cmr
	add (clw-prq
	mta 101	/restart procs waiting to enter
	dzm t5
	jdp smb	/set memory bound to 0
	die
	dzm t4
	jsp exm
gq2,	lac cmr
	ior (c7
	dac t0
	add t4
	dac t2
	jdp dtc	/remove attachment
	idx t4
	sas (6
	jmp gq2
	jsp lxm
	law 1
	dac t4
	jdp dlp	/delete first process
	skp i
	jmp .-2
	jsp exm	/clean off process hoard
	lac cmr
	ior (c7
	TAX
	law i 0
	dac i pss
	lac i prh
	spq
	jmp gq5
	dac t0
	and (7777
	ior (c7
	TAX
	lac i 0
	sza
	jmp .-5
	aam
	lac (c7 frp
	dac i 0
	lac t0
	aam
	dac (c7 frp











                >>13<<m                                
gq5,	jsp lxm
	lac cmr
	ior (c7
	TAX
	jsp dxr	/dismiss external register
	jsp dxe	/and external levels
	jmp gk9

gk3,	TAXI	/queue
	lac frq
	dac i 0
	dio frq
	law 7777
	aam
	and (010076
	dac cmq
gq3,	jdp rqp	/read population
	spq
	jmp gk9	/empty
	jsp exm
	lac cmq
	ior (c7
	TAX
	lac i prq	/get process
	ior (c7
	jdp ddp	/delete it
	jsp lxm
	law 13
	ivk 76	/release queue
	jmp gq3

gk5,	TAXI	/file
	lac frf
	dac i 0
	dio frf
	jmp gk9





























                >>13<<k                                gq0,	TAAIX
	law i qqf
	A+I>>40<<>
	jmp gkd	/drum field
	lac frq	/twr
	dac i 0
	dio frq
	law 2400
	ivk 76	/disable (to unhang procs)
	jmp gk9

gkd,	law i sd2
	A+I<
	jmp gkd2	/drum 2
	law i 1
	adm nfd1
	lac frd1
	dio frd1
	jmp gkk

gkd2,	law i 1
	adm nfd2
	lac frd2
	dio frd2
	jmp gkk

gk7,	TAAIX
	sub (mtu
	sma
	jmp gk9	/utape, reader, punch
	lac frq	/entry
	dio frq
gkk,	dac i 0

gk6,	/hardware device

gk9,	lxr cpd	/restore XR
gk9+1,	law i 2
	A+XAX
	sas (pdl-2
	jmp gk0
	jmp i rmv

gzz,	100
	0
	30
	2
	0
	0
	0
	0

gyy,	-qqfx100+710000
	0
	cms-ccfx30+240000
	qqt-prq-qqfx2+340000
	0
	0
	0
	0






                >>13<<t                                
/set memory bound for computation in cmr(0)
/t5 = new bound

smb,	0
	lac cmr
	ior (c7
	TAX
	dzm t3
sm1,	law i 3777	/find present bound
	and i 1
	sza i
	jmp .+5
	SXX
	idx t3
	sas (6
	jmp sm1
	lac t3	/old bound
	sub t5	/new bound
	spq
	jmp ccc

	jsp exm	/lower the bound
sm2,	lac t5
	add cmr
	dac t
	ior (c7
	dac t1
	sub t5
	dac t2
	lxr t1
	law i 3777
	and i 1
	sas (4000
	jmp ct3
/in core
	aam
	lio t2
	lxr t5
	xct i r1
	law 7
	A>>06<<IA
	ior (c7
	TAX
	lio (1000
	dio i bc	/give it high swap priority
	dzm i uc
/dismiss a field, too
	lxr (c7
	lio i fdf
	lac i udf
	dac i fdf
	ior (c7
	TAX
	lac i 0
	dio i 0
	lio (3777
	A>>06<<II
	lxr  (c7
	dio i udf






                >>13<<c                                ct3,	jdp rlc
	jdp ct1	/flush this core and attachments
	idx t5
	sas t3
	jmp sm2
	jsp lxm
sms,	idx smb
	jmp i smb

/release a core field
/drum field in AC(0-6)
rlc,	0
	ral 7s
	add (sd1
	TAAX
	sub (sd2
	TA<
	law frd2-frd1	/drum 2
	X>>20<<AX
	lio i frd1
	dac i frd1
	X>>20<<AX
	dio i 0
	TAX
	law i 1
	adm i ncd1
	jmp i rlc

ccc,	sza i
	jmp sms	/bound is unchanged

	dac t2	/raise the bound
	lxr frd1	/count fields
	TXXP|
	jmp .+4
	jdp scc
	lxr i 0
	jmp .-4

	lxr frd2
	TXXP|
	jmp i smb	/can't get enough
	jdp scc
	lxr i 0
	jmp .-4





















                >>13<<8                                
/create core fields

scc,	0
	isp t2
	jmp i scc
/can get enough fields
	jsp exm
	lac cmr
	ior (c7
	dac t0
sm4,	lac t3	/core number
	dac t4
	add t0
	dac t2	/comp + core (7)
	jdp dtc	/remove attachment, if any
	lac ncd1
	sub ncd2
	jdp gaf
	idx i ncd1
	law i sd1
	A+II
	rir 7s
	lxr (c7
cr1,	lac i cc
	sma
	lac i uc
	sza i
	jmp onc
	SXXA
	sas (c7 4
	jmp cr1
on2,	lxr t2
	law 3777
	A>>06<<XA
	A>>05<<IA
	dac i 1

	idx t3	/done
	sas t5
	jmp sm4
	jmp sms-1

onc,	law 7777
	and t2
	dac i uc
	law 7
	X>>06<<AA
	dio t4
	aam
	lio t0	/fix core rename
	lxr t3
	xct i r1
	rcr 3s
	CXX
	xct i r2
	aam
	dio t0
	lxr (c7	/chain field into udf
	lio i udf






                >>13<<j                                	lac i fdf
	dac i udf
	ior (c7
	TAX
	lai
	ior t4	/the field
	lio i 0
	dac i 0
	lxr (c7
	dio i fdf
	lio (4000
	jmp on2






















































                >>13<<f                                
/detach, core in t4, must not be real core
/comp in t0(7), t2 = t0 + t4

/EXECUTIVE MODE

dtc,	0
	lxr t2
	law 3777
	A>>06<<XI
	lac i 1
	sza i
	jmp i dtc	/empty
	dac ct1
	dzm i 1
	ior (c7
	TAX
	law 3777
	and i 4001
	A~IP
	jmp .-5
	xor i 4001
	ior ct1
	dac i 4001
	aam
	lio t0
	lxr t4
	xct i r1
	law 6
	rcr 3s
	CXX
	xct i r2
	aam
	dio t0
	jmp i dtc































                >>13<<>>75<<                                
/remove all attachments to core+comp in t
/EXECUTIVE MODE

ct1,	0
	lac t
	dac t0
	and (7770
	TAAX
	ior (c7
	dac t2
	aam
	lio t2
	lac t0
	X~AX
	xct i r1
	law 6
	rcr 3s
	CXX
	xct i r2
	aam
	dio t2
	lac t0
	ior (c7
	TAX
	law 3777
	and i 1
	dzm i 1
ct2,	ior (4000	/enter here from mta 403
	sas t
	jmp ct1+2
	jmp i ct1


































                >>13<<4                                
/create a process for computation in cmq, skip if win.

crp,	0
	jsp exm
	law 7777
	and cmq
	ior (c7
	TAX
	lac i con
	sma
	jmp cpn	/not stopped
	lio i prh
	TII>>40<<<
	jmp .+10	/hoard is not empty
	aam
	lio (c7 frp	/check pool
	sni
	jmp cpn	/too bad
	law i 1
	adm i prh	/increase debt
	lxr (c7 frp-prh
	lai
	ior (c7
	X>>20<<AX
	lio i 0
	X>>20<<AX
	dio i prh	/unlink it
	TAX
	law 7777
	and cmq
	dac i 5
	dac i prn
	ior (c7
	lia
	X>>20<<IX
	law 7777
	and i prn+1
	swp
	dap i prn+1
	lxr i con
	X>>20<<AX
	dio i prn+1
	rar 3s
	and (010000
	dac i 4	/set up PRL bit
	dzm i 0	/clear registers
	dzm i 1
	dzm i 2
	dzm i 3
	dzm i 6
	lac (400000
	dac i prq
	lai
	ior (c7
	X>>20<<AX
	dap i prn
	lxr prc
	lio i prs
	TAX






                >>13<<n                                	dio i prs
	idx crp
cpn,	jsp lxm
	jmp i crp






























































                >>13<<>>40<<                                
/delete process whose number is in t4 from computation in cmr(0)
/skip if win

dlp,	0
	jsp exm
	lio t4
	cmi
	lac cmr
	ior (c7
	TAX
	lac i con
	sma
	jmp dlz	/not stopped
dl7,	law 7777
	and i prn
	sad cmr
	jmp dlz	/process doesn't exist
	ior (c7
	TAAX
	SIIP
	jmp dl7
	jdp ddp
	idx dlp
dlz,	jsp lxm
	jmp i dlp








































                >>13<<>>37<<                                
/delete process
/7pointer in AC
/EXECUTIVE MODE

ddp,	0
	TAAIX
	law 7777
	and i prn+1
	ior (c7
	dzm i prn+1
	lxr i prn	/remove from ring
	X>>20<<AX
	dap i prn
	and (7777
	ior (c7
	X>>20<<AX
	dap i prn+1
	TIIX
	lac i 5
	ior (c7
	lxr i prq
	X>>20<<AX
	ral 4s
	spa
	jmp i ddp	/in enter wait
	dio t	/return to hoard or pool, 7pointer in IO
	lio i prh
	spi
	idx i prh	/decrease debt
	spi
	lxr (c7 frp-prh
	lio i prh
	law 7777
	and t
	dac i prh
	lxr t
	dio i 0
	jmp i ddp



























                >>13<<>>16<<                                
/find C-list of computation in AC(0)
/returns pointer to origin in clp
/returns size (0,20,or 100) in cls, AC

fcl,	0
	ior (240000
	aam
	dac (010073
	xor (240000~c7
	TAX
	lac i con
	ral 2s
	spa
	jmp fl3	/core 0 C-list
	dzm cls
	law 7777
	and i con
	sza i
	jmp fl4	/no C-list
	ior (c7	/core 7 C-list
	dac clp
	law nuf
fl4,	dac cls
	jmp i fcl

fl3,	lio (020000	/core 0 C-list
	dio clp
	law 52
	ivk 73	/attach
	die
	law 100
	jmp fl4

dimension cls(1),clp(1)































                >>13<<m                                
/enter executive mode

exm,	dap ex9
	lxr (c7
	lok
	lio i 107
	dio >>56<<ex1
	lio i 110
	dio >>56<<ex2
	lio i 111
	dio >>56<<ex3
	lio (eem
	dio i 107
	lio (jmp i 111
	dio i 110
	law ex8
	dac i 111
	hlt
lx9,	jmp .
ex8,	eem
	lxr (c7
	lio ex1
	dio i 107
	lio ex2
	dio i 110
	lio ex3
	dio i 111
ex9,	jmp .

/leave executive mode

lxm,	dap lx9
	jmp i (70000+ubs

constants
variables
repeat if2,printo .	printc 77
start



























                >>13<<9                                                                                                                                                                              
