DataMuseum.dk

Presents historical artifacts from the history of:

RC4000/8000/9000

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about RC4000/8000/9000

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download

⟦c8dbd8122⟧ TextFile

    Length: 238848 (0x3a500)
    Types: TextFile
    Names: »tterm2«

Derivation

└─⟦00964e8f7⟧ Bits:30007478 RC8000 Dump tape fra HCØ.
    └─⟦b2ec5d50f⟧ 
        └─⟦0b92c64d5⟧ »ctb« 
            └─⟦this⟧ 

TextFile

(bterm2 = set 1 disc
bterm2 = slang proc.options
scope user bterm2
print bterm2 integer words.4 0.6
)

b.  w.
p.1


; sl 8.12.71          initialize          term2   ...1...

s0=0, s1=0                ; clear checksums
s. h12, q5 w.
     h11, h12     ;
     78 10 22, 151         ; version id:

       ; ***** husk at flytte dette til options: *****
i18=4  ; segments in pooltable page (kitchange)
       ; (each segment holds approx. 50 pool descriptions);
i19=10 ; length of each entry in pooltable (kitchange);
m.          boss 2  tterm2

s. b40, c20, d10, g100  w.;
                       ;    list of externals
           g42.
     g50., g51., g52., g53., g54., g55., g56., g57., g58., g59.
     g60., g61., g62., g63., g64., g65., g66., g67., g68., g69.
     g70., g71., g72., g73., g74., g75., g76., g77., g78., g79.
     g80., g81., g82., g83., g84., g85., g86., g87., g88.
h1:  h2
b. a5
w.
     rl. w0     b24.   ;
     wa. w0     a1.    ;    last of corutine table:= first + length - 1;
     rs. w0     b25.   ;

; initialize printer operations

     rl. w2    g74.     ;   w2 := start printer queues;
     al. w3     g5.     ;   w3 := start printer table;
     al  w1    b17      ;   w1 := start rel of operations;
a0:  rl  w0  x3         ;   output table
     ds  w2  x3+4       ; rep: table(2, 4) := w1, w2;
     al  w1  x1+e43     ;   update w1, w2, w3;
     al  w2  x2+e13     ;
     al  w3  x3+6       ;
     se. w3     g6.     ;   if w3 <> top table then
     jl.        a0.     ;   goto rep;
     al  w0    i63      ; reserve and move:
     al  w1     g1      ;
     jl. w3   (g71.)    ;   w2 := reserve virt (code);
     al  w2  x2+1       ;   writing page(kill, printer buffers);
     rs. w2     g89.   ;    ext(244);

     jl. w3    (2)     ;    set externals;
g87:            40     ;  

         c5 ,   245    ;    rel answer;
         c7 ,   246    ;    rel kill;
         g7 ,   490    ;    rel test;
         c11,   256    ;    rel close;
         c9 ,   254    ;    rel start;
         c8 ,   255    ;    rel repeat;
         c12,   258    ;    rel change;
c.e61-1,
         c15,   528     ;     rel call
z.
g89:     0  ,   244    ;    virt answer etc.;
c.-1
         c14,   295    ;    rel newtape;
z.
         k  ,  -1000   ;    end of externals;

     al. w0     g0.     ;
     jl. w3   (g72.)    ;   move to virt;
     jl. w3    (g73.)   ;    end init ;
a1:  e12*e14-e12        ; length of corutine table - 1;

g70: 0                  ; base externals
g71: 12                 ; reserve virt
g72: 13                 ; move to virt
g73: 15                 ; end init
g74: 80                 ; start printer queues
e.
\f


; bbj  77 06 21             contents of term2                    ...1a...

; the following is a listing of the online commands appearing in term2
; along with the no of the page where the command can be found.

;   kill               page 2
;   test               page 8b
;   define              -   8c
;   convert             -   11
;   go                  -   11
;   run                 -   11
;   regret              -   12
;   job                 -   12
;   newjob              -   12a
;   rename              -   13
;   clear               -   13
;   scope               -   13
;   lookup              -   17a
;   login               -   21
;   logout              -   22
;   get                 -   25
;   print entry         -   25b
;   convert clock       -   25f
;   save                -   26
;   create output       -   28
;   transmit            -   32
;   display             -   48
;   remove              -   49c
;   message             -   49c
;   request             -   52
;   operator display    -   52c
;   kit                 -   53
;   terminal output     -   64
;   request display     -   71

\f


; sl 8.11.71          kill          term2   ...2...

g0:                    ; begin page 0
b0:       0, r.5       ;    page abs
    100<12 + 0         ;    page ident:  kill
b1:  g50: 26           ;    current corutine
b2:  g51: 280          ;    banker variables
b3:  g52: 7            ;    get pages
b4=k+2    0, 0         ;    work
b5:  g53: 284          ;    length psjob descr

b13=k-2*20             ;    base kill buffers
b6:       0, r. i45*10 ;    kill and answer buffers. one for each psjob.
b7:       e13          ;    semafore length

b8:  g54: 63           ;    psjob que
b9:       20           ;    length kill and answer buffer.
     g56: 162          ; 
b10: g57: 204          ;    alarm print
b11: g58: 8            ;    page jump
b12: g59: 6            ;    open chain
b14: g60: 67           ;    banker que
b15: g61: 3            ;    lock
     g62: 202          ;
b16: g63: 203          ;    after action
b17 = k - b0           ;   rel of
h. 0, r.i71*e43      w.;   printer operations
b18: g75: 380          ;    paper queue start
b19: g76: 381          ;    all paper semaphore
b20: g77: 382          ;    convert operations
b21: g78:   5          ;    lock chained
b22: g79:   4          ;    open simple
     g84: 365          ;    virt,
b23: g80: 366          ;    rel start card
b24: g82: 102          ;    first corutine
b25:        0          ;    last corutine
b26:        7          ;    mask
b27:    <:all:>        ;    repeat <printer> all
b30:      255          ;    mask
b31: g42:  25          ;  call

d1=4                   ;    param 1 rel
d2=12                  ;    param 2 rel
d3=20                  ;    param 3 rel
d4=28                  ;    psjob queue. param 4 rel
d5=30                  ;    psjob number
d6=32                  ;    rel return
d7=38                  ;    telexnumber (last of dbword)

\f


; sl 8.12.71          kill          term2   ...3...

; find psjob:   w2 = return, w3 = page 1 abs, param 1 = job name.
; after return: page 4 = 0, x3+d4 = psjobque, x3+d5 = psjob number,
; w2 = kill buf addr. calls alarm if the job does not exist.
b. a10, j10  w.        ;
c1:  ws. w2     b0.    ; find psjob:
     rs  w2  x3+d4     ;    save rel return;
     rl. w2    (b1.)   ;    w2:= current corutine;
     rl. w0     b2.    ;
     rs  w0  x2+14     ;    page 4 descr:= banker variables;
     jl. w3    (b3.)   ;    get pages;
     rl. w2    (b1.)   ;
     al  w1     0      ;    page 4 descr:= 0;
     rs  w1  x2+14     ;
     am.       (b0.+8) ;
j1:  al  w2    +281    ;    w2:= work:= address of account name;
     ds. w2     b4.    ;    searched:= 0;

a1:  dl  w1  x3+d1+2   ; search:   w2 = name addr in banker variables.
     sn  w0 (x2+0)     ;
     se  w1 (x2+2)     ;    if first of name does not match then
     jl.        a2.    ;    goto next;
     dl  w1  x3+d1+6   ;
     sn  w0 (x2+4)     ;
     se  w1 (x2+6)     ;    if last of name does not match then
     jl.        a2.    ;    goto next;

     ws. w2     b4.    ;
     al  w1  x2        ;    w1:= (name address - addr of account)
     al  w0     0      ;    // length psjob descr;
     wd. w1     b5.    ;
     al  w2  x1+2      ;    w1 = psjob number - 2;
     rs  w2  x3+d5     ;    psjob number:= w1 + 2;
     wm. w1     b9.    ;    w2:= 20 * (psjob number - 2)
     al. w2  x1+b6.    ;    + first kill buf;
     wd. w1     b9.    ;    w1:= psjob number - 2;
     wm. w1     b7.    ;    psjob que:= (psjob number - 2)
     wa. w1     b8.    ;    * semafore length + first psjob que;
     rx  w1  x3+d4     ;    w1:= rel return;
     jl.     x1+b0.    ;    return;

a2:  wa. w2     b5.    ; next:   w2:= length psjob descr + w2;
     rl. w1     b4.-2  ;
     al  w1  x1+1      ;    w1:= searched:= searched + 1;
     rs. w1     b4.-2  ;
     sh  w1     i45-1  ;    if searched < no of psjobs then
     jl.        a1.    ;    goto search;
     al  w0     21     ;    w0:= alarm cause:= no such job;
     jl.        c3.    ;    goto alarm;

g55=j1+1
e.                     ;
\f


; sl 8.11.71          kill          term2   ...4...

; store and check:   w0 = operation, w2 = kill buf addr, w3 = page 1 abs,
; w1 = return. return to x1: buffer free, w1 = kill buf addr, w2 = psjob 
; que semafore, w3 = page 1 abs.
; return to x1+2: buffer not free, w3 = page 1 abs.

c4:  hs  w0  x2+3      ; store and check:   save operation;
     se  w0 (x2+2)     ;    if buffer free = 0 then
     jl      x1+2      ;    return + 2;
     hs  w0  x2+2      ;    buffer free:= not 0;
     al  w0  x1        ;    w0:= return;
     al  w1  x2        ;    w1:= buffer addr;
     rl  w2  x3+d4     ;    w2:= psjob que;
     jl        (0)     ;    return;



c0:  am         1-5    ; forbidden alarm:
c2:  al  w0     5      ; param alarm:
c3:  rl. w3     b0.+2  ; alarm:   w0 = alarm code.
     rs  w0  x3+4      ;    save alarm code;
     dl. w3     b10.   ;  
     jl.       (b11.)  ;    page jump to alarm;

; answer <jobname> <name or empty> <integer or empty>
b. a10  w.             ;
c5=k+1-b0              ; answer:
     jl. w2     c1.    ;    find psjob; w2:= kill buf addr;
     ld  w1     64     ;
     ds  w1  x2+6      ;
     ds  w1  x2+10     ;    clear last 8 words of kill buf;
     ds  w1  x2+14     ;
     ds  w1  x2+18     ;
     dl  w1  x3+d2+2   ;    w01:= param 2;
     sh  w0     0      ;    if name then
     jl.        a1.    ;    begin
     ds  w1  x2+6      ;
     dl  w1  x3+d2+6   ;      move name to kill buf;
     ds  w1  x2+10     ;      w01:= param 3;
     dl  w1  x3+d3+2   ;    end;
a1:  sn  w0            ;    if integer then
     rs  w1  x2+18     ;    move integer to last of kill buf;
     al  w0     4      ;
     jl. w1     c4.    ;    store and check(w0 = answer);
     jl. w3    (b12.)  ;+2  if free then opench(psjob que, kill buf);
c6:  dl. w3     b16.   ;+4 
     jl.       (b11.)  ;    page jump to after action;
e.                     ;
\f


; sl 8.11.71          kill          term2   ...5...

; kill <job name or empty or printer number>
; page 4 = psjob descr.
b. a10, j10  w.        ;
c7=k-b0                ; kill:
j1:  bz  w2  x3+179    ;    w2:= console state;
j10: lo  w2  x3+134    ;    <or> terminal user rights;
     dl  w1  x3+d1+2   ;    w01:= param 1;
     sl  w0     0      ;    if empty then
     jl.        a1.    ;    begin
c.-i179                ;    if main console not normal terminal then include:
     so  w2     2      ; kill empty:   if not user console then
     jl.        c2.    ;      goto param alarm;
z.                     ;
     am.       (b0.+8) ;
j2:  bz  w2    +324    ;      w2:= psjob number;
     rs  w2  x3+d5     ;      save psjob number;
     wm. w2     b9.    ;      w2:= 20 * psjob number
     al. w2  x2+b13.   ;      + base kill buffers;
j3:  rl  w1  x3+175    ;
     rs  w1  x3+d4     ;      save psjob que;
j4:  rl  w1 (x3+221)   ;      w1:= value of terminal reserve;
     al  w0     1      ;
     sh  w1    -1      ;      if locked by term out and termout state < 2 then
j7:  rx  w0  x3+299    ;      kill term out := true;
     sl  w0     2      ;
j8:  rs  w0  x3+299    ;
j9:  rl  w0  x3+289    ;      if kill from logout
     sn  w0     33     ;        caused by operator remove then
     am         3-2    ;      w0:=operator kill
     al  w0     2      ;      w0 := user kill;
     jl.        a2.    ;    end else

a1:  so  w2     1      ;    begin if not operator console then
     jl.        c2.    ;      goto param alarm;
     al  w2     3      ;
     sn  w0     0      ;      if param 1 = integer then
     jl.       c10.    ;      ( w2:= kill; goto printer operations);

     jl. w2     c1.    ; kill name:   find psjob; w2:= kill buf addr;
     al  w0     3      ;      w0:= terminate;
                       ;    end;
a2:  jl. w1     c4.    ;    store and check;
     jl. w3    (b12.)  ;+2  if free then opench(psjob que, kill buf);
     al  w0     14     ;+4
     jl. w2     c13.   ;    banker send(14=kill);
     dl  w3  x3+2      ;
     jl.       (b11.)  ;    page jump to return;

c13: ws. w2     b0.    ; banker send(wo=operation):
     rs  w2  x3+d6     ;    store return rel;
     hs  w0  x3+d1+2   ;    param 1:= banker operation; op:= w0;
     rl  w0  x3+d5     ;
     hs  w0  x3+d1+3   ;    move psjob number;
j5:  rl  w0  x3+236    ;
     rs  w0  x3+d1+4   ;    move answer sem addr;
     al  w1  x3+d1     ;
     rl. w2     b14.   ;   
     jl. w3    (b12.)  ;    opench(banker que, operation);
j6:  rl  w2  x3+236    ;
     jl. w3    (b15.)  ;    lock(answer);
     am     (x3+d6)    ;
     jl.       +b0.    ;    return;

g64=j1+1, g65=j2+1, g66=j3+1, g67=j4+1, g68=j5+1, g69=j6+1, g81=j7+1
g83=j8+1, g86=j9+1, g88=j10+1
e.                     ;

\f


; bøt 3.1.72         printer commands          term2  ...6...

b. a10, j10
w.

; change (printerno, paperno)

c12 = k+1-b0
     al  w2      4      ;   opno := 4;
     rl  w1  x3+d1+2    ;   w1 := printerno;
     jl.       c10.     ;   goto printer operation;


; repeat (printerno, pages (may be omitted))

c8 = k+1-b0
     dl  w1  x3+d2+2   ;   if text param then
     sh  w0     0      ;     begin
     jl.        a0.    ;     if param <> <:all:> then
     sn. w0    (b27.)  ; 
     se  w1     0      ;
     jl.        c2.    ;       param alarm;
     al  w0    -2      ;     param:=-2;
a0:  sh  w0    -1      ;     end else if empty param then
     rs  w0  x3+d2+2   ;       param:=-1;
     al  w2      2      ;   opno := 2;
     rl  w1  x3+d1+2    ;   w1 := printerno;
e.


; general printer operation
;
; w1       = printer device number
; w2       = operation number
; x3+d2+2  = parameter (if any)
;
; the specified printer is searched in the
; printer table  and the operation is sent

b. a5, j5
w.

c10: rs  w2  x3+d2      ;   save opno;
     al. w2     j0.     ;   cur := addr of first entry;
a0:jd-1,sn  w1 (x2+0)      ; rep: if devno = devno(cur) then
     jl.        a1.     ;   goto found;
     al  w2  x2+6       ;   cur := addr of next entry;
     se. w2     j1.     ;   if cur <> top entry addr then
     jl.        a0.     ;   goto rep;
     al  w0     27      ;   
     jl.        c3.     ;   call alarm(27);
a1:  dl  w2  x2+4       ; found: w2 := sem addr;
     wa. w1     b0.     ;   w1 := abs of operation;
     rl  w0  x3+d2+2,jd-1  ;   transfer
     rs  w0  x1+4       ;      parameter  and
     rl  w0  x3+d2      ;      operation no;
     rx  w0  x1+2,jd-1  ;
     sh  w0      0      ;   if old operation no = 0 then
     jl. w3   (b12.)    ;   open chained (w1, w2);
     dl  w3  x3+2       ;
     jl.      (b11.)    ;   page jump (return);


\f



; bøt 3.1.72          printer commands          term2  ...7...



; printer table
;
; each entry contains:
;   rel 0   printer device no
;   rel 2   rel of printer operation on this page
;   rel 4   abs of printer queue semaphore

j0: g5:                 ; start of table
     0,r.i71*3          ;
j1: g6:                 ; top of table




; initialize printer table from options
;
; the printer device numbers are copied from
; the printer table in options
c.-1 ; tape printer removed
; the first entry contains no = 0 as device
; number of the tape printer
z.


a2:                     ; jump action:
     al. w2     j2.     ;   from := first of option table;
     al. w1     j0.     ;   to := first of page table;
a3:  rl  w0  x2        ; rep:
     rs  w0  x1        ;   devno(to):=devno(from);
     al  w2  x2+e37     ;   from := from + entry length;
     al  w1  x1+6       ;   to   := to   + entry length;
     se. w2     j3.     ;   if from <> top of table then
     jl.        a3.     ;   goto rep;
     al  w0      0      ;
     al  w2      0      ;
     jl      x3         ;   return to slang
     jl.        a2.     ;   goto jump action;
j2 = e35 
j3 = e36
j.
e.


\f


; bøt 30.01.72          printer commands          term2  ...8...



; start (printerno or text)

c9 = k - b0

b. a10, j10
w.

     dl  w1  x3+d1+2   ;    assume param1 to be a text;
     la. w1     j6.    ;    truncate to 4 chars;

     sn. w0    (j2.)   ;    if text = <:card:> then
     se. w1    (j3.)   ;
     jl.        a0.    ;
     dl. w3     b23.   ;      page jump(start card);
     jl.       (b11.)  ;

a0:  rl  w2  x3+134    ;    if not operator rights then
     so  w2     1      ;
     jl.        c0.    ;      alarm(forbidden);
     rl  w2  x3+d2     ;    if param2 <> empty then
     se  w2    -1      ;
     jl.        c2.    ;      alarm(param);

     sn. w0    (j4.)   ;    if text = <:acco:> then
     se. w1    (j5.)   ;
     jl.        a1.    ;      begin
     al  w0     18     ;      banker send(w0 = start acco);
     jl. w2     c13.   ;      goto return;
     jl.        c6.    ;      end;

a1:
c.-1
     sn. w0    (j0.)   ;    if text = <:tape:> then
     se. w1    (j1.)   ;
     jl.        a2.    ;      begin
     al  w0     24     ;      banker send(w0 = start conv);
     jl. w2     c13.   ;      printerno := 0;
     al  w1     0      ;      opno := 2;
     al  w2     2      ;      goto printer operation;
     jl.        c10.   ;      end;

z.

a2:  dl  w1  x3+d1+2   ;    assume param1 to be an integer;
     sn  w0     0      ;    if param <> integer
     sn  w1     0      ;       or deviceno = 0 then
     jl.        c2.    ;      alarm(param);
     al  w2     1      ;    opno := 1;
     jl.        c10.   ;    goto printer operation;

g85 = a0+1

c.-1

j0:  <:tap:>            ;   parameter texts;
j1:  <:e<0><0>:>        ;

z.

j2:  <:car:>            ;
j3:  <:d<0><0>:>        ;
j4:  <:acco:>           ;
j5=j4+2                 ;
j6:  255<16             ;

e.

\f


; bøt 11.07.72          printer commands          term2  ...8a...



; newtape (tape name)
;
; send banker operation (start convert)
; send tape name to tape printer

b. a5
w.

c.-1

c14 = k + 1 - b0

     rl. w0  b17+b0.    ;   if type (printer
     sn  w0      0      ;   operation <> 0
     jl.        a0.     ;   then
     dl  w3  x3+2       ;   page jump (return);
     jl.      (b11.)    ;
a0:  al  w0     24      ;   w0 := start convert;
     jl. w2    c13.     ;   banker send (w0);
     al. w2  b17+b0.    ;   w2 := start of operation;
     dl  w1  x3+d2+2    ;
     ds  w1  x2+6       ;   transfer tape name;
     dl  w1  x3+d2+6    ;
     ds  w1  x2+10      ;
     al  w0      4      ;   operation := 4;
     rs  w0  x2+2       ;
     al  w1  x2         ;
     rl. w2     g5.+4   ;   w2 := queue addr;
     jl. w3   (b12.)    ;   open chained (queue);
     dl  w3  x3+2       ;
     jl.      (b11.)    ;   page jump (return);

z.



c11=k+1-b0             ; close:
c.-1, o20, z.          ;    (bossfault xref)
     jd        -20     ;    boss fault;

e.
\f


; kll 6.9.72          test          term2   ...8b...
; test <first coruno> <last coruno>/empty <pattern>

b. a9  w.              ;
g7=k+1-b0              ; test:
     dl  w1  x3+d3+2   ;    w1:= param3;
     se  w0    -1      ;    if param3 = empty then
     jl.        a1.    ;    begin
     rl  w1  x3+d2+2   ;      test:= param2;
     rl  w0  x3+d1+2   ;      last corutine:= param1;
     jl.        a2.    ;    end else
a1:  rl  w0  x3+d2+2   ;    begin last:= param2; test:= param3 end;
a2:  ba. w0     1      ;    top corutine:= last + 1;
     la. w1     b26.   ;    test:= test and test mask;
     ds. w1     b4.+2  ;
     rl  w0  x3+d1+2   ;    first corutine:= param1;
     rs. w0     b4.-2  ;
     rl. w2     b24.   ;    descr index:= first descr;

a3:  bz  w0  x2+4      ; rep:
     ls  w0    -3      ;
     sl. w0    (b4.-2) ;    if ident(descr index)>= first and
     sl. w0    (b4.)   ;       ident(descr index) < top then
     jl.        a4.    ;    begin
     ls  w0     3      ;
     wa. w0     b4.+2  ;      test(descr index):= test;
     hs  w0  x2+4      ;    end;
a4:  al  w2  x2+e12    ;    descr index:= descr index + 1;
     sh. w2    (b25.)  ;    if descr index <= last descr then
     jl.        a3.    ;    goto rep;

     dl. w3     b16.   ;
     jl.       (b11.)  ;    page jump(after action);
e.                     ;

\f



; vir 16.1.78          call            term2  ...8e...

; call <devicenumber> <new device name>
; if devicenumber is found in the optionlist e60, the monitor
; procedure  .create peripheral process.  is called, to give
; the device the new name. the command is used to name floppy
; devices.

b. a20 w.

c. e61-1,

c15= k + 1 - b0        ; external 528 = c15 = rel callcommand on page 100
;      + 1             ; means no jobdescription page in this command

; search the device number in the table g9 ( a copy of optionlist e60)

     al  w2     e61    ;    w2:= no_of_call_devices
     rl  w0  x3+d1+2   ;
a0:  sn  w2      0     ;    if devicelist exceeded then 
     jl.        a8.    ;    goto device unknown to boss
     al  w2  x2-1      ;    w2:= next device index (e61-1  =>  0)
     bz. w1  x2+g9.    ;    w1:= next device from list g9 (=optionlist e60)
     se  w1 (x3+d1+2)  ;    if device not found then
     jl.        a0.    ;    goto next device    else
                       ; found:
     al  w3  x3+d1     ;    w3:= first parameter = zero, devicenumber
     am        (66)    ;    own process
     dl  w1    +74     ;    max_base
     jd    1<11+72     ;    set catalog base, note w3 point to zero
     rl  w1  x3+2      ;    w1:= devicenumber
     al  w3  x3-d1+d2  ;    w3:= second parameter = new device name
     jd    1<11+54     ;    create peripheral process
     al  w3  x3-d2     ;    w3:= start page 1
     am        (0)     ;
     bl. w2     a17.   ;    w2:= resulttabel(monitorresult)
jd -1                  ; testprint w0=monitorresult,w1=devicenumber
                       ;           w2=resulttable(monitorresult).

; test the result and return

     sn  w2     0      ;    if result ok then
     jl.        a16.   ;    then goto okreturn
     sl  w2     0      ;    if result > 0 then
     jl.        a10.   ;    goto alarmprintreturn (monitorresult = 3, 4, 5)
c.-1 ,   o105  , z.    ;    bossfault-xref
     jd        -105    ;    else bossfault (monitorresult = 1, 2, 6)

; return
a8:  al  w2     30     ;    device unknown to boss:  alarmtest_number:= 30
a10: rs  w2  x3+4      ;    alarmprintretur: store alarmtext_number
     am      b10.-b16. ;    alarmprintretur
a16: dl. w3     b16.   ;    after aktion return
     jl.       (b11.)  ;    page jump

; resulttable  0 => ok,  >0 => alarmprint,  <0 => bossfault .
; monitorresult : 0, 1, 2, 3, 4, 5, 6 ;
h.          a17 : 0,-1,-2,25,30,53,-6 ;  converted result

; device list moved to codepage during translation
g9: 0, r.e61 w. ; the list is a copy of optionlist e60.

z.
e.



g1=k-g0                ;    length page

b. a2  w.
; move devicelist from optionlist e60 to call-command-list g9.

a0:  rl  w1  x2        ;  reduce segment
     al  w1  x1+a2     ;    with length of
     rs  w1  x2        ;    j.code

; move it
c. e61-1,
     al  w1     e61    ;    no-of-call-devices
a1:  al  w1  x1-1      ;    next device index (e61-1  =>  0)
     bz. w0  x1+e60.   ;
     hs. w0  x1+g9.    ;
     se  w1     0      ;    if device list exceeded then
     jl.        a1.    ;    goto next device index
z.
; else return to slang ;
     al  w2     0      ;
     al  w0     0      ;
     jl      x3        ;
     jl.        a0.    ;    start at a0:
a2=a0.   j.            ; a2= size of j.code
e.

i.e.

\f


; sl 6.10.71          initialize          term2  ...9...

s. c10, g110, b30,  w.  ;
h2=h1-k  ; continue external list
     g29.,g30.,g31.,g32.,g33.,     g36.,g37.,g38.,g39.
     g40.,g41.,g42.,g43.,g44.,g45.,g46.,g47.,g48.,g49.
     g50.,g51.,g52.,g53.,g54.,g55.,g56.,g57.,g58.,g59.
     g60.,g61.,g62.,g63.,g64.,g65.,g66.,g67.,g68.,g69.
     g70.,g71.,g72.,g73.,g74.,g75.,g76.,g77.,g78.,g79.
     g80.,g81.,g82.,g83.,g84.,g85.,g86.,g87.,g88.,g89.
     g90.,g91.,g92.,g93.,g94.,g95.,g96.,g97.,g98.,g99.
     g100.,g101.,g102.,g103.
h3:  h4

     al  w0     i63    ; reserve and move:
     al  w1     g1     ;
     jl. w3    (g71.)  ;   w2:= reserve virt(code);
     rs. w2     g20.   ;    ext(237);
     al. w0     g0.    ;
     jl. w3    (g72.)  ;   move to virt;
     al  w0     i63    ;
     al  w1     g3     ;
     jl. w3    (g71.)  ;   reserve virt(rename clear scope);
     rs. w2     g21.   ;    ext(251);

     jl. w3    (2)     ;    set externals;
g29:            40     ; 
         g14,   232    ;    rel newjob;
         g5 ,   238    ;    rel convert;
         g6 ,   239    ;    rel go;
         g7 ,   240    ;    rel run;
         g8 ,   241    ;    rel regret;
         g9 ,   242    ;    rel job;
         g12,   243    ;    rel scope;
         g10,   252    ;    rel rename;
         g11,   253    ;    rel clear;
         g16,   307    ;    rel lookup;
         g13,   506    ;    rel stop;
g20:     0  ,   237    ;    virt convert go etc;
g21:     0  ,   251    ;    virt rename clear scope;
         0  ,  -1000   ;    end of externals;

     al. w0     g2.    ;
     jl. w3    (g72.)  ;   move to virt;
     am.       (4)     ;
     jl.       +4      ;    next init
     h1.               ;
g70: 0                 ;   base externals
g71: 12                ;   reserve virt
g72: 13                ;   move to virt
g73: 15                ;   end init
\f

                                                                      

; sl 27.10.71          job, run, etc          term2   ...10...


g0:                    ; begin page 0
b0:       0, r.5       ;   page abs
    101<12 + 0         ;   page ident:  go, run, job
b1:  g56: 6            ;   opench
b2:  g57: 3            ;   lock
b3:  g58: 8            ;   page jump
     g59: 162          ;
b4:  g60: 204          ;   alarm print
b5:       <:trf:>      ;
b6:       <:tre:>      ;
b7:  g61: 67           ;   bankerque
     g62: 202          ;
b8:  g63: 203          ;   after action
     g64: 162          ;
b9:  g65: 229          ;   general print
b10: g66: 25           ;   call
b11: g67: 1            ;   send and wait
b12: g68: 26           ;   current corutine
b13:      <:primout:>  ;
b14: g95: h. 2,19 w.   ;    closing
b15:      e13          ;   semaphore length
b16: g40: 63           ;   psjob queue
b17:      <:std:>      ;   <:std:> means rc4000 printer
b18: g94: 140          ;  virt,
b19: g52: 142          ;    rel lookup device;

b. a9, j9  w.          ;

g13=k+1-g0             ; stop:
     dl  w1  x3+6      ;
     sn. w0    (j1.)   ;    if param1 = yes then
     se  w1     0      ;    begin
     jl.        a1.    ;    closing:= true;
     rs. w3    (b14.)  ;      after action;
     jl.        c2.    ;    end else
a1:  sn. w0    (j2.)   ;    if param1 <> no then
     se  w1     0      ;    goto param alarm else
     jl.        c3.    ;    begin
     rs. w1    (b14.)  ;      closing:= false;
     jl.        c2.    ;      after action;
                       ;    end;
j1:  <:yes:>
j2:  <:no:>
e.
\f

                                                                   
; sl 12.11.71          convert, go, run          term2  ...11...

; job start commands:  convert <name>, <printername> or empty, <papertype> or empty
; go, run.  param list is used
; to build up the operations.
 
b. a30, j10 w.
g5=k-g0                ;  convert:

     ld  w1    -100    ;    default printer:=0;
     ds  w1  x3+28+18  ;
     rs  w0  x3+28+20  ;
     al  w0     14     ;
     rs  w0  x3+28+24  ;    default kind:=printer
     dl  w1  x3+6      ;    test file name;
     sn. w0    (b13.)  ;
     se. w1    (b13.+2);
     jl.        a0.    ;    if filename = <:primout:> then
     dl  w1  x3+10     ;
     sn. w0    (b13.+4);
     jl.        a21.   ;    alarm (primout in use);
 
a0:  dl  w1  x3+6      ;    set filename;
     ds  w1  x3+28+8   ;
     dl  w1  x3+10     ;
     ds  w1  x3+28+12  ;
     dl  w1  x3+14     ;    w0w1:=param2;
     sh  w0     0      ;    if param2=text then
     jl.        a2.    ;    begin
     sn. w0    (b17.)  ;
     se  w1     0      ;      if param2 <> <:std:> then
     jl.        a1.    ;      keep the name;
     ld  w1    -100    ;    else printername:=0
a1:  ds  w1  x3+28+18  ;    set printername
     dl  w1  x3+22     ;    w0w1:=param3
     se  w0     0      ;      if param3 empty
     al  w1     0      ;      then papertype:=0;
     rs  w1  x3+28+14  ;      else set papertype;
 
     dl  w1  x3+28+18  ;      set device name;
     sn  w0     0      ;    if std printer then
     jl.        a4.    ;    skip search and lookup
a3:  ds  w1  x3+r1+2   ;
j9:  rl  w0  x3+178    ;
     rs  w0  x3+r0     ;    set abs ref message area
     ld  w1    -100    ;
     ds  w1  x3+r1+6   ;
     am.       (b0.+8) ;      set  host ident;
j2:  dl  w1    +424    ;    w0w1:=host description
     ds  w1  x3+r2+2   ;
     ds  w1  x3+28+22  ;
     al  w0    -1      ;
     rs  w0  x3+r4     ;    set dummy mode,kind
     am.       (b0.+8) ;
j10: dl  w1    +529    ;    set project base
     ds  w1  x3+r6+2   ;
     dl. w3     b19.   ;
     jl. w1    (b10.)  ;    call(lookup device)

     jl.        a12.   ;+2  error return
     rl  w0  x3+r104   ;+4
     rs  w0  x3+28+24  ;    set device kind
     sn  w0     14     ;    if kind <> printer
     jl.        a4.    ;
     sn  w0     12     ;    and kind <> punch
     jl.        a4.    ;
     jl.        a26.   ;    then kind illegal
 
a2:  se  w0     0      ;    if param2 empty then
     al  w1     0      ;    papertype:=0 else
     rs  w1  x3+28+14  ;    set papertype;
     lo  w0  x3+20     ;    if param2 not empty
     se  w0    -1      ;    and param3 not empty then
     jl.        a20.   ;    alarm (param);
                       ;    end;
     am.       (b0.+8) ;
j6:  rl  w0    +423    ;
     sh  w0     0      ;    if rb terminal then
     jl.        a4.    ;    begin
     al  w0     1      ;      printername:=some printer;
     al  w1     0      ;
     ds  w1  x3+28+18  ;      set device name;
     jl.        a3.    ;      goto search and lookup device;
 
a4:  am         10-8   ;    operation:=10; skip;
g6=k-g0+1              ;  go:
     am         8-7    ;    operation:=8; skip;
g7=k-g0+1              ;  run:
     al  w0     7      ;    operation:=7;
 
j3:  rl  w1  x3+236    ;    w1:=answer sem;
     ds  w1  x3+28+4   ;    set operation, answer sem;
 
j4:  al  w2  x3+218    ;    w2:=name of basis file;
     dl  w1  x2+2      ;
     sn. w0    (b13.)  ;
     se. w1    (b13.+2);
     jl.        a5.    ;    if basis file = primout then
     rl  w0  x2+4      ;
     sn. w0    (b13.+4);
     jl.        a21.   ;    alarm (primout in use);
 
a5:  rl. w0    (b14.)  ;    if closing then
     se  w0     0      ;
     jl.        a22.   ;    alarm(installation closing);
 
j5:  rl  w2  x3+175    ;    send to psjob;
     al  w1  x3+28     ;
     jl. w3    (b1.)   ;    opench(psjobqueue,operation);
     rl  w2  x3+28+4   ;
     jl. w3    (b2.)   ;    lock(commio answer);
     bl  w0  x3+28+2   ;    w0:=answer result;
     sn  w0     6      ;    if killed then
     jl.        a23.   ;    alarm (killed by operator);
     se  w0     0      ;    if answer not ok then
     jl.        a24.   ;    alarm (no room for output);
  
j7:  bz  w1  x3+179    ;
     al  w1  x1-4      ;
j8:  hs  w1  x3+179    ;    console state:=not ready;
c2:
a6:  dl. w3     b8.    ; return:
     jl.       (b3.)   ;    page jump to after action;
c.-1 ; before release 15 local terminal could only use local printers set printername:
a10: am.       (b0.+8) ;
j1:  rl  w2    +423    ;    w2:=host id
     sn  w2     0      ;    if local terminal
     jl.        a20.   ;    then alarm(param)
     jl.        a1.    ;
z.
 
a27: am         30-27  ;    device unknown
a26: am         27-19  ;    device kind illegal
c5:
a24: am         19-28  ;    no room for output;
a23: am         28-34  ;    killed by operator
a22: am         34-31  ;    installation is closing
a21: am         31-5   ;    primout in use
c3:
a20: al  w0     5      ;    param
     rs  w0  x3+4      ;
     dl. w3     b4.    ;
     jl.       (b3.)   ;    page jump to alarm;
 
a12: rl  w0  x3+28+16  ;
     se  w0     1      ;    if device name set then
     jl.        a27.   ;    alarm;
     ld  w1    -100    ;    else
     ds  w1  x3+28+18  ;    printer:=std  printer;
     jl.        a4.    ;
 
          g36=j2+1, g37=j3+1, g38=j4+1, g39=j5+1
g96=j6+1, g97=j7+1, g98=j8+1,g54=j9+1, g101=j10+1
e.
\f

                                                                          
; sl 12.11.71          job, regret          term2   ...12...

; tape job commands: job <n> <mode>, regret <n> <mode>.
; param list is used to build up the operations.

b. a10, j10  w.        ;
g8=k-g0                ;
     am         1      ; regret:  operation := 12; skip;
g9=k-g0                ;
     al  w0     11     ; job:  operation := 11;
     ls  w0     12     ;
     rl. w2     b0.+8  ;
     rs  w0  x2+6      ;
j2:  bl  w0  x3+179    ;  w0:=console state
j3:  rl  w1  x2+423    ;  w1:=parent rb name table addr
     so  w0     1      ;  if not main console
     se  w1     0      ;  and not rb terminal
     jl.        4      ;  then
     jl.        c3.    ;  goto param alarm
j4:  dl  w1  x2+424    ;
     ds  w1  x2+14     ;    set host description
     rl  w0  x3+6      ;  number of jobs:=
     bz  w1  x2+6      ;    if regret then -param1
     se  w1     11     ;      else +param2;
     ac  w0     (0)    ;
     rs  w0  x2+10     ;
     rl  w1  x3+12     ;   w1:=param 2;
     sn  w1    -1      ;   if empty then
     jl.        a1.    ;   goto std mode;
     sn. w1    (b5.)   ;   if trf then
     jl.        a2.    ;   goto f-mode;
     se. w1    (b6.)   ;   if not tre then
     jl.        c3.    ;   goto param alarm;

     am         1      ; i-mode:  mode:=1;  skip;
a2:  am        -i117   ; f-mode:  mode:=0;  skip;
a1:  al  w0     i117   ; std mode:  mode:=option;
     se  w0     0      ;  if mode <>0 then
     al  w0     1      ;    mode:=1;
     hs  w0  x2+7      ;
j1:  rl  w0  x3+236    ;   operation.4 := commio answer sem;
     rs  w0  x2+8      ;
     al  w1  x2+4      ;   w1:=operation;
     rl. w2     b7.    ;
     jl. w3    (b1.)   ;   opench(bankerque, operation);
     rl. w3     b0.+8  ;
     rl  w2  x3+8      ;
     jl. w3    (b2.)   ;   lock(commio answer);
     rl. w2     b0.+8  ;

     bz  w0  x2+6      ;   w0:=operation code;
     rl  w1  x2+10     ;   w1:=-1 or no of jobs left;
     se  w0     11     ;   if job then
     jl.        a3.    ;     begin
     se  w1    -1      ;     if result=ok then
     jl.        c2.    ;       goto return
     jl.        c5.    ;     else goto alarm
                       ;     end;
a3:  al  w0    -2      ;   param1:=
     se  w1    -1      ;   if result=ok then
     jl.        a4.    ;     no of jobs left
     al  w0     0      ;   else <:no:>;
     al  w1     43     ;
a4:
     ds  w1  x3+6      ;
     al  w0     0      ;
     al  w1     2      ;   param 2 := text 2;
     ds  w1  x3+10     ;
     al  w0    -6      ;   param 3 := return;
     rs  w0  x3+12     ;
     dl. w3     b9.    ;
     jl. w1    (b10.)  ;   call general print;
     dl. w3     b8.    ;
     jl.       (b3.)   ;   goto after action;

g55=j1+1, g32=j2+1, g33=j3+1, g53=j4+1
e.
\f


; re 16.08.73          newjob                        term2  ...12a...

; newjob command: newjob  <name>, <printername> or empty

b. a30, j15,w.          ;   page 4=job descr page
g14=k-g0               ;newjob:
     rl. w0    (b14.)  ;   if closing then
     se  w0     0      ;     goto alarm
     jl.        a4.    ;
  
     rl. w2     b0.+8  ;    w2:=job  descr page;
j8:  dl  w1  x2+424    ;    w0w1:=host ident;
j10: al  w2  x2+349    ;    w2:=psjob operation;
     ds  w1  x2+24     ;    set host ident in psjob operation;
     dl  w1  x3+6      ;    move file name;
     ds  w1  x2+8      ;
     dl  w1  x3+10     ;
     ds  w1  x2+12     ;    to psjob operation;
j12: rl  w0  x3+178    ;
     rs  w0  x3+r0     ;    set abs ref message area
     am.       (b0.+8) ;
j13: dl  w1    +529    ;    set project base
     ds  w1  x3+r6+2   ;
     rl  w0  x2+22     ;    get host ident;
     sh  w0     0      ;    if rbterminal then
     jl.        a16.   ;    begin
     dl  w1  x3+14     ;      w0w1:=param2;
     rs  w0  x3+28     ;      save kind of param2;
     se  w0    -1      ;      if param2=empty then
     jl.        a17.   ;
     al  w0     1      ;      some rbprinter wanted;
     jl.        a18.   ;
 
a17: sn. w0    (b17.)  ;      if param2=<:std:> then
     se  w1     0      ;
     jl.        a18.   ;

a19: ld  w1    -100    ;
     ds  w1  x2+20     ;      printername:=0;
     rs  w0  x2+22     ;      host ident:=0;

     jl.        a26.   ;      ok;
 
a18: ds  w1  x2+20     ;      set printername in psjob operation;
     ds  w1  x3+r1+2   ;                -        lookup message;
     ld  w1    -100    ;
     ds  w1  x3+r1+6   ;
     am.       (b0.+8) ;
j11: dl  w1    +424    ;      w0w1:=host ident;
     ds  w1  x3+r2+2   ;    set host description
     al  w1     14     ;
     rs  w1  x3+r4     ;      set mode, kind;
     dl. w3     b19.   ;
     jl. w1    (b10.)  ;      call(lookup device);
 
     jl.        a25.   ;+2    error return;
     rl. w2     b0.+8  ;+4

j9:  al  w2  x2+349    ;      w2:=psjob operation;
     rl  w0  x3+r104   ;      w0:=rc kind;
     se  w0     14     ;      if device kind <> 14 then
     jl.        a22.   ;      alarm (device not printer);
     jl.        a26.   ;    end;
 
a16:
     dl  w1  x3+14     ;
     se  w0    -1      ;    if param2 not empty then
     jl.        a17.   ;    goto named printer;
     jl.        a19.   ;    else ok;
a22: am         27-5   ;    device not printer
a23: am         5-30   ;    param
a24: al  w0     30     ;    device unknown;

     rs  w0  x3+4      ;
     dl. w3     b4.    ;
     jl.       (b3.)   ;    page jump to alarm print;
a25: rl  w0  x3+28     ;    w0:=kind of param2;
     se  w0    -1      ;    if param2 not empty then
     jl.        a24.   ;    alarm;
     rl. w2     b0.+8  ;    else
j14: al  w2  x2+349    ;      w2:=psjob operation
     jl.        a19.   ;      goto take std printer
 
a26:

     al  w0     10     ;
     ls  w0     12     ;
     rl. w3     b0.+8  ;   w3:=job descr page
j1:  al  w1  x3+332    ;   w1:=psjob operation
     rs  w0  x1+2      ;   code:=get psjob
     rl. w2     b7.    ;
     jl. w3    (b1.)   ;   open chained(banker queue)
     rl. w3     b0.+8  ;
j2:  rl  w2  x3+334    ;
     jl. w3    (b2.)   ;   lock answer

     rl. w3     b0.+8  ;
j3:  al  w1  x3+349    ;   w1:=psjob operation;
j7:  dl  w0  x3+421    ;
     ds  w0  x1+16     ;   op(+14,+16):=std interval for user

     bl  w2  x1-7      ;   if no psjob idle then
     sn  w2     0      ;     goto no psjob idle
     jl.        a5.    ;

     al  w0     6      ;   code:=internal job
     rs  w0  x1+2      ;
     rl  w0  x1-6      ;
     rs  w0  x1+4      ;   op+4:=answer sem;
     al  w2  x2-2      ;
     wm. w2     b15.   ;   w2:=psjob queue  +
     wa. w2     b16.   ;       (psjobnr-2)*sem length;
     rl. w3     b0.+8  ;   w3:=job descr page;
j4:  al  w1  x3+349    ;   w1:=psjob operation;
     jl. w3    (b1.)   ;   open chained(w1,w2);
     rl. w3     b0.+8  ;   w3:=job descr page;
j5:  rl  w2  x3+334    ;
     jl. w3    (b2.)   ;   lock answer;

     rl. w3     b0.+8  ;   w3:=job descr page;
j6:  al  w1  x3+349    ;   w1:=ref operation;
     bl  w0  x1+2      ;
     se  w0     0      ;   if normal answer then
     jl.        a6.    ;
     dl. w3     b8.    ;
     jl.       (b3.)   ;     page jump to after action;
\f


; re  5.9.1973            newjob                term2    ...12b...

a4:  al  w0     34     ;   alarm text:=<:installation closing:>;
     jl.        a9.    ;   index:=34;

a5:  al  w0     1      ;no psjob idle:
                       ;   (w0=answer code)
a6:  al. w1     a10.   ;   init table search;
a7:  sn  w0 (x1)       ;rep:if answer found then
     jl.        a8.    ;      stop searching;
     al  w1  x1+4      ;
     sh. w1     a11.   ;
     jl.        a7.    ;   if table exhausted then
c.-1, o28, z.          ;    (bossfault xref)
     jd        -28     ;     ***bossfault(28)

a8:  rl  w0  x1+2      ;answer found: set index;
a9:  rl. w3     b0.+2  ;
     rs  w0  x3+4      ;   save alarm index;
     dl. w3     b4.    ;
     jl.       (b3.)   ;   page jump to alarm;

; table of alarm indices:

a10:   1,   36         ;   <:job queue full:>
       2,   37         ;   <:file not permanent:>
       3,   15         ;   <:file does not exist:>
       5,   38         ;   <:file unreadable:>
       7,   11         ;   <:user index too large:>
       8,   10         ;   <:illegal identification:>
       9,   20         ;   <:user index conflict:>
      11,   14         ;   <:file too long:>
      32,   39         ;   <:temp claim exceeded:>
      38,   40         ;   <:option unknown:>
      39,   41         ;   <:param error at job:>
      40,   42         ;   <:syntax error at job:>
      41,    0         ;   <:line too long:>
a11=k-2

g41=j1+1, g42=j2+1, g43=j3+1, g44=j4+1, g45=j5+1, g46=j6+1
g47=j7+1, g48=j8+1, g49=j9+1, g50=j10+1, g51=j11+1, g69=j12+1, g102=j13+1
g103=j14+1

e.
g1=k-g0                ; length page
\f

                                                            
; sl 20.12.71          rename, clear, scope          term2  ...13...

; rename, clear, and scope:  these commands are implemented as
; individual start actions, followed by a common start action (for
; accessing and checking the entry), followed by individual central
; actions (which perform the real work), and terminated by a common
; end or alarm action (for releasing the entry, etc).

b. b20, c20, d30  w.   ;
g2:
b0:       0,r.5        ;   page abs
    102<12 + 0         ;   page ident:  rename, clear, scope
b1:  g74: 8            ;   page jump
b2:  g75: 25           ;   call
b3:  g76: 32           ;   prep access
b4:  g77: 33           ;   term access
b5=k+2,g78:415,g79:413 ;   prep bsadjust
b6=k+2,g80:415,g81:414 ;   term bsadjust
b7=k+2,g82:202,g83:203 ;   after action
b8=k+2,g84:162,g85:204 ;   alarm print
b9=k+2,g86:157,g87:213 ;   clear corrections
b10:      <:log:>      ;
b11:      <:use:>      ;
b12:      <:pro:>      ;
b13:      0            ;   for set base
b14: g88: 26           ;   current corutine
b15:      7            ;   mask for get old perm key
b16=k+2,g99:206,g100:154;   virt, rel print catalog entry

d1=4      ;   param 1
d2=12     ;   param 2
d3=14     ;   new entry name (rename only)
d4=22     ;   scope interval (clear and scope only)
d5=16     ;   actual interval of entry (scope only)
d6=24     ;   switch, remove (even means terminate bs)
d7=26     ;   perm, 2 or 3 (clear and scope only)
d8=28     ;   saved name tab addr, work for lookup
d9=30     ;   old perm key, error code
q0=82     ;   common relative on job file page for codepage 102 and 103
d25=q0    ;   rel entry addr for lookup head and tail

c. q0+32-i46-2, m.***lookup: i46 too small
z.
c. d8+32-i46-2, m.***scope: i46 too small
z.
\f

                                                                  
; sl 20.12.71          rename, clear, scope          term2 ...14...

; individual start actions:
b. a10, j10  w.        ;
; rename:  param 1 is old name, param 2 is new name.
g10=k-b0               ; rename: page 4 = ps job descr
     al  w0     c3     ;   switch:= rename; term bs := false;
     rs  w0  x3+d6     ;
     dl  w1  x3+d2+6   ;   move param 2 to get room for
     ds  w1  x3+d3+6   ;   name table addr;
     dl  w1  x3+d2+2   ;
     ds  w1  x3+d3+2   ;
     jl.        c2.    ;   goto common start action;

; clear:  empty param list or as scope command.
g11=k-b0               ; clear:  page 4 = psjob descr.
     al  w0     c4     ;   switch := clear; term bs := true;
     rl  w1  x3+d1     ;
     sl  w1     0      ;   if param 1 not empty then
     jl.        c1.    ;   goto convert scope;
     rl. w2    (b14.)  ;   w2:= current corutine;
j1:  rl  w0  x3+228    ;
     rs  w0  x2+12     ;   page 3 := first corr page;
     dl. w3     b9.    ;   page jump to clear corrections;
     jl.       (b1.)   ;   returns to after action;

; scope:  param 1 is login, user, or project.  param2 is file name.
g12=k-b0               ; scope:  page 4 = psjob descr.
     al  w0     c5     ;   switch := scope;  term bs := true;

c1:  rs  w0  x3+d6     ; convert scope:  save switch;
     rl  w2  x3+d1     ;   w2:= param 1;
j2:  dl  w1  x3+227    ;   w01:= std interval;
     sn. w2    (b10.)  ;   if <:login:> then
     jl.        a2.    ;   goto perm2;
     rl. w3     b0.+8  ;
j3:  al  w3  x3+421    ;   w3:= abs std int on job descr page;
     dl  w1  x3+4      ;   w01:= user interval;
     sn. w2    (b11.)  ;   if <:user:> then
     jl.        a3.    ;   goto perm 3;
     sn  w0 (x3-6)     ;
     se  w1 (x3-4)     ;   if user int = max int
     se. w2    (b12.)  ;   or param 1 <> <:project:> then
     jl.        c16.   ;   goto illegal scope;
     dl  w1  x3-4      ;   w01 := max interval;

a3:  am         1      ; perm 3:  perm:=3; skip;
a2:  al  w2     2      ; perm 2:  perm:=2;
     rl. w3     b0.+2  ;   w3:= page 1 abs;
     rs  w2  x3+d7     ;
     ds  w1  x3+d4     ;   scope interval := w01;

g89=j1+1, g90=j2+1, g91=j3+1
\f

                                                                 
; sl 20.12.71          rename, clear, scope          term2 ...15...

     dl. w3     b5.    ;
     jl. w1    (b2.)   ;   prepare bsadjust
     dl  w1  x3+d2+2   ;
     ds  w1  x3+d1+2   ;
     dl  w1  x3+d2+6   ;
     ds  w1  x3+d1+6   ;   param 1 := param 2;

; common start action:  prepares access to entry and checks interval.
c2:  rl  w2  x3+d6     ; common start action:  w2:=switch;
j4:  dl  w1  x3+227    ;   w01:= 
     sn  w2     c4     ;   if switch <> clear then std interval
     dl  w1  x3+d4     ;   else scope interval;
     al  w2  x3+d1     ;
     jl. w3    (b3.)   ;   prepare access(param 1);
     jl.        c10.   ;+2 if no create then goto no create;
jd-1
     se  w2     1      ;+4 if number of accesses <> 1 then
     jl.        c11.   ;   goto entry in use;

     al  w1  x1-1      ; check against max interval:  w1:= upper-1;
     rl. w2     b0.+8  ;
j5:  al  w2  x2+421    ;   w2:= abs std int on job descr page;
     sl  w0 (x2-6)     ;   if lower < max lower
     sl  w1 (x2-4)     ;   or upper-1 >= max upper then
     jl.        c13.   ;   goto no writing permission;
     al  w1  x1+1      ;
     am     (x3+d6)    ;   switch to action;
c0:  jl.               ;   w01 = actual interval of entry;

c3=k+1-c0              ; rename action:  term bs is false.
     al  w1  x3+d3     ;   w1 := new name;
     al  w3  x3+d1     ;   w3 := old name;
     jd         1<11+46;   rename entry;
     sn  w0     5      ;   if reserved by another then
     jl.        c11.   ;   goto entry in use;
     se  w0     0      ;   if not ok then
     jl.        c17.   ;   goto new name exists already;
     dl  w1  x3+d3-d1+2;   oldname:= newname;
     ds  w1  x3+2      ;
     dl  w1  x3+d3-d1+6;
     ds  w1  x3+6      ;
     jl.        c14.   ;   goto common end;

c4=k-c0                ; clear action:  term bs is true.
     sn  w0 (x3+d4-2)  ;   if actual interval
     se  w1 (x3+d4)    ;   <> scope interval then
     jl.        c12.   ;   goto no such entry;
     al  w1  x3+d25    ;   load ref to area to catalog entry
     al  w3  x3+d1     ;   load  ref to name
     jd      1<11+76   ;   lookup entry(head and tail)
     al  w3  x3-d1     ;
     se  w0     0      ;   if not normal answer then
     jl.        c12.   ;   goto alarm - no such entry
     rl  w1  x3+d25    ;   load first word of catalog entry
     la. w1     b15.   ;   w1 := catalog key
     rl  w2  x3+d7     ;   load the scope of the entry to remove
     se  w1  x2        ;   if scope from comm <> scope found then
     jl.        c12.   ;   goto alarm - no such entry
     al  w3  x3+d1     ;
     jd         1<11+48;   remove entry;
     se  w0     0      ;   if not ok then
     jl.        c11.   ;   goto entry in use;
     jl.        c14.   ;   goto common end;

g92=j4+1, g93=j5+1
e.
\f

                                                                          
; sl 20.12.71          rename, clear, scope          term2 ...16...

b. a10  w.             ;

a1:  am         d5-d4  ; set entry base:
a2:  dl  w1  x3+d4     ; set scope base:  w2=return.
     al. w3     b13.   ;
     jd      1<11+72   ;    set base;
     rl. w3     b0.+2  ;
     al  w3  x3+d1     ;    w3 := addr of param 1;
     jl      x2        ;    return;

c5=k-c0                ; scope action:  term bs is true.
     ds  w1  x3+d5     ;    save actual interval of entry;
     al  w3  x3+d1     ;
     jd      1<11+8    ;    reserve process;
     se  w0     0      ;    if not ok then
     jl.        c11.   ;    goto entry in use;
     al  w1  x3+d8-d1  ;
     jd      1<11+76   ;    lookup head and tail;
     rl  w0  x3+d1+8-d1;    save name table addr;
     rx  w0  x3+d8-d1  ;
     la. w0     b15.   ;    w0:= old perm key := looked up key;
     rs  w0  x3+d9-d1  ;

     dl  w1  x3+d4-d1  ; access entry with new scope:
     al  w2  x3        ;    w01:= scope interval;
     jl. w3    (b3.)   ;    prepare access(param 1);
     jl.        a3.    ;+2  if no create then goto perm entry;
     sn  w0 (x3+d4-2)  ;    if actual interval
     se  w1 (x3+d4)    ;    <> scope interval then
     jl.        a3.    ;    goto perm entry;
     rl  w0  x3+d1+8   ; entry with new scope locked:
     sn  w0 (x3+d8)    ;    if name tqble addr = saved name table addr
     jl.        a3.    ;    then goto perm entry;
     se  w2     1      ;    if number of accesses <> 1 then
     jl.        a6.    ;    goto scope entry in use;

     al  w3  x3+d1     ; entry with new scope must be removed later:
     jd      1<11+8    ;    reserve process;
     se  w0     0      ;    if not ok then
     jl.        a6.    ;    goto scope entry in use;
     al  w1     2      ;
     jd      1<11+50   ;    permanent scope entry with key 2;
     rl. w3     b0.+2  ;    w3 := page 1abs;
     am        -2      ;    remove := true; skip;
\f

                                                                  
; sl 20.12.71          rename, clear, scope          term2  ...17...

a3:  al  w0     2      ; permanent entry:  remove := false;
     rs  w0  x3+d6     ;
     jl. w2     a1.    ;    set entry base;
     rl  w1  x3+d7-d1  ;    w1:= perm;
     jd      1<11+50   ;    permanent entry;
     dl. w3     b6.    ;
     jl. w1    (b2.)   ;    call terminate bsadjust;
     jl.        a8.    ;+2  if not ok then goto resources exhausted;

     dl. w3     b5.    ; remove scope entry and set new base:
     jl. w1    (b2.)   ;    prepare bsadjust;
     rl  w0  x3+d6     ;
     se  w0     0      ;    if remove then
     jl.        a4.    ;    begin
     jl. w2     a2.    ;       set scope base;
     jd      1<11+48   ;       remove entry;
     rl. w3     b0.+2  ;    end;
a4:  jl. w2     a1.    ;    set entry base;
     dl  w1  x3+d4-d1  ;
     jd      1<11+74   ;    change entry interval to scope int;
     se  w0     0      ;    if not ok then
     jl.        a9.    ;    goto change impossible;

     am        -22     ;   error code := ok;
a6:  am         9      ; scope entry in use:  error code := 22;
a7:  al  w0     13     ; end resources exhausted:  error code := 13;
     rl. w3     b0.+2  ;    w3:= page 1 abs;
     rs  w0  x3+d9     ;    save error code;
     al  w2  x3+d1     ;
     jl. w3    (b4.)   ;    termonate access of scope entry;
     rl  w0  x3+d8     ;
     rs  w0  x3+d1+8   ;    restore name table addr of entry;
     jl.        c15.   ;    goto end, error code set;

a8:  jl. w2     a1.    ; resources exhausted:  set entry base;
     al  w1     2      ;    permanent(2);  key 3 originally would
     jd      1<11+50   ;    not have caused trouble;
     rl. w3     b0.+2  ;    w3 := page 1 abs;
     rl  w0  x3+d6     ;
     se  w0     0      ;    if remove then
     jl.        a7.    ;    begin
     jl. w2     a2.    ;       set scope base;
     al  w1     3      ;       permanent(3);  key 2 originally would
     jd      1<11+50   ;       not have caused trouble;
     jl.        a7.    ;    end;  goto end resources exhausted;

a9:                    ; change impossible:  new scope entry must have
     rl  w1  x3+d9-d1  ;    been created meanwhile by a job.
     jd      1<11+50   ;    reset permanent key;
     jl.        a6.    ;    goto scope entry in use;
e.
\f


; re 4.11.74            lookup                    term2   ...17a...

; lookup:  filename, scope name or empty
;    without scope name the closest scope is looked up,
;    with scope name exactly the specified scope is looked up

b. a20, j10 w.

g16=k-b0
     dl  w2  x3+d2+2   ;    if param2 empty then
     sh  w1     0      ;
     jl.        a2.    ;      goto login;

     rl  w0  x3+d1     ;    save scope spec
     ds  w2  x3+d1+2   ;
     dl  w2  x3+d2+6   ;    move name
     ds  w2  x3+d1+6   ;

     sn. w0    (b10.)  ;    if param1 = <:login:>
     jl.        a2.    ;

     sn. w0    (b11.)  ;    if param1=<:user:> then
     jl.        a3.    ;      goto user interval;

     se. w0    (b12.)  ;    if param1<><:project:> then
     jl.        a11.   ;      parameter error;

a1:  am        -4-0    ;max interval:
a2:  am         0-4    ;std interval:
a3:  al  w2     4      ;user interval:
     am.       (b0.+8) ;
j1:  dl  w1  x2+421    ;    w0w1:=interval;
     al. w3     b13.   ;    w3:=ref zeroes;
     jd         1<11+72;    set catbase;

     rl. w3     b0.+2  ;
     al  w1  x3+d25    ;    w1:=ref entry;
     al  w3  x3+d1     ;    w3:=ref name;
     jd         1<11+76;    lookup head and tail;
     al  w3  x3-d1     ;    restore w3;
     se  w0     0      ;    if result<>0 then 
     jl.        a10.   ;      goto file does not exist

     sl  w0 (x3+d2)    ;    if param2= text 
     jl.        a4.    ;

     am.       (b0.+8) ;      and
j2:  dl  w1  x2+421    ;      cat base set <> base of entry found then
     sn  w0 (x3+d25+2) ;
     se  w1 (x3+d25+4) ;
     jl.        a10.   ;      goto  file does not exist;

a4:
     dl. w3     b16.   ;
     jl. w1    (b2.)   ;    call print catalog entry;

     dl. w3     b7.    ;    page jump to after action
     jl.       (b1.)   ;
\f


; re 6.2.75             lookup               term2  ...18...

; errors from lookup :

a11: am         5-15   ;param:
a10: al  w0     15     ;file does not exist
     rs  w0  x3+4      ;    save error code;

     dl. w3     b8.    ;    page jump to alarm print;
     jl.       (b1.)   ;

g30=j1+1, g31=j2+1

e.

; common end and common alarm actions:

b. a10  w.             ;
c10: sn  w0     3      ; no create:  if result = entry does not exist
     jl.        c12.   ;    then goto no such entry;
jd-1
c11: am         7      ; entry in use:  error code := 22;
c12: am        -11     ; no such entry:  error code := 15;
c13: am         1      ; no writing permission:  error code := 26;
c17: am         25     ; new name exists already:  error code := 25;
c14: al  w0     0      ; common end:  error code := ok;
     rl. w3     b0.+2  ;    w3 := page 1 abs;
     rs  w0  x3+d9     ;    save error code;
c15: al  w2  x3+d1     ; end, error code set:
     jl. w3    (b4.)   ;    terminate access of entry;
     rl  w0  x3+d6     ;    releases a possible reservation because of
     sz  w0     1      ;    the unique access.
     jl.        a1.    ;    if term bs then
     dl. w3     b6.    ;    begin
     jl. w1    (b2.)   ;       terminate bs adjust;
c.-1, o21, z.          ;    (bossfault xref)
     jd        -21     ;+2     if not ok then boss alarm;
a1:  rl  w0  x3+d9     ;    end;
a2:  rs  w0  x3+4      ;    prepare alarm print;
     dl. w3     b7.    ;
     se  w0     0      ;    if error code = ok then
     dl. w3     b8.    ;    page jump to after action else
     jl.       (b1.)   ;    page jump to alarm print;

c16: al  w0     5      ; illegal scope:  error code := 5;
     rl. w3     b0.+2  ;    w3:= page 1 abs;
     jl.        a2.    ;    page jump to alarm print;
e.
g3=k-g2 ; length page
i.e.
i.e.
\f



; sl 23.7.71          initialize          term2 ...19...


; contents:
; common constants                    19
; check login                         21
; relative time                       22
; logout                              22
; get, clear corrections              25
; save output                         26
; clear up save                       27
; create output                       28
; save                                29
; alarms                              30
; initialization                      31

b. d30, g200  w.       ;
h4=h3-k  ; continue external list
     g10., g11., g12., g13., g14., g15., g16., g17., g18., g19.
     g20., g21., g22., g23., g24., g25., g26., g27., g28., g29.
     g30., g31., g32., g33., g34., g35., g36., g37., g38., g39.
     g40., g41., g42., g43., g44., g45., g46., g47., g48., g49.
     g50., g51., g52., g53., g54., g55., g56., g57., g58., g59.
     g60., g61., g62., g63., g64., g65., g66., g67., g68., g69.
     g70., g71., g72., g73., g74., g75., g76., g77., g78., g79.
     g80., g81., g82., g83., g84., g85., g86., g87., g88., g89.
     g90., g91., g92., g93., g94., g95., g96., g97., g98., g99.
     g100.,g101.,g102.,g103.,g104.,g105.,g106.,g107.,g108.,g109.
     g110.,g111.,g112.,g113.,g118.,g119.
     g120.,g121.,g122.,g123.,g124.,g125.,g126.,g127.,g128.,g129.
     g130.,g131.,g132.,g133.,g134.,g135.,g136.,g137.,g138.,g139.
     g140.,g141.,g142.,g143.,g144.,g145.,g146.,g147.,g148.,g149.
     g150.,g151.,g152.,g153.,g154.,g155.,g156.,g157.,g158.,g159.
     g160.,g161.,      g163.,g164.,g165.,g166.,g167.,g168.,g169.
     g171.,g172.,g173.,g175.,g176.,g177.,g178.,g184.,g185.,g186.
     g187.,g188.,g189.
h5:  h6
     jl.        g2.    ;    goto initialisation;


     d1=4, d2=12       ;    param 1 and param 2 (rel on page 1)
     d3=20             ;    param 3
     d4=16             ;    kit name in tail
     d5=14             ;    tail address, area size
     d6=d5+20          ;    segm count output
     d7=d6+2           ;    error code
     d8=d7+2           ;    work, rel return
     d25=q0            ;    entry address, lookup head and tail
     ;note: corresponds to d25 on codepage 102

c. d8-i46-2, m.***login get etc: i46 too small
z.
c. i44-1-i62, m.***save buffer too short: i44 and i62
z.
\f


; sl 23.7.71          login, get, etc          term2 ...20...

b. b50, c30  w.        ;
g0:                    ; begin code page
b0:       0,r.5        ;    page addresses
    103<12 + 0         ;    page ident:  login, get, save
b1=k+2, g37:159,g38:160;    lookup user
b2:  g39: 25           ;    call
b3:       -1-16        ;    remove unlogged
b4:  g40: 33           ;    terminate acces
b5:  g41: 26           ;    current corutine
b6=k+2, g42:157,g43:213;    clear corrections
b7=k+2, g44:202,g45:203;    after action
b8:  g46: 8            ;    page jump
b9:  g47: 7            ;    get pages
b10:      7            ;    mask for cat key
b11=k+2,g48:162,g49:225;    login after error
b12=k+2,g50:244,g51:246;    kill
b13:      600 000      ;    time conversion
b14=k+2,g52:162,g53:229;    general print
b15=k+2,g54:157,g55:211;    bulk get
b16: g56: 8<12+19      ;    reserve 8 bytes for operator name, op name + 2
b17:      0            ;    operator name + 6
b19:      0            ;    0 for set interval
          5<12         ;-2  output operation, save
b21:      0, r.8       ;    answer message
b20:g189: 138          ;    hotnews request line address
b22: g58: 233          ;    save buffer
b23=k+2,g59:157,g60:161;    init line
b24:      i62<9-2      ;    last of save buffer
b25=k+2,g61:157,g62:212;    bulk save
b26: g63: 2            ;    send and wait fast
b27:      -1-1<18-1<1  ;    allowed output bits: end document, normal answer
b28: g64: 32           ;    prepare acces
b29=k+2,g66:162,g67:204;    alarm printing
b30=k+2,g68:162,g69:205;    io alarm printing
b31=k+2,g76:206,    c7 ;    continue, return from bulk get
b32: g79: 74           ;    catalog
b33: g80: 3            ;    lock
b34=k+2,g81:495,g82:363;    entry clean catalog
b35=k+2,g84:415,g85:413;    prepare bs adjust
b36=k+2,g86:415,g87:414;    terminate bs adjust
b37:    g89:  4        ;    open
b38:    g90:280        ;    banker page
b39:    g91:435        ;    virt account buf
b40=k+2,g92:436,g93:431;    outrec account
b43:   g103:284        ;    length psjob descr
b48: g108:34           ;     w0 call
b49=k+2, g113:206, g114;    entry create output
b50: g118:5            ;    lock chained
b41: <:disc:>           ;  used by save
\f


; sl 23.7.71          login          term2 ...21...

; check login:   param 1 contains user name, param 2 user index
; or project id, param 3 project id or empty. page 4 = job descr.
b. a10, j15  w.        ;
g3:  rl. w2     b0.+8  ; check login:  w2:= page 4 abs;
j7:  al  w2  x2+326    ;    w2:= addr project number;
     dl  w1  x3+d1+2   ;
     ds  w1  x2-8      ;    move param 1 to user name;
     dl  w1  x3+d1+6   ;
     ds  w1  x2-4      ;
     dl  w1  x3+d1+18  ;    w0:= param 3 type;
     se  w0     0      ;    if param 3 is number then
     jl.        a2.    ;    begin
     rl  w0  x3+d1+10  ;       w1:= param 3; w0:= param 2;
     jl.        a3.    ;    end else
a2:  rl  w1  x3+d1+10  ;    begin w1:=param 2; w0:=0
     al  w0     0      ;    end;
a3:  ds  w1  x2        ;    project := w1; user index := w0;

     dl. w3     b1.    ;    call lookup user;
     jl. w1    (b2.)   ;
     jl.        c20.   ;+2  illegal user index
     jl.        c21.   ;+4  illegal identification
     jl.        c22.   ;+6  job exists already
     rl. w2     b0.+8  ;    w2:= page 4 abs;
j8:  al  w2  x2+340    ;    w2:= device word abs;
     bl  w1  x2-2      ;    remove online card bit;
     sz  w1     1<8    ;
     al  w1  x1-1<8    ;
     hs  w1  x2-2      ;
j9:  al  w2  x2+422    ;    w2:= max device word abs;
     bl  w1  x2-2      ;    remove max online card bit;
     so  w1     1<8    ;
     al  w1  x1+1<8    ;
     hs  w1  x2-2      ;

j1:  bl  w0  x3+179    ;
     la. w0     b3.    ;    console state:= console state
j2:  hs  w0  x3+179    ;    remove unlogged;
     so  w0     1      ;    if operator then
     jl.        a1.    ;    begin
     al  w2    -1-1<3-1<2-1<1;
     am.       (b0.+8) ;    set max user rights;
j12: rs  w2    +172    ;    on job descr page;
     am.       (b0.+8) ;  
j6:  al  w2    +326    ;      w2:= addr of job name;
     dl  w1  x2-8      ;
     ds. w1    (b16.)  ;      copy user name to operator name;
     dl  w1  x2-4      ;
     ds. w1    (b17.)  ;    end;

a1:  jl. w2     c1.    ;    w1:= login time:= relative time;
     al  w2     0      ;    operations performed:= 0;
j3:  ds  w2  x3+226    ;
     am.       (b0.+8) ;
j4:  dl  w1    +421    ;
j5:  ds  w1  x3+227    ;    copy std interval to jobfile page;
     am.       (b0.+8) ;
j10: rl  w1    +172    ;    move terminal user rights to job file page;
j11: rs  w1  x3+134    ;
     jl. w1     c2.    ;    clear corrections;
\f

                                                       
; sl 18.1.72          login          term2 ...22...

     al  w0     0      ;
     al  w1     20     ;    param1:= <:in:>;
     ds  w1  x3+6      ;
     al  w1    -10     ;    param2:= time;
     rs  w1  x3+8      ;
     al  w1     8      ;    param3:= <:<10>:>;
     ds  w1  x3+12     ;
     al  w1    -18    ;
     rs  w1  x3+14    ;  param4 :=text to appear after login
     rl. w2    (b5.)   ;    cur ciruno page 3:=
     rl. w0    (b20.)  ;      hotnews request line
     rs  w0  x2+12     ;
     sn  w0     0      ;    if hotnews pending then
     jl.        a4.    ;    begin
     al  w1    -6      ;
     rs  w1  x3+16     ;      param5:=outblock and return
     dl. w3     b14.   ;
     jl. w1    (b2.)   ;      call general print
     al  w1    -16     ;
     rs  w1  x3+4      ;      param1:=hotnews
     al  w1    -4      ;
     rs  w1  x3+6      ;      param2:=outblock and goto after action
     jl.        a5.    ;    end else
a4:  al  w1    -4      ;
     rs  w1  x3+16     ;      param5:=outblock and goto after action
a5:  dl. w3     b14.   ;
     jl.       (b8.)   ;    goto general print


; relative time:   w2 = return. at return, w0 spoiled, w1 =
; time since boss start (in seconds), w2, w3 unchanged.

c1:  al  w0     0      ; relative time:
     rl  w1     106    ;
     aa  w1     110    ;
     ld  w1    -13     ;    w1:= (microsec + time)// 8k;
     jl      x2        ;    return;

g10=j1+1, g11=j2+1, g12=j3+1, g13=j4+1, g14=j5+1, g15=j6+1, g78=j7+1
g153=j8+1, g154=j9+1, g184=j10+1, g185=j11+1, g186=j12+1
e.                     ;

; logout:   called as a normal command or indirectly when the
; terminal returns dummy answers. page 4 = job descr.

; ext 289 (special char) on job file page
; must contain -1 or a textindex for general print

b. a10, j12  w.        ;
g4:                    ; logout:
j5:  bz  w0  x3+179    ;    w0:= console state;
     so  w0     16     ;
     jl.        a1.    ;    if unlogged then
     dl. w3     b11.   ;    page jump to login after error;
     jl.       (b8.)   ;

a1:  sz  w0     4      ;
     jl.        a2.    ;    if not ready then
     al  w0    -1      ;    begin
     rs  w0  x3+4      ;      param:=empty;
     dl. w3     b12.   ;    call kill;
     jl. w1    (b2.)   ;
j6:  rl  w2  x3+221    ;
     jl. w3    (b37.)  ;      open(terminal reserve);
\f


; sl 19.10.72          logout          term2 ...23...


a3:                    ; wait finis:
j7:  rl  w2  x3+223   ;
     jl. w3    (b50.)  ;      lock chained(attention);
     bz  w0  x1+3      ;      if operation <> finis then
     sn  w0     3      ;      begin
     jl.        a4.    ;
     sl  w0     4      ;        if login attention then
c.-1, o101, z.         ;    (bossfault xref)
     jd        -101    ;          ***bossfault 101
     al  w2     0      ;        operation:= free;
     hs  w2  x1+2      ;
     se  w0     0      ;        if operation <> att mess then
     jl.        a3.    ;        goto wait finis;
     rx  w2  x1+4      ;        sender.mess:= 0;
     al  w0     1      ;        result:= normal;
     jd         1<11+22;        send answer;
     jl.        a3.    ;        goto wait finis;
a4:                    ;      end;
j9:  bz  w1  x3+179    ;
     al  w1  x1+4      ;    console state:= console state +
j10: hs  w1  x3+179    ;    ready;
j8:  rl  w2  x3+221    ;      
     jl. w3    (b33.)  ;      lock(terminal reserve);
                       ;    end;

a2:  bz  w1  x3+179    ;
     al  w1  x1+16     ;    console state:= console state + unlogged;
j1:  hs  w1  x3+179    ;
     jl. w1     c2.    ;    clear corrections
     dl. w3     b35.   ;    call(prepare bsadjust);
     jl. w1    (b2.)   ;      (to update restkey3 in case of loans)

     rl. w1    (b5.)   ; clean catalog:
     rl. w0     b22.   ;    w1:=current corutine;
     rs  w0  x1+12     ;    page3:=save buf;
     al  w0     3     ;
     rs  w0  x3+4      ;    top clean key:=3;
j4:  dl  w1  x3+227   ;
     ds  w1  x3+8      ;    clean interval:= std int;
     dl. w3     b34.  ;
     jl. w1    (b2.)   ;    call clean catalog;
     rl. w3     b0.+8  ;
     al  w1     0      ;
j11: rs  w1  x3+412    ;    drum rest key 1 := 0;
j12: rs  w1  x3+410    ;    disc rest key 1 := 0;
     dl. w3     b36.   ;   call(terminate bsadjust);
     jl. w1    (b2.)   ;
c.-1, o25, z.          ;    (bossfault xref)
     jd        -25     ;    if claims exceeded then alarm;

     jl. w2     c1.    ;    w1:=relativ time;
j2:  ss  w2  x3+226    ;
     ld  w2    -11     ;
     wd. w2     b13.   ;    login time:=(relativ time-time logged in)/600000;
j3:  rs  w2  x3+494    ;

g17=j4+1, g18=a2+1, g19=j1+1, g77=j5+1, g94=j6+1, g95=j7+1, g96=j8+1
g57=j9+1, g119=j10+1, g155=j2+1, g156=j3+1
g167=j11+1, g168=j12+1
e.                     ;
\f


; sl 20.12.71          logout          term2 ...24...


b.a9,j19  w.
     rl. w1    (b5.)  ; account:
     rl. w0     b38.  ;
     rs  w0  x1+12    ;    page3:= banker page;
     jl. w3    (b9.)  ;    get pages;

     rl. w2     b0.+6 ;    w2:= banker page;
     am.       (b0.+8);    page4 = psjob descr.
j6:  bz  w1    +324   ;    w1:= psjob number - 2;
     al  w1  x1-2     ;
     wm. w1     b43.  ;    w1:= w1 * psjob descr length;
     am      x1       ;    w0:=0;
j7:  al  w1  x2+281   ;    clear name in banker page;
     rs  w0  x1       ;
     rs  w0  x1+2     ;
     rs  w0  x1+4     ;
     rs  w0  x1+6     ;
j1:  rl  w0  x2+267   ;
     sh  w0     1     ;    if free account>1 then
     jl.        a1.   ;    begin
     bs. w0     1     ;      free accounts:= free accounts - 1;
g145=k+1              ;
     rs  w0  x2+267   ; 

     rl. w0     b39.  ;      
     rl. w1    (b5.)  ;
     rs  w0  x1+12    ;      page3:= virt account buf;
j4:  rl  w1  x2+269   ;
     al  w1  x1+1     ;      accounter acc:=accounter acc+ 1;
j5:  rs  w1  x2+269   ;
     al  w0     4     ;      w2:= addr free acc class 0;
j2:  al  w2  x2+268   ;      for w0:= 4 step -1 until 1 do
a2:  rl  w1  x2       ;      begin
     al  w1  x1-1     ;        free acc(class ):= free acc(class) - 1;
     rs  w1  x2       ;
j3:  al  w2  x2+294   ;        w2:= next class;
     bs. w0     1     ;
     sl  w0     1     ;
     jl.        a2.   ;      end;
\f


; kll 15.2.73          logout        term2 ...24a...


j10: dl  w1  x3+226    ;    param1:=time used;
     ds  w1  x3+8     ;    param2:=operations;
     al  w0     2     ;      kind:=logout record;
     rs  w0  x3+4     ;
     rl. w2     b0.+8 ;
j8:  al  w2  x2+326   ;      w2:= abs project number on job descr;
     rl  w0  x2       ;
     rs  w0  x3+18    ;      move project number
     dl  w1  x2-8     ;
     ds  w1  x3+12    ;      move user name;
     dl  w1  x2-4     ;
     ds  w1  x3+16    ;
     dl. w3     b40.  ;      call outrec account;
     jl. w1    (b2.)  ;    end;

a1:  rl. w2    (b5.)  ;
     ld  w1     64    ;    page3 := page4 := 0;
     ds  w1  x2+14    ;
j11: rl  w1  x3+289    ;    w1:=logout cause;
     sn  w1    -1      ;    if not normal logout then
     jl.        a3.    ;    begin
     al  w0     0      ;
     ds  w1  x3+10     ;      item2:=<:<logout cause>:>;
     al  w1     31     ;
     ds  w1  x3+6      ;      item1:=<:logout caused by:>;
     al  w1    -6      ;
     rs  w1  x3+12     ;      item3:=outblock, return;
     dl. w3     b14.   ;
     jl. w1    (b2.)   ;      call general print;
a3:                    ;    end;
j0:  rl  w1  x3+494    ;
     al  w0    -2      ;
     ds  w1  x3+10     ;    item 2:= print integer(time logged in);
j9:  rl  w1  x3+226    ;
     ds  w1  x3+18     ;    item 4:= print integer(operations performed);
     al  w0    -6      ;
     rs  w0  x3+24     ;    item 6:= outblock, return;
     ld  w1     64     ;
     ds  w1  x3+6      ;    item 1:= <:logged in:>;
     al  w1     1      ;
     ds  w1  x3+14     ;    item 3:= <:min. operations:>;
     al  w1     8      ;
     ds  w1  x3+22     ;    item 5:= <newline>;
     dl. w3     b14.   ;
     jl. w1    (b2.)   ;    call general print;

     dl. w3     b11.  ;
     jl.       (b8.)  ;    page jump(login after error);

g97=j1+1, g98=j2+1, g99=j3+1, g100=j4+1, g101=j5+1
g104=j6+1, g105=j7+1, g106=j8+1, g20=j0+1, g74=j9+1, g157=j10+1
g25=j11+1
e.
\f


; sl 23.7.71          get          term2 ...25...

; get:   param 1 is name of new basis file. may be called from
; commandio central or from psjob in case of off-line jobs.
b. a10, j20  w.        ;


g5=k
     dl. w1     b31.   ; get:   bulk return:= continue; odd addr;
j8:  ds  w1  x3+257    ;
g9:  jl. w1     c2.    ; get from psjob:   clear corrections;
j1:  al  w2  x3+218    ;    w2:= name of basis file;
     dl  w1  x3+6      ;
     ds  w1  x2+2      ;    copy param 1 to name of basis file;
     dl  w1  x3+10     ;
     ds  w1  x2+6      ;
j11: rl  w0  x3+177    ;
     rl. w2    (b5.)   ;
     rs  w0  x2+14     ;    page 4 := job descr page;
     rl. w2     b32.  ;    lock(catalog); ensures that no
     jl. w3    (b33.) ;    boss changing of file takes place;
     rl. w2     b32.  ;    open(catalock);
     jl. w3    (b37.) ;
j6:  dl  w1  x3+227   ;    w01:= std int;
j7:  al  w2  x3+218   ;    w2:= name of basis file;
     jl. w3    (b28.) ;    prepare acces; if not ok then
     jl.        c10.  ;+2  goto alarm 10;

     al  w1  x3+d25    ;
j10: al  w3  x3+218    ;    w3:=name of basis file;
     jd         1<11+76;    lookup head and tail;
     bz  w0  x1+30     ;    w0:=content;
     sn  w0     0      ;
     jl.        a0.    ;    if content not text then
     rl. w3     b0.+2  ;
j14: rl  w1  x3+257    ;      if get from commandio then
     sz  w1     1      ;
     jl. w1     c2.    ;      clear corrections;
     jl.        c9.    ;      goto not text file;

a0:                    ;      end;
     rl. w3     b0.+2  ;
     rl  w2  x3+d2     ;    if get from commandio
j12: rl  w1  x3+257    ;      and param2 not empty then
     sz  w1     1      ;
     sn  w2    -1      ;
     jl.        a1.    ;
     jl.        c14.   ;      goto print catalog entry;
c24:                   ;return form print entry:
a1:                    ;

\f


; re 4.11.74               get               term2  ...25a...

     al  w0     10     ;
     al  w1     0      ;
j2:  ds  w1  x3+230    ;    next file line:=10;  next file index:= 0;
j3:  rs  w1  x3+231    ;    segment number:= 0;
j9:  rl  w2  x3+257    ;    w2:= bulk return rel;
     so  w2     1      ;    w0:= page 4 descr:= if odd return then 0
j5:  rl  w0  x3+177    ;    else job descr page;
     rl. w2    (b5.)   ;    w2:= current corutine;
j4:  rl  w3  x3+189    ;    w3:= page 3 descr:= work page;
     ds  w0  x2+14     ;
     dl. w3     b15.   ;    page jump to bulk get;
     jl.       (b8.)   ;
c7=k+1-b0              ; continue:
     jl.        c11.   ;+0  goto io alarm; undo: clear corrections;
     jl.        c12.   ;+2  file too long:   goto alarm 12; undo: clear corrections;
     jl.        c8.    ;+4  normal:   goto after action:

g21=j1+1, g22=j2+1, g23=j3+1, g24=j4+1, g75=j5+1, g65=j6+1, g102=j7+1
g107=j8+1, g110=j9+1, g163=j10+1, g148=j11+1, g169=j12+1,  g176=j14+1
e.                     ;


; clear corrections:   w1 = return, w3 = page 3 abs. return: as
; from a page procedure.

c2:  rl  w3  x3+228    ; clear corrections:
     rl. w2    (b5.)   ;    page3:=first corr page;
     rs  w3  x2+12     ;
     dl. w3     b6.    ;    call clear corrections;
     jl.       (b2.)   ;    return;

g16=c2+1
\f


;  re 4.11.74         print entry              term2   ...25b...

; procedure
; print catalog entry
;     the procedure prints an entire catalog entry which is found in
;     rel d25 on job file page.
;     return address is stored in ext 257 on job file page.
; subentry: c14 - called from get -
;     prints date and time and a mnemonic scope name from the entry.
;     returns to get: c24
; the printing is done by means of general print.

b. a15,j10 w.

a14=k+2,  0,0          ;    saved w2,w3 at convert clock

g174=k-b0
     dl  w1  x3+2      ;
j1:  ds  w1  x3+257    ;    save virt, rel return

     al  w2  x3+d1     ;    w2:=first store;

;    dl  w1  x3+d1+2   ;
;    ds  w1  x2+2      ;
;    dl  w1  x3+d1+6   ;    move file name;
;    ds  w1  x2+6      ;

     al  w0     0      ;
     al  w1     40     ;
     ds  w1  x2+10     ;    <:= set:>

     al  w2  x2+12     ;    w2:=first store;
     al  w0    -14     ;
     rl  w1  x3+d25+14 ;    w1:=size
     ds  w1  x2+2      ;

     sl  w1     0      ;    if size > 0 then
     jl.        a0.    ;      print as word
                       ;    else
     al  w3  x3+d25+14 ;
     jl. w1     c3.    ;      pack word in bytes;

a0:  rl. w3     b0.+2  ;    w2=last store - 2.

     al  w0     0      ;
     al  w1     19     ;
     ds  w1  x2+6      ;    <: :>

     dl  w1  x3+d25+18 ;    move
     ds  w1  x2+10     ;
     dl  w1  x3+d25+22 ;    document name
     ds  w1  x2+14     ;

     al  w0    -6      ;    outblock and return;
     rs  w0  x2+16     ;

     dl. w3     b14.   ;
     jl. w1    (b2.)   ;    call general print;

\f


; re 4.11.74           print entry        term2  ...25c...

     am         8      ;
c14: al  w1     d25+24 ;entry from get:  w1:=rel addr of last word to output;
     al  w2  x3+d1     ;    w2:=first store;
     al  w3  x3+d25+24 ;    w3:=addr of first word to output;
     rs  w1  x3-2      ;    save addr of last word to output;
     bl  w0  x3+6      ;    w0:=content
     se  w0     4      ;    if content=4 or
     sl  w0     33     ;    content>32 then
     jl.        a15.   ;    skip short clock
     rl  w0  x3        ;    w0:=short clock
     sn  w0     0      ;    if short clock<>0 then
     jl.        a15.   ;    begin
     ds. w3     a14.   ;      save w2,w3
     jl. w3     c26.   ;      convert short clock
     rl. w2     a14.-2 ;
     rs  w0  x2+6      ;      set date,
     rs  w3  x2+14     ;          time
     rl. w3     a14.   ;
     al  w0    -13     ;
     rs  w0  x2+4      ;      set format <<-d>
     rs  w0  x2+12     ;
     al  w0     0      ;
     al  w1     51     ;
     ds  w1  x2+2      ;      set <: d.:>
     al  w1     42     ;
     ds  w1  x2+10     ;      set <:.:>
     al  w2  x2+16     ;      w2:=new first core
     al  w3  x3+2      ;      w3:=next word to output
a15: rl. w1     b0.+2  ;
     wa  w1  x1+d25+24-2;   w1:=last word to output
     sl  w3  x1        ;    if called from get  (w3>=last to output)
     jl.        a2.    ;    then skip rest of tail

a1:  jl. w1     c3.    ;rep: pack word in bytes;

     al  w2  x2+4      ;   w2:=first store;
     al  w3  x3+2      ;   w3:=next word to output;
     rl. w1     b0.+2  ;
     wa  w1  x1+d25+24-2;
     sh  w3  x1        ;
     jl.        a1.    ;     goto rep;

a2:  al  w0     0      ;
     al  w1     41     ;
     ds  w1  x2+2      ;    <:; :>

     am.       (b0.+2) ;
     dl  w1    +d25+4  ;    w0w1:=entry interval;
     rl. w3     b0.+8  ;
j2:  al  w3  x3+421    ;    w3:=addr of std interval on job descr page;

     sn  w0 (x3-2)     ;
     se  w1 (x3)       ;    if w0w1 = std interval then
     jl.        a11.      ;
     am.      (b0.+2) ;
     bz  w1    +d25+1 ;   w1 := byte1
     la. w1     b10.  ;   w1 := catalog key
     sh  w1     2     ;   if w1 <= 2 then (i.e. cat key login or temp)
     jl.        a5.   ;   goto login
     jl.        a6.   ;   else goto user

a11: sn  w0 (x3+2)     ;
     se  w1 (x3+4)     ;    if w0w1 = user interval then
     jl.        4      ;
     jl.        a6.    ;      goto user;

     sn  w0 (x3-6)     ;
     se  w1 (x3-4)     ;    if w0w1 =max interval then
     jl.        4      ;
     jl.        a7.    ;      goto project;

     al  w1  x1+1      ;    if w0w1 includes max interval then
     sh  w0 (x3-6)     ;
     sh  w1 (x3-4)     ;      goto system;

a9:  am         39-38  ;***:
a8:  am         38-37  ;system:
a7:  am         37-36  ;project:
a6:  am         36-35  ;user:
a5:  al  w1     35     ;login:
     al  w0     0      ;
     ds  w1  x2+6      ;    scope name

     al  w1     8      ;
     ds  w1  x2+10     ;    new line
   
     al  w1    -6      ;
     rs  w1  x2+12     ;    outblock and return;

     dl. w3     b14.   ;
     jl. w1    (b2.)   ;    call general print;

     rl  w0  x3+d25+24-2;   if called from get then
     se  w0     d25+24+8;
     jl.        c24.   ;      return to get;

\f


; re 4.11.74              print entry          term2  ...25d...

     al  w2  x3+d1     ;    w2:=first store;

     al  w0     0      ;
     al  w1     41     ;
     ds  w1  x2+2      ;    semi colon

     al  w0    -14     ;
     bz  w1  x3+d25    ;
     ds  w1  x2+6      ;    first slice

     bz  w1  x3+d25+1  ;
     ls  w1    -3      ;
     ds  w1  x2+10     ;    name key

     bz  w1  x3+d25+1  ;
     la. w1     b10.   ;
     ds  w1  x2+14     ;    cat key

     rl  w1  x3+d25+2  ;
     ds  w1  x2+18     ;    low base
     rl  w1  x3+d25+4  ;
     ds  w1  x2+22     ;    high base

     al  w0     0      ;
     al  w1     8      ;
     ds  w1  x2+26     ;    new line

     al  w1    -6      ;
     rs  w1  x2+28     ;    outblock and return

     dl. w3     b14.   ;
     jl. w1    (b2.)   ;    call general print;

j3:  dl  w3  x3+257    ;    page jump
     jl.       (b8.)   ;      to return;
\f


; re 6.2.75             print entry          term2   ...25e...


; procedure pack word in bytes
; call:   w1 = return
;         w2 = first store
;         w3 = addr of word to pack
; return: w2 = last store - 2
;         w3 unchanged

                0      ;-2  saved return.
c3:  rs. w1     c3.-2  ;    save return;

     al  w0     0      ;
     al  w1     42     ;
     ds  w1  x2+6      ;    <:.:>

     al  w0    -14     ;
     bz  w1  x3        ;
     ds  w1  x2+2      ;    left byte

     sn  w1     0      ;    if left byte = 0 then
     jl.        a4.    ;

     al  w0    -13     ;
     al  w2  x2+8      ;      forget left byte and <:.:>

a4:  bz  w1  x3+1      ;
     ds  w1  x2+2      ;    right byte

     jl.       (c3.-2) ;
   
g171=j1+1, g172=j2+1, g173=j3+1
e.
\f


; lkn 76.09.30        print entry        term2     ...25f...


; procedure convert clock  (short clock)
;
;
; this procedure is an inversion of the following algorithm
; for computing day-number from a date  (year,month,date)
; extended with a conversion of the time of the day:
;
;
;    if month<3 then
;    begin
;      month:=month+12;
;      year:=year-1;
;    end;
;    dayno:=(1461*year)//4 + (153*month+3)//5 + day;
;
;
;
;      call:               return:
;
; w0   short clock         year*10000+month*100+date
; w1   irrelevant          destroyed
; w2   irrelevant          destroyed
; w3   return              hour*100+minute
;
;
b.  a20  w.

a0:  1172              ;    units per minute
a1:  70313             ;    units per hour
a2:  1687500           ;    units per day
a3:  153               ;    days in the five months (march-july)
a4:  1461              ;    days in four years
a5:  99111             ;    offset for computing year 
a6:  5                 ;
a7:  100               ;    constant for packing date and time
a8:  0                 ;    saved return address
     0                 ;    saved minute
a9:  0                 ;    saved hour

a11=461                ;    three months offset
a12=5                  ;    one days offset
a13=586                ;    half a minute

c26: ld  w2    -100    ;    clear w1,w2
     rs. w3     a8.    ;    save return address
     al  w3     0      ;    clear w3
     ld  w0     10     ;    w3,w0:=short clock<10 (=truncated clock>9)
     wd. w0     a2.    ;    w0:=dayno
     al  w3  x3+a13    ;    add minute rounding
     wd. w3     a1.    ;    w3:=hour
     wd. w2     a0.    ;    w2:=minute
     ds. w3     a9.    ;    save minute,hour
     al  w3     0      ;    clear w3
     ld  w2    -100    ;    clear w1,w2
     ls  w0     2      ;    w0:=dayno*4
     wa. w0     a5.    ;    add offset
     wd. w0     a4.    ;    w0:=year
     ls  w3    -2      ;    w3 is converted 
     wm. w3     a6.    ;    to fifthdays
     al  w3  x3+a11    ;    w3:=w3+three months offset
     wd. w3     a3.    ;    w3:=month
     sh  w3     12     ;    if month>12 then
     jl.        a15.   ;    begin
     ba. w0     1      ;      increase year
     al  w3  x3-12     ;      decrease month
a15: al  w2  x2+a12    ;    end
     wd. w2     a6.    ;    w2:=date
     rs  w3     2      ;    save month (in w1)
     wm. w0     a7.    ;    w0:=year*100
     wa  w0     2      ;      + month
     wm. w0     a7.    ;      * 100
     wa  w0     4      ;      + date
     rl. w3     a9.    ;    w3:=hour
     wm. w3     a7.    ;      * 100
     wa. w3     a9.-2  ;      + minute
     jl.       (a8.)   ;    return
e.

\f


; sl 23.7.71          save          term2 ...26...

; save output:   w2 = return, w3 = page 1 abs. return: w3 = page 1 abs.
; outputs page 4 from byte 0 to base store rel. extends the area if
; necessary.

b. a10, j10  w.        ;
c4:  ws. w2     b0.    ; save output:
     rs  w2  x3+d8     ;    save relative return;
a1:  rl  w0  x3+d6     ; rep output:
     rs. w0     b21.+4 ;    segm:= segm count output;
     rl. w1     b0.+8  ;
     al  w0  x1        ;    first addr:= page 4 abs;
j3:  wa  w1  x3+187    ;    last addr:= page 4 abs + base store rel;
     al  w1  x1+510    ;    (round up to a segment)
     ds. w1     b21.+2 ;
     al. w1     b21.-2 ;
     al  w2  x3+d1     ;
     jl. w3    (b26.)  ;    send and wait fast;

     sz. w0    (b27.)  ;    if hard errors then
     jl.        c16.   ;    goto ioalarm 16;
     rl  w1  x1+2      ;    w1:= bytes transferred;
j1:  sh  w1 (x3+187)   ;    if bytes transferred > base store rel then
     jl.        a2.    ;    begin
     ls  w1    -9      ;      segment count output:=
     wa  w1  x3+d6     ;      segment count output +
     rs  w1  x3+d6     ;      bytes transferred // 512;
     am     (x3+d8)    ;      return;
     jl.        b0.    ;    end;

a2:  rl  w1 (x3+d1+8)  ; area too small: w1 := ref area process;
     rl  w2  x1+10     ;    w2 := ref disc process;
     al  w0     0      ;
     rl  w1  x3+d5     ;    w0w1 := old area size;
     wd  w1  x2+e50    ;
     al  w1  x1+1      ;
     wm  w1  x2+e50    ;
     rs  w1  x3+d5     ;    areasize := areasize + slicelength;
j2:  dl  w1  x3+227    ;
     al. w3     b19.   ;    set std interval;
     jd         1<11+72;
     rl. w3     b0.+2  ;
     al  w1  x3+d5     ;
     al  w3  x3+d1     ;    change entry;
     jd         1<11+44;
     rl. w3     b0.+2  ;    w3:= page 1 abs;
     se  w0     0      ;    if not ok then
     jl.        c17.   ;    goto alarm 17;
     jl.        a1.    ;    goto rep output;

g26=j1+1, g27=j2+1, g158=j3+1
e.                     ;
\f


; sl 23.7.71          save          term2 ...27...

; clear up save:   w1 = return, w3 = page 1 abs, error code in x3+d7.
; return: w0 = error code, w3 = page 1 abs.
b. a10, j10  w.        ;
c6:  al  w0     0      ; clear up save, no error code:
     rs  w0  x3+d7     ;    error code:= 0;
c5:  ws. w1     b0.    ; clear up save:
     rs  w1  x3+d8     ;    save rel return;
     jd        -1      ;
     rl  w0  x3+d1+8   ;    w0:= name table address of save file;
j1:  am      x3+218    ;
     sn  w0   (+8)     ;    if name table addr save = name table addr basis file
     jl. w1     c2.    ;    then clear corrections;

     al  w2  x3+d1     ;
     jl. w3    (b4.)   ;    release access(save file);

     rl  w2  x3+d6     ;    w2:=no of segments output;
     al  w1  x3+d5     ;    w1:=addr of tail;
     al  w3  x3+d1     ;    if size <> no of segments output then
     sn  w2 (x1)       ;
     jl.        a3.    ;
     rs  w2  x1        ;
     jd         1<11+44;      change entry;
a3:  al  w1     2      ;    w1:=cat key;
     jd         1<11+50;    permanent entry(key=2);
     rl. w3     b0.+2  ;
jd -1
     se  w0     0      ;    if result not ok then
     jl.        a2.    ;      goto remove entry;

     rl  w0  x3+d7     ;
     jd        -1      ;
     so  w0     2      ;    if error code shows remove entry then
     jl.        a1.    ;    begin
a2:  dl  w1  x3+227    ; remove entry:
     al. w3     b19.   ;
     jd         1<11+72;      set std interval;
     am.       (b0.+2) ;
     al  w3    +d1     ;      remove entry(param 1);
     jd         1<11+48;
     rl. w3     b0.+2  ;      w3:= page 1 abs;
     al  w0     g7     ;      rel return:= alarm 18;
     rs  w0  x3+d8     ;    end;
a1:
     rl. w2    (b5.)   ;    w2:= current corutine;
j2:  rl  w0  x3+177    ;    
     rs  w0  x2+14     ;    page 4:= job descr page;
     dl. w3     b36.   ;
     jl. w1    (b2.)   ;    call terminate bs adjust;
     jl.        a2.    ;+2  if exceeded then goto remove entry;

     rl  w0  x3+d7     ;    w0:= error code;
     am     (x3+d8)    ;
     jl.       +b0.    ;    return;
c13: ws. w1     b0.    ; term bs:
     rs  w1  x3+d8     ;    save rel return;
     jl.        a1.    ;    goto call term bs;

g28=j1+1, g29=a2+1, g88=j2+1
e.                     ;
\f


; sl 23.7.71          save          term2 ...28...

; procedure create output:   param 1 is file name. param 2 is empty 
; or kit name.  param 3 is size. page 4 = job descr page
; called by w0call, w0 = d8 on page 1.

b. a15, j15  w.        ;
g114=k-b0              ; create output:
     dl. w3     b35.   ;    prepare bs adjust;
     jl. w1    (b2.)   ;
     jd         1<11+36;    get clock
     ld  w1     5      ;    w0:=short clock
     al  w1     0      ;
     ds  w1  x3+d5+12  ;    set short clock in entry

     rl  w2  x3+d3+2   ;    w2:=param 3 (=size);
     rs  w2  x3+d6     ;    save size in case entry exists;

     dl  w1  x3+d2+6   ; generate tail:
     ds  w1  x3+d4+6   ;    move param 2 to kit name in tail;
     dl  w1  x3+d2+2   ;
     ds  w1  x3+d4+2   ;
     al  w1     1      ;
     sn  w0    -1      ;    if param 2 empty then
     rs  w1  x3+d4     ;    kit name:= disc preferred;
a8:  ld  w1    -100    ;
     ds  w1  x3+d5+16  ;    clear block count, content, entry
     rs  w1  x3+d5+18  ;    clear length;
     rs  w2  x3+d5     ;    size:= param3;

j1:  dl  w1  x3+227    ; create or adjust entry:
     al. w3     b19.   ;    set std interval;
     jd         1<11+72;
     rl. w3     b0.+2  ;
     al  w1  x3+d25    ;    d25 points to an area to store head and tail
     al  w3  x3+d1     ;    w3 := ptr to name of entry
     jd         1<11+76;    lookup head and tail
     rl  w1  x3+d25-d1 ;
     la. w1     b10.   ;    w1:=cat key
     se  w0     3      ;    if entry does not exist
     se  w1     2      ;    or entry not login scope
     se  w1  x1        ;    then
     jl.        a11.   ;     goto test entry
                       ;   entry does not exist:
     rl. w3    b0.+2   ;    w3:=page 1 abs
     al  w1  x3+d5     ;    w1 := ptr to tail
     al  w3  x3+d1     ;    w3:= ptr to name
     jd         1<11+40;    create entry
     sn  w0     4      ;      if claims exceeded then
     jl.        c18.   ;      goto alarm 18;
     jl.        a2.    ;    goto create and reserve process
\f


; re  31.7.74           create output              term2   ...28a...
a11: rl. w3     b0.+2  ;
     rl  w0  x3+d25+14 ;    if size<0 then
     sl  w0     0      ;        begin
     jl.        a0.    ;
     jd         1<11+48;        remove entry;
     se  w0     0      ;        if not ok then
c.-1, o27, z.          ;    (bossfault xref)
     jd        -27     ;          bossfault 27;
     rl. w3     b0.+2  ;        w3 := page 1 abs;
     al  w2  x3+d6     ;        w2:=size;
     jl.        a8.    ;        goto create or adjust entry;
a0:                    ;        end;
j13: dl  w1  x3+227    ;    w0,w1 := std int for entry to save
     sn  w0 (x3+d25+2) ;    if std int for entry to save<>
     se  w1 (x3+d25+4) ;        -   -   -    -   looked up then
     jl.        a12.   ;     goto perm entry
     dl  w1  x3+d4+2   ;    w0,w1 := bs-doc-name(0:5)
     se  w0     1      ;    if w0<> 1 then (docname exists)
     jl.        a13.   ;     goto testdoc
     ld  w1    -100    ;
     ds  w1  x3+d4+6   ;    docname(6:11):=0
     dl. w1     b41.+2 ;    w0,w1:=<:disc:>
a13:                   ;   testdoc:
     sn  w0 (x3+d25+16);    if doc name on file to save<>
     se  w1 (x3+d25+18);        -    -  -   -   looked up then
     jl.        c25.   ;     goto alarm - name conflict
     dl  w1  x3+d4+6   ;    w0,w1:=bs-doc-name(6:11)
     sn  w0 (x3+d25+20);    if doc name on file to save(6:11) <>
     se  w1 (x3+d25+22);        -   -    -   -   looked up then
     jl.        c25.   ;     goto alarm - name conflict
 
a12: al  w1     0      ;      w1:= catalog key
     al  w3  x3+d1     ;      w3:=ptr to name of entry
     jd         1<11+50;      permanent entry (key=0);
     rl. w1     b0.+2  ;      w1:=addr of tail;
     rl  w0  x1+d25+14 ;  w0:=size
     al  w1  x1+d5     ;
     rs  w0  x1        ;
     jd         1<11+44;      change entry;
a2:  se  w0     0      ;    end;
     jl.        c19.   ;    if not ok then goto alarm 19, kit name illegal;
     rl. w3     b0.+2  ;    w3:= page 1 abs;


j6:  dl  w1  x3+227    ; create and reserve process:
     al  w2  x3+d1     ;    w01:= std interval;
     jl. w3    (b28.)  ;    prepare access(w2=param1);
c.-1, o22, z.          ;    (bossfault xref)
     jd        -22     ;+0  not exist:   boss alarm;
     al  w3  x3+d1     ;
     jd         1<11+8 ;    reserve area process;
     dl  w3  x3+d8-d1  ;    return;
     jl.       (b8.)   ;
\f


; sl 30.6.72          save          term2   ...29...

; save:
g6:
j12: al  w2  x3+218    ;
     rl  w2  x2+8      ;    w2:=nta of basis file area process
     sl  w2    (72)    ;    if no basisfile present then
     jl.        a9.    ;    begin
     al  w1     1      ;      size:=1
     jl.        a10.   ;    end else begin
a9:  rl  w2  x2        ;      w2:=process description address
     rl  w1  x2+e49    ;      w1:=size of basis file
a10:                   ;    end
     al  w0     0      ;
     ds  w1  x3+d3+2   ;    param 3:= size ;
     al  w0  x3+d8     ;    w0 = store return addr;
     dl. w3     b49.   ;    w0call(create output);
     jl. w1    (b48.)  ;

     rl. w3     b0.+2  ; init line:   w3:= page 1 abs;
     rl. w1     b22.   ;    page 4 descr:= save buffer;
j2:  rl  w0  x3+189    ;    page 3 descr:= work page;
     rl. w2    (b5.)   ;
     ds  w1  x2+14     ;
     al  w0     8      ;    abs or page:= page 4;
j3:  rs  w0  x3+188    ;
     al  w0     0      ;
j4:  rs  w0  x3+190    ;    line got:= segm count output:= 0;
     rs  w0  x3+d6     ;
j8:  al  w0  x3+257    ;
     dl. w3     b23.   ;
     jl. w1    (b48.)  ;    w0 call init line;
     jl.        c15.   ;+0  if io alarm then goto ioalarm 15;

a3:  al  w1    -2      ; prep bulk save:   base store rel:= -2;
     rl. w0     b24.   ;    last store rel:= last save buf;
j5:  ds  w1  x3+187    ;
a4:
j7:  al  w0  x3+257    ;    w0:= store return addr;
     dl. w3     b25.   ; bulk save:
     jl. w1    (b48.)  ;    w0 call bulk save;
     jl.        c15.   ;+0  if io alarm then goto ioalarm 15;
     jl.        a5.    ;+2  goto buffer full;
     jl.        a4.    ;+4  after correction:   goto bulk save;

     jl. w2     c4.    ;+6  end save:   save output;
     jl. w1     c6.    ;    clear up save, no error code;
c8:  dl. w3     b7.    ; after action:
     jl.       (b8.)   ;    page jump to after action;
\f


; re 6.2.75            save                     term2   ...29a...

a5:                    ; buffer full:
j9:  al  w1  x3+218    ;    if name table address of basis file
     rl  w0  x1+8      ;
     se  w0 (x3+d1+8)  ;      = name table address of output file  then
     jl.        a6.    ;
     al  w1     510    ;      begin
j10: rs  w1  x3+187    ;
     jl. w2     c4.    ;      save output; first segment only
     rl. w3     b0.+8  ;      w3:= page 4 abs;
     al  w2  x3+514    ;      w2:= first double word of second save segment;
a7:  dl  w1  x2        ; rep: move the rest of the save buffer to replace the saved segment
     ds  w1  x2-512    ;
     al  w2  x2+4      ;
     am.       (b24.)  ;      if w2 <= top save buffer then 
     sh  w2  x3        ;
     jl.        a7.    ;         go to rep;
     rl. w2     b24.   ;
     al  w2  x2-512    ;      base store rel:=last save buf - 512;
     rl. w3     b0.+2  ;      w3:= page 1 abs;
j11: rs  w2  x3+187    ;
     jl.        a4.    ;      go to bulk save;
                       ;      end;
a6:  jl. w2     c4.    ;    save output;  all segments
     jl.        a3.    ;    goto prep bulk save;

g32=j1+1, g33=j2+1, g34=j3+1, g35=j4+1, g36=j5+1, g83=j6+1, g187=j13+1
g109=j7+1, g112=j8+1, g159=j9+1, g160=j10+1, g161=j11+1, g175=j12+1
e.                     ;
\f



; sl 3.1.72          alarms          term2 ...30...

; alarms:   the error code is composed like this:
; text code for printing < 3 + term bs < 2 + remove entry < 1 + clear corr.
b. a10, j10  w.        ;
c9:  am         50-15  ; alarm 9:   file not text file.
c10: al  w0     15     ; alarm 10:   file does not exist.
     al  w2     0      ;
j3:  rs  w2  x3+218    ;    clear name of basisfile
j2:  dl  w3  x3+257    ;
     so  w3     1      ;    if even return then
     jl.       (b8.)   ;    return to psjob;
     rl. w3     b0.+2  ;
     jl.        c23.   ;

c12: am       1<3-1<1+1; alarm 12:   file too long, clear corr
c17: am           1<1  ; alarm 17:   no resources, remove entry
g7=k-b0                ;
     am        -1<2    ;    no resources
c18: am       1<3      ; alarm 18:   no resources, term bs
c19: al  w0  12<3+1<2  ; alarm 19:   kit not present, term bs
     rl. w3     b0.+2  ;    w3:= page 1 abs;
     rs  w0  x3+d7     ;    save error code;
     sz  w0     1<1    ;    if remove entry then
     jl. w1     c5.    ;    clear up save;
     sz  w0     1<2    ;    if term bs then
     jl. w1     c13.   ;    terminate bs;
     sz  w0     1      ;    if clear corr then
     jl. w1     c2.    ;    clear corr;
     rl  w0  x3+d7     ;
     ls  w0    -3      ;    param 1:= text code for printing;
c23: rs  w0  x3+d1     ; alarm:  w0= alarm code.
     dl. w3     b29.   ;
     jl.       (b8.)   ;    page jump to alarm;

c16: rs  w0  x3+190    ; ioalarm 16:   logical status:= w0;
     jl. w1     c6.    ;    clear up save, no error code;
     dl  w1  x3+d1+6   ;
     ds  w1  x3+d1+8   ;
     dl  w1  x3+d1+2   ;    move param 1 one step
     ds  w1  x3+d1+4   ;    to get room for name addr;
     al  w0     d1+2   ;    name addr:= save file;
     jl.        a1.    ;    goto hard error;

c15: am         c6-c2  ; ioalarm 15:   basis file. clear up save, no error code;
c11: jl. w1     c2.    ; ioalarm 11:   basis file. clear corr;
j1:  al  w0     218    ;    name addr:= basis file;
a1:  rs  w0  x3+d1     ; hard error:
     dl. w3     b30.   ;
     jl.       (b8.)   ;    page jump to hard error;
c25: jl. w1     c13.   ;   terminate bs adjust
     am         41     ;   errorno 52 - name already exists on another document

c20: am         1      ; alarms from lookup user:
c21: am        -10     ;
c22: al  w0     20     ;    w0 := alarm code;
     jl.        c23.   ;    goto alarm;

g30=c16+1, g31=j1+1, g111=j2+1, g188=j3+1
e.                     ;
\f


; sl 23.7.71          initialize          term2 ...31...

b. a10, j10  w.        ;
g1=k-g0                ; length of page
g70: 12                ; reserve virt
g71: 13                ; move to virt
g72: 15                ; end init
g73: 0                 ; base external table

g2:  al  w0     i63    ; start init:   w0:= login get etc on disc;
     al  w1     i62    ;
     ls  w1     9      ;    w1:= 512 * segments in save buffer;
     jl. w3    (g70.)  ;    reserve virt;
     al  w2  x2+1      ;    write page;
     rs. w2     g179.  ;    ext(233);

     al  w0     i63    ; code page:
     al  w1     g1     ;
     jl. w3    (g70.)  ;    reserve virt;
     rs. w2     g180.  ;    ext(206):=
     rs. w2     g181.  ;    ext(215):=virt code page;
     rl. w1     b16.   ;
     rs. w1     g182.  ;    operator name address
     al  w1  x1+2      ;
     rs. w1     b16.   ;          -   + 2
     al  w1  x1+4      ;
     rs. w1     b17.   ;          -   + 6
     al. w0     g0.    ;    start
     al  w1     g1     ;    length
     jl. w3    (g71.)  ;    move to virt
     al  w0     i63    ;
     al  w1     g116   ;    w1:= length of transmit page;
     jl. w3    (g70.)  ;    reserve virt;
     rs. w2     g183.  ;    ext(259);

     jl. w3    (2)     ;    set externals;
g178:           40     ;  

g179:    0  ,   233    ;    save and clean buf;
g180:    0  ,   206    ;    virt save, get;
g181:    0  ,   215    ;    virt logout, check, login;
j1:   g6-b0 ,   207    ;    entry save;
j2:   g5-b0+1,  208    ;    entry get;
j3:   g4-b0 ,   216    ;    entry logout;
j4:   g3-b0 ,   220    ;    entry check login;
      g9-b0 ,   235    ;    entry get from psjob;
      g174  ,   154    ;    entry print catalog entry;
      g114  ,   261    ;    entry create output;
      d8    ,   262    ;    rel return create output;
g182:    0  ,   234    ;    operator name address;
      g115  ,   260    ;    rel entry transmit;
g183:    0  ,   259    ;    virt transmit;
         0  ,  -1000   ;    end of externals;

     al. w0     g117.  ;    start;
     al  w1     g116   ;    length;
     jl. w3    (g71.)  ;    move to virt;
     am.       (4)     ;
     jl.       +4      ;    next init
     h3.               ;
g8:                    ; first of file access table:
e.                     ; end init block
i.e.
\f


; btj 30.6.72          transmit          term2   ...32...

b. b100, c30, f10  w. ;
g117:                     ;    start of transmit page

b0:       0, r.5          ;    page addresses
    104<12 + 0            ;    page ident:  transmit

b2:  g128: 25             ;    call
b3:  g129: 35             ;    wait answer
b4:  g130: 33             ;    terminate access
b5:  g131: 26             ;    current corutine
b8:  g132: 8              ;    page jump
b9:  g133: 7              ;    get pages
g146: 162, g147: 205   ; b14-4 : io alarm;
b14=k+2, g134:162,g135:229;    general print
b19:       0              ; 0  for set catalog base
           5<12           ;-2  output operation
b21:       0, r.3         ;    message

b26: g136: 2              ;    send and wait fast
b58: g164: 1              ;    send and wait
b27:      -1-1<18-1<1     ;    allowed output bits: end document,
                          ;                         normal answer

b35=k+2, g137:415,g138:413;    prepare bs adjust
b36=k+2, g139:415,g140:414;    terminate bs adjust
b48: g141: 34             ;    w0 call
b49=k+2, g142:206,g143:261;    create output
b50:       3<12           ;    constant(=input operation)
b51: <:tretrotrntrftrt:>  ;    allowed modes
b57:       <:sta:>        ;
           <:rt :>        ;+2
           <:tra:>        ;+4
           <:nsm:>        ;+6
           <:it<10>:>     ;+8 (the newline may be incremented to: <14>)
b52:-1-1<21-1<18-1<16-1<1;    allowed input bits: timer, end doc, attention,
                          ;                        normal answer
          1<16         ; b52+2: attention
b53:       0              ;    return from process char, and input(share)
b54:       100            ;    constant
b55:       25,128,0,25,25 ;    end char(modes)
\f


; re 4.11.74           transmit              term2   ...32a...

b56:                      ;    flexo to iso conversion table

; iso code:                  flexowriter characters:
h.
   32,  49,  50,  47,  52  ; space  1      2      /      4
   59,  91,  55,  56,  41  ; ;      uc 6   7      8      )
  127,  12,  25, 125, 195  ; uc 10  stop   end    lc 13  _
  127,  32,  33,  42,  51  ; uc 15  space  uc 1   *      3
   61,  53,  54,  93,  40  ; =      5      6      uc 7   (
   57, 127,  12,  25,  93  ; 9      lc 10  stop   end    uc 13
  133, 127,  48,  62,  83  ; !      lc 15  0      >      uc s
  116,  85, 118, 119,  88  ; t      uc u   v      w      uc x
   89, 122, 127,  39, 127  ; uc y   z      lc 26  ten    clear
  127,   9, 127,  38,  60  ; red    tab    p off  uc 16  <
  115,  84, 117,  86,  87  ; s      uc t   u      uc v   uc w
  120, 121,  90, 127,  44  ; x      y      uc z   uc 26  ,
  127, 127,   9, 127,  45  ; clear  red    tab    p off  -
   74,  75, 108,  77, 110  ; uc j   uc k   l      uc m   n
  111,  80,  81, 114, 127  ; o      uc p   uc q   r      lc 42
   92, 127, 127, 127, 127  ; uc ø   p on   uc 45  uc 46  lc 47
   43, 106, 107,  76, 109  ; +      j      k      uc l   m
   78,  79, 112, 113,  82  ; uc n   uc o   p      q      uc r
  127, 124, 127, 127, 127  ; uc 42  ø      p on   lc 45  lc 46
  127,  91,  97,  98,  67  ; lc 47  uc æ   a      b      uc c
  100,  69,  70, 103, 104  ; d      uc e   uc f   g      h
   73, 128,  46, 127, 127  ; uc i   lower  .      upper  sum
  127, 127, 123,  65,  66  ; black  feed   æ      uc a   uc b
   99,  68, 101, 102,  71  ; c      uc d   e      f      uc g
   72, 105, 127,  58, 128  ; uc h   i      lower  :      upper
  127, 127, 127,  10, 127  ; sum    black  feed   carret fill
w.
\f


; btj 30.6.72          transmit          term2   ...33...

d9 = d8+2   ; byte   ;    transmit mode
d10= d9+1   ; byte   ;    transmit input mode
d11=d10+1   ; 5 words;    transmit file name, name table address
d12=d11+10  ; byte   ;    count (used for shifting chars)
d13=d12+1   ; byte   ;    rel on work page. error code
d14=d13+1   ; word   ;    partial word
d15=d14+2   ; word   ;    reader state
d16=d15+2   ; word   ;    reader case
d17=d16+2   ; byte   ;    share
d18=d17+1   ; byte   ;    timer count
d19=d18+1   ; 2 words;    mess buf addr (0:1)
d20=d19+4   ; word   ;    status
d21=d20+2   ; word   ;    current word addr
d22=d21+2   ; word   ;+2  last of buffer
d23=d22+2   ; 3 words;    input message
d26=d23+6   ; word   :    parent rb device name table address
d24=d26+6   ;


c. d24-i46+1, m.***transmit i46 too small
z.

; error codes: -1 = hard error , input or output
;               0 = ok
;               1 = mode unknown
;               2 = claims exceeded

f0 = 189    ;    rel on job file:   work page
f1 = 178    ;    rel on job file:   first of terminal buffer
f2 = 177    ;    rel on job file:   job descr
f3 = 227    ;    rel on job file:   std interval
f4 = 217    ;    rel on job file:   terminal name
f5 = 223    ;    rel on job file:   attention sem
f6 = 226    ;    rel on job file:   operation counter
f7 = 190    ;    rel on job file:   line got
f8 = 423    ;    rel on job descr:  parent rb name table addr
\f


; btj 30.6.72          transmit          term2   ...34...

; transmit:   param 1 is mode, param 2 is file name, param 3 is possible kitname.
; page 4 = job descr.

b. a10  w.             ;
g115=k-b0              ; entry transmit:

     dl  w1  x3+d1+2   ;    if mode name is more than
     se  w1     0      ;    3 letters then
     jl.        c13.   ;    alarm(mode unknown);

a0:  sn.    (x1+b51.)  ;    for index:= 0,2,4,6,8 do
     jl.        a1.    ;    if param 1 = mode(index) then
     al  w1  x1+2      ;    goto found;
     sh  w1     8      ;
     jl.        a0.    ;
     jl.        c13.   ;    alarm(mode unknown);

a1:  hs  w1  x3+d9     ; found:   save mode;
     sz  w1     2.110  ;
     am         2      ;
     al  w1     2      ;    input mode:= if tre or trt then 2 else 4;
     hs  w1  x3+d10    ;

     dl  w1  x3+d2+2   ;    move file name to param1
     ds  w1  x3+d1+2   ;    and to output name;
     ds  w1  x3+d11+2  ;
     dl  w1  x3+d2+6   ;
     ds  w1  x3+d1+6   ;
     ds  w1  x3+d11+6  ;
     dl  w1  x3+d3+2   ;    move kitname to param2;
     ds  w1  x3+d2+2   ;
     dl  w1  x3+d3+6   ;
     ds  w1  x3+d2+6   ;

     al  w0     0      ;
     al  w1     1      ;
     ds  w1  x3+d3+2   ;    param 3:= size;

     al  w0  x3+d8     ;    w0:= store return addr;
     dl. w3     b49.   ;  
     jl. w1    (b48.)  ;    w0call(create output);
     rl  w0  x3+d1+8   ;    move name table address;
     rs  w0  x3+d11+8  ;

     dl. w3     b36.   ;
     jl. w1    (b2.)   ;    terminate bs adjust;
     jl.        c14.   ;+2  if exceeded then alarm(claims exceeded);

e.                     ;
\f


; btj 30.6.72          transmit          term2   ...35...
; initialize transmit
     rl. w2     b0.+8  ;    w2:= job descr page;
g177=k+1
     rl  w0  x2+f8     ;
     rs  w0  x3+d26    ;    move parent rb name table addr to job file page;

     rl. w2    (b5.)   ;    page 4:= work page;
g120=k+1               ;
     rl  w0  x3+f0     ;
     rs  w0  x2+14     ;
     jl. w3    (b9.)   ;    get pages;
     al  w1     i175   ;
     hs  w1  x3+d18    ;    timer count:=start timer
     al  w1     24     ;
     hs  w1  x3+d12    ;    count:= 24;
     al  w1     0      ;
     rs  w1  x3+d6     ;    segm count output := 0;
     hs  w1  x3+d13    ;    rel:= 0;
     rs  w1  x3+d14    ;    partial word:= 0;
     rs  w1  x3+d15    ;    readerstate:= 0;
     rs  w1  x3+d16    ;    reader case:= 0;

g165=k+1
     rl  w1  x3+f1     ;    first of outputmessage := terminal buffer;
     al  w2  x1+8      ;    last := first + 8;
     ds. w2     b21.+2 ;
     dl. w1     b57.+2 ;    terminal buffer :=
     ds  w1  x2+2-8    ;      <:start transmit<10>:>;
     dl. w1     b57.+6 ;
     ds  w1  x2+6-8    ;
     rl. w1     b57.+8 ;
     bz  w0  x3+d9     ;
     se  w0     8      ;    if mode <> trt then
     al  w1  x1+4      ;      change the <10> to <14> (stop print);
     rs  w1  x2+8-8    ;

     al. w1     b21.-2 ;
g166=k+1               ;    send and wait(terminal);
     al  w2  x3+f4     ;
     jl. w3    (b58.)  ;
     se  w0     1<1    ;    if not ok then
     jl.        c15.   ;      goto terminate use;

     al  w1     0      ;    share := 0;
     jl. w2     c9.    ;    input(share);
\f


; btj 30.6.72          transmit          term2   ...36...

; page 1 = job file, page 4 = virt buf;

c1:  al  w1     i3/2   ; next input:
     bs  w1  x3+d17    ;    share:= 1 - share;
     jl. w2     c9.    ;    input(share);

     sn  w1     0      ;    mess buf:=
     am        +2      ;    mess buf addr(1 - share);
     rl  w2  x3+d19    ;
     jl. w3    (b3.)   ;    wait answer(mess buf);
     ls  w0     2      ;    clear parity bit...
     ls  w0    -2      ;
     sz. w0    (b52.)  ;    if strange status then
     jl.        c17.   ;    goto bad transfer;
     sz. w0    (b52.+2);    if attention bit in status then
     jl.        c19.   ;    goto terminate transmit;
     rs  w0  x3+d20    ;    save status;

     rl  w2  x1+2      ;    w2:= bytes transferred;
     sn  w2     0      ;    if bytes transferred = 0 then 
     jl.        c10.   ;      goto test end;
     al  w1     i176   ;
     hs  w1  x3+d18    ;    timer count:=stop timer
g121=k+1               ;
     rl  w1  x3+f1     ;    w1:= first of terminal buffer;
     al  w1  x1+i3/2-2 ;
     bs  w1  x3+d17    ;    w1:= base of bufferpart(1 - share);
     wa  w2     2      ;    last of buf:= base + bytes;
     ds  w2  x3+d22    ;

c2:  rl  w2  x3+d21    ; next word:
     sl  w2 (x3+d22)   ;    if current word >= last of buf then
     jl.        c1.    ;    goto next input;

     al  w2  x2+2      ;    current word:= current word + 2;
     rs  w2  x3+d21    ;

     bl  w1  x3+d9     ;    if mode is tre, trn or trt then
     so  w1     2      ;    goto move word;
     jl.        c5.    ;

     jl. w2     c3.    ;    process char;
     jl. w2     c3.    ;    process char;
     jl. w2     c3.    ;    process char;
     jl.        c2.    ;    goto next word;
\f


; btj 30.6.72          transmit          term2   ...37...

; procedure process char:   w2 = return, w3 = page 1 abs,

b. a10  w.             ;

c3:  al  w0     0      ;
     rl  w1 (x3+d21)   ;
     ld  w1     8      ;    w0:= char;
     rs  w1 (x3+d21)   ;    word:= word shift 8;
     se  w0     255    ;    if char is <all holes> or
     sn  w0     0      ;    char is <no holes> then
     jl      x2        ;      return;

     rs. w2     b53.   ;    save return;
     al  w1     0      ; check tro parity:
     rl  w2     0      ;    w2:= char;
a0:  lx  w1     4      ;    parity:= (sum of bits) mod 2;
     ls  w2    -1      ;
     se  w2     0      ;
     jl.        a0.    ;

     rl. w2     b53.   ;    w2:= return;

     so  w1     1      ;    if parity = 0 then
     jl.        c20.   ;      goto substitute;

     bl  w1  x3+d9     ;    if mode is trf then
     sn  w1     6      ;      goto convert;
     jl.        c8.    ;

     sz  w0     1<7    ;-2   if iso parity bit is set then
     bs. w0    -1      ;      remove the bit;

; continue in pack char;

e.                     ;
\f


; btj 30.6.72          transmit          term2   ...38...

; procedure pack char:   w0 = char, w2 = return, w3 = page 1 abs.

c4:  bz  w1  x3+d12    ;    count:= count - 8;
     al  w1  x1-8      ;
     hs  w1  x3+d12    ;

     ls  w0  x1        ;    partial word:=
     wa  w0  x3+d14    ;    char shift count
     rs  w0  x3+d14    ;    + partial word;

     se  w1     0      ;    if count <> 0 then
     jl      x2        ;    return;

     rs  w1  x3+d14    ;    partial word:= 0;
     al  w1     24     ;
     hs  w1  x3+d12    ;    count:= 24;

     jl.        c6.    ;    goto move word;


; move word:   

c5:  rl  w0  x2        ;    w0:= word;
     al. w2     c2.    ;    return:= next word;

c6:  bl  w1  x3+d13    ;
     am.       (b0.+8) ;
     rs  w0  x1        ;    save word on work page;

     al  w1  x1+2      ;    rel:= rel + 2;
     hs  w1  x3+d13    ;  
     sh  w1     510    ;    if rel <= 510 then
     jl      x2        ;    return;

     al  w1     0      ;
     hs  w1  x3+d13    ;    rel:= 0;

; continue in send output;
\f


; btj 30.6.72          transmit          term2   ...39...

; procedure send output:   w2 = return, w3 = page 1 abs,
; page 1 = job file, page 4 = buffer page.

b. a10  w.             ;
c7:  ws. w2     b0.    ;    save rel return;
     rs  w2  x3+d8     ;

a0:  rl  w0  x3+d6     ; rep output:
     rs. w0     b21.+4 ;    segm:= segm count output;
     rl. w1     b0.+8  ;    first addr:= page 4 abs;
     al  w2  x1+510    ;    last addr:= first + 510;
     ds. w2     b21.+2 ;
     al. w1     b21.-2 ;
     al  w2  x3+d11    ;
     jl. w3    (b26.)  ;    send and wait fast;

     sz. w0    (b27.)  ;    if hard errors then
     jl.        c18.   ;    goto hard error;

     rl  w1  x1+2      ;    w1:= bytes transferred;
     se  w1     512    ;    if bytes transferred = 512 then
     jl.        a1.    ;    begin
     ls  w1    -9      ;
     al  w0  x1        ;    operations:= operations + segments;
g149=k+1
     wa  w0  x3+f6     ;
g150=k+1
     rs  w0  x3+f6     ;      segm count output:=
     wa  w1  x3+d6     ;      segm count output +
     rs  w1  x3+d6     ;      bytes transferred//512;
     am     (x3+d8)    ;      return;
     jl.        b0.    ;    end;
\f


; re 4.11.74          transmit               term2    ...39a...

a1:  rl. w2    (b5.)   ; area too small:
g122=k+1               ;
     rl  w1  x3+f2     ;    page 4:= job descr;
     rs  w1  x2+14     ;
     dl. w3     b35.   ;    prepare bs adjust;
     jl. w1    (b2.)   ;

     rl  w1 (x3+d11+8) ;    w1 := ref area process;
     rl  w2  x1+10     ;    w2 := ref disc process;
     al  w0     0      ;
     rl  w1  x3+d5     ;    w0w1 := old area size;
     wd  w1  x2+e50    ;
     al  w1  x1+1      ;
     wm  w1  x2+e50    ;
     rs  w1  x3+d5     ;    areasize := areasize + slicelength;
g123=k+1               ;
     dl  w1  x3+f3     ;
     al. w3     b19.   ;
     jd         1<11+72;    set std interval;
jd-1
     rl. w3     b0.+2  ;
     al  w1  x3+d5     ;
     al  w3  x3+d11    ;
     jd         1<11+44;    change entry;
jd-1
     se  w0     0      ;    if not ok then
     jl.        c16.   ;    goto exceeded;

     dl. w3     b36.   ;
     jl. w1    (b2.)   ;    terminate bs adjust;
     jl.        c16.   ;+2  if claims exceeded then goto exceeded;

     rl. w2    (b5.)   ;    page 4:= work page;
g124=k+1               ;
     rl  w1  x3+f0     ;
     rs  w1  x2+14     ;
     jl. w3    (b9.)   ;    get pages;
     jl.        a0.    ;    goto rep output;
e.                     ;
\f


; btj 30.6.72          transmit          term2   ...40...

; procedure convert:   w0 = char, w2 = return, w3 = page 1 abs,
; (the code is -more or less- directly copied from the monitor..).

b. a10  w.             ;
c8:  sl  w0     129    ;    if char > 128 then
     jl      x2        ;    return;
     se  w0     128    ;    if char <> 128 then
     lx  w0  x3+d16    ;    char(19):= char(19) exor case;
     am        (0)     ;
     bz. w0    +b56.   ;    char:= conversion table(char);
     am     (x3+d15)   ;
     sh  w0    +126    ;    if char < 127 + state then
     jl.        c4.    ;    goto pack char;
     sn  w0     127    ;    if char = 127 then
     jl      x2        ;    return;
     sn  w0     128    ;    if char = 128  then
     jl.        a1.    ;    goto case shift;
     sh  w0     132    ;    if char < 133 then
     jl.        a2.    ;    goto not special;
     ac  w0    (0)     ; bar or underline:
     rx  w0  x3+d15    ;    oldstate:= state; state:= char;
     se  w0     0      ;    if oldstate = 0
     sn  w0 (x3+d15)   ;    or oldstate = state then
     jl      x2        ;    return;

a0:  al  w0     0      ; substitute:
     rs  w0  x3+d15    ;    state:= 0;
c20: al  w0     26     ;    char:= 26;
     jl.        c4.    ;    goto pack char;

a1:  al  w0     1<4    ; case shift:
     lx  w0  x3+d16    ;
     rs  w0  x3+d16    ;    case:= case exor bit 19;
     jl      x2        ;    return;

a2:  se  w0     32     ; not special:   if char <> 32
     jl.        a0.    ;    then goto substitute;
     al  w0     0      ;
     rx  w0  x3+d15    ;    char:= - state - 100;
     ac  w0    (0)     ;
     ws. w0     b54.   ;    state:= 0;
     jl.        c4.    ;    goto pack char;

e.                     ;
\f


; btj 30.6.72          transmit          term2   ...41...

; procedure input(share):
; entry: w1 = rel of term buffer start, w2 = return, w3 = page 1 abs,
; exit:  w1, w3 unchanged, w2 undef, saved share:= share.

c9:  hs  w1  x3+d17    ;    save share (= rel of term buf);
     rs. w2     b53.   ;    save return;

g125=k+1               ;
     wa  w1  x3+f1     ;    first:= terminal buffer start + rel;
     al  w2  x1+i3/2-2 ;    last:= first - buffersize//2 - 2;
     ds  w2  x3+d23+4  ;
     rl. w0     b50.   ;
     hl  w0  x3+d10    ;    insert: input, inputmode in message;
     rs  w0  x3+d23    ;
jd-1                   ; testoutput of message **************
     al  w1  x3+d23    ;    w1:= message address;
g126=k+1               ;
     al  w3  x3+f4     ;    w3:= terminal name;
     jd         1<11+16;    send message(w1, w3);
     rl. w3     b0.+2  ;    w3:= page 1 abs;
     bl  w1  x3+d17    ;    w1:= share;
     se  w1     0      ;    
     am         2      ;    mess buf addr(share):= mess buf;
     rs  w2  x3+d19    ;
     jl.       (b53.)  ;    return;
\f


; btj 30.6.72          transmit          term2   ...42...

; test end

b. a10  w.             ;
c10: rl  w0  x3+d20    ;    w0:= saved status;
     sn  w0     1<1    ;    if status is just normal answer then
     jl.        c1.    ;    goto next block;
     bl  w0  x3+d18    ;    if timer count <= 1 or
     rl  w1  x3+d26    ;
     sn  w1     0      ;      rb terminal then
     sh  w0     1      ;
     jl.        c19.   ;      goto terminate transmit;
     bs. w0     1      ;    timer count:=timer count-1;
     hs  w0  x3+d18    ;
     jl.        c1.    ;    goto next block;

; terminate transmit:
c19:

; fill buffer with end-chars

a0:  bl  w1  x3+d9     ; rep:   w1:= mode;
     rl. w0  x1+b55.   ;    w0:= end char(mode);
     jl. w2     c4.    ;    pack char;
     bz  w1  x3+d12    ;  
     bz  w2  x3+d13    ;    if count <> 24 or
     sn  w1     24     ;    rel <> 0 then
     se  w2     0      ;
     jl.        a0.    ;    goto rep;


c11: bl  w1  x3+d17    ; wait other buffer:   w1:= share;
     se  w1     0      ;
     am         2      ;    mess buf:=
     rl  w2  x3+d19    ;    mess buf addr(share);
     jl. w3    (b3.)   ;    wait answer(mess buf);
\f


; re 4.11.74          transmit                term2     ...42a...

c15: al  w2  x3+d11    ; terminate use:   w2:= file name address;
     jl. w3    (b4.)   ;    terminate access(w2);
     rl. w2    (b5.)   ;    page 4 := job descr page;
g144=k+1
     rl  w1  x3+f2     ;
     rs  w1  x2+14     ;
     bl  w1  x3+d13    ;    if error code = -1 then
     sn  w1    -1      ;
     jl.        a1.    ;    goto io-alarm;
     dl. w3     b35.   ;    if errorcode <> 2 then prepare bs adjust;
     se  w1     2      ;
     jl. w1    (b2.)   ;
c22: rl. w3     b0.+2  ; remove:

g127=k+1
     dl  w1  x3+f3     ;    set std interval;
     al. w3     b19.   ;
     jd         1<11+72;
     rl. w3     b0.+2  ;
     al  w3  x3+d11    ;    w3:= file name address;
     al  w1     2      ;    w1:=cat key;
     jd         1<11+50;    permanent entry (key=2);
     se  w0     0      ;    if not ok then
     hs  w1  x3-d11+d13;      error code:=2;
jd -1
     bz  w2  x3-d11+d13;    w2:= error code (=rel);
     se  w2     0      ;    if transmit error then
     jd         1<11+48;    remove entry(w3);
jd-1
     dl. w3     b36.   ;    terminate bs adjust;
     jl. w1    (b2.)   ;
     jl.        c21.   ;+2  goto claims exceeded3;
     bz  w2  x3+d13    ;    w2 := error code (=rel);
c12: al  w2  x2+11     ; exit:   textno:= 11 + error code;
     al  w1     0      ;
     rl. w3     b0.+2  ;
     ds  w2  x3+6      ;
     al  w1    -4      ;
     rs  w1  x3+8      ;
     am         4      ;
a1:  dl. w3     b14.-4 ;
     jl.       (b8.)   ;    print and after action (textno);

e.
\f


; btj 30.6.72          transmit          term2   ...43...


; alarms from transmit
; mode unknown
c13: al  w2     1      ;    error code:= 1;
     jl.        c12.   ;    goto exit;


; claims exceeded1:

c14: al  w2     2      ;    error code:= 2;
     hs  w2  x3+d13    ;
     jl.        c15.   ;    goto terminate use;


; claims exceeded2:

c16: al  w2     2      ;    errorcode:= 2;
     hs  w2  x3+d13    ; 
     jl.        c11.   ;    goto wait other buffer;

; claims exceeded3
 
c21: bz  w2  x3+d13    ;    if error code <> 0 then
     se  w2     0      ;
c.-1, o26, z.          ;      (bossfault xref)
     jd        -26     ;      bossfault 26;
     al  w2     2      ;    errorcode:=2;
     hs  w2  x3+d13    ;
     jl.        c22.   ;    goto remove entry;


; bad transfer input:

c17: al  w1     f4     ;    w1:= rel of terminal name;
g151=c17+1
     jl.        4      ;    skip next...;


; hard error output;

c18: al  w1     d11    ;    w1:= rel of output name;
     rs  w1  x3+d1     ;    save in param1;
g152=k+1
     rs  w0  x3+f7     ;    save status in line got;
     al  w2    -1      ; 
     hs  w2  x3+d13    ;    errorcode:= -1;
     jl.        c11.   ;    goto wait other buffer;


g116=-b0.              ; length of page;
i.e.   ; end transmit page

i.e.   ; end initializing block
\f

; sl 30.6.72          initialize          term2   ...44...

s. b140, d15, g60, c40  w.
b. f30, a10  w.          ;
h6=h5-k  ; continue external list
b1., b2., b3., b4., b5., b6., b7., b8., b12., b16.,b17.
b19.,b20.,b21.,b22.,b23.,b24.,b25.,b26.,b27.,b28.
b29.,b30.,b31.,b32.,b33.,b34.,b36.,b37.,b38.,b39.
b41.,b42.,b43.,b44.,b45.,b46.,b47.,b48.
b52.,b53.,b54.,b55.,b56.,b59.,b60.,b61.
b62.,b63.,b64.,b65.,b66.,b68.,b69.,b70.,b71.,b72.
b73.,b74.,b75.,b76.,b77.,c. i171, b83., z.,b85.,b87.,b88.,b89.,b90.
b92.,b93.,b95.,b96.,b97.,b98.,b99.,b104.,b105.,b107.,b108.
b110., b111., b112., c. i171, b113., b114., b115., b116., b117., z.
b118., b119., b120.,b121.,b122.,b123.,b124.,b125.
f0., f1., f2., f4., f7., f8., f11.
c. i171, f16., f17., f18., f19., f21., f22. z.
g12.
c. e23-1, g13., z.
g20.,g21.,g22.,g23.,g24.,g25.,g26.,g27.,g28.,g29.
g30.,g31.,g32.,g34.,g35.,g36.,g37.,g38.,c.e23-1,g39.z.
g41.,g42.,g43.,g44.,g45.,g48.,g55.
h7:  h8

; init display:
; chain code from name params end signal
a5:  al  w0     i97    ; rep:
     al  w1     g40    ;
     jl. w3    (f1.)   ;    reserve virt message, logout buf;
     al. w0     f14.   ;
     jl. w3    (f2.)   ;    move to virt;
     al  w2  x2+1      ;    writing;
     rl. w1     f13.   ;
     rs. w2  x1+b57.   ;    b57(index):= virt;
     al  w1  x1+2      ;
     rs. w1     f13.   ;    index:= index + 1;
     sh  w1     i4*2   ;    if index <= i4 then
     jl.        a5.    ;    goto rep;

g44=k+1                ;    maxsize :=
     ac  w1     29     ;      (number of core places
g45=k+1                ;       - work core places) * 512;
     al  w1  x1+16     ;
     ls  w1     9      ;
     rs. w1     b78.   ;

     al  w1     i45+1  ;
     wm. w1     b6.    ;    last psjob table:=
     ba. w1     b22.   ;    number * length + start;
     rs. w1     b18.   ;
     al  w0     i97    ;    display, request on disc;
     al  w1     g2     ;    length;
     jl. w3    (f1.)   ;    reserve virt;
     al. w0     b0.    ;   start;
     jl. w3    (f2.)   ;    move to virt;
     rs. w2     g14.   ;    ext(247);

     rl. w0     f8.    ;    move first kit change queue sem
     rs. w0     a4.    ;    to ext def table

     rl. w0     b12.   ;    move abs hotnews request line addr
     rs. w0     a6.    ;    to ext def table;
  
     jl. w3    (2)     ;    set externals;
g12:            40     ; 

g14:     0  ,   247    ;    virt code;
         g0 ,   248    ;    rel display;
         g1 ,   249    ;    rel request;
         g3 ,   250    ;    rel kit;
         g4 ,   263    ;    rel kit label;
         g5 ,   265    ;    rel resource display;
         g6 ,   485    ;    rel message;
         g7 ,   486    ;    rel remove;
         g51,   137    ;    rel hotnews
a6:      0  ,   138    ;    abs hotnews request line addr
a4:      0  ,   79     ;    kit change que;
         0  ,  -1000   ;    end of externals;

\f


; btj  28.6.73          initialize          term2   ...44a...

; init operator display
c. i171
b. j9  w.

; init sender table

     rl  w3     74     ;
     rl  w3  x3+i171<1 ;    w3:= proc descr (op display);
     dl. w1     f16.   ;    w0:= attention sem; w1:= sender descr;
     ds  w0  x1+2      ;    save in sendertable;

; init page 1 (= pseudo job file)

     al. w2     b0.    ;    w2:= first of page 1;
j1:  rs  w0  x2+223    ;    save attention sem;
j2:  rs  w1  x2+222    ;    save sender table entry;
     al  w1     1      ;   console state:=
j5:  hs  w1  x2+179    ;      operator;
     rl. w1     f17.   ;
j3:  rs  w1  x2+178    ;    save first term buf;
j4:  al  w2  x2+217    ;    w2:= addr of term name;
     dl  w1  x3+4      ;    move device name;
     ds  w1  x2+2      ;
     dl  w1  x3+8      ;
     ds  w1  x2+6      ;
     al  w3  x2        ;
     jd         1<11+ 6;    initialize process;
     al. w1     f23.   ;
     jd         1<11+16;
     jd         1<11+18;    send and wait(sense);

; reserve page 1;

     al  w0     i57    ;    job file on disc;
     al  w1     e11    ;    length of job file
     jl. w3    (f1.)   ;    reserve virt;
     al. w0     b0.    ;
     jl. w3    (f2.)   ;    move to virt;

; initialize coroutine descr;

     al  w3  x2+1      ;    insert writing of page 1;
     dl. w2     f19.   ;    w2:= virt of page 0; w1:= coruno;
     ds  w3  x1+8      ;    init page 0, page 1;
     rl. w0     f20.   ;    testmode, entry;
     rs  w0  x1+4      ;
     jl. w3    (f21.)  ;    put in active que;

b113=j1+1, b114=j2+1, b115=j3+1, b116=j4+1, b117=j5+1

e.
z.
\f


; kll 22.8.72          initialize          term2   ...45...

c. e23-1               ; init kit:
     rl. w2     f4.    ;   
     al  w1  x2-10     ;    ext(290):= base of boss kit table;
     al  w2  x2+10*e23 ;    ext(291):= top of boss kit table;
     rs. w1     g49.   ;    ext(290);
     rs. w2     g50.   ;    ext(291);
     rs. w1     f24.   ;

     jl. w3    (2)     ;    set externals;
g13:            40     ;

g49:     0  ,   290    ;    base of boss kit table;
g50:     0  ,   291    ;    top of boss kit table;
         0  ,  -1000   ;    end of externals;

     al  w0     1      ;    label write semaphore := 1;
     am         1500   ;
     rs. w0    (g46.)  ;

     al  w0     i17    ;    psjob kit-on operations
     al  w1     i45*4  ;    length
     jl. w3    (f1.)   ;    reserve kit-on operations
     al  w2  x2+1      ;    writing
     am         1500   ;
     rs. w2     g33.   ;    save on kit code page
     al. w0     f3.    ;
     jl. w3    (f2.)   ;    output virt;

     al  w0     i17    ;    chaintable output buffer on disc;
     al  w1     512    ;    length;
     jl. w3    (f1.)   ;    reserve virt;
     al  w2  x2+1      ;    writing;
     am         1500   ;
     rs. w2     g17.   ;    save on kit change code;
\f


; jma 1978.10.22       initialize          term2   ...45a...


     al  w0     i17    ;    pooltable page on drum or disc
     al  w1     i18    ;
     ls  w1     9      ;    length
     jl. w3    (f1.)   ;    reserve virtual;
     al  w2  x2+1      ;    writing;
     am         1500   ;    save virt addr
     rs. w2     g52.   ;    on kit change code page;

     al  w0     i17    ;    empty catalog contents on drum or disc
     al  w1     512    ;    length
     jl. w3    (f1.)   ;    reserve virt ;
     am         1500   ;
     rs. w2     g16.   ;    save on kit change code;
     am.       (f30.)  ;
     al. w0     f30.   ;    start;
     jl. w3    (f2.)   ;    output virt;


     al  w0     i17    ;    kit change code on disc
     al  w1     g19    ;    length
     jl. w3    (f1.)   ;    reserve virt
     am         1500   ;
     al. w0     g47.   ;    start
     jl. w3    (f2.)   ;    output virt;
     rs. w2     f6.    ;    save in f6.;
\f


; jma 1978.10.22       initialize          term2   ...45b...


; init kitchange coroutines:
; (e23 incarnations)


a0:  rl. w2     f10.   ; next kit:
     al  w1  x2+1      ;
     rs. w1     f10.   ;    device index:= device index + 1;
     sl  w2     e23    ;
     jl.        a1.    ;    if device index > last then goto end init;

     bz. w2  x2+b40.   ;
     hs. w2     f9.    ;    w2:= process descr(device(device index));
     ls  w2     1      ;
     wa  w2     74     ;
     rl  w2  x2        ;

     bz. w3     f12.   ;
     al  w3  x3+10     ;    rel kit:= rel kit + length;
     hs. w3     f12.   ;
     wa. w3     f24.   ;
     dl  w1  x2+4      ;    move kit name from process descr
     ds  w1  x3+2      ;    to boss kit table;
     dl  w1  x2+8      ;
     ds  w1  x3+6      ;
\f


; kll 22.8.72          initialize          term2   ...46...

     rl  w1     92     ;    w1:= first drum;
a2:  al  w1  x1+2      ; next device:   increase device table ptr;
     rl  w2  x1-2      ;    w2:= chain addr;
     sn  w2     0      ;    if end device table then skip;
     jl.        a3.    ;
     rl  w0  x3+0      ;
     se  w0 (x2-34+16) ;    if devicename <> kitname then
     jl.        a2.    ;    goto next device;
     rl  w0  x3+2      ;
     se  w0 (x2-34+18) ;
     jl.        a2.    ;
     rl  w0  x3+4      ;
     se  w0 (x2-34+20) ;
     jl.        a2.    ;
     rl  w0  x3+6      ;
     se  w0 (x2-34+22) ;
     jl.        a2.    ;
     rl  w0  x2-34+26  ;    move slice length;
     rs  w0  x3+8      ;

a3:  al  w0     i17    ;    kit change variables on disc
     al  w1     g54     ;    length
     jl. w3    (f1.)   ;    reserve virtual;
     al  w2  x2+1      ;    writing
     rs. w2     f25.   ;    save page1 virt addr on page1;
     al. w0     f15.   ;    start;
     jl. w3    (f2.)   ;    move to virtual;
     rl. w1     f7.    ;    w3:= descr addr kit change;
     rs  w2  x1+8      ;
     dl. w0     f6.    ;    test rel entry;
     ds  w0  x1+6      ;    page 0
     bz. w3     f5.    ;
     al  w3  x3+1<3    ;    next kit coruno;
     hs. w3     f5.    ;
     al  w3  x1+e12    ;
     rs. w3     f7.    ;    descr addr:= descr addr + corutine length;
     rl. w2     f8.    ;
     al  w3  x2+e13    ;    kit change que:= kit change que +
     rs. w3     f8.    ;    semafore length;
     jl. w3    (f11.)  ;    simulate lock(w1, w2);
     jl.        a0.    ;    goto next kit;
z.
a1:  am.       (4)     ; end init:
     jl.       +4      ;    next init
     h5.               ;
\f


; btj 28.6.73          initialize          term2   ...46a...


; notice: the variables from f15 to f26 (=g54 (=28) halfwords)
;         are used as initial contents of page 1
;         (kitchange variable page, e23 incarnations).



f0:       0            ;    base of external table
f1:       12           ;    reserve virtual
f2:       13           ;    move to virtual
f3:       11, r.i45*2  ;    psjob operations
f4:  h.   10*e23, 19 w.;    reserve boss kit table
f5:  h.  20<3+e91,g18w.;    test rel entry
f6:       0            ;    page 0
f7:   e23*e12<12+ 18   ;    corutine descr. addresses
f8:   e23*e13<12+ 19   ;+10 kit change queue
f15=f8-10              ;    start of page 1
f9:       0            ;+12 device 
f12=f9+1               ;+13 rel addr in boss kittable;
f10:      0            ;    device index
f11:      14           ;    simulate lock
f13:      0            ;    index in b57 virt table
f14:      0, 0         ;    message operations
f25:      0            ;+24 var page virt addr (own incarnation)
f26=k-f15              ;+26 last addr on var page
g54=f26+2              ;=28 length of var page
                       ;    notice: on kit code page it is assumed
                       ;    that g54 = 7 doublewords = 28 halfwords
                       ;    when varpage and pooltable page
                       ;    are being interchanged.
c. i171 , h.           ;
f22:    e13,  19       ;    attention sem
f16:     10,  20       ;+2  sender table entry
f17:     i3,  19       ;    terminal buffer
f18:    e12,  18       ;    coroutine descr
f19:      0, 247       ;+2  virt of display page
f20:10<3+e90,g11       ;    testmode, entry
w.
f21:          24       ;    put in active que
f23:      0,r.8        ;    sense and wait answer
z.
f24:      0            ;    base of boss kit table
f30:      g15.         ;    start of empty catalog contents
e.                     ;
\f


; kll 20.6.72          initialize          term2   ...47...

d8=0                   ;    maxlength of params
b0:       0, r.5       ;    page addresses
    105<12 + 0         ;    page ident:  display
b1:       7            ;    get pages
b2:       25           ;    call
b3:       26           ;    current corutine
b4:       152          ;    virt request line page
b5:       280          ;    banker page
b6:       284          ;    psjob record length
b7:       202          ;    return:
b8:       203          ;            after action point
b9:       <:login:>    ;
b86:      <:idle:>     ;
b79:      -1           ;    empty param (constant)
b10:      <:dead:>     ;
b11:      <:   :>      ;
b12:      2<12+19      ;    abs hotnews request line address
b13:      25*25*25*27  ;    day
b14:      25*25*25*9   ;    hour
b15:      25*25*15     ;    min
b16:      162          ;    general print:
b17:      229          ;
b18:      0            ;    last psjob table
b19:      8            ;    page jump
b35=k+2,0,108000       ;    24 hours
b36:      162          ;    alarm print point:
b37:      204          ;   
b38:      3            ;    lock
b39:      6            ;    open chained
b40: h.   r.e23+1   w. ;    changeable bs-devices
                       ;    initialized during translation (see ---47a---)
b41:      290          ;    base of boss kit table
b42:      291          ;    top of boss kit table
b43:      79           ;    kit change que
b48:      294          ;    length of resource vector
b49:      <:<255>:>    ;
b50:      <:marg:>     ;
b51:      <:max<0>:>   ;
b57:      0, r.i4+1    ;    virt message, logout buffers
b58:      e13>1        ;    length of sem descr//2
b59:      62           ;    first attention semafor
b62:      34           ;    w0 call
b63:      157          ;
b64:      161          ;    init line
b65:      157          ;
b66:      158          ;    next line
b67:      <:all:>, 0   ;
b76:      162          ;
b77:      210          ;    file alarm
b78:      0            ;    max size  = (ext 16 - ext 29) < 9
b85:       5           ;    lock chained
b87:      4            ;    open
b88:      74           ;    catalock
b80:      0, i172      ;    wait short
b81:      0, i173      ;    wait long
b82:  <:clock:>, 0, 0, 0; 
b83:      1            ;    send and wait slow
b84:      5<12+4,0,0   ;    output message
b92:      385          ;    virt,
b93:      147          ;      rel display convert;

b100:  <:<29><29><29><29><0>:> ; clear display:
b101:  <:<31><31><31><31><28><28><28><28><0>:> ;
                       ;    <28> = home down, <30> = erase end of line
                       ;    <29> = home up, <31> = erase end of frame
b102:  <:<7><7>:>
b103:  <:<30><30><30><30><13><10><127><0>:>

b125:     51           ;    request queue semaphore
b105:     52           ;    request free semaphore
b106:  <:hotnews: :>   ;
b126: 32<16+32<8+32 ;    mask for not text
b127: 127           ;    mask for char
\f


; btj  28.6.73          initialize          term2   ...47a...

b. a9  w.              ;
a3:  e22.              ;
a0:  rl  w1  x2        ; j. code:
     al  w1  x1+a2     ;    reduce segment;
     rs  w1  x2        ;

     al  w1     e23    ;
a1:  al  w1  x1-1      ; rep:
     sh  w1    -1      ;
     jl.        a4.    ;    move disc devices to
     am.       (a3.)   ;    binary code from
     bz. w0  x1+a3.    ;    options;
     hs. w0  x1+b40.   ;
     jl.        a1.    ;

a4:  al  w0     0      ;
     al  w2     0      ;
     jl      x3        ;    return to slang;

     jl.        a0.    ;
a2=a3-k                ;
e. j.                  ; jump;

\f


; kll 1.12.71          display           term2   ...48...


b.a20, j15  w.          ;

a15: <:convert<0>:>

g8:                    ; display:
     dl  w1  x3+6      ;    test param1;
     sn. w0    (a15.)  ;
     se. w1    (a15.+2);    if param1=<:convert:> then
     jl.        a14.
     rl  w0  x3+8      ;
     se. w0    (a15.+4);
     jl.        a14.   ;
     dl. w3     b93.   ;
     jl.       (b19.)  ;    page jump to display convert;
a14:                   ;
     rl. w0     b5.    ;  
     jl. w3     c1.    ;    get pages(banker page);
     rl. w2     b0.+6  ;
j3:  al  w2  x2+277    ;    w2:= first psjob; (constant)
     al  w1  x3+d0     ;    w1:= start chain table;
a3:  bz  w0  x2+1      ; rep3:
     hs  w0  x1        ;    chain(w1):= link(w2);
     al  w1  x1+1      ;    w1:= w1 + chain table length;
j4:  al  w2  x2+284    ;    w2:= w2 + psjob length;
     se  w1  x3+d4     ;    if w1 < top chain table then
     jl.        a3.    ;    goto rep3;

     rl. w2     b0.+6  ;    w2:= abs banker page;
     dl  w1  x3+6      ;
     sl  w0     0      ;    if param empty then
     jl.        a1.    ;
j10: rl  w0  x3+134    ;
     sz  w0     1<5    ;    if no right to know other user names then
     jl.        a13.   ;    begin
     am.       (b0.+8) ;
j11: bz  w2    +324    ;      w2:=psjob no
     wm. w2     b6.    ;      * psjob length
     ba. w2     b107.  ;      + rel base of job descriptions
     wa. w2     b0.+6  ;      + abs ref banker page;
     jl. w1     c4.    ;      write job inf(abs job);
     jl.        c19.   ;      goto next;
a13:                   ;    end;
j1:  bz  w0  x2+279    ;    job:= resource head
     jl.        a2.    ;    else
a1:  sn. w0    (b10.)  ;    if param = dead then
     se. w1    (b10.+2);
     jl.        a5.    ;
j12: rl  w0  x3+134    ;    if no right to know other user names then
     so  w0     1<5    ;
     jl.        a16.   ;    alarm (forbidden);
j2:  bz  w0  x2+278    ;    job:= dead head
a2:  rs  w0  x3+d1     ;    else goto idle or login or job;

a4:  rl. w2     b0.+6  ; rep4:
j7:  al  w1  x2+277    ;    w1:=ref convert job;
     ba. w1     b23.   ;
     ba. w1     b23.   ;
     wa  w2  x3+d1     ;    abs job:= page 3 + job;
     rl  w0  x3+d1     ;
     sh  w0     1      ;    if end chain then
     jl.        c19.   ;    goto next action;
     ba. w2     b22.   ;
     al  w2  x2-1      ;    w2:=even;
j8:  bz  w0  x2+271    ;    w0:=state of psjob;
     sh  w0     2      ;    if psjob <> convert
     sh  w0     0      ;    and (psjob<> account
     sl  w2  x1+2      ;    or psjob state<>loading) then
     jl. w1     c4.    ;    write job inf( even abs job);
     rl  w2  x3+d1     ;
     al  w1     0      ;    index:= job // psjob length;
     wd. w2     b6.    ;
     am      x2        ;
     bz  w0  x3+d0     ;    job:= chain table(index);
     rs  w0  x3+d1     ;
     jl.        a4.    ;    goto rep4;
\f


; re 17.7.73          display           term2   ...48a...

a5:  bz  w2  x2+279    ; idle or login or job:
     sn. w0    (b86.)  ;    chainhead:= resourcehead;
     se. w1    (b86.+2);    if param = <:idle:> then
     sz                ;
     jl.        a8.    ;    goto save chainhead;

a7:  sn. w0    (b9.)   ; login or job:
     se. w1    (b9.+2) ;    if param <> <:login:> then
     jl.        c9.    ;    goto one job;
     al  w2     0      ;    chainhead:= empty;
a8:
j13: rl  w0  x3+134    ;    if no right to know other user  names then
     so  w0     1<5    ;
     jl.        a16.   ;    alarm (forbidden);
     rs  w2  x3+d13    ; save chainhead:

     al  w2  i45+2-i4-2;    base of online psjob (number);
     wm. w2     b6.    ;    length;
j5:  al  w2  x2+277    ;    first psjob;
                       ;    job:= base online psjob;
a6:  sl. w2    (b18.)  ; rep6:
     jl.        c19.   ;    if job>= last then goto next action;
     wa. w2     b6.    ;   
     rs  w2  x3+d1     ;    job:= job + 1;
     rl  w1  x3+d13    ;    w1:= chainhead;
a9:  sh  w1     1      ; rep:
     jl.        a10.   ;    if end chain then goto print;
j6:  al  w0  x1+277    ;    w0:= psjob rel;
     sn  w0  x2+1      ;    if w0 = job then
     jl.        a11.   ;    goto next;
     al  w0     0      ;
     wd. w1     b6.    ;    index:= psjob rel//psjob length;
     am       x1       ;
     bz  w1  x3+d0     ;    w1:= chain table(index);
     jl.        a9.    ;    goto rep;
a10:                   ; print:
     wa. w2     b0.+6  ;    w2:= even abs job;
     jl. w1     c4.    ;    write job inf(abs job);
a11: rl  w2  x3+d1     ; next:
     jl.        a6.    ;    goto rep6;
c39:                   ; alarm:  (from hotnews)
a16: al  w0     1      ;    alarm(forbidden):
     rs  w0  x3+4      ;    save alarm index;
     dl. w3     b37.   ;
     jl.       (b19.)  ;    page jump to alarm print;


b20=j1+1, b21=j2+1, b22=j3+1, b23=j4+1, b47=j5+1, b110=a5+1, b111=j6+1
b96=j10+1, b97=j11+1, b98=j12+1, b99=j13+1, b107=j7+1, b108=j8+1

e.                     ;
\f


; kll 1.12.71          display          term2   ...49...


b. a9, j9  w.          ;

c1:  rl. w2    (b3.)   ;  get pages(w0):
     rs  w0  x2+12     ;    page 3:= w0;
     jl.       (b1.)   ;    get pages and return;

c9:  jl. w1     c2.    ; one job:  search job;
     rl  w0  x3+12     ;
     rs  w0  x3+d1     ;    save second param;
     jl. w1     c4.    ;    write job inf;
     rl  w0  x3+d1     ;
     sn  w0    -1      ;    if no second param then
     jl.        c19.   ;    goto next action;

     rl  w2  x3+d3     ;
     wa. w2     b0.+6  ;    w2:=write base:= rest claim for job;
j3:  al  w2  x2+293    ;    ( j14 )
     bz  w0  x2        ;    if static not included then
     so  w0     1      ;
     jl.        a2.    ;    goto write no static;
     jl. w1     c8.    ;    write resource inf;

h. j7:   1,-19,2,-19,3,6,-19,7,8,9,10,11,13, j4=(:k-j7:)*4+6,0  w.
     jl. w1     c8.    ;    write explaining;
h.   -27,-28,0 w.

     jl.        c19.   ;    goto next action;
a2:  jl. w1     c8.    ; write no static:

h. j5:  1,-19,2,-19,3,j6=(:k-j5:)*4+6,0  w.;    write resource inf;
     jl. w1     c8.    ;    write explaining;
h.   -27,0 w.

     jl.        c19.   ;
\f


; re 17.7.73          display           term2   ...49a1...

c2:  rs  w1  x3+d2     ; search job:
     rl. w2     b0.+6  ;    w2 := abs banker page;
j0:  al  w2  x2+277    ;    abs job:= first job;
a0:                    ; rep:
j1:  dl  w1  x2+275    ; 
     sn  w0 (x3+4)     ;    if job name first <> param then
     se  w1 (x3+6)     ;
     jl.        a1.    ;    goto next;
j2:  dl  w1  x2+276    ;
     sn  w0 (x3+8)     ;    if job name last <> param then
     se  w1 (x3+10)    ;
     jl.        a1.    ;    goto next;

     jl    (x3+d2)     ;    goto return;

a1:  al  w2  x2+284    ; next:
     rl. w1     b18.   ;
     wa. w1     b0.+6  ;    abs job:= abs job + length;
     sh  w2  x1        ;    if abs job <= last then
     jl.        a0.    ;    goto rep else
c10: am         24-21  ;24: no such job:

c3:  am         21-22  ; 21: end display:
c6:  am         22-23  ; 22: end request:
c11: al  w1     23     ; 23: wait:
     al  w0     0      ;
     rl. w2    (b3.)   ;
     rs  w0  x2+12     ;    clear page 3;
     ds  w1  x3+12     ;    param3:= text index;
     al  w1     19     ;
     ds  w1  x3+8      ;    param2:= space;
     al  w0    -10     ;
     rs  w0  x3+4      ;    param1:= time;
     al  w0    -4      ; 
     rs  w0  x3+14     ;    param4:= out and after action;
     dl. w3     b17.   ;
     jl.       (b2.)   ;    general print;


b24=j0+1, b25=j1+1, b26=j2+1, b34=a1+1, b52=j3+1
c. j4-d8, d8=j4, z.
c. j6-d8, d8=j6, z.

e.                     ;
\f


; kll 12.7.72          display          term2   ...49a2...


b. a9,j9 w.
; entry: w1=ref list, w2=write base, w3=page 1
; integer: rel, text: -text number, end list: 0
c8:  sz  w2     1      ; write resource inf:
     am        -1      ;    if sub then adjust:=-1
     al  w0     0      ;    else        adjust:= 1;
     rs. w0     j2.    ;
     la. w2     j1.    ;    remove sub bit from w2;
a1:  bl  w0  x1        ; rep:
     sn  w0     0      ;    if rel list(index) <>0 then
     jl.        a2.    ;    goto print;
     sl  w0     0      ;    if text param then
     jl.        a3.    ;    begin
     ac  w0    (0)     ;
     rs  w0  x3+6      ;      text number:= -rel list(index);
     al  w0     0      ;      code:= print text;
     jl.        a4.    ;      goto next;
a3:  sn  w0     100    ;    end;
     jl.        a5.    ;    if code <> 100 then
     am        (0)     ;    begin
     bz  w0  x2        ;    w0:=byte(write base+rel list(index) );
     wa. w0     j2.    ;    integer param:=w0 + adjust;
     jl.        4      ;    end
a5:  rl. w0     b78.   ;    else integer param := maxsize;
     rs  w0  x3+6      ;
     al  w0    -2      ;    code := print integer;
a4:  rs  w0  x3+4      ; next:
     al  w1  x1+1      ;    index:=index+1;
     al  w3  x3+4      ;    param:=param+4;
     jl.        a1.    ;    goto rep;

c33: al  w0     0      ; write date etc:
     al  w1     30     ;    code := <:boss2 performance  :>;
     ds  w1  x3+6      ;
     al  w1    -10     ;    code := print date and time;
     rs  w1  x3+8      ;
     al  w3  x3+6      ;    param := param + 6;
     al. w1     c38.   ;    return := next action;

a2:  ws. w1     b0.    ; print:
     al  w2  x1+2      ;    save rel return in d2;
     al  w0     0      ;
     al  w1     8      ;    param:=new line;
     ds  w1  x3+6      ;
     am.       (b0.+2) ;
     rl  w1    +d7     ;    param+1:= last param;
     rs  w1  x3+8      ;
     rl. w3     b0.+2  ;
     rs  w2  x3+d2     ;
     jl.        c7.    ;    goto call general print;

j1:          -1<1      ;
j2:          0         ;    adjust
e.
\f


;  kll 12.7.72          display          term2   ...49b...


b. a9,j9 w.
g9:                    ; resource:
     rl. w0     b5.    ;
     jl. w3     c1.    ;    get pages(banker page);
     dl  w1  x3+6      ;
     la. w1     b49.   ;    param:= first 4 charecters in param;
     sn. w0    (b50.)  ;
     se. w1    (b50.+2);    if param = marg then
     jl.        4      ;
     jl.        a1.    ;    goto margin;
     sn. w0    (b51.)  ;
     se. w1    (b51.+2);    if param <> max then
j1:  am        -10     ;    w2:= free resources  else
j2:  al  w2    -9      ;    w2:= max  resources;
     dl  w1  x3+14     ;
     sn  w0     0      ;
     sl  w1     4      ;    if no param2 or param2>3 then
     al  w1     3      ;    param2:=3;
     wm. w1     b48.   ;
     am      x2        ;    write base:= w2+time class+sub
     am      x1+1      ;    else
a1:  al  w2     309    ; margin:  write base:= class margin;
     wa. w2     b0.+6  ;    w2:= abs write base;
     jl. w1     c8.    ;    write resource inf;

h. j0:   1,-19,3,-19,5,11,-19,13,15,17,19,21,25,-19,100, j3=(:k-j0:)*4+6,0   w.
     jl. w1     c8.    ;    write explaining;
h.   -27,-28,-29,0 w.

     jl.        c19.   ;    goto next action;
c12: am         b8-b77 ; after action:
c15: dl. w3     b77.   ; io alarm:
     jl.       (b19.)  ;    page jump;

b53=j1+1, b54=j2+1, b55=a1+1
c. j3-d8, d8=j3, z.
e.
\f


; kll 2.10.72          remove, message           term2   ...49.c...

b. d30  w.  b. a9, j9  w.

; line length   d7-d6 is computed from:
;     d7 <= i46+2     and
;     d16+2 + d7-d6 <= i46+4
; and therefore:
;     d7 = min(i46+2, i46+2 - d16+d6)

d0 =0,  d1=2   ;    attention sem, code
d2 =12, d3=14  ;    return, stop
d4 =4,  d5=12  ;    receiver, line param
d6 =14         ;    base store rel
d7 =i46+2      ;    last store rel
d10=2,  d11=3  ;    buffer in use, code
d12=d10+2      ;    from
d13=d12+4      ;    sender name
d14=d13+8      ;    long text
d15=d14+4      ;    new line
d16=d15+4      ;    outblock and return
c. d16-d6, d7=i46+2-d16+d6  z.
g40=d16+2+d7-d6;    length of buffer page
d20=4+8+2+2    ;    length of (<:from:>, <sendername>, <:<10>:>, <:<32>:>);
d21=16         ;    requ oper
d23=20         ;    code, ans sem
d24=22         ;    virt requ addr
d25= 4         ;    code, text length
d26=d25+2      ;    std text
d27=d26+6      ;    var text

c13: ws. w2     b0.    ; send operation(commandio number):
     rs  w2  x3+d2     ;    save return;
     ls  w1     1      ;
     al  w2  x1        ;    w2:= buffer index;
     wm. w1     b58.   ;
     wa. w1     b59.   ;    w1:= attention sem(commandio number);
j0:  sn  w1 (x3+223)   ;    if commandio number = ego then
     jl.        a3.    ;    goto return;
     rs  w1  x3+d0     ;    save attention;
     rl. w0  x2+b57.   ;
     jl. w3     c1.    ;    get page3(buffer(commandio number));
     rl. w2     b0.+6  ;
     bz  w0  x2+d10    ;
     sn  w0     0      ;    if buffer in use then
     jl.        a0.    ;    begin
     rl  w0  x3+d1     ;
     sn  w0     1      ;      if code = message then
     jl.        a4.    ;      goto wait return;
     hs  w0  x2+d11    ;      code:= remove;
     jl.        a3.    ;      goto return;
a0:  rl  w0  x3+d1     ;    end;
     hs  w0  x2+d10    ;    buffer in use;
     hs  w0  x2+d11    ;    code;
\f


; kll 2.10.72          remove, message          term2   ...49.d...

     se  w0     1      ;    if code = message then
     jl.        a2.    ;    begin
     al  w0     0      ;
     al  w1     18     ;
     ds  w1  x2+d12+2  ;      from;
     rl. w3     b0.+8  ;      w3:=ref job desc page;
j1:  dl  w1  x3+329    ;
     ds  w1  x2+d13+2  ;
j2:  dl  w1  x3+330    ;      sender name;
     ds  w1  x2+d13+6  ;
     rl. w3     b0.+2  ;      w3:=ref job file page;
     al  w0    -8      ;      long text;
j3:  rl  w1  x3+187    ;      length:= store rel - base store rel;
     al  w1  x1-d6+2   ;      length:=length + 1 word for space;
     ds  w1  x2+d14+2  ;
     al  w1  x1-2      ;     length:=length - 1 word for space;
     wa  w1     6      ;      w1:= abs base + length; w3:= abs base;
     al  w0     32     ;      start the text
     rs  w0  x2+d14+4  ;      with a space
     al  w2  x2+2      ;

a1:  rl  w0  x3+d6+2   ; rep:
     rs  w0  x2+d14+4  ;      move text word;
     al  w3  x3+2      ;
     al  w2  x2+2      ;      next word;
     se  w3  x1        ;      if index <> top then
     jl.        a1.    ;    goto rep;

     al  w0     0      ;
     al  w1     8      ;      new line;
     ds  w1  x2+d15+2  ;

     al  w0    -4      ;
     rs  w0  x2+d16    ;      outblock and return;
a2:                    ;    end;
     rl. w1     b0.+6  ;    w1:= operation;
     rl. w3     b0.+2  ;
     rl  w2  x3+d0     ;    w2:= attention sem;
     jl. w3    (b39.)  ;    open chained;
a3:  am         2      ; return:
a4:  al  w1     0      ; wait return:
     wa  w1  x3+d2     ;    goto saved return +
     jl.     x1+b0.    ;    if wait then 0 else 2;

b60=j0+1, b61=j1+1, b68=j2+1, b69=j3+1
e.                     ;
\f


; kll 2.10.72          remove, message          term2   ...49.e...

b. a9, j19  w.          ;
g51=k-b0               ; hotnews:
     rl  w0  x3+d4     ;    if no params then
     sl  w0     0      ;      begin
     jl.        a3.    ;      

     al  w0    -16     ;      print request line
     al  w1    -4      ;      outblock and after action
     ds  w1  x3+d4+2   ;

     rl. w1    (b3.)   ;      curr coruno.page3:=
     rl. w0    (b12.)  ;      hotnews request line address;
     rs  w0  x1+12     ;   
     se  w0     0      ;      if hotnews pending then
     am         b17-b8 ;        page jump to general print
     dl. w3     b8.    ;      else
     jl.       (b19.)  ;        page jump to after action;
a3:                    ;      end;
j10: rl  w0  x3+134    ;    if no operator right then
     so  w0     1      ;
     jl.        c39.   ;      goto alarm(forbidden);

     al  w0     1      ;
j8:  rl  w1  x3+236    ;    op.code:=remove;
     ds  w1  x3+d23    ;    op.ans sem;

     al  w0     0      ;
     rx. w0    (b12.)  ;    op.line:=hotnews line addr;
     rs  w0  x3+d24    ;
     sn  w0     0      ;    if hotnews pending then
     jl.        a4.    ;      begin
                       ;      clear request line addr;
     al  w1  x3+d21    ;
     rl. w2     b125.  ;
     jl. w3    (b39.)  ;      opch(req queue);

j9:  rl  w2  x3+236    ;
     jl. w3    (b38.)  ;      lock(answer);
                       ;      end;
a4:  dl  w1  x3+d4+2   ;    if param1=text then 
     se  w0     0      ;     
     jl.        c12.   ;      goto after action;

     al  w0     1      ;    code:=hotnews;
     rs  w0  x3+d4+6   ;    nb last word in receiver param
     rs  w1  x3+d5+2   ;    line param:=param1;
     dl. w1     b67.+2 ;    receiver  param:= <:all:>;
     ds  w1  x3+d4+2   ;    continue with message action;
\f


; lkn 76.10.28                              message   tterm2   ...49.f...


g6=k-b0                ; message:
     rl  w0  x3+d5+2   ;
j1:  rs  w0  x3+190    ;    line got:= line param;
j2:  rl  w0  x3+189    ;
     jl. w3     c1.    ;    get page3(work page);
j3:  al  w0  x3+257    ;
     dl. w3     b64.   ;
     jl. w1    (b62.)  ;    w0 call(init line);
     jl.        c15.   ;+0  io alarm:

     al  w0     2      ;
j4:  rs  w0  x3+188    ;    abs or page:= page 1;
     al  w1     d6     ;    base store rel;
     al  w0     d7     ;    last store rel;
j5:  ds  w1  x3+187    ;
j6:  al  w0  x3+257    ;
     dl. w3     b66.   ;
     jl. w1    (b62.)  ;    w0 call(next line);
     jl.        c15.   ;+0  io alarm:
     jl.        c14.   ;+2  line too long:
j7:  rl  w1  x3+187    ;
     al  w1  x1-d6     ;    w1 := length of line;
     sl  w1     i3-d20 ;    if length of line < length of (term buf - leading info)
     jl.        c14.   ;      then goto line too long;

     am         1-2    ;
g7=k-b0                ; remove:
     al  w0     2      ;
     rs  w0  x3+d1     ;    save operation code;
     dl  w1  x3+d4+2   ;
     sn. w0    (b67.)  ;
     se. w1    (b67.+2);    if receiver param = all then
     jl.        a2.    ;    begin

     al  w1     0      ;      step:= 0;
a1:  rs  w1  x3+d3     ; rep:
     jl. w2     c13.   ;      send operation(step);
     am         0      ;+0    dummy wait;
     rl  w1  x3+d3     ;
     al  w1  x1+1      ;      step:= step + 1;
     sh  w1     i4     ;      if step <= last then
     jl.        a1.    ;      goto rep else

     rl  w0  x3+d4+6   ;    if code =message then
     se  w0     1      ;      goto after action
     jl.        c12.   ;    else
                       ;    <*hotnews*>
     rl. w2     b105.  ;
     jl. w3    (b85.)  ;    lock chain(request free);

     rl. w2    (b3.)   ;
     rl  w0  x2+10     ;    hotnews request line addr:=
     rs. w0    (b12.)  ;    virt page 2 addr;
\f


; lkn 76.10.28                                        tterm2   ...49.g...



     al  w2  x1        ;
     dl. w1     b106.+2;
     ds  w1  x2+d26+2  ;    move std text;
     rl. w0     b106.+4;
     rs  w0  x2+d26+4  ;
     al  w0     1<1    ;    code:=insert line;
j11: rl  w1  x3+187    ;
     al  w1  x1-d6+6   ;    set text length
     sl  w1     e10-d26;
     al  w1     e10-d26;
     ds  w1  x2+d25    ;

a5:  rl  w0  x3+d6+2   ;
     so. w0    (b126.) ;    if not pure text then
     jl.        a7.    ;    goto test nl
a6:  rs  w0  x2+d27    ;
     al  w3  x3+2      ;    move var text;
     al  w2  x2+2      ;
     al  w1  x1-2      ;
     se  w1     6      ;
     jl.        a5.    ;

     rl. w1     b0.+4  ;
     rl. w2     b125.  ;    opch(request queue);
     jl. w3    (b39.)  ;

     jl.        c12.   ;      goto after action;
a7:  ds. w2     b84.+4 ; test nl:  save reg
     al  w2    -24     ;    init shift count
a8:  al  w2  x2+8      ; rep:  step shift count
     sl  w2     1      ;    if all tested then
     jl.        a9.    ;    goto prep return
     rl  w1     0      ;
     ls  w1  x2        ;
     la. w1     b127.  ;    w1:=next char
     se  w1     10     ;    if not nl then goto
     jl.        a8.    ;
     ls  w0  x2-8      ;    shift out nl
a9:  dl. w2     b84.+4 ; prep return:  restore reg
     jl.        a6.    ;    return
a2:                    ;    end;
     rl. w0     b5.    ;
     jl. w3     c1.    ;    get page3 (banker page);
     jl. w1     c2.    ;    search job;
     ws. w2     b0.+6  ;
     bs. w2     b22.   ;
     al  w1     0      ;
     wd. w2     b6.    ;    w2:= psjob number;
     al  w1  x2-i45+i4-1;   w1:= commandio number;
     sh  w1    -1      ;    if w1 offline psjob then
     jl.        c10.   ;    goto no such job;
     jl. w2     c13.   ;    send operation(commandio number);
     jl.        c11.   ;+0  wait return: goto wait;
     jl.        c12.   ;    goto after action;

b70=j1+1, b71=j2+1, b72=j3+1, b73=j4+1, b74=j5+1, b75=j6+1,b89=j7+1
b121=j8+1, b122=j9+1, b123=j10+1, b124=j11+1
e.e.                   ;
\f


; kll 1.12.71          display          term2   ...50...


b. a9, j19  w.          ;
; call:   w1 = link, w2 = abs job, w3 = page 1

a6: 0                  ;    work
a7: 9999               ;    upper limit for written priority
c5:  al  w2  x2-1      ; write job inf(uneven abs job);
c4:  ws. w1     b0.    ; write job inf(abs job):
     ds  w2  x3+d3     ;    save rel return, abs job;
j0=4
     al  w0    -8      ;    type:= long text;
     al  w1     8      ;    length;
     ds  w1  x3+j0+2   ;
j0=j0+4

j2:  dl  w1  x2+275    ; move 8 bytes:
     sn  w0     0      ;    if empty name then
     jl.        a4.    ;    goto return;
     lo. w0     b11.   ;
     lo. w1     b11.   ;
     ds  w1  x3+j0+2   ;    move job name(abs job);
j3:  dl  w1  x2+276    ;    add spaces;
     lo. w0     b11.   ;
     lo. w1     b11.   ;
     ds  w1  x3+j0+6   ;
j0=j0+8

j1:  bz  w1  x2+292    ; move 4 bytes:
     ls  w1    -1      ;
     al  w0     0      ;
     wd. w1     b48.   ;
     al  w0    -13     ;    time class
     ds  w1  x3+j0+2   ;
j0=j0+4
j10: bz  w1  x2+308    ;    w1:= first core place;
     se  w1     0      ;    if first core place <> 0 then
     am         1      ;    b-job else
     al  w1     16     ;    a-job;
     al  w0     0      ;
     ds  w1  x3+j0+2   ;    print standard text;
j0=j0+4                ;
     dl  w1     110    ;    w1:=time now
     ld  w1    -13     ;
j8:  ws  w1  x2+522    ;       -arrival time
j11: bz  w0  x2+497    ;    w0:=priority factor
     rs. w0     a6.    ;
     al  w0     0      ;
     wm. w1     a6.    ;    w1:=current priority
     ld  w1    -10     ;
     sl. w1    (a7.)   ;    if priority>9999 then
     rl. w1     a7.    ;    write 9999
     al  w0    -2      ;
     ds  w1  x3+j0+2   ;  print priority

j4:  bz  w0  x2+271    ; move 4 bytes:
     se  w0     5      ;    if state=logged in (no job running)
     jl.        a5.    ;    then
     al  w1     0      ;
     rs  w1  x3+j0+2   ;    priority:=0
j0=j0+4
a5:
     sn  w0     2      ;    if state(abs job) = core wanted then
     jl.        a1.    ;    goto test in core;
j5:  bz  w1  x2+274    ;    w1:= reserve all(abs job);
     al  w2     5      ;    w2:= text index:= <:waiting:>;
     sz  w1     1      ;    if reserve all then
     jl.        a3.    ;    goto store text index;
     se  w0     1      ;    if state <> reserving then
     am        -1      ;    w2:= text index:= <:loading:> else
     al  w2     4      ;    w2:= text index:= <:reserving:>;
     jl.        a3.    ;    goto store text index;

a1:  ws. w2     b0.+6  ; test in core:
     bs. w2     b22.   ;    w2:= psjob rel;
     rl. w1     b0.+6  ;
j6:  sn  w2 (x1+272)   ;    if psjob rel = job a rel
     jl.        a2.    ;    or
j7:  sn  w2 (x1+273)   ;    psjob rel = job b rel then
a2:  am        -1      ;    w2:= text index:= <:in core:> else
     al  w2     7      ;    w2:= text index:= <:swopped out:>;

a3:  al  w1     0      ; store text index:
     ds  w2  x3+j0+2   ;    standard text(text index);
j0=j0+4

\f


; kll 1.12.71          display          term2   ...51...

     rl  w2  x3+d3     ;    w2:= abs job;
     dl  w1     110    ; move 8 bytes:
     ld  w1    -13     ;    work:= real time - 24 hours;
     ss. w1     b35.   ;
     ds  w1  x3+j0+2   ;
j9:  rl  w1  x2+270    ;    delta:= finistime - work;
     ws  w1  x3+j0+2   ;
     al  w0     0      ;
     aa  w1  x3+j0+2   ;    finistime:= delta + work;
     ld  w1     2      ;

     wd. w1     b13.   ;
     ld  w1    -21     ;    w1:= w1 mod day;
     wd. w1     b14.   ;
     rs  w1  x3+j0+2   ;    param 1:= hour;
     ld  w1    -22     ;
     wd. w1     b15.   ;    param 2:= min;
     al  w0    -2      ;
     ds  w1  x3+j0+6   ;
     rs  w0  x3+j0+0   ;
j0=j0+8
   
     rl  w2  x3+d3     ;    w2:= abs job;
     ws. w2     b0.+6  ;
     rs  w2  x3+d3     ;    save rel job;
     bs. w2     b22.   ;    w2:= psjob rel;
     al  w1     0      ;
     wd. w2     b6.    ;    w2:= psjob number;
     sh  w2     i45-i4 ;    textindex:= if offline then
     am         25-26  ;    <::> else
     al  w2     26     ;    <:   login:>;
     al  w1     0      ;
     ds  w2  x3+j0+2   ;
j0=j0+4

     al  w0     0      ; move 4 bytes:
     al  w1     8      ;    text index:= <:<10>:>;
     ds  w1  x3+j0+2   ;
     rl  w1  x3+d7     ;    get last param;
     rs  w1  x3+j0+4   ;    print and return;
j0=j0+6
c. j0-d8, d8=j0, z.

c7:  dl. w3     b17.   ;
     jl. w1    (b2.)   ;    call general print;
     rl  w1  x3+d7     ;    if last param = return then
     sn  w1    -5      ;
     jl. w2     c36.   ;    count and output;

a4:  rl  w1  x3+d2     ; return:
     jl.     x1+b0.    ;    goto saved rel return;
\f


; re 17.7.73          display           term2   ...51a...

d0=d8                  ;    chain table
d4=d0+i45+2            ;    top chain table
d1=d0+(:i45+2+1:)/2*2  ;    job
d2=d1+2                ;    saved return from write
d3=d2+2                ;+2  saved abs job
d5=4                   ;    used by request
d6=d5+e10+4+2          ;    used by request: rel line
d14=d6+2               ;    used by request: request line count
c. d3-d14
d14=d3
z.
d7=d14+2               ;    last param
d9=d7+2                ;    action pointer
d10=d9+2               ;    rest count
d11=d10+2              ;    old rest count
d12=d11+2              ;    pending request (boolean)
d13=d12+2              ;    chainhead


c. d13+2-i46-2
m.***i46 too small
z.

b56=j1+1, b27=j2+1, b28=j3+1, b29=j4+1, b30=j5+1, b31=j6+1
b32=j7+1, b33=j9+1, b90=j8+1, b46=j10+1, b104=j11+1

e.                     ;
\f


; kll 1.12.71          request          term2   ...52...


b. a9, j9  w.          ;
g10:                   ; request:
     al  w0     0      ;    request line count := 0;
     rs  w0  x3+d14    ;
     rl. w0     b4.    ;
a0:  jl. w3     c1.    ;    get pages(request lines);

     al  w2     0      ;
a1:  rs  w2  x3+d6     ;    line:= 0;

     wa. w2     b0.+6  ; rep:   w2:= abs line:= page 3 + line;
     dl  w1  x2+4      ;    w1:= length;
     sz  w0     1<1+1  ;    if code = pending not free then
     jl.        a3.    ;    begin
     sz  w0     1<3     ;    if code=bell then
     rs  w3  x3+d12    ;    pending request:=true;

     al  w0    -8      ;      type:= long text;
     ds  w1  x3+d5+2   ;      length;

a2:  rl  w0  x2+6      ;      while length > 0 do
     rs  w0  x3+d5+4   ;
     al  w1  x1-2      ;      begin
     al  w2  x2+2      ;        move(w2 + length, w3 + length);
     al  w3  x3+2      ;        length:= length -2;
     sl  w1     2      ;      end;
     jl.        a2.    ;

     al  w0     0      ;
     al  w1     8      ;      text index:= <:<10>:>;
     ds  w1  x3+d5+6   ;
     am.       (b0.+2) ;    last param;
     rl  w0    +d7     ;
     rs  w0  x3+d5+8   ;

     dl. w3     b17.   ;      call general print;
     jl. w1    (b2.)   ;    end;
     rl  w0  x3+d7     ;    if last param = return then
     sn  w0    -5      ;
     jl. w2     c36.   ;    count and output;

a3:  rl  w2  x3+d6     ;
     al  w2  x2+e10    ;    line:= line + length;
     rl  w1  x3+d14    ;    increase(request line count);
     al  w1  x1+1      ;
     sl  w1     i2     ;    if request line count >=
     jl.        c19.   ;      no of request lines then
     rs  w1  x3+d14    ;        goto next action;
     se  w2     e46/e10*e10;if line < top of request page then
     jl.        a1.    ;    goto rep;

     rl. w2    (b3.)   ;    page 3 := page 3 + size of one request page;
     al  w0     e46    ;
     wa  w0  x2+12     ;
     jl.        a0.    ;    goto get pages;
e.                     ;
\f


; btj  28.6.73          main loop          term2   ...52.a...


b. a20, j9  w.         ;

c16: rl  w2  x3+d10    ; testline:   old rest:= rest count;
     rx  w2  x3+d11    ;    if oldrest is changed then
     se  w2 (x3+d11)   ;    goto skip action;
     jl.        c18.   ;
c17: am     (x3+d9)    ; goto action:
     bl. w2    +a1.    ;    pointer:= pointer + rel(pointer+1) -2;
     am      x2-1      ;
c18: am         1      ; skip action:   increase(pointer);
c19: al  w2     1      ; next action:   increase(pointer);
c38=c19-2 ; used in c33
     wa  w2  x3+d9     ;
c20: rs  w2  x3+d9     ; save action:   save(pointer);
     ba. w2  x2+a0.    ;
     jl.     x2+a0.    ;    goto action(pointer);


h.
a0:  a1=a0+1           ; action tables:

a2:                    ; display:
     c31.              ;    lastparam:= outblock and return
     g8.               ;    display
     c3.               ;    end display

a3:                    ; resource:
     c31.              ;    lastparam:= outblock and return
     g9.               ;    resource
     c12.              ;    after action

a4:                    ; request:
     c31.              ;    lastparam:= outblock and return
     g10.              ;    request
     c6.               ;    end request

a5:                    ; operator display:
a6:  c30.              ; rep: lastparam:= return
     c32.              ;    init display
     c33.              ;    write date etc;
     c37.              ;    oldrest := rest;
     g10.              ;    request
     c16., a7.         ;    if rest <> oldrest then
         c35.          ;      write newline;
a7:  c28., a10.        ;    if rest < 1 then goto wait;
     c22.              ;    param:= empty
     c37.              ;    oldrest := rest;
     g8.               ;    display
     c16., a8.         ;    if rest <> oldrest then
         c35.          ;      write newline;
 a8: c28., a10.        ;    if rest < 1 then goto wait;    
     c23.              ;    param:= idle
     c37.              ;    oldrest := rest;
     g8.               ;    display
     c16., a9.         ;    if rest <> oldrest then
         c35.          ;      write newline;
 a9: c27., a10.        ;    if rest < 2 then goto wait;
     g9.               ;    resource;
     c29.              ;    write clear rest of display;

\f


; btj 28.6.73          main loop          term2   ...52.b...


a10: c26., a12.        ; wait:   if pending request etc then
 a11: c34.             ;  rep1:  write bell
      c24.             ;         wait short
      c28., a6.        ;         if rest < 1 then goto rep;
      c17., a11.       ;         goto rep1;
 a12: c25.             ;    else wait long
     c17., a6.         ;    goto rep;

w.

g11=  -b0.             ; entry operator display:
     al  w2     1<5    ;    set right to know other user names
b95=k+1
     rs  w2  x3+134    ;    (for operator display being able to display the job queue)
     am         a5-a3  ;
g5=  -b0.              ; entry resource:
     am         a3-a4  ;
g1=  -b0.              ; entry request:
     am         a4-a2  ;
g0=  -b0.              ; entry display:
     al  w2     a2-a0  ;    initialize action pointer;
     jl.        c20.   ;    goto save action;
e.
\f


; btj  28.6.73          operator display          term2   ...52.c...


c21: rs  w3  x3+d12    ;    pending request:= true;
     jl.        c19.   ;    goto nextaction;


c22: am         b79-b86;    param:= empty;
c23: dl. w1     b86.+2 ;    param:= <:idle:>;
     ds  w1  x3+6      ;
     jl.        c19.   ;    goto next action;


c24: am         b80-b81; wait short:
c25: al. w1     b81.   ; wait long:
     al. w2     b82.   ;
     jl. w3    (b83.)  ;    send and wait(clock, wait);
     jl.        c19.   ;    goto next action;


c26: al  w2   i173/i172; test pending request:
     rs  w2  x3+d10    ;    restcount:= number of bell messages;
     se  w2     0      ;
     rl  w2  x3+d12    ;    if pending request and
     se  w2     0      ;      restcount >0 then
     jl.        c18.   ;    goto skip action;
     jl.        c17.   ;    goto goto action;


c27: am         1      ; testrest2:   if rest <= 1 then
c28: al  w2     0      ; testrest1:   if rest <= 0 then
     sl  w2 (x3+d10)   ;
     jl.        c17.   ;    goto goto action;
     jl.        c18.   ;    goto skip action;

c37: rl  w2  x3+d10    ;    oldrest := rest;
     rs  w2  x3+d11    ;
     jl.        c19.   ;    goto next action;
\f


; btj 28.6.73          operator display          term2   ...52.d...

b. a10, j9  w.         ;
c30: am        -5+6    ;    last param:= return;
c31: al  w2    -6      ;    last param:= outblock and return;
     rs  w2  x3+d7     ;
     jl.        c19.   ;    goto next action;

c32: al  w2     i174   ; init display:
     rs  w2  x3+d10    ;    oldrest:= rest:= maxlines;
     rs  w2  x3+d11    ;
     al  w2     0      ;
     rs  w2  x3+d12    ;    pending request := false;

j2:  rl  w1  x3+222    ;    w1:= sender table entry;
     rl  w0  x1+8      ;    w0:= sender table.mess;
     sh  w0     0      ;    if message in que then
     jl.        a1.    ;    begin
     rl  w2  x1+2      ;
     jl. w3    (b85.)  ;      lock chained(attention semaphore);
     al  w2     0      ;
     rx  w2  x1+4      ;      release sender table entry;
     al. w1     ;here  ;      answer:= dummy;
     al  w0     2      ;      result:= rejected;
     jd         1<11+22;      send answer;
a1:                    ;    end;

     am         b100-b101;  write home up;
c29: am         b101-b102;  write clear rest of display
c34: am         b102-b103;  write bell     :
c35: al. w1     b103.    ;  write newline  :
j1:  rl  w3  x3+178    ;
a0:  rl  w0  x1        ;    move until <nul> char;
     rs  w0  x3        ;
     al  w1  x1+2      ;
     se  w0     0      ;    (skip store counter if word contains all zero)
     al  w3  x3+2      ;
     sz  w0     255    ;
     jl.        a0.    ;
     al  w1  x3-2      ;    w1:= last buf;
     rl. w3     b0.+2  ;
     rs  w1  x3+4      ;
     al. w2     c19.   ;    return:= next action;
; continue in op.display output.
\f


; re 6.2.75       operator display              term2   ...52e...



; procedure operator display output
; call:   w2 = return, w3 = page 1(= job file), (page 1 + 4) = last byte
; exit:                w3 = page 1

c36:                   ; count and output:
     rl  w0  x3+d10    ;
     sh  w0     0      ;    if rest count <= 0 then
     jl.        c19.   ;    goto next action;
     rs  w0  x3+d11    ;    old rest:= rest;
     bs. w0     1      ;
     rs  w0  x3+d10    ;    rest:= rest - 1;

j3:  rl  w0  x3+178    ;    w0:= first byte of term buf;
     rl  w1  x3+4      ;    w1:= last byte;
     ds. w1     b84.+4 ;
     al. w1     b84.   ;    w1:= output message;
     rx  w3     4      ;    w3:= return;
j4:  al  w2  x2+217    ;    w2:= term name;
     jl.       (b83.)  ;    send and wait( no check);

b112=j1+1, b118=j2+1, b119=j3+1, b120=j4+1

e.

\f



; kll 24.5.72          kit          term2   ...53...

; entry: w3=absref page 1 (commandio jobfile page)

b. a9, j9  w.          ;
g4=k-b0, am     1      ; label kit action:
g3=k-b0, al w0  1      ; change kit action:
     rl  w1  x3+6      ;    operation:= label or change;
     ds  w1  x3+10     ;    move devicenumber;
     al  w1    -1      ;    index:= -1;

a0:  al  w1  x1+1      ; next index:   index:= index + 1;
     sl  w1     e23    ;    if index = top then
     jl.        a3.    ;    goto device not changeable bs-device;
     bz. w2  x1+b40.   ;  
     se  w2 (x3+6)     ;    if device(index) <> device param then
     jl.        a0.    ;    goto next index;

     rs  w1  x3+26     ;    save index in page 1 + 26;
     wm. w1     j2.    ;
     wa. w1     b43.   ;    if queue value(index * semlength
     rl  w0  x1        ;      + kit change queue)
     sl  w0     0      ;      >= 0 then
     jl.        a7.    ;      goto kit in use;
     rl  w1  x3+26     ;
     wm. w1     j1.    ;
     wa. w1     b41.   ;    rel entry in kit table:= index* length + base;
c. 2-e79

     rl  w2     76     ;
     al  w2  x2-2      ;    w2:=name table base(first area);
a2:  al  w2  x2+2      ;rep:
     sl  w2    (78)    ;    w2:=name table of next area;
     jl.        a6.    ;    if w2 is still an area then

     rl  w3  x2        ;      begin
     rl  w0  x3+14     ;      if users.areaproc=0 
     se. w0    (j5.)   ;      or procfunc is only user then
     sn  w0     0      ;        goto rep;
     jl.        a2.    ;

     dl  w0  x3+22     ;
     sn  w3 (x1+0+10)  ;      if documentname(areaprocess)=
     se  w0 (x1+2+10)  ;         name(kit entry) then
     jl.        a2.    ;         goto kit in use;
     am     (x2)       ;
     dl  w0    +26     ;      goto rep;
     sn  w3 (x1+4+10)  ;
     se  w0 (x1+6+10)  ;
     jl.        a2.    ;
     jl.        a7.    ;      end;
a6:
z.
     
\f


; re 4.11.74          kit          term2    ...53a...

     rl. w2     b0.+2  ;
     dl  w0  x1+12     ;    move device name
     ds  w0  x2+2      ;      from boss kittable to
     dl  w0  x1+16     ;      page 1:  +0,+2,+4,+6
     ds  w0  x2+6      ;
c. 2-e79
     al  w0    -1      ;
     rs  w0  x1+10     ;   kittable entry.name := undef;
z.
     rl. w2     b88.   ;
     jl. w3    (b38.)  ;    lock(catalock);
c. 2-e79

     al  w1     0      ;    w1:= segment:= 0;
a1:  jd         1<11+88; next segment:   remove bs(segment);
     al  w1  x1+1      ;    segment:= segment + 1;
     sn  w0     0      ;    if result = ok then
     jl.        a1.    ;    goto next segment;
jd-1
     rl. w2     b88.   ;    w2:=catalock sem;
     se  w0     2      ;    if result = device unknown
     sn  w0     3      ;      or result = segment error then
z.
c. e79-3
     al  w2  x3        ;    w2:=device name;
     jd         1<11+108;   delete bs(device name);
jd-1
a1:  jd         1<11+110; rep:  delete entries(device name);
     sn  w0     3      ;    if result = more entries then
     jl.        a1.    ;      goto rep;
jd-1
     rl. w2     b88.   ;    w2:=catalock sem
     se  w0     0      ;    if result ok
     sn  w0     6      ;    or nameformat illegal <*i.e. never mounted before*> then
z.
     jl.        a5.    ;    goto remove kit;
     jl. w3    (b87.)  ;    open(catalock);

a7:  am         23-0   ; 23: kit in use:
c14: am         0-32   ; 0:  line too long:
a3:  am         32-24  ; 32: device not changeable disc drive:
a4:  al  w0     24     ; 24: change kit:
     rl. w3     b0.+2  ;
     rs  w0  x3+4      ;    page 1 + 4:= alarm index;
     dl. w3     b37.   ;
     jl.        (b19.) ;    page jump(alarm print);
a5:  jl. w3    (b87.)  ; remove kit:
     rl  w2  x3+26     ;    open(catalock);
     wm. w2     j2.    ;    (operation = page 1  +0, +44)
     wa. w2     b43.   ;    sem:= index * sem length +
     al  w1  x3+0      ;    kit change que;
j3:  rl  w0  x3+236    ;    operation + 44:= answer sem;
     rs  w0  x1+44     ;
     jl. w3    (b39.)  ;    open chained(sem);
j4:  rl  w2  x3+236    ;
     jl. w3    (b38.)  ;    lock(answer sem);
     jl.        a4.    ;    goto change kit;

j1:       10           ;    length of entry in boss kit table
j2:       e13          ;    semafore length
c. 2-e79
j5:       1<23         ;    identification bit of procfunc
z.
b44=j3+1, b45 = j4+1
e.                     ;
g2=k-b0                ;    length of page
\f


; kll 30.6.72         kit          term2    ...54...

b. b60, d20, c30, j20  w.;


; kit label operation format:
; (received from commio on jobfile page)
j1=8     ; code (1: change, 2: label)
j2=10    ; device no
j3=12    ; device name
j4=20    ; size of catalog(segments)
j5=28    ; slice length   (segments)
j6=36    ; no of segments on device
j7=44    ; answer semafore

; ex:   kitlabel 14 kit37 40 8 8120

; slice table format:

j10=0  ;     first slice of catalog, keys
j11=2  ;     low limit base
;  +4  ;     high limit base
j12=6  ;     catalog name
j13=14 ;     size of catalog
j14=16 ;     document name (device)
j15=24 ;     0
j16=26 ;     slice length
j17=28 ;     last slice (number - 1)
;  +29 ;     first slice of chaintable area (must be 0)
j18=30 ;     if monitor release >= 3 then 0 else -1, 0   (aux cat)
;  +32 ;     0
       ;     slice table contents:
; h.  1, r.  first slice of catalog + size of catalog in slices -1 , 0
;  2048, r.  the rest until catalog      w.

; empty catalog format:
g15:       -1, r. 255, 0
\f


; jma 1978.10.22       kit          term2   ...54a...



; monitor functions (only shown for monitor release < 3) :

; create bs:  jd 1<11+84          ; insert entry: jd 1<11+86
; w1=device,  w3=chain table      ; w1=entry,     w3=chain table
; result: 0   ok                  ; result: 0     ok
;         2   i/o error           ;         2     i/o error cat
;         3   name conflict       ;         3     name conflict
;         4   device trouble      ;         4     claims exceeded
;         5   entry inconsistent  ;         5     entry inconsistent
;         6   name format         ;         6     name format

; remove bs:  jd 1<11+88
; w1=name key (segment no in main catalog), w3=name addr
; result: 0   ok
;         2   i/o error or not exist
;         3   name key
;         4   claims not all
;         5   area used
;         7   cat inconsistent
\f


; kll 20.6.72          kit          term2   ...55...

; page 1: +0, 2, 4, 6, 8   ; name, name table addr or slice length
     d1=10; see page --46--; que semaphore(current coroutine)
     d2=12                 ; device (byte)
     d3=13                 ; rel entry in kittable (byte)
     d4=14                 ; work: segment, rel alarm text
                           ;       operation, sender
     d5=16                 ; code (1: change, 2: label), first segment of catalog
     d6=18                 ; size of catalog (segments), occupied
     d7=20                 ; slice length
     d8=22                 ; no of segments on device
     d9=24; see page --46--; variable page(current coroutine)
    d10=26                 ; work: saved rel return c13, c21, c22

; the following is only on pooltable page:

    d11=g54   ; (=28)      ; current segment in usercat
    d12=g54+2              ; size of current pool (=i19 or 0)
    d13=g54+4              ; last (or current) pool addr (rel to pagestart)
    d14=g54+6              ; current project
    d15=g54+8              ; pooltable start

; pool descriptions:
; pool+0:   project
;     +2:   lower limit of pool interval
;     +4:   upper   -   -   -      -
;     +6:   usercat ref (segm,rel or 0,0)
;     +8:   entries, slices

; page 3 = psjob operations or usercat buffer or empty catalog contents
;                           or chaintable (kitlabel) output buffer
; page 4 = savebuffer (used for chaintable input)  buffer

; psjob operation : chain
;                   reserved, code = 11
\f


; jma 1978.10.22       kit          ...55a...


; kit code page:


b0:  g20: 0, r.5       ;    page addresses
    106<12 + 0         ;    page ident:  kit changer
b1:  g21: 1            ;    send and wait
b2:  g22: 2            ;    send and wait fast
b3:  g23: 3            ;    lock
b4:  g24: 4            ;    open
b5:  g25: 5            ;    lock chained
b6:  g26: 6            ;    open chained
b7:  g27: 7            ;    get pages
b8:  g43: 21           ;    privat output
b10:      0            ;    pooltable page (virt addr)
b11: g28: 26           ;    current corutine
b15: g29: 416          ;    usercat buffer (virt addr)
b16: g30: 233          ;    save buffer (virt addr)
b17: g31: 75           ;    usercat sem
b18: g32: 74           ;    catalock
b19:      0            ;    psjob operations (virt addr)
b20: g34: 51           ;    request que
b21: g35: 52           ;    request free
b22: g41: 32           ;    prepare access
b23: g42: 33           ;    terminate access
b24:      5<12         ;    output message
b50:      0            ;+2  fa,  work: (not used)
b51:      0            ;+4  la,   -  : last pool (abs addr)
b52:      0            ;+6  segm, -  : (not used)
b25:      i62*512-2    ;    length of save buffer
b26:      3<12         ;    input message
b53:      0            ;+2  fa,  work: closest yet (lower limit)
b54:      0            ;+4  la,   -  :    -     -  (upper   -  )
b55:      0            ;+6  segm, -  :    -    pool (rel to pagestart)
b27:      0, 20        ;    wait message, set base:0
b28:      1<18         ;    end medium
b29:      -1-1<18-1<1  ;    hard error
b30:      7            ;    mask for permanent key
b31: g36: 290          ;    base of boss kit table
     g48: 291          ;+2  top boss kittable
b32:      10           ;    convert integer to text
b33: <: 00:>           ;       -       -     -   -
b34: <: on:>           ;       -       -     -   -
b35: <:clock:>, 0, r.3 ;       -       -     -   -
b36:      0            ;    work: saved return c1, saved sender
b37: g37: 151          ;    first psjob sender table entry
b38: g38: 153          ;    top psjob sender table entry
b39:      4<12+10      ;    increase psjob operation, sender table
b40:      0            ;    empty catalog contents (virt addr)
b41:      0            ;    chaintable output buffer (virt addr)
b42: g39: e13<12+19    ;    label write semafore
b43:      <:cat:>      ;    
b44: 8.40000001, 8.37777776;    base of catalog
b45: <:usercat:>, 0    ;    usercat name
b46: g55: 286          ;    usercat nametable addr
b47:     -8388608      ;    large interval
b48:      8388607      ;+2    -       -     , last project in usercat
b49: (:i18*512-d15-i19:)/i19*i19+d15 ;    last pool (rel to pagestart)
                       ;    b50 - b55: see after b24 and b26
b56:      1<12         ;    one entry

g16=b40 - 1500
g17=b41 - 1500
g33=b19 - 1500
g46=g39 - 1500
g47=g20 - 1500
g52=b10 - 1500
\f


; kll 20.6.72          kit          term2   ...56...


b. a9  w.              ;
c0:  rl. w1    (b11.)  ; wait kit change que:
     rl  w2  x1+8      ;
     se  w2 (x3+d9)    ;    if page1 <> own varpage then
     jd        -105    ;    *** bossfault(105);
     c.-1,     o105, z.;    (bossfault xref)
     al  w0     0      ;
     rs  w0  x1+12     ;    page 3:= 0;
     rl  w2  x3+d1     ;
     jl. w3    (b5.)   ;    lock chained(que);

g18=k-b0               ;    first start

; w1 = absref page2 (operation) (=jobfile page)
; w3 = absref page1 (variable page)

c. e79-3
     bz  w2  x3+d3     ;    name.kittable(rel entry.kit) := undef;
     wa. w2     b31.   ;
     al  w0    -1      ;
     rs  w0  x2        ;
z.

     al  w2  x1        ; move operation:
     rl  w0  x2+j2     ;    device number;
     hs  w0  x3+d2     ;
     rl  w0  x2+j1     ;
     rs  w0  x3+d5     ;    code;
     sn  w0     1      ;    if code = label then
     jl.        a0.    ;    begin
     rl  w0  x2+j4+2   ;
     rs  w0  x3+d6     ;      size of catalog;
     rl  w0  x2+j5+2   ; 
     rs  w0  x3+d7     ;      slice length;
     rl  w0  x2+j6+2   ;
     rs  w0  x3+d8     ;      no of segments on device;
     dl  w1  x2+j3+6   ;
     ds  w1  x3+6      ;
     dl  w1  x2+j3+2   ;      device name
     am        (0)     ;    end
a0:  al  w0     0      ;    else device name:= 0;
     ds  w1  x3+2      ;
     rl  w2  x2+j7     ;
     jl. w3    (b4.)   ;    open(answer sem);
a1:  jl. w2     c2.    ; wait unmount:   sense;
     so  w0     1<1    ;    if local then
     jl.        a2.    ;    goto wait mount;
     jl. w3     c3.    ;    wait;
     jl.        a1.    ;    goto wait unmount;

a2:  jl. w2     c2.    ; wait mount:   sense;
     sz  w0     1<1    ;    if normal answer then
     jl.        a3.    ;    goto mounted;
     jl. w3     c3.    ;    wait;
     jl.        a2.    ;    goto wait mount;

a3:                    ; mounted:
     rl  w0  x3+d5     ;
     se  w0     1      ;    if code = label then
     jl.        c11.   ;    goto write label;
c12: rl. w2     b18.   ; read label:
     jl. w3    (b3.)   ;    lock(catalock sem);
     jl. w2     c18.   ;    insert pooltable page as page1;
     rl. w2    (b11.)  ;
     dl. w1     b16.   ;    page 3:= usercat buffer;
     ds  w1  x2+14     ;    page 4:= save buffer;
     rl. w2     b17.   ;
     jl. w3    (b3.)   ;    lock(usercat);

e.                     ;
\f


; kll 20.6.72          kit          term2   ...57...


b. a9  w.              ;

     rl. w1     b0.+8  ; input slice table:
     al  w2  x1        ;
     wa. w2     b25.   ;    first addr:= page 4;
     ds. w2     b26.+4 ;    last addr:= first + length of save buf;
     al  w2     0      ;    segment := 0;
     rs. w2     b26.+6 ; 
     al. w1     b26.   ;    ref message;
     rl. w2     b0.+2  ;    ref name;
     jl. w3    (b2.)   ;    send and wait fast(input);
     sz  w0    -1-1<1  ;    if hard error in status then
     jl.        c5.    ;    goto hard error on kit;

     rl  w1  x1+2      ;    w1:= bytes transferred;
     rl. w2     b0.+8  ;
     bz  w0  x2+j17    ;    w0:= last slice;
     sl  w0  x1-34     ;    if last slice + 34 > bytes transferred then
     jl.        c6.    ;    goto slice table too long;

     al  w0     30<6+17;    testout(chainhead);
     rl. w1     b0.+8  ;
     jl. w3    (b8.)   ;
     rl. w3     b0.+2  ;
     rl. w2     b0.+8  ;
     dl  w1  x2+j14+2  ;    move docname(chaintable)
     ds  w1  x3+2      ;    to page1;
     dl  w1  x2+j14+6  ;
     ds  w1  x3+6      ;
     rl  w1  x2+j16    ;    move slicelength;
     rs  w1  x3+d7     ;
     rl  w1  x2+j17    ;    segments:=
     al  w1  x1+1      ;    slices
     wm  w1  x3+d7     ;    *slicelength;
     rs  w1  x3+d8     ;
c. 2-e79

     bz  w1  x3+d2     ;
     rl. w3     b0.+8  ;
     jd         1<11+84;    create bs(device, chainhead);
jd-1
     sn  w0     3      ;    if name conflict then
     jl.        c20.   ;      goto illegal name;
z.
c. e79-3

     jl. w2     c23.   ;    set catbase, create peripheral process (docname);
     jd         1<11+8 ;    reserve process(docname);

     rl. w3     b0.+8  ;    w3:=chainhead;
     al  w0     1<3+3  ;    kind:=disc;
     hs  w0  x3+j10+1  ;    key:=3;
     jd         1<11+102;   prepare bs(chainhead);
jd-1
z.
     se  w0     0      ;    if result <> 0 then
     jl.        c10.   ;    goto kit cat name format;
     am        (66)    ;
     dl  w1    +74     ;    w0w1 := max interval;
     am.       (b0.+8) ;
     al  w2    +j12    ;
     jl. w3    (b22.)  ;    prepare access(aux catalog);
     jl.        c7.    ;+2  if not ok then goto kit cat base illegal
e.                     ;
\f


; jma 1978.10.22       kit          term2   ...57a...


; initialize pooltable:

b. a19  w.

     rl. w3     b0.+2  ;    w3:=absref pooltable page;
     al  w0     0      ;
     rs  w0  x3+d11    ;    segment:=
     rs  w0  x3+d12    ;    size of current pool:=
     rs  w0  x3+d14    ;    current project:=0;
     al  w2     d15    ;
     rs  w2  x3+d13    ;    current pool:=pooltable start;
     al  w2  x3+d15    ;    for all pools do
     am.       (b49.)  ;
     al  w0  x3        ;
     rs. w0     b51.   ;
     ld  w1    -100    ;    usercat ref:=
a0:  ds  w1  x2+8      ;    entries, slices:= 0,0;
     al  w2  x2+i19    ;
     sh. w2    (b51.)  ;
     jl.        a0.    ;
jd-1
     jl. w3     c21.   ;    read usercat(segment);
     al  w1     0      ;    find first project segment:
     rl. w2     b0.+6  ;    segment:=index:=0;
a1:  al  w2  x2+2      ; rep: index:=next index;
     al  w1  x1+1      ;    segment:=segment + 1;
     rl  w0  x2        ;    if indextable(index) < 0 then
     sh  w0    -1      ;    goto rep;
     jl.        a1.    ;
     al  w1  x1-1      ;    segment:=segment-1;
     rs  w1  x3+d11    ;
a2:  rl  w1  x3+d11    ; next segment:
     al  w1  x1+1      ;    segment:=segment+1;
     rs  w1  x3+d11    ;
     jl. w3     c21.   ;    read usercat(segment);
     am     (x3+d13)   ;    abs current pool:=rel current pool
     al  w1  x3        ;    + absref pooltable page;
     rl. w2     b0.+6  ;    record:=0;
\f


; jma 1978.10.22       kit          term2   ...57b...


; initialize pooltable (cont.)

a3:  rl  w0  x2+0      ; examine record:
                       ;    (w1=abs pool, w2=abs record, w3=abs pooltable page)
     sn  w0     0      ;    if record signals end of segment then
     jl.        a2.    ;      goto next segment;
     bz  w0     0      ;    if recordtype = project or user then
     sl  w0     4      ;    begin
     jl.        a5.
     rl  w0  x3+d12    ;    add length of current pool
     am        (0)     ;    (=i19 or 0)
     al  w1  x1        ;    to abs current pool
     wa  w0  x3+d13    ;    and to rel current pool;
     rs  w0  x3+d13    ;
jd-1
     sl. w0    (b49.)  ;    if current pool >= last pool then
     jl.        a9.    ;      goto terminate;
     bz  w0  x2+0      ;    if type=project then
     se  w0     0      ;    begin
     jl.        a4.    ;
     rl  w0  x2+2      ;      if project in record = 8388607 then
     sn. w0    (b48.)  ;        goto terminate;
     jl.        a9.    ;
     rs  w0  x1+0      ;      project in pool:=
     rs  w0  x3+d14    ;      current project:= project in record;
     al  w0     i19    ;      length of current pool:=
     rs  w0  x3+d12    ;      pool length;
     dl  w0  x2+6      ;      interval in pool:=interval in record;
     ds  w0  x1+4      ;      goto restore registers;
     jl.        a7.    ;    end else if type = user then
a4:  rl  w0  x3+d14    ;    begin
     rs  w0  x1+0      ;      project in pool:=current project;
     al  w0     0      ;      length of current pool:=0;
     rs  w0  x3+d12    ;      goto next record;
     jl.        a8.    ;    end
\f


; jma 1978.10.22       kit          term2   ...57c...


; initialize pooltable (cont.)

a5:  se  w0     6      ;    else if type = private kit then
     jl.        a6.    ;    begin      
     am.       (b0.+8) ;
     dl  w0    +j14+2  ;      if kitname in chaintable
     sn  w3 (x2+2)     ;         matches kitname in record then
     se  w0 (x2+4)     ;
     jl.        a7.    ;
     am.       (b0.+8) ;
     dl  w0    +j14+6  ;
     sn  w3 (x2+6)     ;
     se  w0 (x2+8)     ;
     jl.        a7.    ;
     am.       (b0.+2) ;
     rl  w0    +d11    ;      pool.usercatref:=
     ls  w0     12     ;      current usercat segment < 12
     al  w3  x2
     ws. w3     b0.+6  ;      + relative;
     hs  w3     1      ;
     rs  w0  x1+6      ;
     jl.        a7.    ;      goto restore registers;
a6:  se  w0     34     ;    end else if type = userpool, max interval then
     jl.        a8.    ;    begin
     al  w0     i19    ;      length of current pool:=
     rs  w0  x3+d12    ;      pool length;
     dl  w0  x2+4      ;      interval in pool:=
     ds  w0  x1+4      ;      interval in record;
                       ;    end else goto next record;
a7:  rl. w3     b0.+2  ; restore registers: w3:=pooltable page;
a8:  ba  w2  x2+1      ; next record:
     am.       (b0.+6) ;
     sh  w2    +510    ;    record:=record + length;
     jl.        a3.    ;    if record <512 then goto examine record
     jl.        a2.    ;      else goto next segment;
a9:  dl. w0     b47.+2 ; terminate: interval in last pool:=
     ds  w0  x1+4      ;    large interval;
     rs  w0  x1+0      ;    project in last pool:= 8388607;
jd-1
e.
\f


; kll 20.6.72          kit          term2   ...58...


b. a9  w.              ;

     rl. w3     b0.+2  ;    ref page 1;
     al  w0    -1      ;
     rs  w0  x3+d4     ;    segment:= -1;

a0:  rl. w3     b0.+2  ; next cat segment:
     rl  w1  x3+d4     ;
     al  w1  x1+1      ;    segment in message:= segment:=
     rs  w1  x3+d4     ;    segment + 1;
     rs. w1     b26.+6 ;
     rl. w3     b0.+8  ;    w3:= ref slice table;
     rl. w1     b0.+6  ;    w1:= ref cat buf;
     al  w2  x1+510    ;    first addr:= w1;
     ds. w2     b26.+4 ;    last addr:= w1+510;
     al  w2  x3+j12    ;    w2:= ref kit cat name;
     al. w1     b26.   ;    w1:= ref message;
     jl. w3    (b2.)   ;    send and wait fast(input format);

     rl  w1  x1+2      ;
     sz. w0    (b28.)  ;    if status = end medium then
     jl.        a3.    ;    goto end cat scan;
     sn  w1     512    ;    if bytes transferred <> 512 or
     sz. w0    (b29.)  ;    hard error then
     jl.        c8.    ;    goto hard error on kit cat;
     rl. w1     b0.+6  ;    w1:= entry:= ref cat buf;
     rl. w3     b0.+8  ;    w3:= ref slice table;
\f


; jma 1978.10.22       kit          term2   ...58a...


; insert entries and update pooltable

a1:  rl  w0  x1        ; test entry:   (w1=absref entry, w3=absref chaintable)
     sn  w0    -1      ;    if unused entry then
     jl.        a9.    ;    goto next entry;
c. 2-e79
     jd         1<11+86;    insert entry (entry, w3)
z.
c. e79-3
     jd         1<11+104;   insert entry (entry, w3)
z.
     se  w0     0      ;    if result <> ok
     sn  w0     3      ;    and result <> name conflict
     jl.        a4.    ;
     se  w0     5      ;    and result <> entry inconsistent then
     jl.        c9.    ;    goto kit cat syntax;

a4:  rl. w2     b0.+2  ; find closest pool:   (w1=absref entry)
     am     (x2+d13)   ;    absref last pool:= rel last pool
     al  w0  x2        ;    + absref pooltable page;
     rs. w0     b55.   ;    closest pool :=
     rs. w0     b51.   ;    last pool := absref last pool;
     al  w3  x2+d15-i19;    w3 := pool := absref pooltable base;
     al  w2  x1        ;    w2 := entry := absref entry;
     dl. w1     b47.+2 ;
     ds. w1     b53.+2 ;    closest yet := large interval;
\f


; jma 1978.10.22       kit          term2   ...58b...


; insert entries and update pooltable (cont.)

                       ; next pool:   (w2=absref entry, w3=absref pool)
a5:  al  w3  x3+i19    ;    pool:=pool + pool length;
     sl. w3    (b51.)  ;    if pool >= last pool then
     jl.        a7.    ;    goto closest found;
     dl  w1  x2+4      ;
     al  w1  x1-1      ;    w01:=entry interval - 1 upper;
     sl  w0 (x3+2)     ;
     sl  w1 (x3+4)     ;
     jl.        a5.    ;    if entry is in pool interval then
     dl  w1  x3+4      ;    begin
     sl. w0    (b53.)  ;
     sl. w1    (b53.+2);
     jl.        a5.    ;      if pool interval is in closest yet
     al  w1  x1+1      ;
     se. w0    (b53.)  ;
     jl.        a6.    ;
     sn. w1    (b53.+2);         but is not equal to it then
     jl.        a5.    ;      begin
a6:  ds. w1     b53.+2 ;        closest yet:=pool interval + 1 upper;
     rs. w3     b55.   ;        closest pool:=absref pool;
                       ;      end;
                       ;    end;
     jl.        a5.    ;    goto next pool;
\f


; jma 1978.10.22       kit          term2   ...58c...


; insert entries and update pooltable (cont.)

a7:  rl. w3     b56.   ; closest found:   (w2=absref entry)
     rl  w1  x2+14     ;    entries, slices:= 1,0;
     sh  w1     0      ;    if size > 0 then
     jl.        a8.    ;    begin
     al  w0     0      ;
     am.       (b0.+2) ;      slices:= segments
     wd  w1    +d7     ;      // slicelength;
     se  w0     0      ;
     al  w1  x1+1      ;      maybe round up;
     hs  w1     7      ;    end;
a8:  rl. w1     b55.   ;
jd-1
     wa  w3  x1+8      ;
     rs  w3  x1+8      ;    add entries, slices in pool;
     rl. w3     b0.+8  ;    w3:= absref chaintable;
     al  w1  x2        ;    w1:= absref entry;

a9:  al  w1  x1+34     ; next entry:
     am.       (b0.+6) ;    entry:= entry + length;
     sh  w1     476    ;    if entry <= last on segment then
     jl.        a1.    ;    goto test entry else
     jl.        a0.    ;    goto next cat segment;
\f


; jma 1978.10.22       kit          term2   ...58d...


; terminate cat scan:

c. 2-e79
a3:  rl. w2     b0.+8  ; end cat scan:
     al  w2  x2+j12    ;
z.
c. e79-3
a3:  rl. w3     b0.+8  ; end cat scan:
     al  w2  x3+j14    ;    w2:=docname.chainhead;
     jd         1<11+106;   insert bs(docname);
jd-1
     al  w2  x3+j12    ;
z.
     jl. w3    (b23.)  ;    terminate access(aux catalog);
e.                     ;
\f


; jma 1978.10.22       kit          term2   ...58e...


; update usercat:
b. a9 w.
     rl. w3     b0.+2  ;    w3:= absref pooltable page;
     al  w0     0      ;    segment:=0;
     rs  w0  x3+d11    ;
     jl. w3     c21.   ;    read(usercat,segment);
     al  w1     d15-i19;    pool:=pooltable base;
     rs  w1  x3+d13    ;
a0:  rl  w2  x3+d11    ; next pool:   (w3=absref pooltable page)
     am     (x3+d13)   ;    w2:=current segment;
     al  w1    +i19    ;    pool:=pool + pool length;
     rs  w1  x3+d13    ;
     am      x3        ;
     al  w1  x1        ;    w1:=absref pool;
     rl  w0  x1+0      ;
     sn. w0    (b48.)  ;    if project=8388607 then
     jl.        a2.    ;    goto terminate;
     rl  w0  x1+6      ;    
     sn  w0     0      ;    if usercatref = 0,0 then
     jl.        a0.    ;    goto next pool;
     bz  w0     0      ;
     sn  w0  x2        ;    if segment <> current segment then
     jl.        a1.    ;    begin
     jl. w3     c22.   ;      write(usercat,current segment);
     am     (x3+d13)   ;
     bz  w0  x3+6      ;
     rs  w0  x3+d11    ;      current segment:=segment;
     jl. w3     c21.   ;      read(usercat,current segment;
a1:  am     (x3+d13)   ;    end;
     al  w1  x3        ;    w1:= absref pool;
     rl. w2     b0.+6  ;
     ba  w2  x1+7      ;    w2:= absref usercat record;
a3:  bz  w0  x2+12     ; rep: rest entries:= usercat total claim
     bs  w0  x1+8      ;    - used;
     sh  w0    -1      ;    if rest entries < 0 then
     al  w0     0      ;    rest entries:= 0;
     hs  w0  x2+10     ;    store rest entries in usercat;
     sz  w1     1      ;    repeat for slices;
     jl.        a0.    ;    goto next pool;
     al  w1  x1+1      ;
     al  w2  x2+1      ;
     jl.        a3.    ;
a2:  jl. w3     c22.   ; terminate:
e.                     ;    write(usercat,current segment);
\f


; kll 20.6.72          kit          term2   ...59...


b. a9  w.              ;
  
     rl. w3     b0.+2  ;
     bz  w3  x3+d3     ;    to addr:= boss kit table + rel entry;
     wa. w3     b31.   ;
     rl. w2     b0.+8  ;    w2:= slice table;
     jl. w1     c1.    ;    move kit entry;
     rl. w3     b0.+2  ;
     jl. w2     c19.   ;    reinsert varpage as page1;

     rl. w3    (b11.)  ;
     al  w2     0      ;    page 4:= 0;
     rl. w1     b19.   ;    page 3:= psjob operations;
     ds  w2  x3+14     ;
     rl. w2     b17.   ;
     jl. w3    (b4.)   ;    open(usercat);
     rl. w2     b18.   ;
     jl. w3    (b4.)   ;    open(catalock);
     jl. w3    (b7.)   ;    get pages;

     al  w2     0      ;    sender:= op:= 0;

a0:  rs  w2  x3+d4     ; scan psjob:
     bz  w2  x3+d4+1   ;
     wa. w2     b37.   ;    ps:= sender + first psjob sender table;
     sl. w2    (b38.)  ;    if ps >= top ps then
     jl.        c15.   ;    goto kit mounted;
     rs. w2     b36.   ;

     bz  w1  x3+d4     ;
     wa. w1     b0.+6  ;    w1:= abs op:= op + page 3;
     rl  w0  x1+2      ;    if abs op + 2 <> 0 then
     se  w0     11     ;    comment operation used;
     jl.        a1.    ;    goto next;
     hs  w0  x1+2      ;    abs op + 2:= <> 0;
 
     rl. w2     b36.   ;
     rl  w2  x2+2      ;    w2:= semafore(ps);
     jl. w3    (b6.)   ;    open chained(w1, w2);

a1:  rl  w2  x3+d4     ; next:   op:= op + 4;
     wa. w2     b39.   ;    sender:= sender + 10;
     jl.        a0.    ;    goto scan psjob;
e.                     ;
\f


; sl 30.6.72          kit          term2   ...60...

b. a9  w.              ;

c11: rl. w2    (b11.)  ; write label:
     rl. w0     b41.   ;  
     rs  w0  x2+12     ;    page 3:= slice table buffer;
     rl. w2     b42.   ;
     jl. w3    (b3.)   ;    lock(label write);

     rl. w2     b0.+6  ;    w2:= slice table buffer;
     rl. w0     b43.   ;    name of catalog:=
     rl  w1  x3+0      ;
     ds  w1  x2+j12+2  ;    <:cat:> <device name>;
     dl  w1  x3+4      ;
     ds  w1  x2+j12+6  ;

     dl  w1  x3+2      ;
     ds  w1  x2+j14+2  ;    device name;
     dl  w1  x3+6      ;
     ds  w1  x2+j14+6  ;

     dl. w1     b44.+2 ;
     ds  w1  x2+j11+2  ;    base

     rl  w0  x3+d6     ;
     rs  w0  x2+j13    ;    size of catalog;
  
     rl  w0  x3+d7     ;
     rs  w0  x2+j16    ;    slice length;

     ld  w1    -100    ;
     ds  w1  x2+j18+2  ;    +24:= +32:= 0;
     rs  w0  x2+j15    ;
     rs  w0  x3+d4     ;    segment:= 0;
c. 2-e79
     al  w1    -1      ;
     hs  w1  x2+j18    ;    +30:= -1<12+0;
z.
     rl  w1  x3+d8     ;
     wd  w1  x3+d7     ;
     al  w0  x1-1      ;    last slice:= no of slices - 1;
     ls  w0     12     ;
     rs  w0  x2+j17    ;    first slice:= 0;

     al  w1  x1+34+511 ;    first slice of catalog:=
     ls  w1    -9      ;
     al  w0     0      ;
     wd  w1  x3+d7     ;    round up(
     se  w0     0      ;
     al  w1  x1+1      ;
     hs  w1  x2+j10    ;    (slice table + catalog entry) // slice length);
c. 2-e79
 
     al  w0     3      ;
     hs  w0  x2+j10+1   ;    keys:= 3;
z.
c. e79-3
     al  w0     1<3+3  ;    kind:=disc;
     hs  w0  x2+j10+1  ;    key:=3;
z.

     wm  w1  x3+d7     ;
     rs  w1  x3+d5     ;    d5:= first segment of catalog;

     al  w0     30<6+17;    testout(chainhead);
     al  w1  x2        ;
     jl. w3    (b8.)   ;

e.                     ;

\f


; sl 30.6.72          kit          term2   ...61...

b. a9  w.              ;

     rl  w1  x3+d6     ;    occupied segments:=
     al  w0     0      ;
     wd  w1  x3+d7     ;    (slices in catalog +
     se  w0     0      ;
     al  w1  x1+1      ;    first slice of catalog) * slicelength;
     ba  w1  x2+j10    ;
     wm  w1  x3+d7     ;
     rs  w1  x3+d6     ;

     al  w2  x2+34     ;    w2:= slice table index:= slice buf + entry;

a1:  sh  w1 (x3+d7)    ; rep1:
     am         -1     ;    slice byte(index):= if occupied > 1 then
     al  w0     1      ;    1 else 0;
jd-1
     hs  w0  x2        ;
     ws  w1  x3+d7     ;    occupied:= occupied - slicelength;
     al  w2  x2+1      ;    index:= index + 1;
     se  w1     0      ;    if occupied > 0 then
     jl.        a1.    ;    goto rep1;

     rl. w2     b42.   ;    open(label write);
     jl. w3    (b4.)   ;
     jl. w2     c13.   ;    output page 3;

     rl. w2    (b11.)  ;
     rl. w0     b40.   ;    page 3 := empty catalog buffer;
     rs  w0  x2+12     ;
     jl. w3    (b7.)   ;    get pages;

; initialize empty catalog and rest of disc
a2:  jl. w2     c13.   ; rep2:   output page 3;
     so. w0    (b28.)  ;    if end medium
     sl  w2 (x3+d8)    ;    or segment >= no of segments on device then
     jl.        c12.   ;    goto read label;
     jl.        a2.    ;    goto rep2;

e.                     ;
\f


; kll 20.6.72          kit          term2   ...62...


b. a9, g9  w.          ;

; define end-actions:
g0 = 2.100             ; terminate access(aux catalog))
g1 = 2.010             ; release process(devicename)
g2 = 2.001             ; open(usercat and catalock)
g3 = g1 + g2           ;
g4 = g0 + g2           ;
     <:illegal name      :>
     <:reserver trouble  :>
     <:kit mounted and ok:>
     <:write error on kit:>
     <:hard error on kit :>
     <:slice table length:>
     <:kit cat base illeg:>
     <:hard error kit cat:>
     <:kit cat syntax err:>
a1:  <:kit cat name form :>
c20: am             +g2-0 ; illegal name:
c17: am        -12<3+0 -g2; illegal name:
c24: am             +g2-0 ; reserver trouble:
c16: am        -12<3+0 -0 ; reserver trouble:
c15: am        -12<3+0 -g1; kit mounted and ok:
c14: am        -12<3+g1-g3; write error on kit:
c5:  am        -12<3+g3-g3; hard error on kit:
c6:  am        -12<3+g3-g2; slice table length:
c7:  am        -12<3+g2-g4; kit cat base illegal:
c8:  am        -12<3+g4-g4; hard error kit cat:
c9:  am        -12<3+g4-g3; kit cat syntax error:
c10: al  w1      0<3+g3-0 ; kit cat name format:
jd-1
     rl. w3     b0.+2  ;
     rs  w1  x3+d4     ;    save rel text addr;
     sz  w1     g1     ;    if release proces then
     jd         1<11+10;      release proces(devicename);
     am.       (b0.+8) ;
     al  w2    +j12    ;
     sz  w1     g0     ;    if terminate access then
     jl. w3    (b23.)  ;      terminate access(aux catalog);
     rl  w1  x3+d4     ;    if not open semafors then
     so  w1     g2     ;
     jl.        a2.    ;      goto request alarm;
     rl. w2     b17.   ;
     jl. w3    (b4.)   ;    open(usercat sem);
     rl. w2     b18.   ;
     jl. w3    (b4.)   ;    open(catalog sem);
     jl. w2     c19.   ;    reinsert varpage as page1;
a2:  rl. w2     b21.   ; request alarm(text):
     jl. w3    (b5.)   ;    lock chained(request free);
\f


; re 6.2.75                kit        term2          ...62a...


     rl  w2  x3+d4     ;    w2:= rel text;
     as  w2    -3      ;
     dl. w0  x2+a1.+2  ;
     ds  w0  x1+8      ;    move text(rel text);
     dl. w0  x2+a1.+6  ;
     ds  w0  x1+12     ;
     dl. w0  x2+a1.+10 ;
     ds  w0  x1+16     ;

     rl. w3     b0.+2  ;
     bz  w3  x3+d2     ;    w3:= device nr;
     al  w2     0      ;
     wd. w3     b32.   ;    w3:= convert to text(w3);
     ls  w3     8      ;
     lo  w3     4      ;
     lo. w3     b33.   ;
     rl. w2     b34.   ;    <: on:>;
     ds  w3  x1+20     ;

     al  w2     3      ;    print line;
     al  w3     16     ;    length;
     ds  w3  x1+4      ;

     rl. w2     b20.   ;
     jl. w3    (b6.)   ;    open chained(request que);
     jl.        c0.    ;    goto wait kit change que;
e.                     ;
\f


; kll 20.6.72          kit          term2   ...63...


b. a9  w.              ;

; call: w1 = return, w2 = slice table, w3 = to addr.
c1:  rs. w1     b36.   ; move kit entry:
     dl  w1  x2+j14+2  ;
     ds  w1  x3+2      ;    move kit name from
     dl  w1  x2+j14+6  ;    document name in
     ds  w1  x3+6      ;    kit cat tail;
     rl  w0  x2+j16    ;
     rs  w0  x3+8      ;    move slice length;
     jl.       (b36.)  ;    goto saved return;

; call: w2 = return.

a3:             0      ;    caller

c23: am         1      ;
c2:  al  w0     0      ;
     rs. w0     a3.    ;    save caller;
     am        (66)    ;    set catbase(boss maxbase);
     dl  w1    +74     ;
     al. w3     b27.   ;
     jd         1<11+72;

; search boss kit table to see if the kit name already exists
     rl. w3     b31.   ;    w3:=base kittable;
a0:  al  w3  x3+10     ;rep: w3:=next entry;
     sl. w3    (b31.+2);    if entry >= top entry then goto sense;
     jl.        a2.    ;
     am.       (b0.+2) ;
     dl  w1    +2      ;    if name.entry <> devicename then
     sn  w0 (x3+0)     ;
     se  w1 (x3+2)     ;      goto rep;
     jl.        a0.    ;
     am.       (b0.+2) ;
     dl  w1    +6      ;
     sn  w0 (x3+4)     ;
     se  w1 (x3+6)     ;
     jl.        a0.    ;
     jl.        a5.    ;    if name.entry = devicename then
a2:  rl. w3     b0.+2  ;      goto illegal name;

     bz  w1  x3+d2     ; sense:    w1 := device;
     jd         1<11+54;    create peripheral process;
jd-1
     se  w0     0      ;    if result <> ok then
     sn  w0     3      ;
     jl.        4      ;
     jl.        a4.    ;      goto reserver trouble;
     jd         1<11+4 ;    w0:=process descr addr;
     bz  w1  x3+d2     ;    w1:=name table addr (device no);
     ls  w1     1      ;
     wa  w1     74     ;
     se  w0 (x1)       ;    if inconsistence then
     jl.        a5.    ;      illegal name;
     jd         1<11+6 ;    initialize process;
jd-1
     se  w0     0      ;    if result <> ok then
     jl.        a4.    ;       goto reserver trouble;
     al  w3  x2        ;
     al. w1     b27.   ; 
     rl. w2     b0.+2  ;    return to w3;
     jl.       (b1.)   ;    send and wait(disc, sense);

a4:  rl. w1     a3.    ;    reserver trouble(caller);
     se  w1     1      ;
     jl.        c16.   ;
     jl.        c24.   ;

a5:  rl. w1     a3.    ;    illegal name(caller);
     se  w1     1      ;
     jl.        c17.   ;
     jl.        c20.   ;

; call: w3 = return.
c3:  al. w1     b27.   ; wait:
     al. w2     b35.   ;
     jl.       (b1.)   ;    send and wait(clock, 20 sec);
\f


; re  31.7.74              kit              term2      ...63a...


; call:   w2 = return, w3 = page 1.
; if segment > occupied then output all boss else output only page3
; at return:  w2 = segment
c13: ws. w2     b0.    ; output page 3:
     rs  w2  x3+d10    ;    save return;
     rl. w1     b0.+6  ;
     al  w2  x1+510    ;    first, last in message:=
     ds. w2     b24.+4 ;    first, last of page 3;
     rl  w0  x3+d4     ;
     rs. w0     b24.+6 ;    segment in message:= segment;
     sh  w0 (x3+d6)    ;    if segment in message > occupied then
     jl.        a1.    ;
     am        (66)    ;
     dl  w2    +24     ;      first,last in message :=
     al  w2  x2-2      ;        first,last of boss process;
     ds. w2     b24.+4 ;
     ws  w2     2      ;    topsegm := segments to transfer
     al  w2  x2+2      ;      + segment;
     ls  w2    -9      ;
     wa  w2  x3+d4     ;
     sh  w2 (x3+d8)    ;    if topsegm > no of segments on device then
     jl.        a1.    ;
     ws  w2  x3+d8     ;      last addr := last addr
     ls  w2     9      ;        +(topsegm - no of segments on device) * 512;
     ac  w2  x2        ;
     wa. w2     b24.+4 ;
     rs. w2     b24.+4 ;
a1:  al. w1     b24.   ;
     al  w2  x3        ;
     sh  w0 (x3+d6)    ;    if segment in message <= occupied then
     am         b2-b1  ;      send and wait fast(kit, output, page3) else
     jl. w3    (b1.)   ;      send and wait (kit, output, boss process);
     rl  w2  x1+2      ;
     ls  w2    -9      ;    segment :=
     wa  w2  x3+d4     ;      bytes transferred // 512
     rs  w2  x3+d4     ;      + segment;
     sz. w0    (b29.)  ;    if hard error then
     jl.        c14.   ;    write error;
     am     (x3+d10)   ;
     jl.       +b0.    ;    goto saved return;
e.                     ;
\f


; jma 1978.10.22       kit          term2   ...63b...


; c18: insert pooltable page as page1
; c19: reinsert varpage as page1

;   call: w2=absref return, w3=absref current page1
; return: w3=absref new page1, all other registers destroyed
;         page1=new page1, page3=0

b. a9 w.
c18: ws. w2     b0.    ; insert pooltable page as page1:
     rs  w2  x3+d10    ;    save rel return on current page1;
     rl  w2  x3+d9     ;    page3:=varpage;
     rl. w3     b10.   ;    page1:=pooltable page;
     jl.        a0.    ;    goto move;
c19: ws. w2     b0.    ; reinsert varpage as page1:
     rs  w2  x3+d10    ;    save rel return on current page1;
     rl. w2     b10.   ;    page3:=pooltable page;
     rl  w3  x3+d9     ;    page1:=varpage;
a0:  rl. w1    (b11.)  ; move:
     rs  w3  x1+8      ;
     rs  w2  x1+12     ;
     jl. w3    (b7.)   ;    get pages;
     rl. w2     b0.+6  ;
     dl  w1  x2+2      ;    move 7 doublewords from old page1
     ds  w1  x3+2      ;    to new page1;
     dl  w1  x2+6      ;
     ds  w1  x3+6      ;
     dl  w1  x2+10     ;
     ds  w1  x3+10     ;
     dl  w1  x2+14     ;
     ds  w1  x3+14     ;
     dl  w1  x2+18     ;
     ds  w1  x3+18     ;
     dl  w1  x2+22     ;
     ds  w1  x3+22     ;
     dl  w1  x2+26     ;
     ds  w1  x3+26     ;
     rl. w3    (b11.)  ;
     al  w0     0      ;
     rs  w0  x3+12     ;    page3:= 0;
     jl. w3    (b7.)   ;    get pages;
     am     (x3+d10)   ;
     jl.       +b0.    ;    goto saved return;
e.
\f


; jma 1978.10.22       kit          term2   ...63c...


; c21: read(usercat,segment)
; c22: write(usercat,segment)

;   call: w3=absref return, segment is in page1 +d11
; return: w3=absref page1, all other registers destroyed

c21: am         b26-b24; usercat input:
c22: al. w2     b24.   ; usercat output:
     ws. w3     b0.    ;
     am.       (b0.+2) ;
     rs  w3    +d10    ;    save rel return;
     rl. w1     b44.   ;    base:=left interval;
     al  w0  x1        ;
     al. w3     b27.   ;    w3:=absref 0;
     jd         1<11+72;    set catbase(own process);
     am.       (b0.+2) ;
     rl  w0    +d11    ;
     rs  w0  x2+6      ;    segment
     rl. w3     b0.+6  ;    first addr:= usercat buffer;
     al  w0  x3+510    ;    last addr:= first addr + 510;
     ds  w0  x2+4      ;
     al  w1  x2        ;    w1:= message addr;
     al. w2     b45.   ;    w2:= usercat name addr;
     jl. w3    (b2.)   ;    send and wait fast;
     rl  w1  x1+2      ;
     sn  w0     1<1    ;    if statuserror
     se  w1     512    ;       or bytes <> 512 then
     jd        -106    ;    *** bossfault 106;
     c.-1,     o106,z. ;    (bossfault xref)
     am     (x3+d10)   ;
     jl.       +b0.    ;    goto saved return;

g19=k-g20              ;    length of kit

e.                     ; end b60, d20, c30, j9

i.e.                 ;    end b,d,g-names
\f



; kll 26.11.71          terminal output          term2   ...64...

; Terminal output takes textwords from a superbuffer and outputs them
; on a terminal. The words are generated by the corresponding psjob and
; synchronisation is done by the simple semaphor: terminal full with the
; value of the number of unprinted words in the superbuffer.
; When a new job is started, an operation is sent to the chained sema-
; phor: terminal que.
; The physical terminal is reserved with the binary semaphor: terminal.
; If the job is faster than the terminal, the textwords are taken seg-
; mentwise from the superbuffer area. Otherwise the textwords are taken
; directly from the virtual buffer in which they are collected by the
; psjob.
; The algorithm may be in the following states:
;   0    normal output i.e. after operation to terminal que
;   1    killed by user
;   2    writing system information
;   3    waiting for a new job
; Transition from 0 or 1 to 2 and later from 2 to 3 is made when an indi-
; cation in the textwords is met. Transition from 0 to 1 is made by the
; psjob.
; Terminal output is reentrant with one incarnation per terminal.
; The page descriptions are used for:
;   page 1    job file descr
;   page 3    virt buf
;   page 4    terminal core buf


s. c9, g1  b. b25, f70  w.
h8=h7-k  ; continue external list

     f0.,  f1.,  f2.,  f3.,  f4.,  f5.,  f9.,  b1.,  b2.,  b3.
     b4.,  b5., b6.,  b7.,  b9.,  b10., b11., f6.
     f14., f15., f16., f17., f18., f19., f20., f21., f22., f23.
     f24., f25., f26., f27., f28., f29., f30., f31., f32., f33.
     f34., f35., f36., f37., f38., f39., f40., f41., f42., f43.
     f44., f45., f47., f48., f49., f50., f51., f52., f53.
     f54., f55., f56., f57., f58., f59., f60., f61.
h9:  h10


     al  w0     i23    ;    termout on disc
     al  w1     g1     ;    length
     jl. w3    (f1.)   ;    reserve virt
     al. w0     b0.    ;    start
     jl. w3    (f2.)   ;    move to virt
     rs. w2     f8.    ;    save virt addr;
     rl. w0     f5.    ;
     rs. w0     f62.   ;    ext(22);
     rl. w0     f6.    ;
     rs. w0     f63.   ;    ext(53);
     rl. w0     b10.   ;
     rs. w0     f64.   ;    ext(54);
     rl. w1     b11.   ;  
     rs. w1     f65.   ;    ext(81);

     jl. w3    (2)     ;    set externals;
f61:            40     ;   

f62:     0  ,    22    ;    first terminal output;
f63:     0  ,    53    ;    terminal reserve;
f64:     0  ,    54    ;    terminal full;
f65:     0  ,    81    ;    terminal input sem;
         0  ,  -1000   ;    end of externals;

\f


; kll 26.11.71          terminal output          term2   ...65...

b. a2  w.              ;
a1:  al  w0     1      ; next incarnation:
     rl. w1     f6.    ;    console(rel sem):= free;
     wa. w1     f10.   ;
     rs  w0  x1        ;
     rl. w1     f10.   ;
     wa. w1     b11.   ;
     rs  w0  x1        ;    input sem:= 1;

     al  w0     i25    ;    virt buf on disc;
     al  w1     512    ;    length;
     jl. w3    (f1.)   ;    reserve virt buf;
     al  w2  x2+1      ;    writing;
     rl. w3     f9.    ;    page 4:= terminal core buffer;
     rl. w1     f5.    ;    w1:= descr;
     ds  w3  x1+14     ;    page 3:= virt buf;
     al  w3  x3+i3     ;    terminal core buffer :=
     rs. w3     f9.    ;      terminal core buf + length;
     dl. w3     f8.    ;    rel return in descr;
     ds  w3  x1+6      ;    page 0:= virt page 0;
     bz. w3     f7.    ;
     al  w3  x3+1<3    ;    next corutine;
     hs. w3     f7.    ;
     rl. w2     b10.   ;   
     wa. w2     f10.   ;    sem:= terminal full + rel sem;
     jl. w3    (f3.)   ;    simulate lock(sem, descr);
     al  w1  x1+e12    ; 
     rs. w1     f5.    ;    descr:= descr + length;
     rl. w1     f10.   ;    rel sem := rel sem + length;
     al  w1  x1+e13    ;
     rs. w1     f10.   ;
     sh  w1     i4*e13 ;    if rel sem < (terminals + mainconsole)*length then
     jl.        a1.    ;    goto next incarnation;
a2:  am.       (4)     ; end init:
     jl.       +4      ;    next init
     h7.               ;

f0:       0            ;    external table
f1:       12           ;    reserve virt
f2:       13           ;    move to virt
f3:       14           ;    simulate lock
f4:       15           ;    end init
f5: h. i4*e12+e12,18   ;    descr address
f6:    i4*e13+e13,19   ;    terminal reserve semaphore: terminals + console
f7: 300<3+e97, g0      ;    test mode, rel entry
f8: w.    0            ;    virt page 0
f9:       150          ;    terminal core buf
f10:      0            ;    relative semaphor
b10:h. i4*e13+e13,19   ;    terminal full semaphore: terminals + console
b11:   i4*e13+e13,19   ;    terminal input semaphore: terminals + console

e.                     ;
\f


; kll 26.11.71          terminal output          term2   ...66...

b. a5, j11  w.         ;
b0:       0, r.5       ;    page 0:   page addresses
    107<12 + 0         ;    page ident:  termout
b1:       1            ;    send and wait
b2:       2            ;    send and wait fast
b3:       3            ;    lock
b4:       4            ;    open
b5:       5            ;    lock chained
b6:       6            ;    open chained
b7:       7            ;    get pages
b9:       26           ;    current descr
b13:      1<15         ;    end file
b14:      1<16         ;    attention
b15:   127<16+127<8+127;    remove signal bit
b16:      3<12, 0      ;    input:   first
b17:      0            ;             last, saved return from c7
b18:      0            ;             segment
b19:      5<12, 0      ;    output:  first
b20:      0, 0         ;             last, segment
b21:      4<12         ;    free console state or byte constant 4
b22:      0            ;    used by set base
b23:      0            ;    empty block
\f


; kll 26.11.71          terminal output          term2   ...67...

g0=k-b0                ; first start:
     rl. w2    (b9.)   ;    w2:= current descr;
     rl  w0  x2+12     ;    move virt t.o. buffer
j5:  rs  w0  x3+303    ;    to job file page;
     jl.        a1.    ;    goto output;

c0:                     ; next job:
j6:  rl  w0  x3+302    ;
     ls  w0    -9      ;    segment:= buf byte // 512;
     rs. w0     b20.+2 ;
     rl. w1     b0.+6  ;    first:= page 3;
     al  w2  x1+510    ;    last:= first + 510;
     ds. w2     b20.   ;
     al. w1     b19.   ;    w1:= output message;
j7:  al  w2  x3+195    ;    w2:= superbuffer name;
     jl. w3    (b2.)   ;    send and wait fast;
     sz  w0 -1-1<5-1<1 ;    if not normal answer or not exist then
c. -1, o23, z.         ;    (bossfault xref)
     jd        -23     ;    alarm;
j0:  dl  w1  x3+227    ;
     al. w3     b22.   ;
     jd         1<11+72;    set bs base(job standard);
     rl. w3     b0.+2  ;
     ba. w3     j7.+1  ;
     jd         1<11+64;    remove area process;
     rs  w0  x3+8      ;    destroy name table address;
     rl. w1     b0.+6  ;    operation on page 3;
     rl. w3     b0.+2  ;
     al  w0     3      ;    operation:= finis;
     rs  w0  x1+2      ;
j2:  rl  w2  x3+223    ;
     jl. w3    (b6.)   ;    open chained(attention);

c1:                    ; wait output:
j8:  rl  w0 (x3+197)   ;    comment set input allowed;
j9:  rl  w2  x3+306    ;    if terminal full = 0 then
     sn  w0     0      ;
     jl. w3    (b4.)   ;    open(input);
j3:  rl  w2  x3+197    ;
     jl. w3    (b3.)   ;    lock(terminal full);

a1:                    ; output:
     al  w0     0      ;    comment remove input allowed;
j10: rl  w1 (x3+306)   ;    if input sem > 0 then
     sl  w1     0      ;
j11: rs  w0 (x3+306)   ;    input sem:= 0;
j4:  rl  w2  x3+221    ;
     jl. w3    (b3.)   ;    lock(terminal);


f58=j0+1, f14=j2+1, f15=j3+1, f32=j4+1, f51=j5+1
f52=j6+1, f53=j7+1, f54=j8+1, f55=j9+1, f56=j10+1, f57=j11+1,

e.                     ;
\f


; kll 26.11.71          terminal output          term2   ...68...

b. a5, j15  w.         ;
c2:  rl. w2    (b9.)   ; block size:   w2:=current corutine;
     rl  w0  x2+12     ;    max:= 512;
j1:  se  w0 (x3+193)   ;    if page 3 = buf ps then
     jl.        a1.    ;    begin
j2:  rl  w1  x3+194    ;      buf byte:= buf byte ps;
j3:  rs  w1  x3+302    ;      max:= 0;
     am        -512    ;    end;
a1:  al  w1     512    ;    comment displacement constant;
j4:  rl  w0  x3+302    ;
j5:  ws  w0  x3+301    ;    w0:= buf byte + 512 - next byte;
     ba. w0     a1.+1  ;  
     sl  w0     513    ;    if w0 > 512 then
     al  w0  x1        ;    w0:= max;
j6:  sl  w0 (x3+304)   ;
j7:  rl  w0  x3+304    ;    out bytes:= min(w0, appetite,
j8:  rl  w1 (x3+197)   ;    (terminal full + 1) *2);
     ls  w1     1      ;
     sl  w0  x1+2      ;
     al  w0  x1+2      ;
j9:  rs  w0  x3+305    ;    save out bytes;
     sl  w0     1      ;    if outbytes <= 0 then
     jl.        a5.    ;    begin
j10: rl  w0  x3+193    ;      if page 3 = buf ps then
     se  w0 (x2+12)    ;      begin
     jl.        a2.    ;        page 3:= buf termout;
j11: rl  w0  x3+303    ;        buf byte:= undef;
                       ;        get pages;
     al  w1    -512    ;        goto block size;
j12: rs  w1  x3+302    ;      end else
     jl.        a3.    ;      if next byte = buf byte ps then
a2:  rl  w1  x3+301    ;      begin
j13: se  w1 (x3+194)   ;        page 3:= buf ps;
     jl.        a4.    ;        get pages;
a3:  rs  w0  x2+12     ;        goto block size;
     jl. w3    (b7.)   ;      end else
     jl.        c2.    ;      begin
a4:  ls  w1    -9      ;
     rs. w1     b18.   ;        segment:= next byte // 512;
     ls  w1     9      ;
j14: rs  w1  x3+302    ;        buf byte:= segment * 512;
     rl. w1     b0.+6  ;        first addr:= abs page 3;
     al  w2  x1+510    ;        last addr:= first + 510;
     ds. w2     b17.   ;
     al. w1     b16.   ;        w1:= input message;
j15: al  w2  x3+195    ;        w2:= name of superbuffer;
     jl. w3    (b2.)   ;        send and wait fast;
     sz  w0 -1-1<5-1<1 ;        if not normal answer or not exist then
c.-1, o24, z.          ;    (bossfault xref)
     jd        -24     ;        goto alarm;
     so  w0     1<5    ;        if status<>not exist then
     jl.        c2.    ;        goto block size;
                       ;      end;
     al  w2     511    ;
j0:  la  w2  x3+301    ;
     ac  w2  x2-512    ;        adjust(512-next byte mod 512);
     jl. w1     c5.    ;
     jl.        c1.    ;        goto wait output;
a5:                    ;    end;

f16=j1+1, f17=j2+1, f18=j3+1, f19=j4+1, f20=j5+1, f21=j6+1
f22=j7+1, f23=j8+1, f24=j9+1, f25=j10+1,f26=j11+1,f27=a2+1
f28=j12+1,f29=j13+1,f49=j14+1,f50=j15+1,f60=j0+1

e.                     ;
\f


; kll 26.11.71          terminal output          term2   ...69...

b. a2, j15  w.         ;
     al  w0     i3     ;
j1:  rs  w0  x3+304    ;    appetite:= terminal buffer length;
j2:  rl  w0  x3+299    ;
     sn  w0     1      ;    if state = killed then
     jl.        c4.    ;    goto skip;

     dl. w2     b0.+8  ;    w2:= to addr:= page 4;
j4:  wa  w1  x3+301    ;    w1:= from addr:=
j5:  ws  w1  x3+302    ;    page 3 + next byte - buf byte;
j6:  rl  w3  x3+305    ;
     am      x2        ;    w3:= limit:= to addr + out bytes - 2;
     al  w3  x3-2      ;    first addr mess:= to addr;
     ds. w3     b20.   ;    last addr mess:= limit;
     al  w0     0      ;
     rs. w0     b23.   ;    empty block := true;

a1:  rl  w0  x1        ; rep:
     sh  w0    -1      ;    if word(from addr) < 0 then
     jl. w3     c6.    ;    get state;
     rs  w0  x2        ;    word(to addr):= word(from addr);
     se  w0     0      ;    if word <> 0 then
     rs. w0     b23.   ;      empty block := false;
     al  w1  x1+2      ;    from addr:= from addr + 2;
     al  w2  x2+2      ;    to addr:= to addr + 2;
     sh. w2    (b20.)  ;    if to addr <= limit then
     jl.        a1.    ;    goto rep;

     rl. w3     b0.+2  ;
     rl. w0     b23.   ;
     sn  w0     0      ;    if empty block then
     jl.        a2.    ;      goto skip block;
     al. w1     b19.   ;    w1:= message;
j7:  al  w2  x3+300    ;    w2:= terminal name;
     jl. w3    (b1.)   ;    send and wait;
     so. w0    (b14.)  ;
     am         i3-2   ;    appetite:= if attention then 2
     al  w2     2      ;    else terminal buffer length;
j8:  rs  w2  x3+304    ;
     rl  w2  x1+2      ;    
     so  w0     2      ;    if not normal answer then
a2:                    ; skip block:
j9:  rl  w2  x3+305    ;    bytes transferred:= outbytes;
     jl. w1     c5.    ;    adjust(bytes transferred);

c7:                    ; next action:
j10: rl  w1 (x3+197)   ;
j11: rl  w0  x3+299    ;    return to
     sn  w1     0      ;    if terminal full = 0 and
     se  w0     3      ;       state = 3 then
     am         c1-c0  ;    new job else
     jl.        c0.    ;    wait output;

f30=j1+1, f31=j2+1, f33=j4+1, f34=j5+1
f35=j6+1, f36=j7+1, f37=j8+1, f39=j10+1,f48=j11+1
f59=j9+1
e.                     ;
\f


; kll 26.11.71          terminal output          term2   ...70...

b. a5, j9  w.          ;
c4:  rl  w2  x3+301    ; skip:
j1:  ws  w2  x3+302    ;  
     wa. w2     b0.+6  ;    w1:= from addr:=
     rs. w2     b20.   ;    next byte - buf byte + page 3;
     al  w1  x2        ;    w2:= limit:= from addr + out bytes;
j2:  wa  w2  x3+305    ;
     al. w3     a2.    ;    return from get state:= end skip;

a1:  rl  w0  x1        ; rep:
     sh  w0    -1      ;    if word(from addr) < 0 then
     jl.        c6.    ;    get state return to end skip;
     al  w1  x1+2      ;    from addr:= from addr+ 2;
     sh  w1  x2-1      ;    if from addr < limit then
     jl.        a1.    ;    goto rep;

a2:  ws. w1     b20.   ; end skip:
     al  w2  x1        ;
     rl. w3     b0.+2  ;    w3:= page 1;
     jl. w1     c5.    ;    adjust(skipped bytes);
     jl.        c7.    ;    return to next action;

c5:  rl  w0  x3+301    ; adjust(w2 = bytes):
     wa  w0     4      ;
j3:  rs  w0  x3+301    ;    next byte:= next byte + bytes;
     ls  w2    -1      ;
     ac  w0  x2        ;
                       ;    terminal full:= terminal full
j4:  rl  w2  x3+197    ;    - bytes // 2 + 1;
     wa  w0  x2        ;
     ba. w0     1      ;
     rs  w0  x2        ;
j7:  rl  w2  x3+221    ;    return:= w1;
     al  w3  x1        ;    
     jl.       (b4.)   ;    open(terminal);

c6:  ba. w0     b21.   ; get state:   state:= if end file then 3 else 2;
     am.       (b0.+2) ;
j6:  rs  w0    +299    ;
     sn  w0     3      ;    if state = 3 then
     am         25     ;    signal word:= end medium else
     al  w0     0      ;    signal word:= 0;
     rs  w0  x1        ;
     jl      x3        ;    goto return;

g1=k-b0                ;    length page 0;
f40=c4+1, f41=j1+1, f42=j2+1, f43=c5+1, f44=j3+1
f45=j4+1, f47=j6+1, f38=j7+1
e.                     ;
i.
e.
i.
e.\f


; kll 8.9.71          request-display          term2 ...71...


s. a10, b30, c10, d20, f20, g10, j20 w.
h10=h9-k  ; continue external list
     b1.,b3.,b4.,b5.,b6.,b7.,b8.,b11.,b12.,b13.,b14.,b17.
     j4.,j5.,j12.,j13.,j14.,j15.,j16.,0  

a0:  al  w0     i21    ;    request lines on disc;
     al  w1     e46    ;    size of one request line page;
     jl. w3    (j12.)  ;    reserve virtual;
     al  w2  x2+1      ;    insert writing bit;
     rl. w0     j1.    ;    if first page then
     sn  w0     0      ;
     rs. w2     j1.    ;      save virt first line;

     al  w3     1      ;    line state = not pending
     al  w1     2      ;    w1 := rel first line chain;

a6:  al  w2  x2+e10    ; rep6:
     ds. w3  x1+f8.    ;    line state := not pending;
     al  w1  x1+e10    ;    line chain := virt next line;
     sh  w1     e46/e10*e10;terminate on enough lines
     jl.        a6.    ;      on one page;
     al  w1  x1-e10    ;    line state last on page := not pending;
     al  w2  x2-(:e46/e10*e10:)+e46;  (w2 := virt next page start)
     ds. w3  x1+f8.    ;    line chain last on page := virt next page;

     rl. w1     j3.    ;    w1 := rel of last state element;
     al  w2  x2-e46    ;    w2 := virt start of page;
     am      x2        ;
     al  w0  x1-2      ;    w0 := virt start + rel of last line;
     rs. w0     j2.    ;    save virt start of last line;

     ld  w0    -24     ;    if page contains last request line then
     sh  w1     e46/e10*e10;
     ds. w0  x1+f8.    ;      line chain last line := 0;
     al  w1  x1-(:e46/e10*e10:);
     rs. w1     j3.    ;    update rel last request line;

     al. w0     f8.    ;    w0 := abs start of page
     al  w1     e46    ;    w1 := size of page
     jl. w3    (j13.)  ;    move to virt(w2 = virt start of page);

     rl. w1     j3.    ;
     sl  w1     2      ;    if not all lines are initialized then
     jl.        a0.    ;      goto reserve virtual;

\f


; kll 8.9.71          request-display          term2 ...72...

     al  w0     i2     ;
     rs. w0    (b12.)  ;    request free := no of request lines;
     dl. w1     j2.    ;
     am.       (b12.)  ;    first, last of request free :=
     ds  w1    +4      ;     virt first,last line;
     bs. w0     1      ;    remove writing bit for request command;
     rs. w0     j17.   ;    ext(152);


     al  w0     i22    ; output code:  w0:=request code on disk
     al  w1     g1     ;   w1:=length of code
     jl. w3    (j12.)  ;   w2:=reserve virtual
     al. w0     g0.    ;   w0:=address of code
     jl. w3    (j13.)  ;   move to virtual
     rl. w1     b11.   ;
     rs. w1     j18.   ;    ext(51);
     rl. w1     b12.   ; 
     rs. w1     j19.   ;    ext(52);

     jl. w3    (2)     ;    set externals;
j16:            40     ;

j17:     0  ,   152    ;    virt first line;
j18:     0  ,    51    ;    addr of request que sem;
j19:     0  ,    52    ;    addr of request free sem;
     e46>9  ,   510    ;    length of request line page;
         0  ,  -1000   ;    end of externals;


     rl. w1     j5.    ; init corutine descr:  w1:=addr of corutine descr
     rs  w2  x1+6      ;   page descr 0 := virt addr of code
     rl. w0     j6.    ;
     rs  w0  x1+4      ;   rel return := testmode + return from wait op
     rl. w2     b11.   ;   w2:=request que
     jl. w3    (j14.)  ;   simulate lock
     am.       (4)     ;
     jl.       +4      ;    next init
     h9.               ;

j1:  0                 ;    virt first request line
j2:  0                 ;+2  virt last request line
j3:  i2*e10-e10+2      ;    rel ref line state of last request line
j4:  0                 ;   base of external table
j5:  h. e12, 18  w.    ;   request display corutine descr
j6:  c2                ;   testmode + return from wait op
j12: 12                ;   reserve virt
j13: 13                ;   move to virt
j14: 14                ;   simulate lock
j15: 15                ;   end init
\f


; kll 8.9.71          request-display          term2 ...73...


g0:  0, r.5            ; begin of page 0, page addresses
    108<12 + 0         ;   page ident:  request display
b1:  1                 ;   send and wait
b3:  3                 ;   lock
b4:  4                 ;   open
b5:  5                 ;   lock chain
b6:  6                 ;   open chain
b7:  26                ;   current corutine
b8:  7                 ;   get pages
b11: h. e13, 19  w.    ;   request que sem
b12: h. e13, 19  w.    ;   request free sem
b13: 53                ;   terminal reserve
     5<12              ;b14-2: output message
b14: 150               ;   first of terminal buffer
     0                 ;b14+2: last in message
b16: 1<16+1<21         ;   test attention or timer
b17: 23                ;   name of main console
b18: 10<16             ;   new line
b19: 600000            ;    minutes scale factor
b20: 24*60             ;    minutes in 24 hours
b21: 60                ;    minutes in one hour
b22: 10                ;    convert decimal
b23: <: 00:>           ;    text bits
b24: <:  :>            ;    spaces
b25:  -1<2+1           ;    mask for converting insert-request-line to
                       ;         pending-request-line;
\f


; re  31.7.74         request display      term2   ...73a...

; pending line states of request lines
;    0:  normal pending, i.e. insert line that has been printed
;    5:  remote batch pending
;
;  request line codes:
;
;  the rightmost four bits of the operation code contain the following
;  information:
;
;          0<0  =  pending             1<0  =  free
;          0<1  =  displayed           1<1  =  insert, not displayed
;          0<2  =  normal              1<2  =  remote batch
;          0<3  =  silent              1<3  =  bell
;
; operations to request display
;    remove line:          op+0:  chain
;                          op+2:  1
;                          op+4:  answer sem
;                          op+6:  virt request line addr
;                         (new line state -> 1)
;
;    print line:           op+0:  chain
;                          op+2:  1<1+1<0
;                          op+4:  text length in bytes
;                          op+6...: text
;
;    insert rb line:       op+0:  chain
;                          op+2:  1<2+1<1
;                          op+4:  text length in bytes
;                          op+6...: text
;                         op+e10-4 :    see tjobstart
;                         op+e10-2 :    and tread
;                         (new line state -> 5)
;
;    insert normal line:   op+0:  chain
;                          op+2:  1<1
;                          op+4:  text length in bytes
;                          op+6...: text
;                         (new line state -> 0)

\f


; re  31.7.74         request display        term2  ...73b...



c0:  rl. w2     b11.   ; wait op:
     rl. w1    (b7.)   ;   clear page 1;
     al  w0     0      ;
     rs  w0  x1+8      ;
     jl. w3    (b5.)   ;   lock chain(requestque, w1:=op)
c2=k-g0+e88<12+8<15    ;
     rl  w0  x1+2      ;   w0:=op kind
     se  w0     1      ;   if op kind <> remove line then
     jl.        a1.    ;   goto print line

     rl  w2  x1+4      ; remove line:  page 2 is senderbuf.
     jl. w3    (b4.)   ;   open(sem in op)
     rl. w2    (b7.)   ;   w2:=current corutine;
     rl. w1     g0.+4  ;
     rl  w1  x1+6      ;   page 1:=virt line addr;
     rs  w1  x2+8      ;
     jl. w3    (b8.)   ;   get pages
     al  w1  x3        ;   w1:=abs line;
     al  w0     1      ;
     rs  w0  x1+2      ;   line state := not pending
     rl. w2     b12.   ;   w2:=request free sem
     jl. w3    (b6.)   ;   open chain(requestfree, line addr)
     jl.        c0.    ;   page 2 is 0.  goto wait op
\f


; kll 17.10.72          request-display          term2 ...74...

a1:  rl. w2    (b7.)   ; print line:
     rl  w0  x2+10     ;
     rs  w0  x2+8      ;   desc page1:=page2;
     rl. w2     b13.   ;
     jl. w3    (b3.)   ;   lock(terminal reserve)
     jd         1<11+36;    w01:=get clock;
     wd. w1     b19.   ;    w01:= minutes after midnight:=
     ld  w0    -100    ;    time//600000 mod (24*60);
     wd. w1     b20.   ;
     wd. w0     b21.   ;    w3:= min; w0:= hours;
     ld  w1    -24     ;
     wd. w1     b22.   ;    w1:= hours converted to text;
     ls  w1     8      ;
     wa  w1     0      ;
     lo. w1     b23.   ;
     al  w2     0      ;
     wd. w3     b22.   ;
     ls  w3     8      ;    w2:= min converted to text;
     wa  w2     6      ;
     lo. w2     b23.   ;
     rl. w3     b14.   ;    w3:= first of terminal buffer;
     ds  w2  x3+2      ;    store w1, w2 in terminal buffer;
     rl. w0     b24.   ;
     rs  w0  x3+4      ;    spaces;
     al  w2  x3+6      ;    w2:= first free of terminal buffer;
     rl. w1     g0.+2  ;   w1:=op addr
     rl  w3  x1+4      ;
     wa  w3     4      ;   w3:= terminal buffer + request length;

a3:  rl  w0  x1+6      ; rep3:
     rs  w0  x2        ;   copy text word from request line;
     al  w1  x1+2      ;
     al  w2  x2+2      ;    w2:= w2 + 2;
     sh  w2  x3-2      ;    if w2 < w3 then
     jl.        a3.    ;   goto rep3;

     rl. w0     b18.   ;   end line with <new line>
     rs  w0  x2        ;
     rl. w3     g0.+2  ;   w3:= page 1;
\f


; kll 8.9.71          request-display          term2 ...75...


     rs  w2  x3        ;    chainelement.operation := abs last word copied;
a4:  rl  w2  x3        ; rep4: last in message :=
     rs. w2     b14.+2 ;        abs last word copied;
     al. w1     b14.-2 ;    w1 := mess addr;
     rl. w2     b17.   ;   w2:=console name
     jl. w3    (b1.)   ;   send and wait
     rl  w0  x1        ;   w0:=status
     sz. w0    (b16.)  ;   if attention pushed or timer then
     jl.        a4.    ;   goto rep4

     rl. w2     b13.   ;   w2:= terminal reserve sem
     jl. w3    (b4.)   ;   open(terminal reserve)
     rl. w1     g0.+2  ;   w1:=op addr
     rl  w0  x1+2      ;   w0:=op kind
     so  w0     3      ;   if print only then
     jl.        a5.    ;   begin
     rl. w2     b12.   ;      w2:=requestfree
     jl. w3    (b6.)   ;      open chain(requestfree, line)
     jl.        c0.    ;   end
a5:  la. w0     b25.   ;    request line:=pending;
     rs  w0  x1+2      ;   line state := pending
     jl.        c0.    ;   goto wait op
g1=k-g0                ; end of page 0
f8:                    ;    abs first request line
i.e. ; page 1 is placed last, because the following e46 bytes
     ; are set during init.

h11 = s0, h12 = s1     ; final checksum
e. e. e. ; end h-names, end options, end tterm2
\f

▶EOF◀