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

⟦db263d6d1⟧ TextFile

    Length: 158976 (0x26d00)
    Types: TextFile
    Names: »tprinter«

Derivation

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

TextFile


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

\f


; bøt  28.12.71     general description     paper printer  ...1...
b.w.p.1  ; include options
s0 = 0, s1 = 1 ; initialize checksums


; printer coroutines
;
; the coroutines consists of one or more printer drivers printing
; directely on paper and one driver printing on magnetic tape,
; which later may be copied on paper (separately described)
;
; the coroutines consists of the following pages:
;
;
;   paper descriptions  (used by all printers)
;      description of each paper format
;      selecting routines to find a new paper
;
;   main loop (paper printers)
;      the central loop in printing (reading and
;      writing).  all other actions are concentrated
;      on:
;
;   central page (paper printers)
;      start and stop of printing
;      handling of end paper and errors
;      handling of operator messages
;
;   triangle page (paper printers)
;      printing of leading and trailing triangle with associated information
;
;   variables (paper printers)
;      variables to be used by all paper printer pages
;
;
;
; the initialization code of each page is placed just after
; the page itself.
; initialization of the convert operations is placed before
; the first page


\f


; bøt  28.12.71     general description     paper printer  ...2...


; options defining the printers
;
; i65    paper printers on disc
; i66    super buffer on disc
; i67    no of segments in super buffer
; i68    no of named papers + 1
; i70    paper printer buffer on disc
; i71    no of paper printers
; i72    no of points
; i73    no of lines pr vt
; i74    no of lines pr ff
; i75    value of output mode (tape printer)
; i76    value of  set   mode (tape printer)
; i77    max no of segments in points
; i78    no of paper semaphores
; i79    standard repeat value
; i164   convert operations on disc
; i165   paper descriptions on disc
; i166   paper printer variables on disc
; i167   no of lines in triangle
; i168   no of ff before front page
; i169   no of ff after  last  page
; i170   min no of pages before kill
; i190   no of remote batch printers
; i191   max waiting time when reserving rbdevice (timeout period)
; i192   time interval in rb convert queue scan
;
;
; e35    start address of printer table
; e36    top   address of printer table
; e37    length        of printer table entry
; e38    start address of paper   table
; e39    top   address of paper   table
; e40    length of core store print buffer
; e41    length of convert operation
; e42    length of point
; e43    length of printer operation
; e47    length of core store remote batch printer buffer
;
;
; global names:
;
; f-names  relative addresses inside a page
; g-names  absolute addresses of a page or initialization
; d-names  relative addresses of variables

s. h2 w.   ; outermost segment
h0, h1     ; checksums
78 12 11, 68; version id:
m.          boss 2  tprinter



b. d70, f140, g200
w.
f100 = 0        ;  count k-assignments


\f


; bøt  28.12.71       external list       paper printer  ...3...


; externals in main loop

g20. , g21. , g22. , g23. , g24. , g26.
g27. , g28. , g29. , g30. 


; externals in central page

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.


; externals in paper descriptions

g90. , g91. , g92. , g93. , g94. , g95. , g96. , g99. 
g97. , g98. ,  g101.
g173., g174., g175., g176., g177., g178.
g181., g182., g183., g184., g185., g186.

; externals in triangle page

g150., g151., g152., g153., g154., g155., g156.
g157., g158., g159., g160., g161.

; externals in triangle page initialization

g170., g171., g172.


; externals in initialize convert operations

g109., g110., g111., g112., g113., g114.


; externals in initialize paper descriptions

g115., g116., g117., g118., g119.


; externals in initialize variables

g120., g121., g122., g123., g124., g125., g126.
g105., g127., g128., g129.


; externals in initialize central page

g130., g131., g132., g133., g134.


; externals in initialize main loop

g140., g141., g142., g143., g144., g145.
; external 40  -  reference to set-external-procedure;

g165.,g166.,g167.,g168.,g169.,g180.



; end external list
0


\f


; bøt  28.12.71      initialization       paper printer  ...4...


; initialize convert operations
;
; the convert operations are inserted in the
; virtual store, and the semaphore  convert
; operations  is initialized

b. a5, j10
w.

     al  w0      1      ;   no  := 1;
     al  w1      0      ;   chain := 0;
     ds. w1     j1.     ;   save(no, chain);

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

j5:  e13<12+19,  382   ;    convert operations;
j10: e13<12+19,  388   ;    convert op sem type 2;
          0  ,  -1000  ;    end of externals;

a0:  al  w0   i164      ; rep:   w0 := reserve on disc;
     al  w1    e41      ;   w1 := operation length;
     jl. w3    (j7.)    ;   reserve virt (w0, w1, w2);
     al. w0     j1.     ;   w0 := start of operation;
     jl. w3    (j8.)    ;   move to virt ( w0, w1, w2);
     al  w2  x2+1       ;   virt := virt + writing;
     rs. w2     j1.     ;   chain := virt;
     rl. w1     j0.     ;
     sn  w1      1      ;   if no = 1 then
     jl.        a1.     ;   goto set last;
     sz  w1      7      ;   if no mod 8
     jl.         4      ;   = 0 then
     jl. w3    (j9.)    ;   newline;
     al  w1  x1+1       ;   no := no + 1;
     rs. w1     j0.     ;   if no <=
     sh  w1   i104      ;   no of operations then
     jl.        a0.     ;   goto rep;
     al  w0  x1-1       ;   w0 := no - 1;
     rl. w2     j5.     ;   w2 := addr of sem;
     rl. w1     j1.     ;   w1 := virt of first op;
     ds  w1  x2+2       ;   value, first := w0, w1;
     jl. w3    (j9.)    ;   newline;

\f


; bøt  11.03.72       initialization     paper printer  ...4a...


     al  w0      0      ;
     rs. w0     j1.     ;   chain := 0;
     al  w0   i164      ;   w0 := reserve on disc;
     al  w1    e41      ;   w1 := operation length;
     jl. w3    (j7.)    ;   reserve virt (w0, w1, w2);
     al. w0     j1.     ;   w0 := operation addr;
     jl. w3    (j8.)    ;   move to virt (w0, w1, w2);
     al  w2  x2+1       ;   insert writing;
     rl. w3    j10.     ;   w3 := sem addr;
     al  w1  x2         ;   first := last :=
     ds  w2  x3+4       ;   virt of operation;
     al  w1      1      ;
     rs  w1  x3         ;   value := 1;
     am.      (+4)      ; 
     jl.        +2 ,g11.;   goto init papers;
a1:  rl. w1     j5.     ; set last:
     rs  w2  x1+4       ;   sem(last chain) := virt;
     al  w1      2      ;   no := 2;
     rs. w1     j0.     ;
     jl.        a0.     ;   goto rep;

j0:              0      ;   no:
j1: h.  0  , r.e41   w. ;   chain, operation
j6:              0      ;*  start of ext list
j7:             12      ;*  reserve virt
j8:             13      ;*  move to virt
j9:             27      ;*  newline

g109 = j10, g110 = j5, g111 = j6, 
g112 = j7, g113 = j8, g114 = j9  ;   externals

e.

\f


; bøt  28.12.71     paper descriptions     paper printer  ...5...


; paper description page
;
; this page contains descriptions of each paper
; format and the code handling them.
;
; all search strategies are concentrated on this
; page

g6:
k = 10000, f100 = f100 + 4  ;  count k-assignments
b. a10, b101, c10, h20
w.

b0:             0     ;   page 0   this page
b1:             0     ;   page 1   variables
          0, 0, 0     ;   page 2, 3 and 4 are not used
           70<12+0    ;  pageident:  paper description page


; paper descriptions

h0 = 0     ;  rel of users
h10= 2     ;  rel of allowed
h1 = 6     ;  rel of name word 2
h2 = 10    ;  rel of name word 4
h3 = 12    ;  rel of sem addr
h4 = 14    ;  length of entry


; paper description area

b25:
h.  0, r.i78*h4   w.  ;   paper description area
b26:   0,r.i71        ;   addr of top description  =  device number table of paper printers
b27:            0     ;   waiter bits:  a bit = 1 indicates, that the corresp. printer is waiting
b28:            0     ;   saved return from start next printer

h5 = b26 - b0         ;   rel of top   description
h6 = b25 - b0         ;   rel of first description
h9 = h6 + h4*i68-h4   ;   rel top of named papers


; external variables

b2:             3     ;*  lock simple
b3:             4     ;*  open simple
b4:             8     ;*  page jump
b5:           387     ;*  virt of central
b6:           f61     ;   rel of return to central
b7:           381     ;   printer wait
b11:h.    e13, 19  w. ;*  reserve paper descriptions
b12:            5     ;*  lock chained
b20:          380     ;*  first paper queue
b30:          377     ;*  rb printer wait
b31:          378     ;*  rb convert queue
b32:            6     ;*  open chained
b33:            7     ;*  get pages
b34:            1     ;*  send and wait
\f


; re 5.2.75         paper descriptions    paper printer   ...5a...



; local variables

b15:           h4     ;   size of entry
b16:            0     ;   abs of first paper

; variables used by rb printers
b40:            0     ;    work;
b38:           25     ;    call;
b39:          140     ;    virt,
b61:          141     ;      rel. lookup and reserve device;
b60:          146     ;      rel. connect telex;
b41:            0,r.5 ;   term name and name table addr
b42:            0,i192;   timer message
b43:   <:clock:>,0,0,0;
b44:            0     ;   timer send (0 == false, else true)
b45:            0     ;   any scan trouble (0== false, > 0 true)
b46:            0     ;   zero (for set catbase)
b47:          255     ;   mask
b48:         1<16     ;   attention status
b49:          e13     ;   size of semafor
b50:            3     ;    characters per word;
b62:      i185<12     ;    defaultvalue for mode in rb-printer(punch)


;  variables used by display convert

b51:           25     ;    call
b52:           61     ;    printer full sem
b53:          162     ;    virt,
b54:          204     ;      rel alarm print;
b55:          229     ;      rel general print;
b56:          379     ;    paper manipulation semaphore;

b57:  32<16+32<8+32   ;    three space characters;
b58:  0,  r.10        ;    room for entry tail;
b59:
c. i190-1, <:remote<0>:>   z.   ;    if no rb coroutines then 
c. -i190 , <:no rb:>       z.   ;    rb-printer queue cannot be displayed;


\f


; bøt  28.12.71     paper descriptions     paper printer  ...6...

; stepping stones to address page-0 and page-1 at top of page

b100:  b0. ; stepping stone to page-0-addres
b101:  b1. ; stepping stone to page-1-addres

; commandio actions for select and reject commands:
;  syntax:   reject <prno> all  =>  no papers allowed
;            reject <prno> <list of paperno>  =>  those papers not allowed
;            select <prno> all  =>  all papers allowed
;            select <prno> <list of paperno>  =>  those papers allowed too

b. a10, j10 w.
j0:  <:all:>

f96=k-b0               ; entry reject command:
     am        -1      ;
f97=k-b0               ; entry select command
     al  w0     0      ;
     rs. w0     b16.   ;    mask := if reject then -1 else 0;

; search deviceno table to get the corresponding idbit
     al  w0     1<0    ;    idbit := 1 shift 0;
     al  w1     0      ;    index :=0;
     rl  w2  x3+6      ;    w2=deviceno := param1 (integer);

a0:  sn. w2 (x1+b26.)  ; search: if devno(index) = deviceno then
     jl.        a3.    ;      goto found;
     ls  w0     1      ;    idbit := next idbit;
     al  w1  x1+2      ;    increase(index);
     sh  w1  i71*2-2   ;    if index < no of paper printers then
     jl.        a0.    ;      goto search;

     am         6-4    ; device unknown:
a1:  am         4-0    ; param alarm:
a2:  al  w1     0      ; after action:
     rl. w3     b1.    ;
     dl  w3  x3+2      ;    page jump to commandio return + alarm index;
     wa  w3     2      ;
     jl.       (b4.)   ;
\f


; re 5.2.75       paper descriptions      paper printer   ...6a...


a3:  rs. w0     b40.   ; found:
     la. w0     b16.   ;    save idbit;
     rs. w0     b16.   ;    mask := if reject then idbit else 0;

     dl  w1  x3+14     ;    if param2 text then
     sh  w0     0      ;      begin
     jl.        a5.    ;
     sn. w0    (j0.)   ;      if param2 <> <:all:> then
     se  w1     0      ;
     jl.        a1.    ;        goto param alarm;

     al  w1     0      ;      for paperno := 0 step 1 until no of queues -1 do
a4:  jl. w2     a6.    ;
     al  w1  x1+h4     ;        set or clear idbit(paperno);
     se  w1     i78*h4 ;
     jl.        a4.    ;
a7:  jl. w1     c6.    ;      start next printer; goto after action;
     jl.        a2.    ;      end;

a5:  al  w3  x3+8      ;    for paramindex := paramindex + 8
     dl  w1  x3+14-8   ;      while param(paramindex-8) <> empty do
     sn  w0    -1      ;
     jl.        a7.    ;      begin
     sl  w1     i78-1  ;
     al  w1     i78-1  ;      paperindex := param (until no of queues);
     wm. w1     b15.   ;      set or clear idbit(paperindex);
     al. w2     a5.    ;      end;  goto after action;

a6:  rl. w0  x1+b25.+h10;procedure set or clear idbit(w1):
     lo. w0     b40.   ;    w0 := allowed(paperno);
     ws. w0     b16.   ;    if select then set idbit else
     rs. w0  x1+b25.+h10;                  remove idbit;
     jl      x2        ;    return;

e.
\f


; re 5.2.75          paper descriptions     paper printer   ...6b...



; search paper / paper printer
;
; the paper descriptions are scanned from preferred paper and on.
; only the selected papers are tested, and preferably those, which
;   are not used by other printers.
; if no papers are found, the next convert (or some change in
;   paper-allows) is awaited, and the scan is repeated.
; during the search, the paper-manipulation semafore is reserved.
;
; call: d45 must contain preferred paper number
; exit: d45 is updated, corresponding to the convert got,
;       w1 = rel paper description on page
;       w2 = abs paper description

b. a10 w.
c0:  rl. w2     b11.   ; search paper:
     jl. w3    (b2.)   ;   lock(paper manipulation);

     jl. w1     c6.    ;   start next printer;
     al  w0    -1      ;   mask := first loop;

     bz  w2  x3+d45    ;   w2 := abs of
     sl  w2     i78    ;      preferred paper description;
     al  w2     i78-1  ;
     wm. w2     b15.   ;
     al. w2  x2+b25.   ;
     rs. w2     b16.   ;   first paper := w2;

     rl  w1  x2+h0     ;   remove user bits from
     lo  w1  x3+d44    ;     users(preferred paper);
     ws  w1  x3+d44    ;
     rs  w1  x2+h0     ;

a0:  rl  w1 (x2+h3)    ; next:
     sh  w1     0      ;   if que(abs actual paper) empty
     jl.        a1.    ;     then goto test next;
     rl  w1  x2+h10    ;
     so  w1 (x3+d44)   ;   if not allowed then
     jl.        a1.    ;     goto test next;
     sn. w2    (b16.)  ;   if first paper then
     jl.        a2.    ;     goto take it;
     sz  w0 (x2+h0)    ;     if (used by other and first loop)
     jl.        a1.    ;     then goto test next;
a2:  ac. w1     b25.   ; take it:
     wa  w1     4      ;   w1 := rel paper description;
     al  w0     0      ;
     wd. w1     b15.   ;   preferred paper := actual paper;
     hs  w1  x3+d45    ;
     al  w1  x2        ;
     ws. w1     b0.    ;   w1 := rel paper descr on page;
     jl.        c3.    ;   goto paper exit;

a1:  al  w2  x2+h4     ; test next:
     sn. w2     b26.   ;   w2 := next (cyclical) paper descr;
     al. w2     b25.   ;
     se. w2    (b16.)  ;   if paper descr <> first paper then
     jl.        a0.    ;     goto next;
     ba. w0     1      ;   increase mask, i.e. next loop;
     sn  w0     0      ;   if mask = second loop then
     jl.        a0.    ;     goto next;
e.

\f


; bøt  28.12.71     paper descriptions     paper printer  ...7...


; no papers were found.
; wait until any changes.

     rl. w2     b11.   ;   open(paper manipulation);
     jl. w3    (b3.)   ;

; (it is not nescessary to have the ...printer-wait... semafore
;  too much open)
; indicate that the printer is waiting for printer wait semafor
     rl. w2     b7.    ;   w2 := printer wait sem;
     al  w0     1      ;
     sh  w0 (x2)       ;   if sem value >= 1 then
     rs  w0  x2        ;     then sem value := 1;
     rl. w1     b27.   ;   set idbit in waiter bits;
     lo  w1  x3+d44    ;
     rs. w1     b27.   ;

c.i71-2                ;   if more than one std printer then include:
     am        (66)    ;
     al  w1    +74     ;
     al. w3     b46.   ;
     jd         1<11+72;   set catbase(boss maxbase);
     al. w1     b43.+4 ;   w1:=ref (zero,zero);
     al. w2     b43.   ;
     jl. w3    (b34.)  ;   send and wait(clock, wait n secs);
z.

     rl. w2     b7.    ;
     jl. w3    (b2.)   ;   lock(printer wait);

     rl. w1     b27.   ;   remove idbit from waiter bits;
     ws  w1  x3+d44    ;
     rs. w1     b27.   ;

     jl.        c0.    ;   goto search paper;


; new paper / paper printer / remote batch printer

c1:  bl  w1  x3+d46    ;   if printer kind = paper printer
     sn  w1     0      ;     then goto search paper, paper printer;
     jl.        c0.    ;
b. a20 w.
; reserve paper queue admittance
; prepare scan of rb convert queue

a0:  rl. w2     b11.   ;   lock(paper manipulation);
     jl. w3    (b2.)   ;

     al  w0     0      ;
     hs  w0  x3+d45    ;   count:=0;
     rs  w0  x3+d41    ;   error count := 0;
     rs. w0     b45.   ;   any trouble:=false;

; scan rb convert queue to find an available rb printer.
; if queue was non-empty, but none was available, then 
; the rb convert coroutine must wait a while.

a1:  bz  w0  x3+d45    ;rep:
     ba. w0     1      ;   count:=count+1;
     hs  w0  x3+d45    ;

     rl. w1    (b31.)  ;   w1:=value of rb convert queue;
     sh  w0  x1        ;   if count >= queue value then
     jl.        a2.    ;     begin
\f


; re  5.2.75      paper descriptions       paper printer   ...7a...



; the following is just an ad hoc solution for this problem:
;  there are files to be converted and there is at least one rb convert
;  coroutine, but the rb printers are already in use.
;  if the rb printers are used by boss, there will be no problem, since 
;  as soon as an rb conversion is finished, the rb converter will scan
;  the queue and pick up the next file for that device, i.e. the system
;  is kept alive without any delays for conversion.
;  the real problem arises however, if one rb printer is used by a process
;  in rc4000, running in parallel with boss.  in this case boss will not
;  be invoked when the printer becomes ready.
;  the solution says:  if any troubles comes up during the scan (e.g. reserved by
;  other process in rc4000, or the rb terminal cannot get resources for a process
;  description for the device) and the rb converter found no other files to
;  convert, the rb converter will wait a  while, and then repeat the scan to
;  determine, whether the situation has changed.

a14: rl. w2     b11.   ;give up:  open(paper manipulation);
     jl. w3    (b3.)   ;
     rl. w2     b30.   ;     w2:=rb printer wait sem;
     al  w0     1      ;     if sem value >= 1 then
     sh  w0 (x2)       ;       sem value:=1;
     rs  w0  x2        ;

     al. w3     a0.    ;     return:=search rb paper;
     sh. w0    (b45.)  ;
     rl. w0     b44.   ;     if no troubles during scan  or
     sn  w0     0      ;       timer already send  or
     sh  w1     0      ;       rb convert queue empty  then
     jl.       (b2.)   ;       lock(rb printer wait); goto return;

     rs. w3     b44.   ;     timer send:=true;
     am        (66)    ;
     al  w1    +74     ;
     al. w3     b46.   ;
     jd         1<11+72;     set catbase(boss maxbase);
     al. w1     b42.   ;     w1:=delay message;
     al. w2     b43.   ;
     jl. w3    (b34.)  ;     send and wait(clock, wait n secs);
     al  w0     0      ;     timer send:=false;
     rs. w0     b44.   ;     goto search paper;
     jl.        a0.    ;     end;

a2:  rl. w2     b31.   ;   
     jl. w3    (b12.)  ;   lock chained(rb convert queue);
     al  w0     d6     ;
     ws  w1     0      ;    w1:=modified reference to operation
     rl  w0  x1+d60    ;    move from operation to page 1
     rs  w0  x3+d60    ;      error count
     rl  w0  x1+d62    ;
     rs  w0  x3+d62    ;      device kind
     rl  w0  x1+d59    ;
     rs  w0  x3+d59    ;      time of paper out or hard error
     jl.        a7.    ;   goto release queue;
a3:  rs. w3     b45.   ;error: any trouble:=true;
a13: rl  w2  x3+d41    ;reserved by boss:
     al  w2  x2+1      ;   increase(error count);
     rs  w2  x3+d41    ;

     rl. w2     b31.   ;   queue:=rb convert queue;
\f


; re 5.2.75       paper descriptions     paper printer    ...7b...


a4:  rs. w2     b16.   ;put in queue:  save queue;
     jl. w3    (b33.)  ;   get pages;
     rl. w1     b0.+4  ;   w1:=convert operation;
     al  w0     d6     ;
     ws  w1     0      ;
     rl  w0  x3+d60    ;   move to operation
     rs  w0  x1+d60    ;   status, error count
     rl  w0  x3+d62    ;   device kind
     rs  w0  x1+d62    ;
     al  w1  x1+d6     ;
     rl. w2     b16.   ;   w2:=queue;
     jl. w3    (b32.)  ;   open chained;
     rl. w2     b16.   ;
     se. w2    (b31.)  ;   if queue <> rb convert queue then
     jl. w1     c6.    ;     start paper printers;
     rl. w1    (b31.)  ;   if error count <= value of rb conv queue then
     sh  w1 (x3+d41)   ;
     jl.        a14.   ;     goto give up;
     jl.        a1.    ;   goto rep;

; in case of too many errors, the file is converted as a normal convert:
a5:                    ;   unknown
     bz  w2  x3+d60    ;   increase no of errors
     al  w2  x2+1      ;   during printing and
     hs  w2  x3+d60    ;   skip the file
     sh  w2     i180   ;   unless the error count
     jl.        a3.    ;   is too big
     al  w2      4      ;
     hs  w2   x3+d61    ;    status:= rerouted remotefile.
     al  w2     14     ;   
     rs  w2  x3+d62    ;   device kind:=printer
     bz  w2  x3+d8     ;
     sl  w2     i68-1  ;   w2:=paper no;
     al  w2     i78-1  ;
     wm. w2     b49.   ;   w2:=rel paper queue;
     wa. w2     b20.   ;   w2:=paper queue;
     jl.        a4.    ;   goto put in queue;

; release the queue admittance
; if the queue is non-empty then start the next rb converter

a7:  rl. w2     b11.   ;
     jl. w3    (b3.)   ;   open (paper manipulation);
     rl. w2     b30.   ;
     ac  w0 (x2)       ;   w0 := - value of rb printer wait;
     sl  w0     1      ;   if value < 0  and
     rl. w0    (b31.)  ;
     sl  w0     1      ;    rb conv queue non-empty then
     jl. w3    (b3.)   ;     open(rb printer wait);
\f


; lkn 76.1.22    paper descriptions   printer   ...7c...
 
 
; reserve the rb printer
     bz  w0  x3+d61    ;    w0:=status
jd-1
     sh  w0     2      ;    if status = continuation after hard error (= 2)
     sh  w0     0      ;    or status = continuation after end paper (= 1) then
     jl.        a10.   ;    begin
     dl  w1     110    ;      w01:=clock
     ld  w1     5      ;      w0:=short clock
jd-1
     ws  w0  x3+d59    ;      - time of hard error
jd-1
     sh  w0     i191   ;      if time elapsed<=i191 then
     jl.        a15.   ;      goto "reserved by boss"
a10:                   ;    end
 
     rl  w2 (x3+d2)    ;
     rs  w2  x3+d32    ;    save virt operation address;
     ac. w2    (b0.+4) ;    w2:=negative abs operation address;
     ac  w2  x2+d6     ;    w2:=abs opaddr (modified);
     bz  w1  x2+d8     ;
     hs  w1  x3+d8     ;    save papertype on page 1;
                       ;    begin
a9:  dl  w1  x2+d52    ;
     ds  w1  x3+r1+2   ;      set devicename;
     ld  w1    -100    ;
     ds  w1  x3+r1+6   ;
     rl  w0  x3+d4     ;
     rs  w0  x3+r0     ;    set abs ref message area
     dl  w1  x2+d66    ;    set catalog base
     ds  w1  x3+r6+2   ;
     dl  w1  x2+d50    ;
     ds  w1  x3+r2+2   ;    set device host description
     rl  w0  x2+d62    ;
     wa. w0     b62.   ;    w0:= kind+ stdmode
     al  w1     i191   ;
     ds  w1  x3+r5     ;      set mode,kind,timeout;

     dl. w3     b61.   ;
     jl. w1    (b38.)  ;      call (lookup and reserve device);
                       ;    end;
     jl.        a6.    ;+2  error return;
a17: rl  w0  x3+r102   ;+4
     rs  w0  x3+d43    ;    set logical device no;
     rl  w0  x3+r103   ;
     am         1      ;
     hs  w0  x3+d18    ;    set mode;
     rl  w2 (x3+r101)  ;    w2:=process descr addr of subprocess;
     al  w3  x3+d21    ;   w3:=abs ref process name;
     dl  w1  x2+4      ;    move process name;
     ds  w1  x3+2      ;
     dl  w1  x2+8      ;
     ds  w1  x3+6      ;
     rl. w3     b0.+2  ;    reestablish w3;
     rl  w1  x3+r106   ;    w1:=max blocksize;
     se  w1     0      ;    if maxblocksize set then
     sl  w1     e47    ;
     al  w1     e47    ;    w1:= min(printerbuffer,maxblocksize);
     wa  w1  x3+d4     ;
     al  w1  x1-2      ;
     rs  w1  x3+d5     ;    last of buffer:=first of buffer
     rs  w1  x3+d47    ;      +length - 2;
     rl  w2  x3+d32    ;
     rs  w2 (x3+d2)    ;    restore virt operation address;
     dl. w3     b6.    ;
     jl.       (b4.)   ;    page jump to central;
a6:  rl  w2  x3+d32    ;
     rs  w2 (x3+d2)    ;    restore virt operation address;

     rl  w0  x3+r100   ;    w0:=result;
     sh  w0     6      ;    if result>6 then
     jl.        a8.    ;
     sl  w0     8      ;
     am         a13-a3 ;    reserved by boss  (regret);
a15: am         a3-a5  ;    reserved by rc4000 process<>boss;
a8:  al. w3     a5.    ;    unknown;
     rl. w2     b11.   ;
     jl.       (b2.)   ;    lock (paper manipulation);

e.
\f


; re 5.2.75     paper descriptions          printer   ...7f...



; start next printer
;
; all paper queues are scanned, and compared to waiterbits and allowedbits.
; if at least one printer is found able to print, the ..printer wait..
;   semafor is opened

c6:  rs. w1     b28.   ;   save abs return;
     al  w0     0      ;   anything to print := false;
     am        -2000   ;
     al. w2     b25.+2000 ;

a2:  rl  w1 (x2+h3)    ;   for w2 := each paper descr entry do
     sh  w1     0      ;
     jl.        a3.    ;     if queue.entry > 0 then
     rl  w1  x2+h10    ;       anyprint := anyprint  or
     la. w1     b27.   ;         (allowed.entry and waiterbits);
     lo  w0     2      ;
     se  w0     0      ;
     jl.        a4.    ;
a3:  al  w2  x2+h4     ;
     se. w2     b26.   ;
     jl.        a2.    ;
a4:  rl. w2     b7.    ;   if some of the waiting printers will be able to print then
     se  w0     0      ;
     jl. w3    (b3.)   ;     open(printer wait);
                       ; nb: if that printer is not the one, it will activate the next
     jl.       (b28.)  ;   return;



; paper exit
;
; reserve current paper, lock the paper queue
; and open paper reservations

c3:  rl  w0  x2+h0     ;
     am.       (b101.) ;    b101 stepping stone to b1
     rl. w3     b101.  ;
     lo  w0  x3+d44    ;   users := users or printer id-bit;
     rs  w0  x2+h0     ;
     al  w1  x1+h0     ;
     rs  w1  x3+d29    ;   set rel of cur paper state;
     al  w3  x3+d41    ;   w3 := addr of saved name area;
     dl  w1  x2+h1      ;
     ds  w1  x3+2       ;   move name from paper
     dl  w1  x2+h2      ;   descriptions to variables;
     ds  w1  x3+6       ;
     rl  w2  x2+h3      ;   w2 := abs addr of paper sem;
     jl. w3   (b12.)    ;   lock chained (w2);
     rl  w0 (x3+d2)     ;   save virt addr of
     rs  w0  x3+d32     ;   convert operation;
     rl. w2    b11.     ;
     jl. w3    (b3.)    ;   open (paper reservation);
     dl. w3     b6.     ;   w2, w3 := virt, rel of ok-return;
     jl.       (b4.)    ;   page jump to central;


\f


; bøt  28.12.71     paper descriptions     paper printer  ...8...
c.-1


; search any paper / tape printer
;
; the paper queues are scanned backwards from cur
; paper (or top if cur paper = 0) and the next
; paper is reserved (or cur paper := 0 on end).

c4:  rl. w2    b11.     ;
     jl. w3    (b2.)    ;   lock paper reservations;
     al  w1  x3         ;
     wa. w1    b13.     ;   w1 := abs paper descr (page 1);
     rl  w2  x1         ;   w2 := cur paper;
     sn  w2      0      ;   if w2 = 0 then
     al  w2     h5      ;   w2 := top paper;
     al  w2  x2-h4      ;   cur paper := previous (w2);
     rs  w2  x1         ;   save cur paper;
     wa. w1    b17.     ;   w1 := abs of sem addr;
     rl. w0  x2+b25.+h3 ;
     rs  w0  x1         ;   transfer sem addr;
     wa. w1    b18.     ;   w1 := abs of paper name (page 1);
     al. w2  x2+b25.+h1 ;   w2 := abs of paper name (descr);
     dl  w0  x2         ;
     ds  w0  x1+2       ;   transfer paper name;
     dl  w0  x2+4       ;
     ds  w0  x1+6       ;
     rl. w2    b11.     ;
     jl. w3    (b3.)    ;   open paper reservations;
     dl. w3     b9.     ;
     jl.       (b4.)    ;   page jump (return);
z.


; set paper name
; initialize paper name and
; semaphore addr in variables

c5:  al  w2     h4      ;
     wm  w2  x3+d30     ;   w2 := abs of paper
     am        -2000     ;
     al. w2  x2+b25.+2000;   descr (spec paper);
     al  w1  x2+h0      ;
     am.       (b100.)  ;    b100 stepping stone to b0
     ws. w1     b100.   ;
     rs  w1  x3+d29     ;   set rel of cur paper state;
     dl  w1  x2+h1      ;
     am           2     ;
     ds  w1  x3+d41     ;   move paper name
     dl  w1  x2+h2      ;
     am           6     ;
     ds  w1  x3+d41     ;
     rl  w1  x3+d44    ;   w1 := id-bit(printer);
     lo  w1  x2+h0      ;   reserve paper;
     rs  w1  x2+h0      ;
     dl  w3  x3+2       ;
     jl.       (b4.)    ;   page jump (return);
\f


;    lkn  20.10.75        disp convert        tprinter        ...8a...

b.   a50, p3, q50   w.

q1=i46-18              ;    user name
q2=q1+8                ;    paper type
q3=q2+2                ;    paper semaphore
q4=q3+2                ;    relative address on job file page
q5=q4+2                ;    accumulated length of queue
q6=q5+2                ;    accumulated number of files
q7=q6+2                ;    user fits:   0 = no,   >0 = yes;

q10=4                  ;    paper description
q11=12                 ;    <colon>
q12=16                 ;    number of files
q13=20                 ;    <:files:>
q14=24                 ;    <nl>
q15=28                 ;    output block and return

q20=4                  ;    paper description
q21=12                 ;    <colon>
q22=16                 ;    number of files
q23=20                 ;    <:files:>
q24=24                 ;    number of segments
q25=28                 ;    <:segments:>
q26=32                 ;    <nl>
q27=36                 ;    output block and return

q30=4                  ;    <:after:>
q31=8                  ;    number of segments
q32=12                 ;    <:segments:>
q33=16                 ;    paper description
q34=24                 ;    <colon>
q35=28                 ;    file description
q36=36                 ;    number of segments
q37=40                 ;    <:segments:>
q38=44                 ;    <nl>
q39=48                 ;    output block and return

p1=4                   ;    param1
p2=12                  ;    param2
p3=20                  ;    param3

f98=k-b0               ;    rel entry display convert;
     al  w0     0      ;
     rs  w0  x3+q1     ;    clear username;
     rs  w0  x3+q5     ;    clear length of queue;
     rs  w0  x3+q6     ;    clear number of files;

     dl  w1  x3+p2+2   ;
     sn  w0    -1      ;    if param2 empty then
     jl.        a10.   ;    goto scan semaphores;
     sn  w0     0      ;    if param2 = integer then
     jl.        a3.    ;    goto set papertype;

\f


;    lkn  20.10.75        disp convert        tprinter        ...8b...

     sn. w0    (b59.)  ;    if param2<>remote then
     se. w1    (b59.+2);
     jl.        a1.    ;
     dl  w1  x3+p2+6   ;
     se. w0    (b59.+4);
     jl.        a1.    ;    goto save username;
     rl  w0  x3+p3     ;
     se  w0    -1      ;     if param3 not empty then
     jl.        a4.    ;    alarm(param);

     al  w1     i68    ;    else papertype:=remote;
     jl.        a5.    ;    goto set papertype;
a1:  dl  w1  x3+p2+2   ; save username:
     ds  w1  x3+q1+2   ;
     dl  w1  x3+p2+6   ;
     ds  w1  x3+q1+6   ;

     dl  w1  x3+p3+2   ;    w01:=param3;
     se  w0    -1      ;    if param3 empty then
     jl.        a2.    ;
     al  w1     0      ;    w1:=paper0;
     jl.        a3.    ;    goto set papertype;

a2:  sn  w0     0      ;    if param3=integer then
     jl.        a3.    ;    goto set papertype;
     sn. w0    (b59.)  ;    if param3<>remote then
     se. w1    (b59.+2);
     jl.        a4.    ;
     rl  w0  x3+p3+4   ;
     se. w0    (b59.+4);
     jl.        a4.    ;    print alarm(param);
     al  w1     i68    ;    papertype:=remote;
     jl.        a5.    ;

a3:  sl  w1     i68-1  ;    if paper not known then
     al  w1     i68-1  ;    paper:=special paper;
a5:  rs  w1  x3+q2     ;
     jl.        a20.   ;

a4:  al  w1     5      ;    param1:=alarm(5)=param;
     rs  w1  x3+4      ;
     dl. w3     b54.   ;
     jl. w1    (b51.)  ;    call(alarm print);

a10: al  w0     0      ; scan semaphores:
     rs  w0  x3+q2     ;    current paper:=0;
     rl. w1     b20.   ;    w1:=paper0 semaphore;
     rs  w1  x3+q3     ;    save current semaphore;

     al  w0    -2      ;    initialize line;
     rs  w0  x3+q12    ;    insert(integer);
     al  w0     0      ;
     al  w1     44     ;
     ds  w1  x3+q11+2  ;    insert(colon);

\f


;    lkn  20.10.75        display convert        tprinter        ...8c...

     al  w1     45     ;
     ds  w1  x3+q13+2  ;    insert(files);
     al  w1     8      ;
     ds  w1  x3+q14+2  ;    insert(nl);
     al  w1    -6      ;
     rs  w1  x3+q15    ;    insert(output block and return);

a11: rl  w1  x3+q3     ;    w1:=current semaphore;
     rl  w0  x1        ;    w0:= semaphore value;
     al  w1  x1+e13    ;    

a14: rs  w1  x3+q3     ;    current semaphore:=next semaphore;
     sh  w0     0      ;    if queue empty then
     jl.        a12.   ;    goto next paper;
     rs  w0  x3+q12+2  ;    insert(no of files);
     al  w2  x3+q10    ;    w2:= addr(paper description);
     jl. w1     a30.   ;    insert(paper description);
     rl. w2     b53.   ;
     rl. w3     b55.   ;
     jl. w1    (b51.)  ;    call(general print);

a12: rl  w1  x3+q2     ;
     al  w1  x1+1      ;
     rs  w1  x3+q2     ;    current paper:=next paper;
     se  w1     i68    ;    if paper=remote then
     jl.        a13.   ;
     rl. w1     b31.   ;    w1:=remote semaphore;
     jl.        a14.   ;

a13: sh  w1     i68    ;    if more papers then
     jl.        a11.   ;    goto next semaphore;
     jl.        a45.   ;    goto end display;


a20: rl  w1  x3+q2     ;    w1:=paper type;
     se  w1     i68    ;    if paper=remote  then
     jl.        a19.   ;
     rl. w1     b31.   ;    w1:=remote semaphore;
     jl.        a18.   ;

a19: wm. w1     b49.   ;
     wa. w1     b20.   ;    w1:=paper semaphore;

a18: rs  w1  x3+q3     ;    save current semaphore;
     rl  w0  x3+q1     ;
     se  w0     0      ;    if no username  then
     jl.        a21.   ;    begin
     al  w1     44     ;   
     ds  w1  x3+q21+2  ;      insert(colon);
     al  w1     45     ;
     ds  w1  x3+q23+2  ;      insert(files);
     al  w1     47     ;
     ds  w1  x3+q25+2  ;      insert(segments);
     al  w1     8      ;
     ds  w1  x3+q26+2  ;      insert(nl);
     al  w1    -6      ;
     rs  w1  x3+q27    ;      insert(outblock and return);
     al  w0    -2      ;
     rs  w0  x3+q22    ;      insert(integer);
     rs  w0  x3+q24    ;         -
     al  w2  x3+q20    ;    
     jl. w1     a30.   ;      insert(paper description);
     jl.        a22.   ;    end else

\f


;    lkn  20.10.75        display convert        tprinter        ...8d...

a21: al  w0    -2      ;    begin
     rs  w0  x3+q31    ;      insert(integer);
     rs  w0  x3+q36    ;             -
     al  w0     0      ;
     al  w1     48     ;
     ds  w1  x3+q30+2  ;      insert(after);
     al  w1     47     ;
     ds  w1  x3+q32+2  ;      insert(segments);
     ds  w1  x3+q37+2  ;            -
     al  w1     44     ;
     ds  w1  x3+q34+2  ;      insert(colon);
     al  w1     8      ;
     ds  w1  x3+q38+2  ;      insert(nl);
     al  w1    -6      ;
     rs  w1  x3+q39    ;      insert(output block and return);
     al  w2  x3+q33    ;      w2:=address(paper description);
     jl. w1     a30.   ;      insert(paper description);
                       ;    end;

a22: al  w0     q39+2  ;    w0:=first free on job file page;
     rs  w0  x3+q4     ;    save current position on job file page;
     rl. w2     b56.   ;
jd-1
     jl. w3    (b2.)   ;    lock(paper man. semaphore);

a25: rl  w2  x3+q3     ;    w2:=paper semaphore;
     rl  w0  x2        ;
jd-1
     sh  w0 (x3+q6)    ;    if semaphore value <=accumulated number of files
     jl.        a29.   ;    then goto end of papertype;
     jl. w3    (b12.)  ;    lockch(paper sem);
     al  w2  x1+d70    ;    w2:=operation;
     dl  w1  x2+d12    ;
     sn  w0 (x3+q1)    ;    test username;
     se  w1 (x3+q1+2)  ;
     jl.        a15.   ;
     dl  w1  x2+d13    ;
     sn  w0 (x3+q1+4)  ;
     se  w1 (x3+q1+6)  ;    if username does not fit then
     jl.        a15.   ;    goto accumulate queue;

     rl  w1  x3+q4     ;    w1:=current position on job file page;
     rs  w1  x3+q7     ;    username fits  (q7>0);
     al  w1  x1+12     ;
jd-1
     sl  w1     q1     ;    if no more room then
     jl.        a28.   ;    goto end of operation;
     rs  w1  x3+q4     ;    save next position on job file page;
     rl  w0  x3+q5     ;    w0:=length of queue so far;
     am     (x3+q4)    ;  
     rs  w0  x3-4      ;    save length of queue;

     rl  w1  x2+d7     ;
jd-1
     se  w1     0      ;    if type=convertfile then
     jl.        a24.   ;

\f


;    lkn  20.10.75        display convert        tprinter        ...8e...

     dl  w1  x2+d68    ;    move filename;
     am     (x3+q4)    ;
     ds  w1  x3-10     ;
     dl  w1  x2+d69    ;
     am     (x3+q4)    ;
     ds  w1  x3-6      ;
     jl.        a26.   ;    else

a24: al  w0     0      ;
     am     (x3+q4)    ;
     ds  w1  x3-10     ;     insert(type)    primout or job controlled;
     sn  w1     1      ;    if type=primout then
     jl.        a26.   ;    goto primout;
     rl. w1    (b52.)  ;    w1:=printer full sem;
     jl.        a27.   ;
a15: al  w1     0      ;
     rs  w1  x3+q7     ;    username does not fit;

     rl  w1  x2+d7     ; accumulate length of queue;
     sh  w1     1      ;    if job controlled then
     jl.        a26.   ;
     rl. w1    (b52.)  ;    w1:=printer full sem;
     jl.        a23.   ;


a26: dl  w1  x2+d10    ;
     al. w3     b46.   ;
     jd         1<11+72;    set catalog base;
     al. w1     b58.   ;    w1:=entry tail;
     al  w3  x2+d9     ;    w3:=filename;
     jd         1<11+42;    lookup entry;
     am.       (b101.)   ;    b101 stepping stone to b1
     rl. w3     b101.  ;    w3:=abs page 1
jd-1
     se  w0     0      ;    if entry not found then
     jl.        a28.   ;    goto end of operation;
     rl  w1  x1        ;    w1:= size;

a27: sn  w0 (x3+q7)    ;    if userfiles then
     jl.        a23.   ;
     am     (x3+q4)    ;
     rs  w1  x3-2      ;    save length of file;

a23: wa  w1  x3+q5     ;
     rs  w1  x3+q5     ;    accumulate length of queue;

a28: al  w1  x2+d6     ;
     rl  w2  x3+q3     ;
     jl. w3    (b32.)  ;    opench(paper sem);
     rl  w1  x3+q6     ;
     al  w1  x1+1      ;
     rs  w1  x3+q6     ;    increment number of files;
     jl.        a25.   ;    repeat;

a29: rl. w2     b56.   ;
     jl. w3    (b3.)   ;    open(paper manipulation sem);
     al  w0     0      ;
     se  w0 (x3+q1)    ;    if no username then
     jl.        a40.   ;
     rl  w0  x3+q6     ;
     rs  w0  x3+q22+2  ;    insert(number of files);
     rl  w0  x3+q5     ;
     rs  w0  x3+q24+2  ;    insert length of queue;

\f


;    lkn  20.10.75        display convert        tprinter        ...8f...

     rl. w2     b53.   ;
     rl. w3     b55.   ;
     jl. w1    (b51.)  ;    call(general print);
     jl.        a45.   ;    goto end of display;

a40: al  w0    -1      ;
     am     (x3+q4)    ;
     rs  w0  x3        ;    save stopsymbol;
     al  w0     q39+2  ;
     rs  w0  x3+q4     ;    set current position on job file page;
jd-1

a41: am     (x3+q4)    ;
     rl  w1  x3        ;
     sh  w1    -1      ;    if next block is a stop symbol then
     jl.        a45.   ;    goto end display;
     rl  w2  x3+q4     ;
     al  w2  x2+12     ;
     rs  w2  x3+q4     ;    current position:=next position on job file page;
     am     (x3+q4)    ;
     dl  w1  x3-10     ;
jd-1
     sn  w0     0      ;    if filename then
     jl.        a42.   ;
     lo. w0     b57.   ;    move filename and insert spaces;
     lo. w1     b57.   ;
jd-1
     ds  w1  x3+q35+2  ;
     am     (x3+q4)    ;
     dl  w1  x3-6      ;
     lo. w0     b57.   ;
     lo. w1     b57.   ;
     ds  w1  x3+q35+6  ;
     jl.        a43.   ;

a42: al  w1  x1+48     ;    else insert(primout or job controlled);
     ds  w1  x3+q35+2  ;
     al  w1     19     ;
     ds  w1  x3+q35+6  ;

a43: am     (x3+q4)    ;
     dl  w1  x3-2      ;
     rs  w0  x3+q31+2  ;    insert(length of queue);
     rs  w1  x3+q36+2  ;    insert(length of file);
     al  w0     0      ;
     rs  w0  x3+q30    ;    reestablish print text command;

a44: rl. w2     b53.   ;
     rl. w3     b55.   ;
     jl. w1    (b51.)  ;    call(general print);
     jl.        a41.   ;    repeat;

a45: al  w1    -10     ;  
     rs  w1  x3+4      ;    insert(print time);
     al  w0     0      ;
     al  w1     19     ;
     ds  w1  x3+8      ;    insert(space);
     al  w1     21     ;
     ds  w1  x3+12     ;    insert(end display);

\f


;    lkn  20.10.75        display convert        tprinter        ...8g...

     al  w1    -4      ;
     rs  w1  x3+14     ;    insert(output block and goto after action);
     jl.         a44.   ;    goto call general print


;  procedure insert paper description
;
;       call             return
;  w0   -                undefined
;  w1   link             undefined
;  w2   addr.of paper descr.  unchanged
;  w3   addr.of job file page unchanged

a34:  0                ;    return address;
a35:  <:special  :>,0  ;
a36:  <:remote   :>,0  ;

a30: rs. w1     a34.   ;    save return address;
     rl  w1  x3+q2     ;    w1:=paper;
     sl  w1     i68-1  ;    if standard paper then
     jl.        a31.   ;    begin
     al  w0    -2      ;
     ds  w1  x2+6      ;      insert(paper number);
     al  w0     0      ;
     al  w1     46     ;
     ds  w1  x2+2      ;      insert(paper);
     jl.       (a34.)  ;      return;
                       ;    end;
a31: se  w1     i68-1  ;    if special paper then
     jl.        a32.   ;    begin
     dl. w1     a35.+2 ;
     ds  w1  x2+2      ;    insert(special);
     dl. w1     a35.+6 ;
     ds  w1  x2+6      ;
     jl.       (a34.)  ;    return;
                       ;    end;
a32: dl. w1     a36.+2 ;    begin
     ds  w1  x2+2      ;
     dl. w1     a36.+6 ;      insert(remote);
     ds  w1  x2+6      ;
     jl.       (a34.)  ;      return;
                       ;    end;

e.


\f


; bøt  28.12.71     paper descriptions     paper printer  ...9...


; define relative addresses to be used in
; initialization and other pages

f80 = b2  - b0     ;  lock simple
f81 = b3  - b0     ;  open simple
f82 = b4  - b0     ;  page jump
f83 = b5  - b0     ;  virt of central page
f84 = b38 - b0         ;  call
f85 = b39 - b0         ;  virt,
f86 = b61 - b0         ;    rel. lookup and reserve device;
f89 = b60 - b0         ;    rel. connect telex;
f87 = b11 - b0     ;  paper reservation sem
f88 = b12 - b0     ;  lock chained
f90 = c1  - b0     ;  rel entry new paper
f91 = b7  - b0     ;  paper manipulation sem
f93 = c5  - b0     ;  rel entry set printer name
f120= b20 - b0     ;  first paper queue
f121= b30 - b0     ;  rb printer wait
f122= b31 - b0     ;  rb convert queue
f123= b32 - b0     ;  open chained 
f124= b33 - b0     ;  get pages
f125= b34 - b0     ;  send and wait
f131= b51 - b0     ;  call
f132= b52 - b0     ;  printer full sem
f133= b53 - b0     ;  virt,
f134= b54 - b0     ;    rel alarm print
f135= b55 - b0     ;    rel general print
f136= b56 - b0     ;  paper manipulation sem;


; define absolute addresses
; to external list  or initialization

g90 = f80 + g6 , g91 = f81 + g6 , g92 = f82 + g6
g93 = f83 + g6 , g94 = f84 + g6 , g95 = f85 + g6
g96 = f86 + g6 , g97 = f87 + g6 , g98 = f88 + g6
 g99 = f89 +g6 , g100= f90 + g6 , g101= f91 + g6
g102= h5  + g6 , g103= h6  + g6 , g104= h9  + g6
g173= f120+ g6 , g174= f121+ g6 , g175= f122+ g6
g176= f123+ g6 , g177= f124+ g6 , g178= f125+ g6
g181= f131+ g6 , g182= f132+ g6 , g183= f133+ g6
g184= f134+ g6 , g185= f135+ g6 , g186= f136+ g6


; terminate page
f3 = k - b0    ;   length of page
k  = g6 + f3   ;   reset k
g7 = k - 2     ;   last of page
f100 = f100 + 4;   count k-assignments


\f


; bøt  28.12.71      initialization       paper printer  ...10...


; the following code is executed during the translation
;
; it initializes the paper description entries.
; special paper names are copied from the options.
; if any error is found in the names, the translation
; is terminated with an alarm message.

b. a15, j20
w.

a0:  ds. w3     j3.    ; insert names:
     am        -2000   ;
     al. w2   g103.-4+2000;   to := first of paper descr;
     am        -2000   ;
     al. w3    e38.+2000-f100;   from := first of paper table;
a1:  al  w1  x2        ; next paper: save  to;
     al  w0     0      ;   set initial users;
     rs  w0  x2+h0     ; rep1:
     al  w0    -1      ;   set initial allows: all papers allowed;
     rs  w0  x2+h10    ;
a2:  rl  w0  x3         ;   word (to + namerel) :=
     rs  w0  x2+h1-2    ;   word (from);
     aa. w3     j4.     ;   update pointers;
     sz  w0    255      ;   if last char <> 0 then
     jl.        a2.     ;   goto rep1;
     sl  w2  x1+h2+3    ;   if w2 > last name word + 2 then
     jl.        a4.     ;   goto alarm2;
     al  w2  x1+h4      ;   to := first of next entry;
     sn. w2   g104.-4   ;   if to = top name then
     jl.        a6.     ;   goto set fixed;
     am        -2000   ;
     se. w3    e39.+2000-f100;   if from <> top then
     jl.        a1.     ;   goto next paper;
a3:  al. w0     j0.     ; alarm1:
     jl.       (j3.)    ;   <:too few paper names:>;
a4:  al. w0     j1.     ; alarm2:
     jl.       (j3.)    ;   <:paper name too long:>;
a5:  al. w0     j2.     ; alarm3:
     jl.       (j3.)    ;   <:too many paper names:>;
a6:  am        -2000   ;
     se. w3    e39.+2000-f100; set fixed: if from <> top then
     jl.        a5.     ;   goto alarm3;
     dl. w1     j6.     ;   insert general name
     ds  w1  x2+h1      ;   in name area;
     dl. w1     j7.     ;
     ds  w1  x2+h2      ;
     al  w1     0      ;
     rs  w1  x2+h0     ;   initialize users;
     al  w1    -1      ;   initialize allowed
     rs  w1  x2+h10    ;
a7:  sl. w2   g102.-h4-4; rep2:  if to = last then
     jl.        a8.     ;   goto insert devicenumbers;
     rl  w1  x2         ;   word(to + length of entry)
     rs  w1  x2+h4      ;   := word (to);
     al  w2  x2+2       ;   update to;
     jl.        a7.     ;   goto rep2;


\f


; bøt  28.12.71      initialization       paper printer  ...11...


a8:                    ; insert devicenumbers:
     al. w2     g6.+h5-4;   w2 := to := first of deviceno table;
     am        -2000   ;
     al. w3     e35.+2000-f100;  w3 := from := first of option table;

a9:  rl  w0  x3        ; rep:
     rs  w0  x2        ;   move devicenumber;
     al  w2  x2+2      ;   increase(to);
     al  w3  x3+e37    ;   from := from + length of entry;
     am        -2000   ;
     se. w3     e36.+2000-f100; if from <> top entry then
     jl.        a9.    ;     goto rep;

     am        -2000   ;
     al. w3     e58.-f100+2000; w3:=first of preselected papers
     rs. w3     j12.   ;    save first entry in preselect table
     am        -2000   ;
     al. w2     g103.-4+2000;  w2:=first of paper descriptions
     rs. w2     j14.   ;    set current paper description
     al  w0     0      ;
     rs. w0     j15.   ;    clear all paper mask
     al  w0    -2      ;
     rs. w0     j11.   ;    paper count:=-2
j17: rl. w3     j11.   ;    w3:=paper count
     al  w3  x3+1      ;      + 1
     sl  w3     i78    ;    if more papers then
     jl.        j20.   ;    begin
     rs. w3     j11.   ;
     al  w0     0      ;
     rs. w0     j13.   ;      clear allowed bits
     al  w2    -1      ;
j18: al  w2  x2+1      ;      w2:=next printer
     sl  w2     i71    ;      if more printers then
     jl.        j19.   ;      begin
     rl. w3     j12.   ;
     wa  w3     4      ;        w3:=abs ref current entry in preselect table
     bl  w3  x3        ;        w3:=preselected paper
     sn. w3    (j11.)  ;        if w3 = current paper
     am         1-0    ;        then allowed := true
     al  w0     0      ;        else allowed :=false
     ls  w0  x2        ;        set idbit if allowed
     lo. w0     j13.   ;
     rs. w0     j13.   ;        allowed mask:=idbit or allowed mask
     jl.        j18.   ;      end
j19: rl. w0     j13.   ;      w0:=allowed mask
     rl. w3     j11.   ;      w3:=current paper
     se  w3    -1      ;      if all papers  (=-1) then
     jl.        j16.   ;      begin
     rs. w0     j15.   ;        set all paper mask
     jl.        j17.   ;      end else
j16:                   ;      begin
     sn  w0     0      ;        if current paper not preselected at all
     rl. w0     j15.   ;        then take all paper mask
     rl. w1     j14.   ;        w1:=current paper description
     rs  w0  x1+h10    ;        set allowed bits
     al  w1  x1+h4     ;
     rs. w1     j14.   ;        set next paper description
     jl.        j17.   ;      end
j20:                   ;    end

     al  w0      0      ; finis:
     al  w2      0      ;
     jl.       (j3.)    ;   return (ok);

c. e59-e58-i71-1
m.***table of preselected papers does not match printer table
z.
c.-e59+e58+i71-1
m.***table of preselected papers does not match printer table
z.


j0:  <:<10>***too few paper names<0>:>
j1:  <:<10>***paper name too long<0>:>
j2:  <:<10>***too many paper names<0>:>
                 2      ;
j4:              2      ;   update pointers
j6 = k + 2    ,0,0
j7 = k + 2    ,0,0

j10:             0      ;   saved w2
j3:              0      ;   saved w3
j11:              0      ;    paper count
j12:              0      ;    first entry in preselect table
j13:              0      ;    allowed bits in current paper
j14:              0      ;    current paper description
j15:              0      ;    all paper mask

     jl.        a0.     ;   goto insert names

e.
i.
j.

\f


; bøt  28.12.71      initialization       paper printer  ...12...


; initialize paper description page
;
; the semaphore addresses are initialized
; the page is put in the virtual store, and
; all external entries on it are put in the
; external list

b. a5, j5
w.

g11: rl. w3     j3.     ;   w3 := first of semaphores
     am        -2000     ;
     al. w2   g103.+2000;   w2 := first paper descr addr;
     rs. w3     g135.   ;   ext 380 := paper 0 queue addr;
a0:  rs  w3  x2+h3      ; rep: queue addr(w2) := sem(w3);
     al  w2  x2+h4      ;   w2 := addr of next descr;
     al  w3  x3+e13     ;   w3 := addr of next semaphore;
     se. w2   g102.     ;   if w2 <> top descr addr then
     jl.        a0.     ;   goto rep;
     rs. w3     g136.   ;   ext 381 := addr of all paper sem;
     am        -2000     ;
     rl. w2     g97.+2000 ;   ext(379) := paper manipulation sem;
     rs. w2     g137.  ;
     rl. w2     j4.    ;   ext(378) := remote batch printer convert que;
     rs. w2     g138.  ;
     al  w2  x2+e13    ;   ext(377):=rb printer wait sem;
     rs. w2     g139.  ;
     al  w0   i165      ;   w0 := reserve on disc;
     am        +2000     ;
     al  w1     f3-2000 ;   w1 := length of page;
     jl. w3    (j0.)    ;   reserve virt ( w0, w1, w2);
     am        -2000     ;
     al. w0     g6.+2000;   w0 := start of page;
     al  w2  x2+1       ;   writing bit;
     jl. w3    (j1.)    ;   move to virt (w0, w1, w2);
     rs. w2     g146.   ;   ext 385 := virt of papers

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


g135:    0  ,   380    ;    paper 0 queue addr;
g136:    0  ,   381    ;    addr of all paper sem;
g137:    0  ,   379    ;    paper manipulation sem;
g138:    0  ,   378    ;    remote batch printer;
g139:    0  ,   377    ;    rb printer wait sem;
g146:    0  ,   385    ;    virt of papers;
         f98,   147    ;    rel entry display convert;
         f97,   396    ;    rel entry select;
         f96,   397    ;    rel entry reject;
         0  ,  -1000   ;    end of externals;

     al  w0      1      ;   reserve paper descriptions
     am        -2000     ;
     rs. w0   (g97.+2000)  ;   sem value := 1;
     jl.       g10.     ;   goto initialize variables

j0:             12      ;*  reserve virt;
j1:             13      ;*  move to virt
j2:              0      ;*  first externals
j3: h. e13*i78+e13      ;*  semaphores
                19      ;
j4:                     ;
c. i190-1, 2*e13 , 19 z.  ;*  remote batch printer convert queue, rb printer wait sem
w.               0      ;   (or first external)

g115 = j0, g116 = j1, g117 = j2, g118 = j3, g119 = j4

e.
e.


\f


; bøt  28.12.71        variables          paper printer  ...13...


; variables for paper printers
;
; this page exists in as many incarnations as there
; is paper printers
;
;
; define start of page
g4:

b. k = 0,  f100 = f100 + 4  ;  count k-assignments
w.

d0:            0     ;   work 0  (in state 3 and 4: rel of cur in)
d1:            0,r.4 ;   work 1,2,3,4
d30:       0,r.8     ;   works
d31:            0     ;   work
d2:            0     ;   page 2  addr of virt addr
d3:            0     ;   page 3  addr of virt addr
d4:            0     ;   first of output buffer
d5:            0     ;   last  of output buffer (modified)
d47:           0     ;   last of output buffer (constant)


; actual convert operation

h. -1, r. e41-2      ;   space for operation (except chain)
w.
d6   =  k-e41        ;   chain (not used)
d7   =  d6 + 2       ;   type
                     ;     0  =  convert
                     ;     1  =  primout
                     ;     2  =  job controlled before -2  (end signal to printer);
                     ;     3  =  job controlled after  -2             -
d38  =  d6 + 4       ;   no of slices
d8   =  d6 + 5       ;   paper number
d9   =  d6 + 6       ;   document name
d10  =  d6 + 18      ;   interval
d11  =  d6 + 20      ;   project number
d12  =  d6 + 24      ;   username 0,2
d13  =  d6 + 28      ;   username 4,6
d14  =  d6 + 30      ;   addr of user id
d39  =  d6 + 32      ;   file name

d68  =  d39+2       ;    first of file name;
d69  =  d39+6       ;    last of file name;
d70  = -d6

;  the points start with a pseudo point consisting of the following variables:
d15  =  d6 + 40      ;   rel segmno  or  virt addr
d16  =  d15+ 2       ;   no of segments to release
d17  =  d15+ 3       ;   segment rel
d36  =  d15+ 4       ;   global line count
d37  =  d15+ 6       ;   global page count
d49  =  d6 + 48      ;    device host description
d50  =  d6 + 50      ;          -
d51  =  d6 + 52      ;   local term id of rb term (two chars, left justified)
d52  =  d6 + 56;+54  ;   local rb printer name (last of double word)
d60  =  d6 + 58      ;   no of errors during printing
d61  =  d6 + 59      ;   status of conversion:
                     ;               0 = ok
                     ;               1 = continues after endpaper
                     ;               2 = continues after malfunction
;                                    4 = rerouted remote convert file
d59  =  d6 + 60      ;+60: time of hard error
d62  =  d6 + 62      ;   device kind
d66  =  d6 + 66;+64  ;    catalog base of job
d70  =  d6 + 70;+68  ;    unused

d40 = k-2            ;   last of operation
\f


; sm 75.07.07        variables         paper printer ...14...


c. (:(:e41-d40+d6-2:) a. 4095:) - 1
m.***convert buffer size
z.
h.
d24:  0, r.i72*e42  ;   first point
d25 = k - e42    w. ;   last point



; output operation

d18:      5 < 12+i185 ;   standard-printer mode = 2 in operation (see page 16)
d19:           0     ;   first of transfer
d20:           0     ;   last  of transfer



d21:       0,r.4     ;   printer name
               0     ;   name table entry
d22:           0     ;   coroutine status
d23:           0     ;   segment claim
                     ;   rest no of segments to be locked
                     ;   in points
d26:           0     ;   top addr of input buffer
d27:           0     ;   local line count
d28:           0     ;   local page count
d29:           0     ;   rel paper address (zero for remote batch printers)
d32:           0     ;   virt addr of cur operation
d33:           0     ;   printer queue addr (undef for remote batch printers)
d34:           0     ;   virt of cur request line  or  0
d35:           0     ;   answer sem addr (undef for remote batch printers)
d41:       0,r.4     ;   paper name (remote batch printers: error count)
d42:           0     ;   segment buffer, virt
d43:           0     ;   printer device no
d44:           0     ;   id bit (zero for remote batch printers)
d45:  h.       0     ;   preferred paper (initially std paper = 0)
d46:           0 w.  ;   printer kind:  0 == standard printer
                     ;                  1 == remote batch printer
d53:           0     ;   operator mode (remote batch printers only)
d54:           0     ;   serial number of printer output
d55:           0     ;   saved statusword from output

f2 = k               ;   define length of page
k = g4 + f2          ;   reset k
e.
g5 = k - 2           ;   define last of page
f100 = f100 + 4      ;   count k-assignments


\f


; bøt  28.12.71      initialization       paper printer  ...15...


; initialize variables
;
; the coroutine descriptions are initialized
; the core store buffers are reserved
; the variables are reserved and initialized

b. a10, j20
w.

g10: jl. w3    (2)     ;    set externals;
g169:           40     ;

j12: (:e13*i71:)<12+19,80;  start printer queue;
         0  ,  -1000   ;    end of externals;

     am        (66)     ;
     dl  w1    +74      ;   w0, w1 := max interval;
     al. w3    j14.     ;   w3 := addr o fzero;
     jd    1<11+72      ;   set catalog base;
a0:  rl. w1     j5.     ; next;
     al  w1  x1+1       ;   incarnation := incarnation + 1;
     rs. w1     j5.     ;
     sh  w1     i71+i190;   if incarnation > no of printers + remote batch printers then
     jl.        6       ;
     am         2000    ;     goto initialize central;
     jl.        g9.     ;
     rl. w2     j6.     ;   w2 := coroutine descr addr;
     al  w0  x2+10      ;
     rs. w0     g4.+d2  ;   insert virt page 2 addr;
     al  w0  x2+12      ;
     rs. w0     g4.+d3  ;   insert virt page 3 addr;
     rl. w0     j8.     ;
     rs  w0  x2+6       ;   page0(descr) := central;
     al  w1  x1+39      ;   return (descr):= ((39+incarnation)
     ls  w1     15      ;   shift 3 + test) shift 12
     wa. w1     j9.     ;   + rel entry central;
     rs  w1  x2+4       ;   rel entry central;
     al  w0   i166      ;   w0 := variables on disc;
     al  w1     f2      ;   w1 := length of page;
     jl. w3    (j0.)    ;   reserve virt (w0, w1, w2);
     al  w2  x2+1       ;   insert writing
     rs. w2    j14.     ;   save virt;
     rl. w1     j6.     ;   w1 := descr addr;
     rs  w2  x1+8       ;   page1(descr) := variables;
     jl. w3    (j2.)    ;   put in active queue;
     al  w1  x1+e12    ;   descr addr :=
     rs. w1     j6.    ;     descr addr + length of descr;
\f



; re  22.7.1974      initialization     paper printer    ...15a...
     rl. w0     j5.    ;   w0 := incarnation;
     rl. w1     j7.    ;   w1 := actual buffer start;
     sl  w0     i71+1  ;   if incarnation > no of printers then
     am         e47-e40;     use remote batch printer buffer size;
     al  w2  x1+e40-2  ;   w2 := actual buffer end;
     ds. w2     g4.+d5 ;   save buffer limits on page;
     rs. w2     g4.+d47;
     sl  w0     i71+1  ;   if incarnation > no of printers then
     am         e47-e40;     use remote batch printer buffer size;
     al  w1  x1+e40    ;   actual buffer start :=
     rs. w1     j7.    ;   actual buffer start + length;
     sl  w0     i71+1  ;   if incarnation > no of printers then
     jl.        a2.    ;     goto remote batch printer;
     am.       (j5.)   ;   w2 := deviceno of
     bz. w2    j15.    ;   printer(incarnation)*2;
     rs. w2     g4.+d43;   save device no;
     ls  w2      1     ;
     wa  w2     74     ;   w2 := proc descr addr of printer;
     rs. w2     g4.+d21+8; set name table address;
     sl  w2    (76)    ;   if illegal device number then
     jl.        a3.    ;     goto alarm;
     rl  w2  x2         ;
     al. w3     g4.+d21 ;   w3 := printer name area on page;
     dl  w1  x2+4       ;
     ds  w1  x3+2       ;   move printer name from
     dl  w1  x2+8       ;   process description to
     ds  w1  x3+6       ;   variable page;
     jd    1<11+ 6      ;   initialize process


\f


; bøt  28.12.71      initialization       paper printer  ...16...


;*** test for centronics printer
     al  w0     i185   ;   mode in message :=
     rl  w1  x2        ;     if kind = 70
     sn  w1     70     ;       (i.e. medium speed telemultiplexor)
     al  w0     1<6    ;     then 1<6
     hs. w0     g4.+d18+1;   else i185;
;***



     al. w3     g4.    ;   w3 := page start;
     rl. w2     j16.   ;
     rs  w2  x3+d44    ;   idbit(page 1) := ident bit;
     ls  w2     1      ;
     rs. w2     j16.   ;   identbit := identbit shift 1;
     rl. w2    j12.     ;   w2 := queue addr;
     rs  w2  x3+d33    ;   actual queue(page 1):= w2;
     al  w2  x2+e13     ;   w2:= w2 + sem length;
     rs. w2    j12.     ;   queue addr := w2;
     rl. w2    j13.     ;   answer(page 1) :=
     rs  w2  x3+d35     ;   answer sem;
     al  w2  x2+e13     ;   answer sem :=
     rs. w2    j13.     ;   answer sem + sem length;
a1:  al  w0    i70      ; reserve virt buffer:  w0 := reserve on disc;
     al  w1    512      ;   w1 := length of buffer;
     jl. w3    (j0.)    ;   reserve virt (w0, w1, w2);
     al  w2  x2+1       ;   insert writing;
     rs. w2     g4.+d42 ;   buffer addr(page 1) := virt;
     al. w0     g4.     ;   w0 := start of page 1;
     al  w1     f2      ;   w1 := length of page 1;
     rl. w2    j14.     ;   w2 := virt of page 1;
     jl. w3    (j1.)    ;   move to virt ( w0, w1, w2);
     jl.        a0.     ;   goto next;

a2:  al. w3     g4.    ; remote batch printer:
     al  w0     1      ;
     hs  w0  x3+d46    ;   printer kind(page 1) := remote batch printer;
     al  w0     0      ;   idbit(page 1) := 0;
     rs  w0  x3+d44    ;
     jl.        a1.    ;   goto reserve virt buffer;

a3:  al. w0     j10.   ; alarm: <:illegal printer device number:>;
     jl. w3    (j4.)   ;


\f


; bøt  28.12.71      initialization       paper printer  ...17...



j0:             12      ;*  reserve virt
j1:             13      ;*  move to virt
j2:             24      ;*  put in active queue
j3:              0      ;*  base externals
j4:             31      ;*  init alarm
j5:              0      ;   incarnation number
j6: h. e12*i71+e12*i190, 18      ;*  coroutine descr addr;
j17:           e40*i71, 19      ;*  buffer area
j7:            e47*i190, 19      ;*  buffer area
j8:          0,387      ;*  virt addr of central
j9:        e92,f60   w. ;   test mode, entry in central
j10: <:<10>illegal printer device no.<10><0>:>,0,0
j11: h.    0,r.i71   w. ;   printer device no table
     h.
j13:    e13*i71,19      ;*  answer sem addr (only paper printers)
j14: w.          0      ;   virt of descr
j15 = j11-1
j16:             1      ;   identification bit;
c. (:e40*i71-4095:) o. (:e47*i190-4095:)
m. ***sum of printer buffer sizes exceeds 4095
z.




; define externals
g120 = j0, g121 = j1, g122 = j2, g123 = j3, g124 = j4
g126 = j6, g127 = j7, g128 = j8, g129 =j12, g125 = j13
g105 = j17



; initialize printer device numbers

a5:  am        -2000    ;
     am        -2000    ;
     al. w1    e35.-f100+4000;   w1 := start of option table
     al. w2    j11.     ;   w2 := start of page   table;
a6:  rl  w0  x1         ; rep:
     hs  w0  x2         ;   byte(w2) := word(w3);
     al  w1  x1+e37     ;   w1 := w1 + length of entry;
     al  w2  x2+1       ;   w2 := w2 + 1;
     am        -2000    ;
     am        -2000    ;
     se. w1    e36.-f100+4000;   if w1 <> top entry then
     jl.        a6.     ;   goto rep;
     al  w0      0      ;
     al  w2      0      ;
     jl      x3         ;   return to slang
     jl.        a5.     ;   goto initialize
j.
e.
\f



; bøt  28.12.71          central page       paper printer  ...18...



; central page
; ============
;
; this page takes care of all special situations not handled
; in the main loop.   all information about this is contained
; in the page-1 variable  state
;
; state has the following contents:
;
;     bit value   contents
;        1
;        2        progress
;        4
;
;        8        waiting for operator message (queue)
;
;       16        end of paper
;       32        hard error        printer bits
;       64        disconnected
;
;      128        wait for start operation
;
; progress defines the actual state of printing:
;
;     value
;
;        0         no paper found
;        1         ready for printing, operation saved
;                                    , points initialized
;        2         head printed
;        3         text conversion started
;        4         -2 passed
;        5         text ended
;        6         end printed, conversion not terminated
;
;
; the contents of state will be handled in the following
; order:
;        1.  operator messages
;        2.  hard error / disconnected
;        3.  end paper
;        4.  progress
;
; the handling of each part of state will allways result in a
; changing of state (normally a simplification) and as a rule
; a return to the central entry.
;
; when progress = 3 or 4  and the rest of state = 0, return
; is performed to the main loop.


\f


; bøt  28.12.71          central page       paper printer  ...19...

g2:
k = 10000,  f100 = f100 + 4   ;  count k-assignments

b. b100, c50
w.

; the names are used as follows:
;
;   a-names   local labels
;   b-names   global variables
;   c-names   global labels
;   d-names   global variables on page 1
;   j-names   local  variables
;
;   i- and e- names are options
;   f- and g- names are super global addresses used in
;                   other pages and in initialization
;
;   the b- and c- names have same meaning in this page and in
;   the main loop and in the triangle page
;
;
;   the pages are used as follows:

b0:      0   ;   page 0  this page
b1:      0   ;   page 1  variables
b2:      0   ;   page 2  operations
b3:      0   ;   page 3  input buffer
b4:      0   ;   page 4  not used (= zero)
     71<12+0        ; pageident:  central page


; entries in central logic

b5:      1   ;*  send and wait
b6:      2   ;*  send and wait fast
b7:      3   ;*  lock simple
b8:      4   ;*  open simple
b9:      5   ;*  lock chained
b10:     6   ;*  open chained
b11:     7   ;*  get pages
b12:     8   ;*  page jump
b15:    25   ;*  call
b16:    32   ;*  prepare access
b17:    33   ;*  terminate access
b18:    21   ;*  priv output


; semaphores

b20:   380   ;*  first paper queue
b21:   381   ;*  printer wait
b22:    67   ;*  banker queue
b23:    60   ;*  segments free
b24:    61   ;*  segments full
b25:   382   ;*  convert operations
       388   ;* b25+2:   convert operations type 2
b27:    51   ;*  request display queue
b28:    52   ;*  request lines
b29:     0   ;-  answer sem from banker (ext 76 + e13)
b30:    78   ;*  reserve banker access
b31:    74   ;*  catalock
b32:   379   ;*  paper manipulation
b33:   378   ;*  rb convert queue


\f


; bøt  28.12.71          central page       paper printer  ...20...


; virtual addresses

b41:   383   ;*  first of super buffer
b42:   384   ;*  top   of super buffer
       385   ;*  virt and
b43:   f90   ;   rel  of next free paper
       386   ;*  virt and
b45:   f21   ;   rel  of return to main loop
b46:   435   ;*  virt of account buf;
b47:   436   ;*  virt and
b48:   431   ;*  rel  of account code;
b81:   389   ;*  virt of triangle page
b82:   f70   ;   rel of print front page
b83:   f71   ;   rel of print last page


; input operation

b50:   3<12  ;   operation
b51:     0   ;   first of transfer
b52:     0   ;   last  of transfer
b53:     0   ;   segment number


; miscellaneous constants and variables

b60:                7   ;   mask progress
b61:             -1-7   ;   clear progress
b62:          <:   :>   ;   spaces
b63:          <:***:>   ;   stars
b69:              e13   ;   size of semafor
b70:              e42   ;   length of point
                    2   ;
b71:                2   ;   update pointers, malfunction status, malfunction status
b72:               10   ;
             2<12 + 1   ;   banker operation -
b74:         1<12 + 0   ;   contents (2,4 or 6), error count increment, error count increment
b75:               -2   ;*  boss private interval start
b76:               -1   ;*  boss private interval end
b77:  <:printer <0>:>   ;   operator text fixed part
b78 = k - b77 + 10      ;   operator text rel of var part


\f


; bøt  28.12.71          central page       paper printer  ...21...


; entry central page
;
; entry parameter :  state (in x3+d22)
;
; the central page will first interprete
; a possible operation in the printer queue
;
; then the printer state will be handled
; and at last, the progress
;
; all parts of state may change during the
; handling, and this entry will be entered
; several times


b.  j4
w.

c10: rl  w1  x3+d22     ;   if wait bits in state
     rl  w0  x3         ;
jd-1                   ;   w1:=state
     sz  w1    128+8    ;   > 0 then
     jl.       c11.     ;   goto prepare examine;
     ls  w1     -4      ;
     la. w1    b60.     ;   extract printer state;
     ba. w1  x1+j0.     ;
     jl.     x1+j0.     ;   goto action (printer state);


; prepare examine queue
;
; the queue bit in state (w1) is
; cleared

c11: sz  w1      8      ;   if queue bit set then
     al  w1  x1-8       ;   state := state
     rs  w1  x3+d22     ;   - queue bit;


; examine queue
;
; the operation is locked and interpreted
; on exit w1 = param value  and the operation
; is released

c12: rl  w2  x3+d33     ;
     jl. w3    (b9.)    ;   lock (printer queue);
     bz  w2  x1+3       ;   w2 := type * 2
     ls  w2      1      ;
     al  w0      0      ;
     rs  w0  x1+2       ;   release operation;
     rs  w0 (x3+d2)     ;   release page 2;
     rl  w1  x1+4       ;   w1 := param;
     rl  w0  x3+d22     ;
jd-1                   ;   w0:=state, w1:=param
     la. w0  x2+j2.     ;   st := state and mask (w2);
     sl. w0 (x2+j3.)    ;   if st < min(w2)  or
     sl. w0 (x2+j4.)    ;      st > max(w2)  then
     jl.       c30.     ;   goto alarm;
     ls  w2     -1      ;   w2 := type;
     ba. w2  x2+j1.     ;
     jl.     x2+j1.     ;   goto action (type);


\f


; bøt  28.12.71          central page       paper printer  ...22...


; printer state  action table
h.
j0:   c15. , c16. , c17. , c17. , c18. , c18. , c18. , c18.
;  no bits , end  , hard error  ,   disconnected


; operations   action table

j1:   c30.  ,  c20.  ,  c21.  ,  c22.  ,  c23.  
;   alarm     start  , repeat ,  kill  , change  
w.


;  state masks
;  minimum state values
;  top     state values
;
;   no op  ,  start   ,   repeat ,  kill , change  
j2:    0   ,     0    ,    128+7 ,  128+7,   128+7 
j3:    1   ,    -1    ,      3   ,    3  ,   128+1   
j4:   -1   ,     1    ,      4   ,    4  ,   128+2   
e.


; procedure  reset points
;
;  w1 = no of points to release
;  w2 = return
;
; the top in the points is calculated as first point +
; no of points to release * point length.
; in case of  job controlled output  all segments locked
; in points before  (and inclusive) top  will be released by opening the
; simple semaphore  segments full
;
; then top point will be moved to first point,  top point + 1
; will be moved to second point and so on, letting last point
; fill the ending points
;
; at last the local line-  and page- counters will be
; cleared


b.  a10, j5
w.

c13: rs. w2     j1.     ;   save return;
     wm. w1    b70.     ;   top := no of points *
     al  w1  x1+d24     ;   point length + rel of
     sl  w1     d25+e42 ;   first point;
     al  w1     d25     ;   if top > top of points then
     wa. w1     b1.     ;   top := last points;
     rs. w1     j0.     ;   save abs of top;


\f


; bøt  28.12.71          central page       paper printer  ...23...


; reset points (continued)

     rl  w1  x3+d7      ;   if type <>
     so  w1      2      ;   job controlled output then
     jl.        a3.     ;   goto move;
     al  w2  x3+d24-e42 ;   cur := addr of first point - point length;
     al  w0      0      ;
     al  w1      0      ;   segm := 0;
a1:  sl. w2    (j0.)    ; test:  if cur = top then
     jl.        a7.     ;   goto set claims;
     ba  w1  x2+2+e42   ;   segm := segm + no of
jd-1
     hs  w0  x2+2+e42   ;   segments to release(cur + point length);
     al  w2  x2+e42     ;   cur := addr of next point;
     jl.        a1.     ;   goto test;
a7:  rl  w0  x3+d23     ; set claims:
     wa  w0      2      ;   segment claim := segment claim
     rs  w0  x3+d23     ;   + no of segments to release;
a2:  sh  w1      0      ; release:  if segm = 0 then
     jl.        a3.     ;   goto move;
     rl. w2    b24.     ;
     jl. w3    (b8.)    ;   open (segments full);
     al  w1  x1-1       ;   segm := segm - 1;
     jl.        a2.     ;   goto release;
a3:  rl. w2     j0.     ; move : from := top;
     al  w1  x3+d24     ;   to := addr of first point;
a4:  rs. w2     j0.     ; next point:  save from;
     sn  w1  x2         ;   if to = from then
     jl.        a6.     ;   goto finis;
     al  w2      0      ;   rel := 0;
a5:  am.       (j0.)    ; next word:
     rl  w0  x2         ;   word(to) :=
     rs  w0  x1         ;   word(from + rel);
     aa. w2    b71.     ;   update to and rel;
     se  w2    e42      ;   if rel < point length then
     jl.        a5.     ;   goto next word;
     wa. w2     j0.     ;   from := addr of next point to move;
     sh  w2  x3+d25     ;   if from <= last then
     jl.        a4.     ;   goto next point;
     al  w2  x3+d25     ;   from := last point;
     al  w0      0      ;   no of segments to
     hs  w0  x2+2       ;   release := 0;
     jl.        a4.     ;   goto next point;
a6:  al  w0      0      ; finis:
     rs  w0  x3+d27     ;   local line count :=
     rs  w0  x3+d28     ;   local page count := 0;
     rl  w1  x3         ;
     jl.       (j1.)    ;   return;

j0:              0      ;   saved top  or  saved from
j1:              0      ;   saved return;

e.


\f


; bøt  28.12.71          central page       paper printer  ...24...


; procedure put back in queue
;
;  w2 = return
; the first point is inserted in the operation,
; which is set in front of the actual queue
; cur paper := no paper;

b. a10
w.


c14: ws. w2     b0.    ;
     rs  w2  x3+d1     ;   save rel return;
     bl  w1  x3+d46    ;
     se  w1     1      ;   if remote batch printer then
     jl.        a6.    ;     begin
     al  w1    4    ;    w1:= rerouted status
     bz  w0  x3+d60 ;    w0:= error count
     sl  w0    i180 ;    if this file will be rerouted now then
     hs  w1  x3+d61 ;    status:= rerouted remote convert file
     am        (66)    ;
     dl  w1    +74     ;
     al. w3     b4.    ;
     jd         1<11+72;     set boss max interval;
     rl. w3     b1.    ;
     al  w3  x3+d21    ;     remove process(printer name);
     jd         1<11+64;
     al  w0     0      ;     name table address := 0;
     rs  w0  x3+8      ;
     rl. w3     b1.    ;     end;
a6:  al  w1    i79     ;
     jl. w2    c13.    ;   reset points (std value);
     rl  w1  x3+d32    ;
     rs  w1 (x3+d3)    ;   page 3 :=  operation;
     rl. w2     b32.   ;   lock(paper manipulation);
     jl. w3    (b7.)   ;
     jl. w2    c29.     ;   release cur paper;
     rl. w2     b3.     ;   w2 := page 3;
     rl  w0  x3+d59    ;    move time of stop
     rs  w0  x2+d59-d6 ;    to operation
     rl  w0  x3+d60    ;   move status to
     rs  w0  x2+d60-d6 ;     operation;
     al  w3  x3+e42     ;   rel := length of point;
a0:  sn. w3    (b1.)    ;  while rel <> 0 do
     jl.        a1.     ;     begin
     ss. w3     b71.    ;     w2 con rel:=w2 con rel - 2 con 2;
     rl  w0  x3+d24     ;     last wd(p3.pspoint):=last wd(p1.first point);
     rs  w0  x2+d15-d6+e42;     end;
     jl.        a0.     ;

\f


; sm   75.06.09          central page       paper printer  ...24a...

a1:  dl  w2  x3+d37     ;
     al  w2  x2-1       ;   global counters :=
     al  w1  x1-1       ;   global counters - 1;
     ds  w2  x3+d37     ;
     bz  w2  x3+d8     ;   w2 := paper type;
     sl  w2     i68-1  ;
     al  w2     i78-1  ;
     wm. w2     b69.   ;   w2 := rel paper que sem
     wa. w2     b20.   ;       + first paper que;
     bz  w0  x3+d60    ;    if remote batch and
     bl  w1  x3+d46    ;      error count < option limit then
     sn  w1     1      ;
     sl  w0     i180   ;
     jl.        4      ;
     rl. w2     b33.   ;      w2:=rb convert queue;
     al  w1    -1      ;
     hs  w1  x3+d8     ;   paper type := no paper;
     rl. w1     b3.     ;   w1 := addr of operation;
     rl  w0  x3+d32     ;   w0 := virt op addr;
     rx  w0  x2+2       ;   first(sem) := w0; w0 := second;
     rs  w0  x1         ;   chain (operation) := second;
     rl  w0  x1         ;
     rl  w1  x3+d32     ;   if second = 0 then
     sn  w0      0      ;   last(sem) := virt op;
     rs  w1  x2+4       ;
     al  w0      0      ;
     rs  w0 (x3+d2)     ;   release page 2;
     rs  w0 (x3+d3)     ;   release page 3;
     jl. w3    (b8.)    ;   open simple (cur paper sem);
     rl. w2    b21.     ;
     jl. w3    (b8.)    ;   open (printer wait);
     rl. w2     b32.   ;   open(paper manipulation);
     jl. w3    (b8.)   ;
     al  w2  x3+d9     ;
     rl  w0  x3+d7     ;   if job controlled output
     sz  w0      2     ;   then
     jl.        a2.    ;   goto job controlled;
     jl. w3   (b17.)   ;   terminate access (document);
     jl.        a5.    ;   goto return;
\f


; re 24.9.73              central page           paper printer   ...25...


a2:  rl  w1  x3+d23     ; job controlled: w1:= segment claim;
a3:  sl  w1     i77-1   ;   for w1:= w1+1 while w1 < max segment claim do
     jl.        a4.     ;   open(segments free);
     rl. w2     b23.    ;
     jl. w3     (b8.)   ;
     al  w1  x1+1       ;
     jl.        a3.     ;
a4:  rl. w2    b24.     ;
     se  w1     i77     ;    if segment claim <> max segment claim then
     jl. w3    (b8.)    ;   open (segments full);
a5:  rl  w1  x3+d1      ;
     jl.     x1+b0.     ;   return

e.


\f


; bøt  28.12.71          central page       paper printer  ...26...



; normal printer status
;
; switch to action (progress);

b. j0
w.

c15: rl  w1  x3+d22     ;
     la. w1    b60.     ;   extract progress;
     ba. w1  x1+j0.     ;
     jl.     x1+j0.     ;   goto action(progress);
h.
j0:            c31.     ;  0  nextfile
               c43.     ;  1  print front page
               c32.     ;  2  start printing
               c19.     ;  3  return to main loop
               c19.     ;  4  return to main loop
               c44.     ;  5  print last page
               c33.     ;  6  end printing
w.
e.

; end paper  action
;
; put operation back in queue
; state := 0
; goto central;


c16:                   ;
     dl  w1     110    ;    w01:=clock
     ld  w1     5      ;    w0:=short clock
     rs  w0  x3+d59    ;    set time of paper out
     al  w0     1      ;   status := 1 (i.e. continue after endpaper);
     hs  w0  x3+d61    ;
     jl. w2    c14.     ;   put back in queue;
     al  w0      0      ;
     rs  w0  x3+d22     ;   state := 0;
     jl.       c10.     ;   goto entry central;


; release cur paper

c29: ws. w2     b0.     ;
     rs  w2  x3+d30+2   ;   save return;
     rl. w2    b43.-2   ;
     rs  w2 (x3+d2)     ;   page 2 := paper descr;
     jl. w3   (b11.)    ;
     rl. w1     b2.     ;
     wa  w1  x3+d29     ;   w1 := addr of state
     rl  w0  x1         ;     of cur paper;
     lo  w0  x3+d44    ;   remove idbit from users;
     ws  w0  x3+d44    ;
     rs  w0  x1         ;
     al  w0      0      ;
     rs  w0 (x3+d2)     ;   release page 2;
     am     (x3+d30+2)  ;
     jl.        b0.     ;   return;



\f


; bøt  28.12.71          central page       paper printer  ...27...

; hard error
; disconnected
;
; clear printer status   and set
; waiting for start + end paper+ queue bit
; goto print alarm;

b. a1, j5
w.

c17: am         j2      ; hard error:
c18: al  w1     j1      ; disconnected:
     rs  w1  x3+d30     ;   save alarm addr;
     dl  w1     110    ;    w01:=clock
     ld  w1     5      ;    w0:=short clock
     rs  w0  x3+d59    ;    set time of hard error
     rl  w0  x3+d60    ;   error count:=
     wa. w0     b74.   ;    error count+1;
     hl. w0     b71.   ;
     rs  w0  x3+d60    ;
     jl. w2    c14.     ;   put back in queue;
     am        (66)     ;
     dl  w1    +74      ;
     al. w3     b4.     ;
     jd    1<11+72      ;   set boss max interval;
     am.       (b1.)    ;
     al  w3   +d21      ;
     jd    1<11+10      ;   release printer
     rl. w3     b1.     ;
     al  w0      0      ;   printer name
     rs  w0  x3+d21+8   ;   table addr := 0;
     bl  w1  x3+d46    ;   state:=if remote batch then
                       ;     no paper found
     se  w1     1      ;   else wait for start;
     al  w0    128      ;
     rs  w0  x3+d22     ;   
     al  w0     -1      ;   type :=
     rs  w0  x3+d7      ;   change not allowed;
     rl. w2    b28.     ;
     jl. w3    (b9.)    ;   lock chained (w1, request op);
     bl  w0  x3+d46    ;   if remote batch printer then
     sn  w0     1      ;     operation := print line
     am         1-1<3  ;    else
     al  w0     1<3+1<1;    operation:=
     rs  w0  x1+2       ;   insert line;
     al  w2  x1+b78     ;   cur out := var text start;
     am     (x3+d30)    ;
     al. w1     b0.     ;
     jl. w3    c37.     ;   outtext (alarm);
     rl. w3     b1.     ;
     rl  w0  x3+d55     ;
     rl  w1  x3+d30     ;   saved status
     sn  w1     j0      ;   if hard error then
     jl. w3     c38.    ;   outnumber(saved status);
     jl.       c39.     ;   goto print;


; operator texts
; each text will be headed by printer id

j0 = k - b0
     <: hard error, decimal status = <0>:>
j1 = k - b0
     <: disconnected<0>:>
j2 = j0 - j1

e.


\f


; bøt  28.12.71          central page       paper printer  ...28...


;return to main loop

b. a5
w.

c19: rl  w1  x3+d0      ;
     al  w1  x1-2       ;   segmrel := segmrel - 2;
     rs  w1  x3+d0      ;
     rl  w0  x3+d7      ;   page 3 := if file
     rl  w1  x3+d42     ;   conversion then
     sz  w0      2      ;   work page else
     rl  w1  x3+d15     ;   buffer page;
     rs  w1 (x3+d3)     ;
     sz  w0      2      ;   if job output then
     jl.        a1.     ;   goto jump;
     jl. w3   (b11.)    ;   get pages;
     rl  w0  x3+d15     ;
     rs. w0    b53.     ;   move segment number
     rl. w1     b3.     ;   and page 3 limits
     al  w2  x1+510     ;   to input operation;
     ds. w2    b52.     ;
     al. w1    b50.     ;   w1 := operation addr;
     al  w2  x3+d9      ;   w2 := document name addr;
     jl. w3    (b6.)    ;   send and wait fast(w1, w2);
     sn  w0     1<1     ;   if not ok then
     jl.        a1.     ;
     rs  w1  x3+d0      ;   segm rel :=
     rs  w1  x3+d15     ;   segm no  := big;
a1:  dl. w3    b45.     ; jump: get main loop addr;
     jl.      (b12.)    ;   page jump;
\f


; re 24.9.73              central page          paper printer   ...29...




; start operation
;
; clear waiting for start
; release request line
; goto central

c20: rl  w1  x3+d22     ;
     sz  w1    128      ;   if no wait bit then
     jl.        a2.     ;      begin
     rl  w2  x3+d0      ;      segmrel := segmrel+2;
     al  w2  x2+2       ;
     rs  w2  x3+d0      ;      goto central entry;
     jl.       c10.     ;      end;
a2:  al  w1  x1-128     ;
     rs  w1  x3+d22     ;   remove wait bit in state;
     rl  w0  x3+d21+8   ;   if printer name
     se  w0      0      ;   table addr = 0 then
     jl.        a3.     ;     begin
     am        (66)     ;     w0, w1:= boss max interval;
     dl  w1    +74      ;
     al. w3     b4.     ;     w3 := addr of zero;
     jd    1<11+72      ;     set catalog base;
     am.       (b1.)    ;
     al  w3    +d21     ;     
     jd    1<11+6       ;     initialize process;
     rl. w3     b1.     ;
     rl  w2  x3+d4      ;     w2 := buffer addr;
     al  w1  x3+d18     ;     w1 := message addr;
     al  w0     12      ;     output := ff;
     rs  w0  x2         ;
     rs  w2  x1+2       ;     insert buffer limits;
     rs  w2  x1+4       ;
     al  w2  x3+d21     ;     w2 := printer name addr;
     jl. w3    (b5.)    ;     send and wait; end;
a3:  al  w1  x3+d30     ;   operation := work area;
     al  w0      1      ;
     rs  w0  x1+2       ;   op(2) := remove line;
     rl  w0  x3+d35     ;
     rs  w0  x1+4       ;   op(4) := answer sem addr;
     al  w0      0      ;
     rx  w0  x3+d34     ;   op(6) := line addr;
     rs  w0  x1+6       ;   line addr := 0;
     rl. w2    b27.     ;
     jl. w3   (b10.)    ;   open chained (op, request queue);
     rl  w2  x3+d35     ;
     jl. w3    (b7.)    ;   lock (answer sem);
     jl.       c10.     ;   goto central entry;

e.

\f


; bøt  05.02.72          central page       paper printer  ...30...



; repeat operation
;
; if the parameter (w1) < 0, it will
; be changed to the standard value.
; the procedure is only called when progress = 3

b. a5, j5
w.

c21: se  w1    -2      ;   if repeat all then
     jl.        a1.    ;      begin
     rs  w1  x3+d1     ;
     al  w1     i72    ;      reset point(max no of pages);
     jl. w2     c13.   ;
     rl  w0  x3+d7     ;
     sz  w0     2      ;      if file conversion then
     jl.        a2.    ;        begin comment initialize operation point;
     ld  w1    -100    ;        segmno := (segm to release :=)
     ds  w1  x3+d16+d15-d15;    segmrel :=
     ds  w1  x3+d37+d36-d36;    line,page counts := 0;
     jl. w2     c40.   ;        fix points;
     jl.        a2.    ;        end;
                       ;      goto reset counters;
a1:                    ;      end;
     sh  w1     -1      ;   if no of pages < 0 then
     al  w1    i79      ;   no of pages := standard;
     rs  w1  x3+d1      ;
     jl. w2    c13.     ;   reset points;
a2:  dl  w1  x3+d24+d37-d15; reset counters:
     ds  w1  x3+d37     ;   reset global counters;
     bz  w1  x3+d24+d17-d15;   rel cur in :=
     rs  w1  x3+d0      ;   rel segment (first point);
     rl  w0  x3+d24     ;   transfer segment no;
     rs  w0  x3+d15     ;
     rl  w2  x3+d4      ;
     rs  w2  x3+d19     ;
     al. w1     j0.     ;
     jl. w3    c37.     ;   outtext(operator repeat);
     am.       (b1.)    ;
     rl  w0    +d1      ;   outnumber(no of pages);
     se  w0    -2      ;   if repeat all then
     jl.        a3.    ;
     al. w1     j2.    ;     outtext ( all );
     jl.        a4.    ;
a3:  jl. w3    c38.     ;
     al. w1     j1.     ;
a4:  jl. w3    c37.     ;   outtext(termination);
     rl. w3     b1.     ;
     al  w2  x2-2       ;
     rs  w2  x3+d20     ;
     al  w1  x3+d18     ;
     al  w2  x3+d21     ;
     jl. w3    (b5.)    ;   print buffer;
     jl.       c10.     ;   goto central entry;
j0: <:<10><10><10>***operator repeat <0>:>
j2: <:all:> ; (no termination of text)
j1: <: ***<12><0>:>

e.
\f


; re 24.9.73              central page          paper printer    ...31...


; change operation
;
; a new paper is selected
; w1 = paper no

b. j5
w.
c23: rl  w2  x3+d22     ;
     rl  w0  x3+d7      ;
     sz  w2    128      ;   if not waiting for start
     sh  w0     -1      ;   or type < 0 then
     jl.       c30.     ;   goto alarm;
     sl  w1    i78      ;
     al  w1    i78-1    ;   variable d30 :=
     hs  w1  x3+d45    ;   preferred paper :=
     rs  w1  x3+d30     ;   new paper no;
     jl. w2    c14.     ;   put back in queue;
     al  w0    128      ;   state := waiting for start;
     rs  w0  x3+d22     ;
     rl. w2    b43.-2   ;
     am        +2000    ;
     al  w3    f93 -2000  ;
     jl. w1   (b15.)    ;   call (set paper name);
     jl.       c20.     ;   goto start operation;

e.


\f


; bøt  28.12.71          central page       paper printer  ...32...


; kill operation
;
; print kill-message on printer
; goto kill-action (type);


b. a35, j10
w.


c22: rl  w0  x3+d28     ;   if local page counter
     sh  w0   i170      ;   < min value then
     jl.       c30.     ;   goto alarm;
     rl  w2  x3+d4      ;   cur out := first of transfer
     rs  w2  x3+d19     ;   := first of buffer;
     al. w1     j0.     ;
     jl. w3    c37.     ;   outtext(<:output killed:>);
     rl. w3     b1.     ;   restore w3;
     al  w2  x2-2       ;   last of transfer :=
     rs  w2  x3+d20     ;   cur out - 2;
     al  w1  x3+d18     ;   w1 := message addr;
     al  w2  x3+d21     ;   w2 := printer name addr;
     jl. w3    (b5.)    ;   send and wait (w1, w2);
     rl  w1  x3+d7      ;
     ba. w1  x1+j1.     ;
     jl.     x1+j1.     ;   goto kill action (type);


j0:  <:<10><10><15>*** output killed ***<10><0>:>
h.
j1:  a1. , a10. , a20. , a20.
w.


; kill action (convert file);
;
; fix points to eternal segment no;
; progress := end text;
; goto entry central (via end kill);


a1:  rl. w0     j2.     ;
     rs  w0  x3+d15     ;   segm no := eternal;
     al  w0      5      ;   progress := end text;
     jl.       a30.     ;   goto end kill;

j2  = b63               ;   use stars as eternal value;


\f


; bøt  28.12.71          central page       paper printer  ...33...


; kill action (convert primary output);
;
; skip until  -2
; set points to this point
; progress := -2 passed
; goto entry central (via end kill);

a10: rl. w1     b3.     ;
     al  w2  x1+510     ;   w2 := last of input;
     wa  w1  x3+d0      ;   w1 := addr of cur input word;
a12: rl  w0  x1         ; rep: if word(w1)
     sh  w0     -1      ;   < 0 then
     jl.       a16.     ;   goto test neg;
a13: al  w1  x1+2       ;   w1 := addr of next input;
     sh  w1  x2         ;   if w1 <= last then
     jl.       a12.     ;   goto rep;
     rl  w1  x3+d15     ;
     al  w1  x1+1       ;   segmno :=
     rs  w1  x3+d15     ;   segmno + 1;
     rs. w1     j6.     ;
     rl. w1     b3.     ;   w1 := first of buffer;
     ds. w2     j5.     ;   save buffer limits;
     al. w1     j4.     ;   w1 := message addr;
     al  w2  x3+d9      ;   w2 := area name addr;
     jl. w3    (b6.)    ;   send and wait fast(w1, w2);
     se  w0    1<1      ;   if not normal answer then
     jl.       a14.     ;   goto terminate;
     rl. w1     b3.     ;   w1 := first of buffer;
     al  w2  x1+510     ;   w2 := last of buffer;
     jl.       a12.     ;   goto rep;
a14: al  w0      5      ; terminate: progress := end text;
     jl.       a30.     ;   goto end kill;
a16: sn  w0     -2      ; test neg:  if word = -2 then
     jl.       a18.     ;   goto exit;
     se  w0     -1      ;   if word <> -1 then
     jl.       a13.     ;   return;
     jl.       a14.     ;   goto terminate;
a18: ws. w1     b3.     ; exit:
     rs  w1  x3+d0      ;   save rel of buffer
     rs  w1  x3+d17     ;   save rel in operation;
     al  w0      4      ;   progress := -2 passed;
     jl.       a30.     ;   goto end kill;

j4:      3<12 ,  0      ; input operation
j5:              0      ;   buffer limits;
j6:              0      ;   segment no;



\f


; bøt  28.12.71          central page       paper printer  ...34...


; kill action (convert job-controlled output);
;
; release points and buffer
; skip until -1 or -2
; progress := end text
; goto central entry (via end kill);


a20: al  w1    i77-1    ;   no := max claim -
     ws  w1  x3+d23     ;   segment claim;
a21: sh  w1      0      ; test: if no = 0 then
     jl.       a22.     ;   goto empty;
     rl. w2    b23.     ;
     jl. w3    (b8.)    ;   open (segments free);
     al  w1  x1-1       ;   no := no - 1;
     jl.       a21.     ;   goto test;
a22: rl. w1     b3.     ; empty:
     al  w2  x1+510     ;   w2 := addr of last word;
     wa  w1  x3+d0      ;   w1 := addr of cur word;
a23: rl  w0  x1         ; rep:
     so  w0     -2      ;   if cur word = -1 or -2 then
     jl.         4      ;
     jl.       a26.     ;   goto neg;
a24: al  w1  x1+2       ;   w1 := addr of next word;
     se  w1  x2         ;   if w1 <= last then
     jl.       a23.     ;   goto rep;
     rl. w2    b23.     ;
     jl. w3    (b8.)    ;   open (segments free);
     rl  w1 (x3+d3)     ;   virt := virt addr of
     al  w1  x1+512     ;   page3 + 512;
     sn. w1   (b42.)    ;   if virt = top then
     rl. w1    b41.     ;   virt := first;
     rs  w1 (x3+d3)     ;   virt of page3 := virt;
     rl. w2    b24.     ;
     jl. w3    (b7.)    ;   lock segments full);
     rl. w1     b3.     ;   w1 := addr of first;
     al  w2  x1+510     ;   w2 := addr of last;
     jl.       a23.     ;   goto rep;
a26: al  w1      3      ; neg: if cur word = -2 then
     se  w0     -1      ;   type := 3; comment
     rs  w1  x3+d7      ;   account := true;
     al  w0    i77-1    ;   segment claim :=
     rs  w0  x3+d23     ;   max claim - 1;
     al  w0      5      ;   progress := 5;


; end kill
;
; set progress in state
; fix points  and
; goto central entry;

a30: rl  w1  x3+d22     ;   state := state
     la. w1    b61.     ;   except progress
     wa  w1      0      ;   + progress;
     rs  w1  x3+d22     ;
     jl. w2    c40.     ;   fix points;
     jl.       c10.     ;   goto central entry;

e.


\f


; bøt  28.12.71          central page       paper printer  ...35...



; alarm  illegal command
;
; print operator alarm  via  print


b. j1
w.


c30: rl  w1  x3+d0      ;
     al  w1  x1+2       ;   segmrel := segmrel+2;
     rs  w1  x3+d0      ;
     rl. w2    b28.     ;
     jl. w3    (b9.)    ;   lock chained (request line);
     al  w0      3      ;   operation := print line;
     rs  w0  x1+2       ;
     al  w2  x1+b78     ;
     al. w1     j0.     ;
     jl. w3    c37.     ;   outtext (alarm);
     jl.       c39.     ;   goto print;

j0:
     <: illegal command<0>:>

e.


; next file
;
; all paper sem is locked
; if cur paper sem value < 1 then search new paper
; initialize points
; increase state by 1
; if no new paper format then goto central
; state := state or queue bit or wait bit
; insert change paper message via print

b. a5, j5
w.

c31: bz  w0  x3+d8     ;
     rs  w0  x3+d1     ;   work1 := act paper no;
     dl. w3     b43.   ;   page jump(next paper);
     jl.       (b12.)  ;
c42:                   ; return



\f


; bøt  28.12.71          central page       paper printer  ...36...


a2:  rl. w2     b2.     ; init:  w2 := op addr;
     al  w1  x3+d7      ;   w1 := addr of saved op;
a3:  rl  w0  x2+2       ; rep:
     rs  w0  x1         ;   page1(w1) := operation(w2);
     aa. w2    b71.     ;   update w1, w2;
     sh  w1  x3+d40     ;   if w1 < saved op top then
     jl.        a3.     ;   goto rep;
     jl. w2    c40.     ;   fix point;
     al  w0      0      ;
     rs  w0  x3+d27     ;   local counters := 0;
     rs  w0  x3+d28     ;
     rl  w1  x3+d22     ;
     al  w1  x1+1       ;   state := state + 1;
     rs  w1  x3+d22     ;
     al  w0     i77    ;    segment claim := max segment claim;
     rs  w0  x3+d23    ;
     bz  w0  x3+d8     ;   if actual paperno
     sn  w0 (x3+d1)    ;   =  last   paperno then
     jl.       c10.    ;   goto central entry;
     bl  w0  x3+d46    ;   if remote batch printer then
     sn  w0     1      ;
     jl.        c10.   ;     goto central entry;
     al  w1  x1+128+8   ;   state := state + queue bit
     rs  w1  x3+d22     ;   + waiting for start bit;
a4:  rl  w2  x3+d33     ;   while queue value > 0 do
     rl  w0  x2         ;     lock chained (queue);
     sh  w0      0      ;
     jl.        a5.     ;
     jl. w3    (b9.)    ;
     al  w0      0      ;   release operation
     rs  w0  x1+2       ;
     jl.        a4.     ;
a5:  rl. w2    b28.     ;   
     jl. w3    (b9.)    ;   lock chained (request line);
     al  w0      1<3+1<1     ;
     rs  w0  x1+2       ;   operation := insert line;
     al  w2  x1+b78     ;   set cur out;
     al. w1     j0.     ;
     jl. w3    c37.     ;   outtext (change);
     am.       (b1.)    ;
     bz  w0    +d8      ;
     jl. w3    c38.     ;   outnumber (paper no);
     am.       (b1.)    ;
     bz  w0    +d8      ;   if paper <>
     sl  w0    i68-1    ;   named paper then
     jl.       c39.     ;   goto print;
     al. w1     j1.     ;
     jl. w3    c37.     ;   outtext ( = );
     am.       (b1.)    ;
     al  w1   +d41      ;
     jl. w3    c37.     ;   outtext (paper name);
     jl.       c39.     ;   goto print;

j0:  <: change to <0>:> ;
j1:  <:  = <0>:>        ;


e.


\f


; bøt  28.12.71          central page       paper printer  ...37...


; start printing
;
; separate start actions are performed for
; jobcontrolled output and file output

b. a10
w.

c32: rl  w1  x3+d22     ;
     al  w1  x1+1       ;   state := state + 1;
     rs  w1  x3+d22     ;
     bz  w0  x3+d24+d17-d15;
     rs  w0  x3+d0      ;   transfer segment rel;
     rl  w0  x3+d7      ;
     so  w0      2      ;   if file conversion then
     jl.        a5.     ;   goto start file;

; start job controlled conversion

     rl  w0  x3+d15     ;   page 3 :=
     rs  w0 (x3+d3)     ;   first of buffer;
     rl. w2    b24.     ;
     jl. w3    (b7.)    ;   lock(segments full);
     al  w0    i77-1    ;   segment claim :=
     rs  w0  x3+d23     ;   max no of segments - 1;
     jl.       c10.     ;   goto central entry;

; start file conversion

a5:  dl  w1  x3+d10     ;   w0, w1 := interval;
     al  w2  x3+d9      ;   w2 := doc name addr;
     jl. w3   (b16.)    ;   prepare access (w0, w1, w2);
     jl.        a6.     ;   goto error;
     bz  w0  x3+d61     ;    if status
     se  w0     4       ;    <> remote-rerouted then
     jl.        c10.    ;    goto central entry
     rl. w2     b28.
     jl. w3    (b9.)    ;    lock chained(request line)
     al  w0     3       ;    w0= print line
     rs  w0  x1+2       ;    
     al  w2  x1+b78     ;    x2= cur out
jd-1
     al  w0     32      ;    w0= space
     rs  w0  x2         ;    output space
     rl  w0  x3+d7      ;    w0= type
     al  w3  x3+d39     ;    w3text= filename
     se  w0     0       ;    if type <> convertfile then
     al. w3     a10.    ;    w3text= primout
     dl  w1  x3+2
     ds  w1  x2+4       ;    move w3text to line
     dl  w1  x3+6
     al  w1  x1+32      ;    add one space
     ds  w1  x2+8       ;
     dl. w1     a9.     ;    text= from
     ds  w1  x2+12
     rl. w3    b1.      ;    w3 = page1
     dl  w1  x3+d12     ;
     ds  w1  x2+16      ;    output username
     dl  w1  x3+d13     ;
     al  w1  x1+32      ;    add one space
     ds  w1  x2+20      ;
     al  w2  x2+22      ;    update cur out
     rl  w0  x3+d50     ;    w0=hostid
     jl. w3     c38.    ;    outnumber(hostid)
     jl.        c39.    ;    goto print (returns to central entry)
a10: <:primout<0><0><0><0><0>:> ; 12 chars
a9=k+2, <:from  :> ; 6 chars
a6:                     ; error:
al  w0  8<6+15 ;
al  w1  x3+d9  ;    testout(name);
jl. w3    (b18.);
     al  w0      2      ;
     rs  w0  x3+d9      ;   name := name table
     rs  w0  x3+d9+8    ;   addr := dummy;
     jl.       c10.     ;   goto central entry;

e.


\f


; bøt  28.12.71          central page       paper printer  ...38...


; end printing
;
; release convert operation
; progress := 0;
; release resources

b. a5
w.

c33: rl  w0  x3+d22    ;
     la. w0    b61.    ;   progress := 0;
     rs  w0  x3+d22    ;
     bl  w0  x3+d46    ;
     se  w0     1      ;   if remote batch printer then
     jl.        a3.    ;     begin
     am        (66)    ;
     dl  w1    +74     ;
     al. w3     b4.    ;
     jd         1<11+72;     set boss max interval;
     rl. w3     b1.    ;
     al  w3  x3+d21    ;
     jd         1<11+64;     remove process(printer name);
     rl. w3     b1.    ;     end;
a3:  rl  w0  x3+d32     ;
     rs  w0 (x3+d2)     ;   page 2 :=
     jl. w3   (b11.)    ;   convert operation;
     rl. w1     b2.     ;   w1 := abs addr of operation;
     rl  w0  x3+d36     ;
     rs  w0  x1+d36-d6  ;   transfer global
     rl  w0  x3+d37     ;   counters to operation;
     rs  w0  x1+d37-d6  ;
     al  w0     0      ;   status in operation := 0
     rs  w0  x1+d60-d6 ;     (i.e. ok termination);
     rs  w0  x1+d62-d6 ;    device kind:=undef;
     rl  w0  x3+d7      ;
     so  w0      2      ;   if file output then
     jl.        a0.     ;   goto terminate file;
     al  w1    i77      ;   while any locked segment do
     ws  w1  x3+d23     ;
a2:  sh  w1      0      ;
     jl.        a4.     ;   open(segments free);
     al  w1  x1-1       ;
     rl. w2    b23.     ;
     jl. w3    (b8.)    ;
     jl.        a2.     ;   

a4:                    ;
;***test begin
     rl. w0    (b23.)  ;   w0 := value of segments free;
     rl. w1    (b24.)  ;   w1 := value of segments full;
     sn  w0     i67    ;   if segments free <> buffer size or
     se  w1     0      ;      segments full <> 0 then
c.-1, o74, z. ; (bossfault xref)
     jd        -74     ;      bossfault(74);
;***test end

     rl. w1     b2.    ;
     rl. w2     b25.+2 ;   open chained(convert operation, job convert queue);
     jl. w3    (b10.)  ;
     jl.        c10.   ;   goto central entry;
\f


; re 24.9.73               central page           paper printer    ...39...

a0:  rl. w2     b25.   ;   open chained(convert operation, convert queue);
     jl. w3    (b10.)  ;
     rl. w2     b30.    ; terminate file:
     jl. w3    (b7.)    ;   lock(banker access);
     dl. w1     b74.    ; set banker operation:
     ds  w1  x3+d30+4   ;   op(2) := 2<12 + 1;
     al  w0     0       ;   op(4) := 1<12 + 0;
     rs  w0  x3+d30+6   ;   op(6) :=        0;
     al  w2  x3+d9      ;
     jl. w3   (b17.)    ;   terminate access (document);
     dl  w1  x3+d10     ;   w0, w1 := interval (document);
     sn. w0   (b75.)    ;   if interval (document)
     se. w1   (b76.)    ;   <> interval (boss) then
     jl.        a1.     ;   goto exit;
     rl. w2     b31.    ;   lock(catalock);
     jl. w3    (b7.)    ;
     dl  w1  x3+d10     ;   w0w1:= interval(document);
     al. w3     b4.     ;   w3 := addr of zero;
     jd    1<11+72      ;   set document interval;
     am.       (b1.)     ;
     al  w3    +d9      ;   w3 := name addr;
     jd    1<11+48      ;   remove document;
     se  w0     0       ;    if result <> 0 then
c.-1, o72, z. ; (bossfault xref)
     jd        -72      ;      bossfault(72);
     rl. w2     b31.    ;   open(catalock);
     jl. w3    (b8.)    ;
     rl. w0    b74.     ;   op(6) := 1<12 +
     ba  w0  x3+d38     ;   no of slices;
     rs  w0  x3+d30+6   ;
a1:  al  w1  x3+d30     ; exit:  w1 := addr of op;
     rl. w2    b22.     ;   w2 := banker queue sem addr;
     jl. w3   (b10.)    ;   open chained (w1, w2);
     rl. w2    b29.     ;
     jl. w3    (b7.)    ;   lock (answer);
     rl. w2    b30.     ;
     jl. w3    (b8.)    ;   open (banker access);
     jl.       c10.     ;   goto central entry;

e.
\f


; bøt  18.1.72         central page       paper printer  ...40...


; outtext
;
; transfer text from area (cur in) to
; area (cur out)
;
; w0      -         destroyed
; w1   cur in       destroyed
; w2   cur out      cur out
; w3   return       return


c37: rl  w0  x1         ;   word(cur out) :=
     rs  w0  x2         ;   word(cur in);
     aa. w2    b71.     ;   update cur in, out;
     sz  w0    255      ;   if not end text then
     jl.       c37.     ;   goto outtext;
     jl      x3         ;   return



; outnumber
;
; convert number to text in area(cur out)
;
; w0   number      destroyed
; w1     -         destroyed
; w2   cur out     cur out
; w3   return      return

b. a10, j10
w.

c38: al  w2  x2+4       ;   cur out := cur out + 4;
     ds. w3     j0.     ;   save cur out, return;
     al  w1      0      ;   place := 0;
     rs  w1  x2-4       ;   text area  := 0;
     rs  w1  x2-2       ;
     am         16      ;   place := 16;
a0:  al  w1  x1+8       ; next: place := place + 8;
     se  w1     24      ;   if place <> 24 then
     jl.        a1.     ;   goto char;
     al  w2  x2-2       ;   text := text - 2;
     al  w1      0      ;   place := 0;
a1:  al  w3      0      ; char:
     wd. w0    b72.     ;   number := number//10;
     al  w3  x3+48      ;   char := remainder + 48
     ls  w3  x1         ;   shift place;
     wa  w3  x2         ;   text := text +
     rs  w3  x2         ;   char;
     se  w0      0      ;   if number <> 0 then
     jl.        a0.     ;   goto next;
     dl. w3     j0.     ;   restore cur out, return;
     jl      x3         ;   return;
                 0      ; saved cur out;
j0:              0      ; saved return;
e.



\f


; bøt  28.12.71          central page       paper printer  ...41...

; print
;
; on entry w2 = last cur out (= top of text);
; the operator text has been inserted in the
; operation in rel b78.  the text is headed

c39: al  w1  x2-6       ;
     ws. w1     b2.     ;
     rl. w2     b2.     ;   insert text length;
     rs  w1  x2+4       ;
     al  w2  x2+6       ;   w2 := start of text;
     al. w1    b77.     ;   
     jl. w3    c37.     ;   outtext (printer);
     am.       (b1.)    ;
     rl  w0    d43      ;
     jl. w3    c38.     ;   outnumber (device no);
     rl. w3     b1.     ;
     rl. w1     b2.     ;   w1 := abs of operation;
     rl  w0  x1+2       ;
     rl  w2 (x3+d2)     ;   if operation =
     so  w0      1      ;   insert line then
     rs  w2  x3+d34     ;   save virt of operation;
     rl. w2    b27.     ;   w2 := request queue;
     jl. w3   (b10.)    ;   open chained (w1, w2);
     jl.       c10.     ;   goto central entry;


; fix point
;
;  w2 = return
; the point from the operation is
; copied to all points

b. a1, j0
w.
c40: rs. w2     j0.     ;   save return;
     al  w1  x3+d24     ;   w1 := addr of first point;
a0:  al  w2  x3+d15     ; next point: w2 := addr of op point;
a1:  rl  w0  x2         ; move:  move point word to
     rs  w0  x1         ;   point area;
     aa. w2    b71.     ;   update w1 and w2;
     sh  w2  x3+d37     ;   if w2 <= last of point then
     jl.        a1.     ;   goto move;
     sh  w1  x3+d25     ;   if w1 <= last point then
     jl.        a0.     ;   goto next point;
     jl.       (j0.)    ;   return;
j0:              0      ;   saved return

e.
\f


; re 18.9.73               central page        paper printer   ...42...


; page jump to -
; print front page:
; in triangle page

c43: dl. w3     b82.   ;
     jl.       (b12.)  ;


; page jump to -
; print last page:
; in triangle page

c44: rl. w2     b81.   ;
     rl. w3     b83.   ;
     jl.       (b12.)  ;
\f


; re  18.9.73               central page        paper printer   ...43...



; define relative addresses to be used in
; initialization


f30 = b5  - b0   ; send and wait
f31 = b6  - b0   ; send and wait fast
f32 = b7  - b0   ; lock simple
f33 = b8  - b0   ; open simple
f34 = b9  - b0   ; lock chained
f35 = b10 - b0   ; open chained
f36 = b11 - b0   ; get pages
f37 = b12 - b0   ; page jump
f39 = b15 - b0   ; call
f40 = b16 - b0   ; prepare access
f41 = b17 - b0   ; terminate access
f42 = b21 - b0   ; all paper sem addr
f43 = b22 - b0   ; banker queue
f44 = b23 - b0   ; segments free sem addr
f45 = b24 - b0   ; segments full sem addr
f46 = b25 - b0   ; convert operations sem addr
f47 = b27 - b0   ; request display queue sem addr
f48 = b28 - b0   ; request lines sem addr
f49 = b30 - b0   ; reserve banker access sem addr
f50 = b41 - b0   ; virt addr : first of super buffer
f51 = b81 - b0   ; virt addr: triangle page
f52 = b75 - b0   ; boss private interval start
f53 = b76 - b0   ; boss private interval end
f54 = b43 - b0-2 ; virt addr: next paper
f55 = b45 - b0-2 ; virt addr: main loop
f56 = b29 - b0   ; banker answer sem
f57 = b42 - b0   ; virt addr: top super buffer
f58 = b20 - b0   ;   first paper
f59 = b31 - b0   ; catalock sem addr

f60 = c10 - b0   ; rel entry on central page
f61 = c42 - b0   ; rel return from next paper, found
f62 = b32 - b0   ; paper manipulation semafore
f63 = b46 - b0   ; virt of account buf
f64 = b47 - b0   ; virt and
f65 = b48 - b0   ; rel of account code
f66 = b18 - b0   ; priv output
f67 = b33 - b0   ; rb convert queue semaphore


; define absolute addresses to be used in external list

g40 = f30 + g2   ,   g41 = f31 + g2   ,   g42 = f32 + g2
g43 = f33 + g2   ,   g44 = f34 + g2   ,   g45 = f35 + g2
g46 = f36 + g2   ,   g47 = f37 + g2   ,   g48 = f67 + g2   
g49 = f39 + g2   ,   g50 = f40 + g2   ,   g51 = f41 + g2
g52 = f42 + g2   ,   g53 = f43 + g2   ,   g54 = f44 + g2
g55 = f45 + g2   ,   g56 = f46 + g2   ,   g57 = f47 + g2
g58 = f48 + g2   ,   g59 = f49 + g2   ,   g60 = f50 + g2
g61 = f51 + g2   ,   g62 = f52 + g2   ,   g63 = f53 + g2
g64 = f54 + g2   ,   g65 = f55 + g2   ,   g66 = f56 + g2
g67 = f57 + g2   ,   g68 = f63 + g2   ,   g69 = f64 + g2
g70 = f65 + g2   ,   g71 = f58 + g2   ,   g72 = g56 +  2
g73 = f66 + g2   ,   g74 = f59 + g2   ,   g75 = f62 + g2


; terminate page
f1 = k - b0      ; define length of page
k  = g2 + f1     ; k := real value of load address
g3 = k-2         ; define last of page
f100 = f100 + 4  ; count k-assignments
i.
e.


\f


; bøt  28.12.71          central page       paper printer  ...44...



; initialize central page
;
; initialize boss private interval and
; banker access semaphore in externals
; write page


b. j10
w.

g9=k-2000 ; (because of stepping stone)
     am        (66)     ;   boss private interval :=
     rl  w1    +76      ;   point interval (std
     al  w1  x1+1       ;   interval start + 1);
     al  w0  x1         ;
     rs. w0     g147.  ;    ext(-2);
     rs. w1     g148.  ;    ext(-1);
     rl. w1     j4.     ;
     al  w1  x1+e13     ;   insert banker answer
     rs. w1    g66.     ;   sem addr;
     al  w0    i65      ;   w0 := reserve on disc;
     al  w1     f1      ;   w1 := length of page;
     jl. w3    (j2.)    ;   reserve virt (w0, w1, w2);
     al. w0     g2.     ;   w0 := start addr of page;
     jl. w3    (j3.)    ;   move to virt ( w0, w1, w2);
     rs. w2     g149.  ;    ext(387);

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

g147:    0  ,    -2    ;    boss private
g148:    0  ,    -1    ;         interval;
j5:  e13<12+19,  78    ;    banker access sem;
g149:    0  ,   387    ;    virt addr of central;
         0  ,  -1000   ;    end of externals;

     al  w0      1      ;   reserve banker access
     rs. w0    (j5.)    ;   sem value := 1;
     jl.        g14.    ;   goto initialize triangle page;

j0:              0      ;*  base of externals
j2:             12      ;*  reserve virt
j3:             13      ;*  move to virt
j4:             76      ;*  banker answers, start

g130 = j0, g131 = j2 , g132 = j3 , g133 = j4 , g134 = j5

e.
\f


; re 18.9.73                triangle page        paper printer    ...45...

;   triangle page
;   =============
;
;   this page is an extension of the central page and performs the printing of
;   the leading and trailing triangles including the additional information
;   which is printed on these two pages.
;

g12:
k=10000, f100=f100 +4 ; count k-assignments

b. b100, c50
w.

;   the names are used as follows:
;
;       a-names      local labels
;       b-names      global variables
;       c-names      global labels
;       d-names      global variables on page 1
;       j-names      local variables
;
;       i- and e- names are options
;       f- and g- names are super global addresses used in other pages 
;                       and in initialization.
;       the b- and c- names have the same meaning in this page and in
;       the central page and in the main loop page.

\f


; re 24.9.73             triangle page           paper printer    ...46...



;
;  the pages are used as follows

b0:      0   ;   page 0 this page
b1:      0   ;   page 1 variables
b2:      0   ;   page 2 not used (= zero)
b3:      0   ;   page 3 input buffer
b4:      0   ;   page 4 not used (= zero)
     72<12+0        ; pageident:  triangle page

;  entries in central logic

b5:      1   ;*  send and wait
b6:      2   ;*  send and wait fast
b11:     7   ;*  get pages
b12:     8   ;*  page jump
b15:    25   ;*  call

;  printer state bit patterns

b36: -1 - 1<23 - 1<1              ;   error bits
b37:                   1<18       ;   end of paper bit
b38: -1 - 1<23 - 1<1 - 1<18 - 1<4 ;   hard error bits
b39:                       1<8    ;   stopped bit

;  virtual addresses

b46:   435   ;*  virt of account buf
b47:   436   ;*  virt and
b48:   431   ;*  rel of account code
b79:   162   ;*  virt and
b80:   229   ;*  rel of general print
b84:   387   ;*  virt and
b85:   f60   ;   rel of central entry in central page

;  input operation

b50:  3<12   ;   operation
b51:     0   ;   first of transfer
b52:     0   ;   last of transfer
b53:     0   ;   segment number

;  miscellaneous constants and variables

b64:  <:usercat:>,0       ;    usercat name
b65:            286       ;    usercat name table address
b66: c. i168-1,12,r.i168  ;  extra ff before front
     z.        15<8       ;  si
b67: c. i169-1,12,r.i169  ;  extra ff after last page
z.
c. i167-1
       12<16+25<8+0       ;    ff,em
z.
c.-i167
        0<16+25<8+0       ;    em
z.
                  2       ;-2
b71:              2       ;  update pointers
b72:             10       ;
b73:            768       ;   constant (chars per segm)
b74:         9<12+1       ;    output operation (operator mode);
                  0       ;
                  0       ;
                  0       ;    process description address
b75:         0<12+2,0,0,0,0,0,0,0       ;    sense ready operation
b20:  0            ;   serialno in triangle
b21:  0            ;   work


; page jump to -
; central entry:
; in central page

c10: dl. w3     b85.   ;
     jl.       (b12.)  ;
\f



; re  18.9.73             triangle page       paper printer     ...47...



; outtext
;
; transfer text from area (cur in) to
; area (cur out)
;
; w0      -         destroyed
; w1   cur in       destroyed
; w2   cur out      cur out
; w3   return       return


c37: rl  w0  x1         ;   word(cur out) :=
     rs  w0  x2         ;   word(cur in);
     aa. w2    b71.     ;   update cur in, out;
     sz  w0    255      ;   if not end text then
     jl.       c37.     ;   goto outtext;
     jl      x3         ;   return



; outnumber
;
; convert number to text in area(cur out)
;
; w0   number      destroyed
; w1     -         destroyed
; w2   cur out     cur out
; w3   return      return

b. a10, j10
w.

c38: al  w2  x2+4       ;   cur out := cur out + 4;
     ds. w3     j0.     ;   save cur out, return;
     al  w1      0      ;   place := 0;
     rs  w1  x2-4       ;   text area  := 0;
     rs  w1  x2-2       ;
     am         16      ;   place := 16;
a0:  al  w1  x1+8       ; next: place := place + 8;
     se  w1     24      ;   if place <> 24 then
     jl.        a1.     ;   goto char;
     al  w2  x2-2       ;   text := text - 2;
     al  w1      0      ;   place := 0;
a1:  al  w3      0      ; char:
     wd. w0    b72.     ;   number := number//10;
     al  w3  x3+48      ;   char := remainder + 48
     ls  w3  x1         ;   shift place;
     wa  w3  x2         ;   text := text +
     rs  w3  x2         ;   char;
     se  w0      0      ;   if number <> 0 then
     jl.        a0.     ;   goto next;
     dl. w3     j0.     ;   restore cur out, return;
     jl      x3         ;   return;
                 0      ; saved cur out;
j0:              0      ; saved return;
e.


\f


; bøt  05.01.73          triangle page       paper printer  ...48...


; output triangle
;
; the triangle with asterisks and user name is
; printed. the following variables are used:
;

; d0     current line number in triangle
; d1     last line number in triangle
; d30+0  partial word
; d30+2  saved w1
; d30+4  saved returns, locally used
; d30+6  direction of triangle (-1 meaning leading, +1 trailing triangle)
; d30+8  saved return from out triangle
; d30+10 saved sub - return from writetext
; d30+12 saved page - number in writetext
; d4     first of buffer (considered constant)
; d5     last of buffer       -          -
; d14    adresses of user id  -          -
; d19    first transferred    -          -
; d20    word address and last transferred
;
; At call time, the following registers and variables 
; must be initialized:
;   w0    = -1 meaning leading, +1 meaning trailing triangle
;   w1    = 0 means only ff are output
;         <> 0 means everything is output
;   w2    return address (this page)
;   w3    page 1 address
;   d19   = d4
;   d20   must point at the last word to be output before the triangle
;         starts (d4-2 <= d20 < d5).
;
; At return all registers except w3 are spoiled.
;
; The procedure outputs the leading text, the triangle, various messages
; and a number of formfeed, depending on leading or trailing triangle.


b. a19, j8
w.

j1:         255<16      ;   mask for partial word filled
j2: <:<10><10><10>:>    ;   three new lines
j3: <:<10><10>contents of <0>:>
j4: <:primary output<0>:>
j5: <:job printer output<0>:>
j6: <:<15><12><0>:>
j7: <:<10>printing initiated at  <0>:>
j8: <:<10>printing terminated at  <0>:>

c41: ws. w2     b0.     ;
     rs  w2  x3+d30+8   ;   save rel return
     sn  w1     0      ;   if no triangle then
     jl.        a9.    ;     goto output ff;

\f


; bøt  15.03.73          triangle page       paper printer ...49...




     al  w1     15      ;   partial word:= 15;  (15 = shiftin)
     rs  w1  x3+d30+0   ;  
     al  w1     i167    ;   if leading triangle then
     al  w2     1       ;    begin first line:=size; last line:=1;
     sl  w0     0       ;          direction:=-1;
     rx  w1     4       ;    end else
     ds  w2  x3+d1      ;    begin first line:=1;  last line:=size;
     rs  w0  x3+d30+6   ;          direction:=+1;
     jl.        a1.     ;    end;
a0:  wa  w1  x3+d30+6   ; for line:=first line step direction
     rs  w1  x3+d0      ;                      until last line do
a1:  al  w0     10      ;  begin
     jl. w2     a10.    ;   outchar(NL);
     ac  w1  x1-i167    ;
a2:  al  w0     32      ;   for i:=size-line step -1 until 0 do
     jl. w2     a10.    ;    begin
     al  w1  x1-1       ;       outchar(space);
     sl  w1     0       ;    end;
     jl.        a2.     ;

     rl  w1  x3+d0      ;   for i:=line step -1 until 0 do
a3:  jl. w2     a11.    ;    begin
     al  w1  x1-1       ;     outasterisk;
     sl  w1     1       ;    end;
     jl.        a3.     ;
     al  w0     32      ;
     jl. w2     a10.    ;   output(space)

     jl. w2     a15.    ;   terminate partial word;

     al  w0     2       ;
     al  w1     d12-2   ;   writetext(username, page1);
     jl. w2     a17.    ;
     al  w0     32      ;
     jl. w2     a10.    ;   output(space)
     rl  w2  x3+d54     ;   w2:=serial number
     al  w1     0       ;
     wd. w2     b72.    ;   w1:=serialno mod 10
     al  w1  x1+48      ;
     hs. w1     b21.+1  ;   store third digit in work+1
     al  w1     0       ;
     wd. w2     b72.    ;   w1:=serial number // 10 mod 10
     al  w1  x1+48      ;
     hs. w1     b21.    ;    store second digit in work
jd-1
     al  w0  x2+48      ;
     jl. w2     a10.    ;   output(first digit)
     bl. w0     b21.    ;
     jl. w2     a10.    ;   output(second digit)
     bl. w0     b21.+1  ;
     jl. w2     a10.    ;   output(third digit)
     al  w0     32      ;
     jl. w2     a10.    ;   output(space)

     rl  w1  x3+d0      ;
a4:  jl. w2     a11.    ;   for i:=line step -1 until 0 do
     al  w1  x1-1       ;    begin
     sl  w1     1       ;     outasterisk;
     jl.        a4.     ;    end;

     rl  w1  x3+d0      ;   comment w1:=line;
     se  w1 (x3+d1)     ; end for line:=;
     jl.        a0.     ;

     jl. w2     a15.    ;   terminate partial word;
     rl. w0     j2.     ;   outword(3 NL)
     jl. w2     a12.    ;

\f


; rc 15.03.73          triangle page       paper printer     ...50...




; print user id, contents id  and  end text

     rl  w0  x3+d42     ;
     rs  w0 (x3+d3)     ;   page 3 := work page;
     jl. w3   (b11.)    ;
     bz  w1  x3+d14     ;   segm := addr of user id;
     rs. w1    b53.     ;
     rl. w1     b3.     ;   first address;
     al  w2  x1+510     ;   last address;
     ds. w2     b52.    ;
     al. w1     b50.    ;
     al. w2     b64.    ;   input(<:usercat:>);
     jl. w3    (b6.)    ;   send and wait fast;
     se  w0     1<1     ;   if not ok
c.-1, o70, z. ; (bossfault xref)
     jd        -70      ;    then bossfault(70);
     bl  w1  x3+d14+1   ;
     al  w0     6       ;   writetext(user id, page3);
     jl. w2     a17.    ;
     al  w0     0       ;
     rs  w0    (x3+d3)  ;   release page 3;

     al  w1     j3-b0   ; end text:
     al  w0    0        ;   
     jl. w2     a17.    ;   writetext(<:contents of:>, page0);
     rl  w0  x3+d7      ;   writetext(
     al  w1     d39     ;    if outputtype=1 then
     sn  w0     1       ;      <:primary output:>
     al  w1     j4-b0   ;    else if type = 2 or 3 then
     sz  w0     2       ;      <:job controlled output:>
     al  w1     j5-b0   ;    else <:convert file:>);
     sn  w1     d39     ; 
     am         2       ;   select page;
     al  w0     0       ;
     jl. w2     a17.    ;
\f


; re 24.9.73            triangle page            paper printer     ...51...

; print date and time

     rl  w0  x3+d30+6   ;   if leading triangle
     sh  w0     0       ;
     am         j7-j8   ;     then writetext(start print, page0)
     al  w1     j8-b0   ;     else writetext(stop print, page0);
     al  w0     0       ;
     jl. w2     a17.    ;
     rl  w0  x3+d47    ;   if correct last of buffer
     ws  w0  x3+d20    ;     - word address
     sh  w0     40-1+2 ;     <= 40 bytes
     jl. w2     a14.   ;     then outblock;
     rl  w1  x3+d30+6  ;   save triangle kind
     rs  w1  x3+d30+10 ; 
     rl  w1  x3+d20     ;
     al  w1  x1+2       ;   param(0,1) := first free in buffer;
     al  w0    -12      ;
     ds  w1  x3+6       ;
     al  w0    -10      ;   param(2) := print time;
     rs  w0  x3+8      ;
     al  w0     0      ;
     al  w1     8      ;    param(3):=new line
     ds  w1  x3+12     ;
     al  w0    -18     ;    param(4):=installation text (from options)
     al  w1    -5      ;  
     ds  w1  x3+16     ;    param(5):=return

     dl. w3     b80.    ;
     jl. w1    (b15.)   ;   call(general print);
     rl  w1  x3+d30+10 ;   restore triangle kind;
     rs  w1  x3+d30+6  ;
; test
rl  w0  x3+4
ws  w0  x3+d20
sl  w0     40+1 ; if date, time and inst.text exceed 40 bytes then alarm;
c.-1, o73, z. ; (bossfault xref)
jd        -73
; end test
     rl  w0  x3+4       ;
     rs  w0  x3+d20     ;   word address := last used in buffer;
     rl  w0  x3+d30+6   ;   if leading triangle
a9:  sl  w0     0       ;    then writetext(leading ff, page0)
     am         b67-j6  ;    else writetext(trailing ff, page0);
     al  w1     j6 -b0  ;
     al  w0     0       ;
     jl. w2     a17.    ;
     rl  w0  x3+d20     ;
     sl  w0 (x3+d4)     ;   if word address >= first buffer
     jl. w2     a14.    ;    then outblock;
     am     (x3+d30+8)  ;
     jl.        b0.     ;   return;

\f


; rc 17.01.73           triangle page         paper printer       ...52...


;subprocedures outchar, outasterisk, outword, outblock and terminate
; partial word.    the procedures assume that their parameters, i.e.
; partial word and word address have been initialized.   all procedures
; have their return point in w2, and a possible parameter in w0.
; w0 and w2 may be spoiled.


a11:                    ;  entry outasterisk:
     al  w0     42      ;   call outchar(*);

a10:                    ;  entry outchar(w0):
     rx  w0  x3+d30+0   ;   
     ls  w0     8       ;   partial wd:= partial wd shift 8
     lo  w0  x3+d30+0   ;                   + char;
     rs  w0  x3+d30+0   ;
     sz. w0    (j1.)    ;   if partial wd full
     jl.        a12.    ;     then call outword(partial wd)
     jl      x2         ;     else return;

a12: rx  w1  x3+d20     ;  entry outword(w0):
     al  w1  x1+2       ;   word addr:=word addr + 2;
     rs  w0  x1         ;   buf(word addr):=word;
     al  w0     0       ;   partial wd:=0;
     rs  w0  x3+d30+0   ;
     sl  w1 (x3+d5)     ;   if buffer full then
     jl.        a13.    ;    call outblock
     rx  w1  x3+d20     ;   else return;
     jl      x2         ;

a13: rx  w1  x3+d20     ;  entry outblock from outword:

a14: ws. w2     b0.     ;  entry outblock from outside:
     ds  w2  x3+d30+4   ;   save w1, rel return;
     al  w1  x3+d18     ;
     al  w2  x3+d21     ;
     jl. w3    (b5.)    ;   output(buffer);
     se  w0     1<1     ;   if no errors
     jl.        a16.    ;
     rl  w2  x3+d20     ;
     al  w2  x2+2       ;
     ws  w2  x3+d19     ;
     se  w2 (x1+2)      ;   and bytes transferred<>bytes sent then
     lo. w0     b39.    ;   status:=status or 1<8;
a16: rs  w0  x3+d55     ;   saved status:=status
jd -1
     se  w0     1<1     ;   if error
     jl. w2     c45.    ;    then test result;
     rl  w1  x3+d4      ;   word address:= first of buffer - 2;
     al  w1  x1-2       ;
     rs  w1  x3+d20     ;
     dl  w2  x3+d30+4   ;   reestablish w1;
     jl.     x2+b0.     ;   return;

a15: rl  w0  x3+d30+0   ;  entry terminate partial word:
     sn  w0     0       ;   if partial wd = 0
     jl      x2         ;    then return;
     jl.        a12.    ;    else call outword(partial wd);


\f


; rc 19.02.73         triangle page            paper printer ...53...



;  sub-procedure write text;
;   outputs a text constant stored on any page. 
;   at entry the registers have the following meaning:
;   w0   page number*2
;   w1   relative address of text on page
;   w2   return (this page)
;   w3   page 1 address
;
;   at return all registers except w3 are spoiled

a17: ws. w2     b0.     ; entry writetext:
     rs  w2  x3+d30+10  ;   save relative return;
     rs  w0  x3+d30+12  ;   k:=pagenr*2;
     jl.        a19.    ;   i:=textaddr;
a18: jl. w2     a12.    ; repeat
     al  w1  x1+2       ;   wordaddr:= pageaddr(k) + i;
a19: am     (x3+d30+12) ;   outword(word(wordaddr);
     am.       (b0.)    ;   i:=i+2;
     rl  w0  x1         ; until last char(
     sz  w0     255     ;             word(wordaddr+2)) = 0;
     jl.        a18.    ;
     rl  w2  x3+d30+10  ;   reestablish return;
     wa. w2     b0.     ;   outword(word(wordaddr+2);
     jl.        a12.    ;   comment and return from there;



e.                      ;   end output triangle;

\f


; bøt  05.01.73          triangle page       paper printer  ...54...


; print front page
;
; the start text and the triangle is printed

b. a5, j9, q10
w.
j1: <:<10>continuation after endpaper<10><10><0>:>
j2: <:<10>continuation after malfunction<10><10><0>:>
j3: <: prepare :>
j4: <:host:>,0,0,0     ;    name of host process
j5: <:clock:>,0,0,0    ;    name of clock process
j6: 0,5                ;    timer message
j7: 1<21               ;    timeout status
j8:<:<10>obs obs obs this is a rerouted remote convertfile<10><10><0>:>
j9:<:primout<0><0><0><0><0>:>  ; 12 chars

q0 = 0   ;  first of empty word (12*null)
q1 = 8   ;  username
q2 = 16  ;  <: prepare :>
q3 = 22  ;  device name
q4 = 26  ;  space
q5 = 28  ;  filename
q6 = 36  ;  new line


c43: bz  w0  x3+d62+1  ;   if device kind <> printer then 
     se  w0     14     ;     skip the triangle page
     jl.        a3.    ;
     al  w2     i167   ;    w2:=triangle size
     sh  w2     0      ;    if size=0 then
     jl.        a3.    ;    skip triangle page
     rl. w2     b20.   ;
     rs  w2  x3+d54    ;    set current serial number
     al  w2  x2+1      ;    w2:=next serial number
     sl  w2     1000   ;
     al  w2     0      ;        mod 1000
     rs. w2     b20.   ;    set next serial number

     rl  w2  x3+d4      ;   cur out :=
     rs  w2  x3+d19     ;   first of buffer;
     bz  w0     x3+d61  ;    w0:= status
     sn  w0        0    ;    if status=0 then
     jl.           a1.  ;    goto a1;
     al. w1        j5.  ;    text:= dummy
     sn  w0         1   ;    if status=1 then
     al. w1        j1.  ;    text:= j1
     sn  w0         2   ;    if status=2 then
     al. w1        j2.  ;    text:= j2
     sn  w0        4    ;    if status=4 then
     al. w1        j8.  ;    text:= j8
     jl. w3     c37.   ;
a1:                    ;
     al. w1    b66.     ;
     jl. w3    c37.     ;   outtext ( start text);
     rl. w3     b1.     ;
     al  w2  x2-2       ;
     rs  w2  x3+d20     ;   set last of buffer;
     rl  w0  x3+d62    ;   if printer mode <> 0 then
     se  w0     14     ;
     am         0-1    ;   triangle:=w0
     al  w1     1      ;   else
     al  w0    -1       ;   triangle = leading;
     jl. w2    c41.     ;   print triangle;
a2:  al  w0      1      ;
     wa  w0  x3+d22     ;   state := state + 1;
     rs  w0  x3+d22     ;
     jl.       c10.     ;   goto central entry;
\f


;  lkn  11.3.76     triangle page         paper printer        ...54a...


a3:  se  w0     12     ;    if device kind=punch
     jl.        a2.    ;    then
     rl  w2  x3+d4     ;    w2:=start of output buffer;
     al  w0     10     ;    move <nl>
     rs  w0  x2+q0     ;
     dl  w1  x3+d12    ;    move user name;
     ds  w1  x2+q1+2   ;
     dl  w1  x3+d13    ;
     ds  w1  x2+q1+6   ;
     ld  w1    -100    ;    set empty text
     ds  w1  x2+q0+2   ;
     ds  w1  x2+q0+6   ;
     dl. w1     j3.+2  ;    move <: prepare :>;
     ds  w1  x2+q2+2   ;
     rl. w0     j3.+4  ;
     rs  w0  x2+q2+4   ;
     dl  w1  x3+d52    ;    move device name;
     sh  w0     31     ;    if not text then
     ld  w1    -100    ;    device name:=0;
     ds  w1  x2+q3+2   ;
     al  w0     32     ;    move <space>;
     rs  w0  x2+q4     ;
     dl  w1  x3+d39+2  ;    move file name;
     ds  w1  x2+q5+2   ;
     dl  w1  x3+d39+6  ;   
     ds  w1  x2+q5+6   ;
     al  w0     10     ;    move <nl>;
     rs  w0  x2+q6     ;
     al  w2  x2-8      ;    include 8 dummy bytes first in output
     rs. w2     b74.+2 ;    set first of buffer;
     al  w2  x2+q6+8   ;
     rs. w2     b74.+4 ;    set last of buffer;
     al  w3  x3+d21    ;    w3:=printer process name
     jd         1<11+4 ;    get process description address
     rs. w0     b74.+6 ;    set process description address in operator message
     al. w1     b74.   ;    w1:=message;
     al. w2     j4.    ;    w2:=abs ref <:host:>
     jl. w3    (b5.)   ;    send and wait(operator message);
jd-1
a4:  bz  w0  x3+d18+1  ;    output mode
     rs. w0     b75.+2 ;    in sense ready message
     rl  w0  x3+d7     ;    w0= type of convert
     al  w3  x3+d39    ;    w3= filename
     se  w0     0      ;    if type <> convert
     al. w3     j9.    ;    then name := primout
     dl  w1  x3+2
     ds. w1     b75.+6 ;     move filename to message
     dl  w1  x3+6
     ds. w1     b75.+10;
     rl. w3     b1.     ;    w3:= page1 used in al w2 x3+d21
     al. w1     b75.   ;    w1:=message;
     al  w2  x3+d21    ;    w2:=name;
     jl. w3    (b5.)   ;    send and wait(sense ready);
     so. w0    (j7.)   ;    if timer status then
     jl.        a2.    ;    begin
     al. w1     j6.    ;      w1:=timer message
     al. w2     j5.    ;      w2:=<:clock:>
     jl. w3    (b5.)   ;      send and wait
     jl.        a4.    ;      goto send sense ready
                       ;    end


e.
\f


; re 5.2.75        triangle page          printer   ...54b...



; print last page
;
; account
; print triangle and end text

b. a5, j10
w.
c44: rl  w2  x3+d4     ;   cur out := first of buffer;
     rs  w2  x3+d19    ;
     al  w0     i167   ;    w0:=triangle size
     sh  w0     0      ;    if size=0 then
     jl.        a2.    ;    skip triangle page

     rl  w0  x3+d62    ;   if device kind <>printer then
     se  w0     14     ;     then skip the triangle page;
     jl.        a2.
     al. w1     j0.     ;
     jl. w3    c37.     ;   outtext ( accounted );
     am.       (b1.)    ;
     rl  w0   +d36      ;
     jl. w3    c38.     ;   outnumber ( lines );
     al. w1     j1.     ;
     jl. w3    c37.     ;   outtext (lines on);
     am.       (b1.)    ;
     rl  w0   +d37      ;
     jl. w3    c38.     ;   outnumber ( pages);
     al. w1     j2.     ;
     jl. w3    c37.     ;   outtext ( pages);
     rl. w3     b1.     ;

     rl  w0  x3+d15    ;   if segmentno (or virtual address) < 999999 chars then
     sl  w0  999999/768+1+1;
     jl.        a1.    ;     begin condition not fulfilled for job contr printing
     al. w1     j3.    ;           or after kill;
     jl. w3     c37.   ;     outtext( output );
     am.       (b1.)   ;
     rl  w0    +d15    ;
     ba. w0     1      ;
     wm. w0     b73.   ;     outnumber( chars = segmentno * 768 + 768 );
     jl. w3     c38.   ;
     al. w1     j4.    ;
     jl. w3     c37.   ;     outtext( characters );
     rl. w3     b1.    ;
a1:                    ;     end;


\f


; bøt  05.01.73          triangle page       paper printer  ...55...
     am         1      ;   triangle=yes;
a2:  al  w1     0      ;   triangle=no;


     al  w2  x2-2       ;   last := cur out - 2;
     rs  w2  x3+d20     ;
     al  w0     1      ;   triangle = trailing
     jl. w2     c41.   ;   print triangle;
     rl  w2  x3+d62     ;    w2:=devicekind
     bz  w1  x3+d18+1   ;    w1:= mode in output-operation
     sn  w1     2       ;    if mode <> 2
     se  w2    14       ;    or kind <> 14
     jl.       a3.      ;    then goto no duoble buffering
     al. w1     j5.     ;    sense printer, to resieve the last status,
     al  w2  x3+d21     ;    in case of mode-2 (doubble) buffering
     jl. w3    (b5.)    ;    send and wait
     rs  w0  x3+d55     ;    save status
     se  w0     1<1     ;    if not normal answer
     jl. w2     c45.    ;    then goto testresult
a3:                     ;    no double buffering:
     al  w0      1      ;
     wa  w0  x3+d22     ;   state := state + 1;
     rs  w0  x3+d22     ;
     rl  w0  x3+d7      ;   if type = job controlled
     sn  w0      2      ;   output and not account then
     jl.        a0.     ;   goto return;
     al  w0      3      ; account:  set page 1
     rs  w0  x3+4       ;   (4)  type ( = 3)
     dl  w1  x3+d37     ;   (6)  pages
     ds  w1  x3+8       ;   (8)  lines
     dl  w1  x3+d12     ;
     ds  w1  x3+12      ;   (10-16) user name
     dl  w1  x3+d13     ;
     ds  w1  x3+16      ;
     rl  w1  x3+d11     ;   (18)  project
     rs  w1  x3+18      ;
     bz  w0  x3+d8      ;  
     rs  w0  x3+20      ;   (20) paper number;
     rl. w0    b46.     ;
     rs  w0 (x3+d3)     ;   page 3 := account buffer;
     dl. w3    b48.     ;
     jl. w1   (b15.)    ;   call account;
a0:                    ;
     jl.       c10.     ;

j0:  <:<10><15><12>accounted : <0>:>
j1:  <: lines  on <0>:>
j2:  <: pages<10><10><0>:>
j3:  <:output <0>:>
j4:  <: characters (approx. upper limit)<10><0>:>
j5:   0   ;    sens-message

e.



; test result
;
; w0 = logical status
; w2 = return

c45: la. w0    b36.,jd-1;   extract error bits;
     sn  w0      0      ;   if no error then
     jl      x2         ;   return;
     al  w1      0      ;   st := 0 +
     sz. w0   (b37.)    ;   if end of paper then
     al  w1  x1+16      ;   end paper bit;
     sz. w0   (b38.)    ;   if hard error then
     al  w1  x1+32      ;   hard error bit;
     sz  w0    1<4      ;   if disconnected then
     al  w1  x1+64      ;   disconnected bit;
     lo  w1  x3+d22     ;   state := state
     rs  w1  x3+d22     ;   or  st;
     al  w0      0      ;
     rs  w0 (x3+d3)     ;   release page 3;
     jl.       c10.     ;   goto central entry;
\f


; re  18.9.73             triangle page        paper printer    ...56...

; define relative addresses to be used in the initialization

f101 = b5 - b0   ;   send and wait
f102 = b6 - b0   ;   send and wait fast
f103 = b11- b0   ;   get pages
f104 = b12- b0   ;   page jump
f105 = b15- b0   ;   call
f106 = b65- b0   ;   usercat name table address

f110 = b46- b0   ;   virt addr of account buf
f111 = b47- b0   ;   virt and
f112 = b48- b0   ;   rel addr of account code
f113 = b79- b0   ;   virt and
f114 = b80- b0   ;   rel addr of general print
f115 = b84- b0   ;   virt addr of central page

f70  = c43- b0   ;   rel of print front page
f71  = c44- b0   ;   rel of print last page

; define absolute addresses to be used inthe external list

g150 = f101 + g12,  g151 = f102 + g12,  g152 = f103 + g12,  g153 = f104 + g12
g154 = f105 + g12,  g155 = f110 + g12,  g156 = f111 + g12,  g157 = f112 + g12
g158 = f113 + g12,  g159 = f114 + g12,  g160 = f106 + g12,  g161 = f115 + g12


;  terminate page

f4= k-b0       ;   define length of page
k=g12 + f4     ;   k:=real value of load address
g13=k-2        ;   define last of page
f100=f100 + 4  ;   count k-assignments
i.
e.

; re  18.9.73           triangle page       paper printer      ...57...

;    initialize triangle page

b. j10
w.

g14: al  w0     i65    ;   w0:= reserve on disc;
     al  w1     f4     ;   w1:= length of page;
     jl. w3    (j1.)   ;   reserve virt(w0, w1, w2);
     al. w0     g12.   ;   w0:= start addr of page;
     jl. w3    (j2.)   ;   move to virt(w0, w1, w2);
     al  w2  x2+1      ;    w2:=virt + writing
     rs. w2     g162.  ;    ext(389);

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

g162:    0  ,   389    ;    virt addr of triangle page;
         0  ,  -1000   ;    end of externals;

     jl.        g8.    ;   goto initialize main loop;

j0:             0      ;*  base of externals
j1:            12      ;*  reserve virtual
j2:            13      ;*  move to virtual

g170 = j0,  g171 = j1,  g172 = j2

e.
\f


; bøt  28.12.71          main loop page     paper printer  ...58...




; this page contains the main loop in the printing, ie 
; copying from the input area to the output buffer.
; furthermore the input- and output routines are placed
; here
;
; all seldom used actions such as treatment of errors
; and operator operations, start and ending of printing
; etc are placed on a separate page, the central page,
; which is entered with the state as parameter.  the
; state will then define what to do.
;
; the state will in the main loop be <= 4  and only
; equal to 4 during printing of the last buffer.
; on exit to the central page the value may be greater
; than 4.
;
;
; the names are used as follows :
;
;    a-names are local labels on page 0
;    b-names are global varibles (used on all page 0-s)
;    c-names are global labels   (used on all page 0-s)
;    d-names are relative addresses on page 1
;    f- and g- names are used in the initialization
;    i-names are options
;    j-names are local variables on page 0
;
;   the b- and c- names have the same meaning in this page and in
;   the central page and in the triangle page
;
;
; the pages are used as defined in the following


; start of page,  all addresses will be relative to g0 - 10000

g0:  k = 10000,  f100 = f100 + 4  ;  count k-assignments

b. b80, c9
w.

; define page addresses

b0:     0    ;   page 0,  this page
b1:     0    ;   page 1,  variables
b2:     0    ;   page 2,  not used
b3:     0    ;   page 3,  input buffer
b4:     0    ;   page 4,  not used (= zero)
     73<12+0        ; pageident:  main loop


\f


; bøt  28.12.71          main loop page     paper printer  ...59...


; entries in central logic

b5:         1      ;*  send and wait
b6:         2      ;*  send and wait fast
b7:         3      ;*  lock simple
b8:         4      ;*  open simple
b12:        8      ;*  page jump


; semaphores

                   ;  super buffer:
b23:       60      ;*  segments free
b24:       61      ;*  segments full


; bit patterns

b35:  32<16+32<8+32        ;   interesting bits
b36:  -1 -1<23 -1<1        ;   error bits from printer
b37:  1<18                 ;   end paper bit   = bit 5
b38:  -1-1<23-1<1-1<18-1<4 ;   hard error bits
b39:  1<8                  ;   stopped bit


; virtual addresses

          387      ;*  entry central page
b40:      f60      ;
b41:      383      ;*  super buffer start
b42:      384      ;*  super buffer top


; input operation

b50:     3<12      ;   operation code =input
b51:        0      ;   first of transfer
b52:        0      ;   last of transfer
b53:        0      ;   segment number


\f


; bøt  28.12.71          main loop page     paper printer  ...60...


; get next segment from area 


b. a5, j5
w.

c0:  al  w0      1      ;   segment no :=
     wa  w0  x3+d15     ;   segment no + 1;
     rs  w0  x3+d15     ; prepare:
a0:  rl. w1     b3.     ;   w1 := buffer start;
     al  w2  x1+510     ;   w2 := buffer end;
     ds. w2    b52.     ;   save buffer limits
     rs. w0    b53.     ;   and segment no;
     al. w1    b50.     ;   w1 := message address;
     al  w2  x3+d9      ;   w2 := area name addr;
     jl. w3    (b6.)    ;   send and wait fast (w1, w2);
     sn  w0    1<1      ;   if ok then
     jl.        c2.     ;   return with segment;
     so. w0   (b37.)    ;   if error then
     jl.        c8.     ;   goto hard error;
     al  w1      5      ;   state := 5;
     rs  w1  x3+d22     ;
     jl.        c6.     ;   goto central page;

e.



; next virtual segment
;
; increase virt addr
; change segment counters
; lock segments full


b. a5
w.

c1:  al  w0    512      ;   virt := 512 +
     wa  w0  x3+d15     ;   actual virt;
     sn. w0   (b42.)    ;   if virt = top then
     rl. w0    b41.     ;   virt := first;
     rs  w0  x3+d15     ;   actual virt :=
     rs  w0 (x3+d3)     ;   page 3 := virt;
     al  w1      1      ;   no of segments :=
     ba  w1  x3+d24+d16-d15;   no of segments + 1
     hs  w1  x3+d24+d16-d15;   (in first point);
     rl  w0  x3+d23     ;
     bs. w0      1      ;   segment claim :=
     rs  w0  x3+d23     ;   segment claim - 1;
     sh  w0     -1      ;   if segment claim < 0
     jl.        a1.     ;   then goto release;
a0:  rl. w2    b24.     ; get:
     jl. w3    (b7.)    ;   lock (segments full);
     jl.        c2.     ;   goto return with segment;


\f


; bøt  28.12.71          main loop page     paper printer  ...61...


; release point
; a point binding segments is found and released
; and the corresponding part of the super buffer is
; released,  the segment counters are updated

a1:  al  w0      0      ;
     rs  w0  x3+d16     ;   segment rel := 0;
     al  w2  x3+d25+e42;  point := top of points;
a2:  al  w2  x2-e42     ;   while no of segments to
     bz  w1  x2+d16-d15 ;   release (point) = 0 do
     sh  w1      0      ;   point := point -
     jl.        a2.     ;   point length;
     rx  w1  x3+d23     ;   segment claim :=
     wa  w1  x3+d23     ;   segment claim +
     rx  w1  x3+d23     ;   no of segments;
     sn  w2  x3+d24     ;
     am        -d24+d15 ;
     rl  w0  x2-e42     ;
     rs  w0  x2         ;   move virt addr;
     sn  w2  x3+d24     ;
     am        -d24+d15 ;
     bz  w0  x2-e42+d17-d15;   no of segments := 0;
a3:  rs  w0  x2+d16-d15+d17-d17;
     al  w2  x2+2       ;   while point < top point
     sh  w2  x3+d24+e42-2-d16+d15;
     am        -d24+d15 ;
     rl  w0  x2-e42+d16-d15;   move preceding point
     se  w2  x3+d25+e42-d16+d15;   to point;
     jl.        a3.     ;
a4:  rl. w2    b23.     ;   while no of segments to
     jl. w3    (b8.)    ;   release > 0 do  begin
     al  w1  x1-1       ;     decrease no of segments;
     se  w1      0      ;     open (segments free);
     jl.        a4.     ;     end;
     jl.        a0.     ;   goto get;

e.


\f


; bøt  28.12.71          main loop page     paper printer  ...62...


; copy block from input buffer to printer buffer
;
; in the central loop the registers are used as follows:
;
;     w0  cur word to be moved
;     w1  input addr of cur word
;     w2  output addr of cur word
;     w3  page 1 addr
;
; in the loop all states  <=  4



b. a30, j5
w.

a0:  al  w1  x1+2       ; next: cur in := addr of next word;
     sl  w1 (x3+d26)    ;   if cur in = top then
     jl.       a25.     ;   goto next segment;
a1:  rl  w0  x1         ; move:  word(cur out) :=
     rs  w0  x2         ;   w0 := word (cur in);
     sh  w0      0      ;   if w0 <= 0 then
     jl.        a8.     ;   goto test negative;
a2:  so. w0   (b35.)    ;   if special characters then
     jl.       a10.     ;   goto test chars;
a3:  al  w2  x2+2       ;   cur out := addr of next word;
     sh  w2 (x3+d5)     ;   if w2 <= last of buffer then
     jl.        a0.     ;   goto next;

; print contents of output buffer

     ws. w1     b3.     ;   w1 := work0 :=
     rs  w1  x3+d0      ;   rel addr of cur in;
a4:  al  w2  x2-2       ; output: w2 := last of transfer;
     rl  w1  x3+d4      ;   w1 := first of transfer;
     sh  w2  x1-1       ;   if first > last then
     jl.        a5.     ;   goto test queue;
     ds  w2  x3+d20     ;   insert buffer limits;
     rl  w0  x3+d47    ;
     rs  w0  x3+d5     ;   insert last of buffer;
     al  w1  x3+d18     ;   w1 := output message addr;
     al  w2  x3+d21     ;   w2 := printer name addr;
     jl. w3    (b5.)    ;   send and wait (w1, w2);
     se  w0     1<1     ;   if result=1
     jl.        a6.     ;
     rl  w2  x3+d20     ;
     al  w2  x2+2       ;
     ws  w2  x3+d19     ;
     se  w2 (x1+2)      ;   and bytes transterred <> bytes sent then
     lo. w0     b39.    ;   status:=status or 1<8
a6:  rs  w0  x3+d55     ;   saved status:=status;
jd -1
     sz. w0   (b36.)    ;   if any error then
     jl. w2     c4.     ;   goto test result;
a5:  bl  w0  x3+d46    ; test queue:
     sn  w0     1      ;   if not remote batch printer
     jl.        a29.   ;     and
     rl  w0 (x3+d33)   ;
     sl  w0      1      ;     printer queue sem value > 0 then
     jl.        c5.     ;       goto prepare examine;
a29: rl  w0  x3+d22     ;
     sl  w0      5      ;   if state > max then
     jl.        c6.     ;   goto call central;
c7:  rl. w1     b3.     ; return from central:
     al  w2  x1+512     ;
     wa  w1  x3+d0      ;   w1 := abs addr of cur in;
     rs  w2  x3+d26     ;   restore top in;
     rl  w2  x3+d4      ;   cur out := first of buffer;
     jl.        a0.     ;   goto next;


\f


; bøt  28.12.71          main loop page     paper printer  ...63...


; test negative

a8:  sn  w0      0      ;   if word = 0 then
     jl.        a0.     ;   goto next;
     so  w0     -2      ;   if word <>-1 or -2 then
     jl.        a2.     ;   return;
     rl  w0  x3+d7      ;
     sn  w0      0      ;   if type = 0 then
     jl.        a0.     ;   goto next;
     rs  w2  x3+d1      ;   save cur out;
     rl  w0  x1         ;
     se  w0     -2      ;   if word = -1 then
     jl.        c3.     ;   goto end text;
     rl  w0  x3+d7     ;   if type = 2 then
     se  w0      2      ;     begin
     jl.        a9.     ;     type := 3;
     al  w0      3      ;     comment account := true;
     rs  w0  x3+d7      ;     goto end text;
     jl.        c3.     ;     end;
a9:  al  w0      4      ;   state :=
     rs  w0  x3+d22     ;   -2 passed;
     jl.        a0.     ;   goto next;


; test chars

a10: ds  w2  x3+d1      ;   work0,1 := save w1,w2;
     rl  w2  x1         ;   w2 := word;
a11: sn  w2      0      ; test rest: if w2 = 0 then
     jl.       a12.     ;   goto exit;
     al  w1      0      ;   char := first char (w2);
     ld  w2      8      ;   w2 := w2 shift 8;
     sl  w1     26      ;   if char > 25 then
     jl.       a11.     ;   goto test rest;
     bl. w1  x1+j0.     ;
     jl.     x1+a11.    ;   goto action (char);

a12: dl  w2  x3+d1      ; exit: restore w1,w2;
     jl.        a3.     ;   return;

a13: am       i73-1     ; vt:   inc := vt no of lines  or
a14: al  w0      1      ; nl:   inc := 1;
     rl  w1  x3+d36     ;   global linecount :=
     wa  w1      0      ;   global linecount + inc;
     rs  w1  x3+d36     ;
     wa  w0  x3+d27     ;   local linecount :=
     rs  w0  x3+d27     ;   local linecount + inc;
     sh  w0   i74-1     ;   if linecount < max then
     jl.       a11.     ;   goto test rest;
     jl.       a22.     ;   goto virt ff;
a15: al  w0      1      ; ff:
     al  w1      1      ;
     aa  w1  x3+d37     ;   global counters :=
     ds  w1  x3+d37     ;   global counters + 1;
a22: al  w0      0      ; virt ff: 
     rs  w0  x3+d27     ;   local linecount := 0;
     al  w0      1      ;
     wa  w0  x3+d28     ;   local pagecount :=
     rs  w0  x3+d28     ;   local pagecount + 1;


\f


; bøt  28.12.71          main loop page     paper printer  ...64...


;  release eldest point and create a new

     bz  w1  x3+d25+d16-d15;   w1 := no of segments to release;
     rl  w0  x3+d23     ;    segment claim:=
     wa  w0     2       ;    segment claim
     rs  w0  x3+d23     ;    + no of segments to release;
     rs. w2     j1.     ;   save rest chars;
a16: sh  w1      0      ; rep2:  if w1 = 0 then
     jl.       a17.     ;   goto move points;
     rl. w2    b23.     ;
     jl. w3    (b8.)    ;   open(segments free);
     al  w1  x1-1       ;   w1  := w1 - 1;
     jl.       a16.     ;   goto rep2;
a17: al  w1  x3+d25+e42; move points:  to := top of points;
     al  w2  x3+d25    ;   from := last point;
a18: sn  w2  x3+d24    ; rep3:  if from = first point then
     al  w2  x3+d15+e42;     from := top of pseudo point;
     al  w1  x1-2      ;   decrease(to, from);
     al  w2  x2-2      ;
     rl  w0  x2        ;   move word;
     rs  w0  x1        ;
     se  w2  x3+d15    ;   if from <> start of pseudo point then
     jl.       a18.    ;   goto rep3;
     rl  w1  x3+d0     ;   
     ws. w1     b3.    ;   rel of segment
     rs  w1  x3+d24+d16-d15+d17-d17;   (no of segments to release = 0)
     rl  w2  x3+d1     ;   last of buffer :=
     bl  w1  x3+d46    ;   if remote printer then
     sn  w1     0      ;     unchanged else
     rs  w2  x3+d5     ;   cur out;
     rl. w2     j1.    ;   restore rest chars;
     jl.        a11.   ;   goto test rest;

a20: rs. w2     j1.    ; em:  save rest chars;
     rl  w1 (x3+d0)    ;
     al  w0     0      ;   remove em from word:
     ld  w1     8      ;
     so  w0     25     ;   shift until em char got;
     jl.       -4      ;
     sz  w0 1<8-25-1   ;
     jl.       -4      ;
     ls  w0    -8      ;   w0 now contains the leading chars, rigth justified;
     rl  w2  x3+d7     ;   w1 contains the remainigs chars, left justified;
     sn  w2     0      ;   if type <> 0 then
     jl.        a19.   ;
     ld  w1     8      ;     shift the remaining chars into the word;
     se  w1     0      ;
     jl.       -4      ;

a19: rs  w0 (x3+d0)    ;   save in buffers;
     rs  w0 (x3+d1)    ;
     rl. w2     j1.    ;   w2 := rest chars;
     rl  w0  x3+d7     ;
     se  w0     0      ;   if type <> 0 then
     jl.        a11.   ;   goto test rest;


; end text
;
; set end of text bit  and print rest of buffer

c3:  al  w1      5      ;   status :=
     rs  w1  x3+d22     ;   end text;
     al  w0      1      ;
     al  w1      1      ;   global counters :=
     aa  w1  x3+d37     ;   global counters + 1;
     ds  w1  x3+d37     ;
     rl  w2  x3+d1      ;   restore w2;
     al  w2  x2+2       ;
     jl.        a4.     ;   goto output;
\f


; re 24.9.73           main loop page       paper printer    ...65...




; next segment
;
; type = 2       :  next virt segment
; type = 0 or 1  :  next area segment

a25: rs  w2  x3+d1      ;   save cur out;
     rl  w0  x3+d7      ;
     so  w0      2      ;   if type <> 2 or 3 then
     jl.        c0.     ;   goto next area segment;
     jl.        c1.     ;   goto next virt segment;
c2:  rl  w2  x3+d1      ; return with segment: restore w2;
     rl. w1     b3.     ;   cur in := start of input buffer;
     al  w0  x1+512     ;
     rs  w0  x3+d26     ;   restore top in;
     jl.        a1.     ;   goto move;


; action table
; index is a character value < 26

j0:
h.
   0,r.10 , a14-a11 , a13-a11 , a15-a11 , 0,r.12 , a20-a11
;char: 0-9,   nl    ,   vt    ,   ff    , 13-24  ,   em
w.
j1:            0    ;   save w2
c8:  ld  w2    -100     ; hard error:
     al  w3     0       ;   w1w2w3:=0;
a26: ld  w2     8       ;   repeat
     ls  w2    -8       ;
     ld  w3     8       ;     w1w2w3:=w1w2w3 shift 8
     ls  w3    -3       ;            + status shift (24-3)
     ld  w0     3       ;            + 48;
     al  w3  x3+48      ;     status:=status shift 3;
     sh  w1     255     ;
     jl.        a26.    ;   until w1w2w3 contains 8 characters;
     ds. w2     j3.     ;   
     rs. w3     j2.     ;   octal status:=w1w2w3;
                        ;
     al. w1     j4.     ;
     rl. w3     b1.     ;   reestablish page1 address;
     rl  w2  x3+d4      ;   cur in := error text addr;
     rs  w2  x3+d26     ;   cur out := top := first of buffer;
     jl.        a1.     ;   goto move;
j4:    <:<15><10><10>:> ;   si, 2 newlines

     <:<32>file unreadable, octal status = :>,
   0, j3: 0, j2: 0      ;    octal status
     <:<25>:>, -1       ;



e.   ;   end copy block
\f


; re 24.9.73           main loop page       paper printer    ...66...




; test printer status
;
; the coroutine state is updated depending
; on the printer status bits
;
;  w0 = printer status
;  w2 = return
;  w3 = page 1 addr

c4:  rl  w1  x3+d22     ;   w1 := state;
     sz. w0   (b37.)    ;   if end of paper then
     al  w1  x1+16      ;   set end paper bit;
     sz. w0   (b38.)    ;   if hard error then
     al  w1  x1+32      ;   set hard error bit;
     sz  w0    1<4      ;   if disconnected then
     al  w1  x1+64      ;   set disconnected bit;
     rs  w1  x3+d22     ;   save state;
     jl      x2         ;   return;



; set queue bit

c5:  rl  w1  x3+d22     ;
     al  w1  x1+ 8      ;   state := state
     rs  w1  x3+d22     ;   or queue > 0;


; call central page

c6:  dl. w3    b40.     ;   w2,w3 := addr;
     jl.      (b12.)    ;   page jump (central);



\f


; bøt  28.12.71          main loop page     paper printer  ...67...



; define relative addresses to be used 
; in initialization


f10 = b5  - b0      ;  send and wait
f11 = b6  - b0      ;  send and wait fast
f12 = b7  - b0      ;  lock simple
f13 = b8  - b0      ;  open simple
f14 = b12 - b0      ;  page jump
f16 = b23 - b0      ;  segments free
f17 = b24 - b0      ;  segments full
f18 = b40 - b0      ;  entry central
f19 = b41 - b0      ;  super buffer start
f20 = b42 - b0      ;  super buffer top
f21 = c7  - b0      ;  return from central



; define absolute addresses to
; the external list

g20 = f10 + g0
g21 = f11 + g0
g22 = f12 + g0
g23 = f13 + g0
g24 = f14 + g0
g26 = f16 + g0
g27 = f17 + g0
g28 = f18 + g0 - 2
g29 = f19 + g0
g30 = f20 + g0

f0 = k - b0    ;  define length of page
k  = g0 + f0   ;  k := absolute value of load addr
g1 = k - 2     ;  define last of page
f100 = f100 + 4;  count k-assignments
i.
e.



\f


; bøt  28.12.71          main loop page     paper printer  ...68...


; initialize main loop
;
; reserve super buffer and
; initialize the semaphores, free and full
; write page


b. a5, j10
w.


g8:  al  w0    i66      ;   w0 := reserve on disc;
     al  w1    512      ;   w1 := page size;
     jl. w3    (j1.)    ;   reserve virt (w0, w1, w2);
     al  w2  x2+1       ;   w2 := virt + writing;
     am.       (j6.)    ;
     al  w3  x2         ;   w3 := top virt;
     rs. w2     g163.  ;    ext(383);
     rs. w3     g164.  ;    ext(384);
     sn  w2  x3         ;   if no super buffer then
     jl.        a1.     ;   goto rest;
     al  w3  x3-513     ;
     rs. w3     j7.     ;   save last virt;
a0:  jl. w3    (j1.)    ;   reserve last of buffer
     se. w2    (j7.)    ;
     jl.        a0.     ; rest:
a1:  al  w1    i67      ;   segments free value :=
     rs. w1    (j4.)    ;   length of buffer;
     al  w0    i65      ;   w0 := reserve on disc;
     al  w1     f0      ;   w1 := length of page;
     jl. w3    (j1.)    ;   reserve virt (w0, w1, w2);
     al. w0     g0.     ;   w0 := abs start of main loop;
     jl. w3    (j2.)    ;   move to virt (w0, w1, w2);
     rs. w2     g179.  ;    ext(386);

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

g163:    0  ,   383    ;    buffer
g164:    0  ,   384    ;        limits;
j4: e13<12+19,   60    ;    segments free;
j5: e13<12+19,   61    ;    segments full;
g179:    0  ,   386    ;    virt of main lop;
         0  ,  -1000   ;    end of externals;

     jl. w3    (j3.)    ;   end init

j0:              0      ;*  base of externals
j1:             12      ;*  reserve virt
j2:             13      ;*  move to virt
j3:             15      ;*  end init
j6: w.       i67<9      ;   length of superbuffer
j7:              0      ;   last virt

g140 = j0, g141 = j1, g142 = j2, g143 = j3
g144 = j4, g145 = j5

e.
i.

h0 = s0, h1 = s1        ;   define final checksums
h2 = f100               ;   transfer k-assignments to
                        ;     tape printer
e.e.                    ;   end global blocks


e.e.                    ;   end options
\f


▶EOF◀