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

⟦ea886eb9c⟧ TextFile

    Length: 37632 (0x9300)
    Types: TextFile
    Names: »hcrhcomtx«

Derivation

└─⟦621cfb9a2⟧ Bits:30002817 RC8000 Dump tape fra HCØ.  Detaljer om "HC8000" projekt.
    └─⟦0364f57e3⟧ 
        └─⟦this⟧ »hcrhcomtx« 

TextFile

(hcdriver=slang list.yes xref.yes;
hcdriver);
b.  g2 w.             ;
s.  a70,b50,h50,i100 w.;

;. format of message buffer
    a40=-10           ; buffer state
    a38= -8           ; receiver<12+sender (computer numbers)
    a36= -6           ; process description addr for receiver other computer
    a34= -4           ;    -         -       -    -  sender     -      -
    a32= -2           ; w2
    a0 =  0           ; next buffer
    a2 =  2           ; prev buffer
    a4 =  4           ; receiver
    a6 =  6           ; sender
                      ;               i-o (normal)    i-o (other com)   mon call
    a8 =  8           ; message       op<12 +mode       3<12            1<22+m_p_n
    a10= 10           ;    -          first address     first addr      w0
    a12= 12           ;    -          last  address     last  addr      w1
    a14= 14           ;    -          1. segment        first addr(oc)  w2
    a16= 16           ;    -                            comp no         w3
    a18= 18           ;    -
    a20= 20           ;    -
    a22= 22           ;    -
    a49=a22-a40+2     ; buffer length
    a48=10            ; max numbers of buserrors
    a50= 21<3         ; level 21
    a51= 22<3         ; level 22
    a54= 1            ; time out limit for mess, buff
    a55=10            ; time out limit for transfer
    ;; buffer state = 0  for a normal buffer (is only copied)
    ;                -1  for a buffer from monproc copy
    ;                -2  for a moncall buffer               
    ;                -3  mirrorbuffer received of master
    ;                -4        -          -    -    -    and send to receiver
\f


;.
; format of message to another computer:
;
;
; do     wreg             addr
;        wa        1<23+level<3+ 2.001  send data transfer request
;                  wa > 0 :   contents irr
;                             request to send data specified by level location
;                  wa <=0 :   message
;
;
;
; di    wreg              addr
;       wb         1<23+level<3+ 2.001  start input
;                  wb > 0 :   input to addr specified in level location
;                  wb <=0 :   message
;
;                   level location   (8) + level < 3
;                   *----------*----------*----------*----------*
;                   ! number of! input or ! interrupt!          !
;                   ! bytes to ! output   ! address  ! level    !
;                   ! transfer ! address  !          !          !
;                   *----------*----------*----------*----------*
;
;
;  format of message
;
;  1<23+type<19 + mess
;
;  type = 16  input-output communication
;             mess  = mess-type < 17 + mess-id
;             mess-type = 0 send buffer request
;                         1 ready for receiving a buffer
;                         2 send data request
;                         3 ready for receiving data
;
;             mess-id is a unique number for each transfer
;
;  state for i-o transfer
;        0 nothing pendling
;
;        1 a send buffer request is sent
;        2 a buffer is sent
;        4 a send data request is sent
;        8 data is sent
;
;       32 an input buffer request is received
;       64 a start input buffer is sent
;      128 an input data request is received
;      256 a start data input is sent
;
;
;
; external interrupt  16 :  channel input finis
;    -         -      18 :  channel input start (input request)
;    -         -      20 :  channel output finis
;    -         -      22 :  character device interrupt(not used)
\f




;. all input and output actions are described in chained links:
;
    a60=0             ; link: next link
    a61=2             ;       prev link
    a62=4             ;       type
    a63=6             ;       buffer address
    a64=8             ;       link id  other computer
    a65=10            ;       link id   this computer
    a66=12            ;       input or output addr
    a67=14            ;       halfwords
    a68=16            ;       time left before time out
    a70=a68-a60       ; length of a link
                      ;
;. link type= 11   mirror buf describing an area waiting for input form o. c.
;             10   mirror buf      -      -   -     -    to be output to o. c.
;              9   mirror buf waiting for input from o. c.
;              8   mirror buf only linked
;              7   a buffer waiting for an answer
;              3   real buf describing an area waiting for input
;              2   real buf     -       -   -      -   to be output to o. c.
;              1   real buf waiting to be output to o. c.
;              0   real buf only linked
;
\f


    rs. w3     h7.    ; own proc desr addr
    al  w0     6      ;
    hs  w0  x3+104    ; disable interrupt level:=6
    al. w1     h31.   ;
    al. w2     h31.   ;
    ds  w2  x2+2      ; link head:=link head
    al. w1     h32.   ;
    al. w2     h32.   ;
    ds  w2  x2+2      ; free link head:=free linkhead
    jl. w3     b50.   ; goto chain free links
    al  w0     4      ;
    jd         1<11+32; set own process descr addr in monitor
    jd         1<11+28; set monitor mode
    al. w3     h10.   ;
    jd         1<11+4 ; w0:=process descr addr(master)
    rs. w0     h8.    ;
    rl  w3     8      ; base of controller table
    al  w3  x3+a50+2  ; +rel addr(level21)
    rs. w3     h0.    ; input location
    al  w3  x3+8      ;
    rs. w3     h1.    ; output location
    jl. w3     b18.   ; send time out limit to clock
\f


i0: rl. w1     h4.    ; w1:=i-o state
    sz  w1     2.1111 ; if output pendling then
    jl.        i3.    ; goto wait event
    jl. w3     b13.   ; search link waiting for output
    jl.        i1.    ; return 0 not found: goto test input
    jl.        i15.   ; return 2 goto send output buffer request
    jl.        i35.   ; return 4 goto send output data request
i1: rl. w1     h4.    ; w1:=i-o state
    sz  w1     2.101000000; if a ready for input is sent then
    jl.        i3.    ; goto wait event
    so  w1     2.000100000; else if an input buffer request is not sent then
    jl.        i2.    ; goto test data
    al  w0     9      ; else
    jl. w3     b14.   ; goto search link in state 9
    jl.        i3.    ; not found: goto wait event
    jl.        i42.   ; else goto send input buffer ready signal
i2: so  w1     2.010000000; if an input data request is not sent then
    jl.        i3.    ; goto wait event
    jl. w3     b12.   ; search input link
    jl.        i3.    ; return 0 not found: goto wait event
    jl.        i45.   ; return 2: goto send input data ready signal
i3: al  w2     0      ;
    je.        2      ; interrupt level:=26
    jd         1<11+24; wait event
    jd.        2      ; set interrupt level=6
    sl  w0     2      ; if interrupt from hc8000 then
    jl.        i4.    ; goto i4 else
    jd         1<11+26; get event
    se  w0     0      ; if not message then
    jl.        i50.   ; goto i50
    rs. w2     h2.    ; else save buf addr
    jl.        i11.   ; goto link buff
\f


i4: sn  w0     16     ; if channel input finis then
    jl.        (h29.) ; goto return point for input finis
    sn  w0     20     ; if channel output finis then
    jl.        (h28.) ; goto returnpoint for output finis
    rl. w3     h4.    ; w3:=i-o state
    sz  w3     2.010100000; if input data is expected then
    jl.        i6.    ; goto i6.
    jl. w3     b1.    ; else load message via data in
    jl.        i0.    ; if buserror then goto next event
i5: jl. w3     b6.    ; get mess type
    se  w0     8      ; if not i-o mess then
    jl.        i0.    ;  goto next event
    jl. w3     b7.    ; get i-o mess type
    ls  w0     1      ;
    am         (0)    ;
    jl.        2      ; case mess-type of
    jl.        i40.   ; start buffer input
    jl.        i20.   ; send a buffer
    jl.        i45.   ; start data input
    jl.        i36.   ; send data
                      ;
                      ;
i6: dl. w3     h16.   ; 
    ds. w3     (h0.)  ; set input address
    jl. w3     b1.    ; and start input
    jl.        i64.   ; if buserror then goto set result
    rl. w3     h3.    ; w3:=last di reg  value
    sh  w3     0      ;
    jl.        i5.    ; goto mess
    jl.        i0.    ; else goto wait next event
                      ;
                      ;
\f


    ;; ************************************************************
    ;
    ;          start output to hc8000
    ;
    ;; ************************************************************
i7: al. w1     h31.   ;
    jl.        i9.    ;
i8: sn  w2     (x1+a63); if recieved buf=buf.link then
    jl.        i10.   ; goto i10
i9: rl  w1  x1        ; next link
    sn. w1     h31.   ;
    jl.        i31.   ; goto remove buf and link
    jl.        i8.    ; else test next link
i10:al  w0     0      ; set link state and
    rs  w0  x1+a62    ;
    jl.        i0.    ; goto next event
i11:jl. w3     b20.   ; goto link buffer
    jl.        i0.    ;
i15:rl  w2  x1+a63    ; w2:=buf
    jl. w3     b40.   ; set outputmess
    jl. w3     b0.    ; send output message to RH8000
    jl.        i64.   ; if buserror then set result 2
    al  w0     a54    ;
    rs  w0  x1+a68    ; set time out limit
    al  w0     2.1    ;
    jl. w3     b2.    ; goto set i-o state
    jl. w3     b21.   ; set link state
    jl. w3     i0.    ; goto next event
i20:jl. w3     b8.    ; get transfer-id from last data in
    jl. w3     b16.   ; search transfer-id
    jl.        i0.    ; if not found then goto next event
    rs. w1     h6.    ; set current output link
    rl  w2  x1+a63    ;
    al  w3     a49    ; w3:=buffer length
    al  w0  x2+a40    ; w0:= first addr of buff
    ds  w0  x1+a67    ;
    ds. w0     (h1.)  ; set(byte,addr)
    rs. w3     h5.    ; next reg val for data out
    jl. w3     b0.    ; send output request to hc8000
    jl.        i64.   ; if buserror then goto result 2
    al  w0     a54    ;
    rs  w0  x1+a68    ; set time out limit
    al  w0     2.10   ;
    jl. w3     b2.    ; set i-o state
    jl. w3     i39.   ; goto next event
\f


i30:rl. w1     h6.    ; w1:=current output link addr
    rl  w2  x1+a63    ; w2:=buffer addr
    rl  w0  x2+a6     ; w0:=sender
    se. w0     (h8.)  ; if sender<>master then
    jl.        i38.   ; goto i38
    bz  w0  x2+a8     ; w0:=op
    sn  w0     7      ; if op=mubf-copy then
    jl.        i32.   ; goto copy area.buf
i38:rl  w0  x2+a40    ; w0:=buf.status
    sn  w0     -1     ; if a buf from copy then
    jl.        i32.   ; goto i32
    sh  w0     0      ; else if a normal buf then
    jl.        i34.   ; goto set state.buf to waiting for an answerbuffer
                      ; else is it a answer buffer to other computer,
                      ; which now is transfered
    jl. w3     b9.    ; remove link from activ queque
i31:al. w1     h12.   ; return buf
    jd         1<11+18;
    jl.        i0.    ; and goto next event
i32:                  ;
    bz  w0  x2+a8     ; w0:=op
    se  w0     3      ; if op<>input then
    jl.        i33.   ; goto i33
    jl. w3     b23.   ; else link.state:=waiting for input
    jl.        i0.    ;
i33:se  w0     5      ; if op<>output then
    jl.        i37.   ; goto i37
    jl. w3     b22.   ; else link.state:=waiting for output
    jl.        i0.    ; goto next event
i34:rl  w0  x2+a4     ; w0:=receiver
    sl  w0     10     ; if not answer from o. c. then
    jl.        i37.   ; goto change link state
    rl  w3  x2+a6     ; else change sender.oc and
    rx  w3  x2+a34    ; sender this computer
    rs  w3  x2+a6     ;
    jl. w3     b9.    ; remove link and
    rl  w0  x2+a4     ;
    jl.        i66.   ; move buf to master
i37:jl. w3     b27.   ; change link state to waiting for answerbuffer
    jl.        i0.    ; and goto next event
i35:rl  w2  x1+a63    ; w2:=buf
    jl. w3     b42.   ; set outputmess
    jl. w3     b0.    ; send output data request
    jl.        i64.   ; if buserror then goto set result
    al  w0     a55    ;
    rs  w0  x1+a68    ; set time out limit
    al  w0     2.100  ;
    jl. w3     b2.    ; goto set i-o state
    jl. w3     i39.   ;
\f


i36:jl. w3     b8.    ; w0:=transfer-id
    jl. w3     b16.   ; search link
    jl.        i0.    ; if not found then goto next event
    rl  w2  x1+a63    ; else w2:=buf
    rl  w0  x1+a62    ; w0:=linktype
    sh  w0     3      ; if real buf then
    am         a10-a14; first addr:=first addr this computer else
    rl  w0  x2+a14    ; w:=first addr. other computer
    rl  w3  x2+a12    ;
    ws  w3  x2+a10    ;
    al  w3  x3+2      ; w3 :=number of halfwords
    sh  w3     0      ; if nothing to transfer then
    jl.        i67.   ; goto set result
    ds  w0  x1+a67    ;
    ds. w0     (h1.)  ;
    rs. w3     h5.    ;
    jl. w3     b0.    ; start output data
    jl.        i64.   ; if buserror then goto set result
    al  w0     2.1000 ; else
    jl. w3     b2.    ; goto set i-o state
    rl. w1     h6.    ; save current link
    jl. w3     i39.   ; goto next event
    al  w0     0      ;
    jl. w3     b2.    ; set i-o state
    rl. w1     h6.    ; w1:=link
    rl  w2  x1+a63    ; w2:=buf
    jl. w3     b9.    ; remove link
    rl  w3  x1+a67    ;
    rs  w3  x2+a10    ; set number of halfwords in buf
    jl.        i69.   ; goto set result
i39:rs. w3     h28.   ; set return addr
    jl.        i0.    ; and goto next event
\f


    ;; ************************************************************
    ;
    ;          start input from hc8000 to rh8000
    ;
    ;; ************************************************************
i40:                  ; make a buffer ready for input from hc8000
    al. w1     h12.   ;
    al. w3     h13.   ; name
    jd         1<11+16; get buffer
    rs. w2     h2.    ; curr buf
    jl. w3     b28.   ; link buf
    al  w0     a54    ;
    rs  w0  x1+a68    ; set time out limit
    al  w0     2.000100000;
    jl. w3     b2.    ; goto set i-o state
    rl. w0     h3.    ; w0:=last mess from data in
    rs  w0  x1+a64    ; to link
    jl.        i0.    ; goto next event
i42:rs. w1     h14.   ; set current link
    rl  w2  x1+a63    ; w2:=buff
    al  w0  x2+a40    ; w0:=1. addr
    al  w3     a49    ; w3:=buffer length
    ds. w0     h16.   ;
    ds  w0  x1+a67    ;
    jl. w3     b41.   ; set outputmess
    jl. w3     b0.    ; send ready signal for receiving a buffer
    jl.        i0.    ; if buserrror then goto next event
    al  w0     a54    ;
    rs  w0  x1+a68    ; set time out limit
    al  w0     2.001000000;
    jl. w3     b2.    ; set i-o state
    jl. w3     b29.   ; change link state
    jl. w3     i49.   ; goto to next event
                      ;
    rl. w1     h14.   ;
    al  w0     2.000001111;
    jl. w3     b15.   ; reset input state
    rl  w2  x1+a63    ; w2:=buff
    rl  w0  x2+a40    ; w0:=buf.state
    sn  w0     0      ; if message then
    jl.        i43.   ; goto i43
    sn  w0     -1     ; if a mirror buf from copy o.c. then
    jl.        i44.   ; goto i44
    jl. w3     b17.   ; else search buffer in chains
    jl.        i50.   ; not found: return buffer
                      ; else set and test result.
    rl  w3  x1+a63    ; w3=real buf  w2=mirror buf
    rl  w0  x2+a4     ; w0:=result
    sh  w0     (x3+a4); set higthest result
    rl  w0  x3+a4     ; in the
    rs  w0  x3+a4     ; real buf
    rl  w0  x2+a8     ;
    lo  w0  x3+8      ; set status in
    rs  w0  x3+8      ; in the real buf
    rs. w1     h14.   ; save current link
    al. w1     h12.   ;
    jd         1<11+18; return mirror buf
    jl.        i66.   ; and move real buf to master
\f


i43:dl  w0  x2+a6     ; change sender/receciver.this computer
    rx  w0  x2+a34    ;
    rx  w3  x2+a36    ;  with sender/reciever.other comp.
    ds  w0  x2+a6     ;
    jl.        i66.   ; and move buffer to master
i44:bz  w0  x2+a8     ;
    sl  w0     3      ; if not input message or
    sl  w0     6      ; not output mesage then
    jl.        i43.   ; move buf to master
    sn  w0     4      ;
    jl.        i43.   ;
    rl  w3  x1+a65    ; else transfer-id to
    rs  w0  x2+40     ; buf
    jl. w3     b30.   ; set link state as mirror output
    se  w0     5      ;
    jl. w3     b31.   ; or as mirror input 
    jl.        i0.    ; and goto next event
i45:jl. w3     b8.    ; w0:=transfer-id
    jl. w3     b16.   ; search link
    jl.        i0.    ; if not found then goto next event
    rs. w1     h14.   ; set current link
    rl  w2  x1+a63    ; w2:=buf
    jl. w3     b3.    ; if address is outside proc then
    jl.        i67.   ; goto set result
    rl  w0  x1+a62    ; w0:=link type
    sh  w3     3      ; if real buf then
    am         a10-a14; w0:=first addr this computer else
    rl  w0  x2+a14    ; else w0:=first addr other computer
    rl  w3  x2+a12    ;
    ws  w3  x2+a10    ; w3:=number of halfwords
    al  w3  x3+2      ; to transfer
    sh  w3     0      ; if nothing to transfer then
    jl.        i67.   ; goto set result
    ds  w0  x1+a67    ;
    jl. w3     b43.   ; set ready signal for input
    jl. w3     b0.    ; goto send ready signal
    jl.        i64.   ; if buserror then goto set result
    al  w0     a55    ;
    rs  w0  x1+a68    ; set time out limit
    al  w0     2.100000000;
    jl. w3     b2.    ; set i-o state
    jl. w3     i49.   ; set return point and goto next event
                      ;
    rl. w1     h14.   ;
    rl  w2  x1+a63    ; w2:=buf
    rl  w3  x1+a67    ;
    rs  w3  x2+a10    ; number of halfwords to buf
    jl.        i69.   ; set result
i49:rs. w3     h29.   ; set return point and
    jl.        i0.    ; goto next event
\f


    ;; ************************************************************
    ;          send answer and/or move buffer
    ;; ************************************************************
i50:                  ; an answer is arrived
    se. w2     (h17.) ; if current buf <> time delay buf then
    jl.        i61.   ; goto return buf
    al. w1     h31.   ; else test chain for time out
    sn. w1     h31.   ; if chain is empty then
    jl.        i56.   ; goto send a new message to clock
    rl  w1  x1        ; next link
i51:rl  w0  x1+a68    ; time out limit:=
    bs. w0     1      ; time out limit-1
    rs  w0  x1+a68    ;
    sh  w0     -1     ; if time out then
    jl. w3     b19.   ; goto return buffer
    rl  w1  x1        ; w1:=next link
    se. w1     h31.   ; if more to test then
    jl.        i51.   ; goto next

i56:jl. w3     b18.   ; else send new mess to clock
    jl.        i0.    ; goto next event
                      ;
i61:                  ;
    rl  w1  x2+a4     ; w1:=receiver
    sh  w0     10     ; if answer then
    jl.        i7.    ; goto search link
    se. w1     (h7.)  ; if receiver<>this proc then
    jl.        i64.   ; goto i64
i62:al  w0     2      ; result=2 (rejected)
    al. w1     h9.    ; mess addr
    jd         1<11+22; send message
    jl.        i0.    ; goto next event
i67:am         -1     ; set result 3          address error
i64:am         -508   ; set result 4          rejected (buseeror)
i63:am         511    ; set result 512        time out
i65:al  w0     1      ; set result 1
    al  w3     0      ;
    se  w0     512    ; if not time out then
    jl.        i68.   ; goto set status and answer
    rl  w3     0      ; w3:=2.0010 0000 0000
    al  w0     1      ; result=1
i68:hs  w3  x2+a8+1   ; set buf.status
    rs  w0  x2+a40    ; set result
    rl  w0  x1+a62    ; w0:=link state
    sn  w0     7      ; if waiting for answer buf then
    jl.        i0.    ; goto next event
i66:al. w3     h10.   ;
    jd         1<11+34; move buf to master proc
    jl.        i0.    ; goto next event
                      ;
i69:al  w0     1      ;
    rs  w0  x2+a4     ; set result=1
    al  w0     0      ;
    rs  w0  x2+a8     ; and set status
    rl  w0  x1+a62    ; w0:=link type
    sl  w0     7      ; if mirror buf then
    jl.        i10.   ; change link state to buffer to be output
    jl. w3     b27.   ; else set link state=wait for answer
    jl.        i0.    ; and goto next event
\f


h0: 0                 ; controller table addr(level(21))  input
h1: 0                 ; controller table addr(level(22))  output
h2: 0                 ; buffer addr
h3: 0                 ; last di-register value
h4: 0                 ; i-o state
h5: 0                 ; next register value at data-out
h6: 0                 ; current output link
h7: 0                 ; own proc descr addr
h8: 0                 ; process description addr for master 
h9: 0,r.8             ; message
h10:<:masterproc:>,0,0;
h12:0,r.8             ; pseudo message
h13:0,r.5             ; pseudo name
h14:0                 ; current input link 
h15:0                 ; halfwords
h16:0                 ; next input addr
h17:0                 ; clock buf
h18:2.1111<19         ; mask for extracting mess-type
h19:2.11<17           ; mask for extracting i-o mess-type
h20:2.111111          ; mask for extracting transfer id
h28:0                 ; output return addr
h29:0                 ; input return point
h31:0,0               ; activ link chain head
h32:0,0               ; free links head
\f


    ;;
    ;
    ;
    ; send output request to hc8000
b.  f5,g5 w.          ;
b0:                   ;
    rs. w3     g3.    ; save return
    al  w3     0      ;
    rs. w3     g1.    ; reset counter
f0: rl. w3     h5.    ; w3:=do-reg-value
    do. w3     (g0.)  ; send output request to hc8000
    sx         2.111  ; if buserror then
    jl.        f2.    ; goto f2 else
    jl.        f3.    ; goto f3
f2: rl. w0     g1.    ; w0:=counter
    ba. w0     1      ; counter:=counter+1;
    rs. w0     g1.    ; save counter
    sh  w0     a48    ; if counter<=max number of buserrors then
    jl.        f0.    ; repeat data out
    rl. w3     g3.    ;
    jl      x3+0      ;
f3: rl. w3     g3.    ;
    jl      x3+2      ; and return
g0: 1<23 + a50 +2.001 ;
g1: 0                 ;
g3: 0                 ;
e.                    ;
                      ;
                      ;
                      ; send input request to hc8000
b.  f5,g5 w.          ;
b1:                   ;
    rs. w3     g3.    ; save return
    al  w3     0      ;
    rs. w3     g1.    ; reset counter
f0: di. w3     (g0.)  ; send input request to hc8000
    sx         2.111  ; if buserror then
    jl.        f2.    ; goto f2 else
    jl.        f3.    ; goto f3
f2: rl. w0     g1.    ; w0:=counter
    ba. w0     1      ; counter:=counter+1;
    rs. w0     g1.    ; save counter
    sh  w0     a48    ; if counter<=max number of buserrors then
    jl.        f0.    ; repeat data out
    rl. w3     g3.    ; else return+0
    jl      x3+0      ;
f3: rs. w3     h3.    ; set di-reg-value
    rl. w3     g3.    ; return+2
    jl      x3+2      ;
g0: 1<23 + a50 +2.001 ;
g1: 0                 ;
g3: 0                 ; return addr
e.                    ;
                      ;
\f


    ;;
    ;
    ;
    ;
    ; set i-o state
    ; w0=state
    ;
b.  f5,g5 w.          ;
b2:                   ;
    ds. w3     g3.    ;
    al  w2     2.1111 ;
    sl  w0     2.100000; if input state then
    ls  w2     5      ; move mask
    la. w2     h4.    ; extract old mask
    wa  w2     0      ; insert new
    rs. w2     h4.    ; state and store
    dl. w3     g3.    ;
    jl      x3        ; return
g2: 0                 ;
g3: 0                 ;
e.                    ;
    ;;
    ;
    ;
    ; test buffer
    ; test first.buff and last.buff in case of input buffer
    ; call: w2=buffer addr
    ; return 1 if first or last is not within proc
    ; return 2 else
    ; return: w0,w1,w2  unchanged, w3 return addr
b.  f5,g5 w.          ;
b3:                   ;
    ds. w0     g0.    ;
    rs. w1     g1.    ;
    al  w3     2      ;
    bz  w0  x2+a8     ;
    se  w0     3      ; if not input buffer then
    jl.        f0.    ; return
    rl  w1  x2+a6     ; w1:=sender 
    dl  w0  x1+24     ; w3,w0:=first,last addr.proc
    wa  w3  x1+98     ; +base
    wa  w0  x1+98     ; +base
    ba. w0     1      ;
    sh  w3  x2+a10    ; if first.buf<first.proc or
    sh  w0  x2+a12    ; last.buf >= last.proc then
    am         -2     ; return 2
    al  w3     2      ; else return 1
f0: rl. w0     g0.    ;
    wa. w3     g3.    ;
    rl. w1     g1.    ;
    jl      x3        ;
g1: 0                 ;
g3: 0                 ;
g0: 0                 ;
e.                    ;
                      ;
                      ;
                      ;
                      ;
                      ;
\f


b.w.                  ;
b4:                   ; insert a link
                      ; w1=element, w2=head
                      ; return: w1,w2 unchanged, w3 prev element
    rs  w3     0      ;
    rl  w3  x2+2      ; w2:=prev link
    rs  w1  x2+2      ; prev link:=curr link
    rs  w1  x3+0      ;
    rs  w2  x1+0      ;
    rs  w3  x1+2      ;
    jl         (0)    ; return
e.                    ;
b.w.                  ;
b5:                   ; remove a link
                      ; w1=element
                      ; return: w1,w2 unchanged,  w3=next element
    rs  w3     0      ;
    rl  w3  x1+0      ;
    rx  w1  x1+2      ;
    rs  w3  x1+0      ;
    rx  w1  x3+2      ;
    rs  w1  x1+0      ;
    jl         (0)    ;
e.                    ;
                      ;
                      ;
b.w.                  ; extract
b6: am         h18-h19; mess type,
b7: am         h19-h20; i-o mess type or
b8: rl. w0     h20.   ; transfer id
    la. w0     h3.    ;
    jl      x3        ; 
e.                    ;
                      ;
                      ;
b.  g5 w.             ; remove a link from activ chain and insert it in free chain
                      ; call : w1=link,  w2=buffer
                      ; return w0,w3 undef, w1,w2 unchanged
                      ;        h2 is set to buf.w2
b9: rs. w3     g3.    ;
    jl. w3     b5.    ; remove link
    rs. w2     h2.    ; save current buffer
    al. w2     h32.   ; free chain head
    jl. w2     b4.    ; insert link
    rl. w2     h2.    ;
    jl.        (g3.)  ; 
g3: 0                 ;
e.                    ;
\f


b.  g5,f5 w.          ;
    ;; search a link in state 3 or 11
    ; return 0     w1=chain head, w2 unchanged
    ; return 2     w1=link in state 3 or 11, w2 unchanged
b12:rs. w3     g3.    ;
    al  w3  x3+2      ;
    rs. w3     g4.    ; return 2
    al. w1     h31.   ; link head
    jl.        f1.    ; goto test
f0: rl  w0  x1+a62    ; link state
    so  w0     2.11   ; if state<>3 or state <>11 then
    jl.        f1.    ; goto test next
    jl.        (g4.)  ; else return 2
f1: rl  w1  x1        ;
    se. w1     h31.   ; if more to test then
    jl.        f0.    ; goto f0
    jl.        (g3.)  ; else return 0
g3: 0                 ;
g4: 0                 ;
e.                    ;
                      ;

                      ;
b.  g6,f5 w.          ;
    ;; search a link in state 0, 2 or 10
    ; return 0: w1=chain head, w2 unchanged
    ; return 2: w1=link in state 0, w2 unchanged
    ; return 4: w1=link in state 2 or 10, w2 unchanged
b13:rs. w3     g3.    ;
    al  w3  x3+2      ;
    rs. w3     g4.    ; return 2
    al  w3  x3+2      ;
    rs. w3     g5.    ; return 4
    al  w0     0      ;
    jl. w3     b14.   ; search buffer to output
    jl.        f2.    ; not found: goto search area output
    jl.        (g4.)  ; else return 2
f2: al. w1     h31.   ; link head
    jl.        f1.    ; goto test
f0: rl  w0  x1+a62    ; link state
    la. w0     g6.    ;
    sn  w0     2      ; if state=2 or state=10 then
    jl.        (g5.)  ; return 4
f1: rl  w1  x1        ;
    se. w1     h31.   ; if more to test then
    jl.        f0.    ; goto f0
    jl.        (g3.)  ; else return 0
g3: 0                 ;
g4: 0                 ;
g5: 0                 ;
g6: 2.111             ;
e.                    ;
\f


b.  f5,g5 w.          ;
    ;; search a link in state.w0 in link chain
    ; if found then return 2
    ; else return 0
    ; return: w0, w2 unchanged.  w1=link
b14:                  ;
    ds. w0     g0.    ;
    al. w1     h31.   ; w1:=link head for input
    sn  w1     (x1)   ; if chain is empty
    jl.        f1.    ; then goto return 0
f0: rl  w1  x1        ; w1:=next link
    sn  w0     (x1+a62); if link is in state.w0
    jl.        f2.    ; goto return 2;
    se. w1     h31.   ; if more links then
    jl.        f0.    ; get next
f1: am         -2     ; else return 0
f2: al  w3     2      ; return 2
    rl. w0     g0.    ;
    wa. w3     g3.    ;
    jl      x3        ;
g3: 0                 ;
g0: 0                 ;
e.                    ;
                      ;
                      ;
                      ;
b.w.                  ; clear input or output state
b15:la. w0     h4.    ;
    rs. w0     h4.    ;
    jl      x3        ; 
e.                    ;
                      ;
b.  f5,g5 w.          ;
    ;; search a link  with transfer id = w0
    ; if found then return 2
    ; else return 0
    ; return: w0, w2 unchanged.  w1=link
b16:                  ;
    rs. w3     g3.    ;
    al  w3  x3+2      ;
    rs. w3     g4.    ;
    al. w1     h31.   ; w1:=link head for input
    jl.        f1.    ;
f0: rl  w3  x1+a65    ;
    la. w3     h20.   ; w3:=transfer id
    sn  w0  x3        ; if link is in state.w0
    jl.        (g4.)  ; goto return 2
f1: rl  w1  x1        ;
    se. w1     h31.   ; if more links then
    jl.        f0.    ; get next
    jl.        (g3.)  ;
g3: 0                 ;
g4: 0                 ;
e.                    ;
\f


b.  g5,f5 w.          ;
    ;; search link with given transfer-id
    ; if mirrorbuf then transfer-id other computer
    ;              else transfer-id this computer is compared
    ; w0=transfer-id
    ; return0: not found 
    ; else
    ; return2: w1=link, w2 unchanged, w3=buf.link
b17:ds. w0     g0.    ;
    al  w3  x2+2      ;
    rs. w3     g4.    ; save return2
    al. w1     h31.   ;
    jl.        f1.    ;
f0: rl. w0     h20.   ; w0:=mask for transfer-id
    rl  w3  x1+a62    ;
    sl  w3     7      ; if mirrorbuffer then
    am         a64-a65; w0:=transfer-id o.c. else
    la  w0  x1+a65    ; transfer-id this computer
    sn. w0     (g0.)  ; if found then
    jl.        (g4.)  ; return 2
f1: rl  w1  x1        ;
    se. w1     h31.   ; if more links then
    jl.        f0.    ; goto next else
    jl.        (g3.)  ; return 0: not found
g4: 0                 ;
g3: 0                 ;
g0: 0                 ;
e.                    ;
b.  g5 w.             ;
b18:                  ; send message to clock
    rs. w3     g3.    ; save return
    al  w3     0      ;
    al  w0     1      ; w3,w0:=mode,delay
    al. w1     h12.   ;w1:=buf
    ds  w0  x1+2      ;
    al. w3     h13.   ;
    jd         1<11<16;
    rs. w2     h17.   ; save buf addr
    jl.        (g3.)  ;
g3: 0                 ;
e.                    ;
b.  g5 w.             ;
b19:                  ; return buf to master (after time out)
    rs. w3     g3.    ; save return
    rl  w2  x1+a63    ; w2:= buf
    rs. w1     g1.    ; save link
    al  w3     512    ; w3:=2.0010 0000 0000
    hs  w3  x2+a8+1   ; set status
    al  w0     1      ;
    rs  w0  x2+a40    ; set result
    al. w3     h10.   ; w3:=master proc
    jd         1<11+34; move buf to master
    rl. w1     g1.    ;w1:=link
    jl. w3     b5.    ; remove link
    al. w2     h32.   ; w2:=free link head
    jl. w3     b4.    ; insert link
    jl.        (g3.)  ; return
g1: 0                 ;
g3: 0                 ;
e.                    ;
\f


    ;; set up link or change link state
    ; call: w2=buffer addr, w1=link (not for b28 and b20)
    ; return: w0=state, w1=link, w2=buffer, w3 undef
b.  g5,f5 w.          ; change link state to
b31:am         1      ; mirror buf describing an area waiting for input form o. c.
b30:am         1      ; mirror buf      -      -   -     -    to beoutput to o. c.
b29:am         1      ; mirror buf waiting for input from o. c.
b28:am         1      ; mirror buf only linked
b27:am         4      ; a buffer waiting for an answer buf from o. c.
b23:am         1      ; real buf describing an area waiting for input
b22:am         1      ; real buf     -       -   -      -   to be output to o. c.
b21:am         1      ; real buf waiting to be output to o. c.
b20:al  w0     0      ; real buf only linked
    ds. w3     g3.    ;
    sz  w0     2.111  ; if already linked then
    jl.        f0.    ; goto f0
    rs  w0  x1+a62    ; set link state
    rl. w1     h32.   ; else get a free link
    jl. w3     b5.    ;
    al. w2     h31.   ; and insert in
    jl. w3     b4.    ; activ queque
    rl. w2     g2.    ;
    rs  w2  x1+a63    ; buffer addr
    al  w0     100    ; set init value for
    rs  w0  x1+a68    ; for time out
    jl.        (g3.)  ;
f0: rs  w0  x1+a62    ; link state
    jl.        (g3.)  ;
g2: 0                 ;
g3: 0                 ;
e.                    ;
b.  f5,g5 w.          ;
b50:                  ; set up chain with free links
    rs. w3     g3.    ;
    al  w0     0      ;
    al. w2     h32.   ; w2:=head
    al. w1     h30.   ; w1:=first
f0: jl. w3     b4.    ; chain link
    rs  w0  x1+a65    ; set link-id
    ba. w0     1      ;
    al  w1  x1+a70    ; w1:=next link
    sh  w0     127    ;
    jl.        f0.    ;
    jl.        (g3.)  ;
g3: 0                 ;
e.                    ;
\f


    ;; set up output message
    ; transfer-id is selected from link.w1
    ; if mirror buffer then  transfer-id other computer
    ;                  else       -      this    -
    ; call: w1=link, w2=buffer
    ; return: w1,w2 unchanged    w0,w3 undef
    ;         outputmess to h5
b.  g5 w.             ;
b40:am         -1     ; io-mess-type = 0: send buffer request
b41:am         -1     ;                1: ready for receiving a buffer
b42:am         -1     ;                2: send data request
b43:al  w0     4      ;                3: ready for receiving data
    ds. w0     g0.    ;
    rl. w0     h20.   ; w0:=mask for extracting transfer-id
    rl  w3  x1+a62    ; w3:=io-mess-type
    sl  w3     7      ; if mirrorbuf then
    am         a64-a65; load transfer-id other computer
    la  w0  x1+a65    ; else load transfer-id this computer
    rl. w3     g0.    ;
    ls  w3     17     ; set up output mess
    wa  w3     0      ;
    wa. w3     g4.    ;
    rs. w3     h5.    ;
    jl.        (g3.)  ;
g3: 0                 ;
g0: 0                 ;
g4:1<23 + 8<19 + 00<17 + 2.000000
e.                    ;

\f


c.  -1                ;
b.  f10,g10 w.        ;
b49:                  ;
    al. w1     g0.    ;
    al. w3     g1.    ;
    jd         1<11+42; lookup(<:kkmon8004:>)
    se  w0     0      ; if not found then
    jl.        f5.    ; goto f5
    rl. w1     h7.    ; w1:=own process desc addr
    rl  w2  x1+24     ; w2:=last byte
    al. w1     h30.   ; first byte
    rs. w1     g3.    ;
    ws  w2     2      ; w2:=buffer length
    ls  w2     -9     ; in segments
    rs. w2     g9.    ;
    rl. w1     g0.    ; w:=monitor length
    al  w0     0      ;
    wd  w1     4      ; w1:=number af shares
    se  w0     0      ;
    al  w1  x1+1      ; round
    rs. w1     g6.    ;
    al. w1     g6.    ;
    al  w0     2      ;
    ds. w1     (h0.)  ; set(byte,addr)
    jl. w3     b0.    ; send output request to HC8000
    jl.        f5.    ; if buserror then goto f5
    al  w0     20     ;
    jl. w3     b2.    ; wait for channel output finis
    al. w1     h30.   ;
    rl. w0     g9.    ; w0:=share length
    ls  w0     9      ; in halfwords
    ds. w1     (h0.)  ; set(byte,addr)
    al. w3     g1.    ;
    jd         1<11+52;
    jd         1<11+8 ; create and reserve(<:kkmon8004:>)
    se  w0     0      ; if error then
    jl.        f5.    ; goto f5
f1: al. w3     g1.    ;
    al. w1     g2.    ;
    jd         1<11+16; input next share
    al. w1     g8.    ;
    jd         1<11+18;  wait for input finis
    se  w0     1      ; if error then
    jl.        f5.    ; goto f5
    jl. w3     b0.    ; send output request
    jl.        f5.    ; if buserror then
    al  w0     20     ; else wait
    jl. w3     b2.    ; for output finis
    rl. w3     g3.    ;
    wa. w3     g9.    ;
    rs. w3     g3.    ; count segments
    sl. w3     (g0.)  ; if no more then
    jl.        f3.    ; goto stop
    jl.        f1.    ; else start input
f3: al. w3     g1.    ;
    jl.        f6.    ; goto remove process
f5: al. w3     g1.    ;
    jd         1<11+4 ; if process exist then
    se  w0     0      ;
f6: jd         1<11+64; remove process
    jl.        i0.    ; goto wait
g0: 0,r.10            ; tail
g1: <:kkmon8004:>,0,0 ;
g2: 3<12 + 0          ; input message
g3: 0                 ; first addr
g4: 0                 ; last addr
g5: 0,r.5             ; segment
g6: 0                 ; number of shares
g7: 1<23              ; message
g8: 0,r.8             ;
g9: 0                 ; share length
e.                    ;
z.                    ;
h30:                  ; buffer start addr
e.                    ;

    g2=k              ;
g1:                   ;
g0: (:g2>9:)+1        ; size
    0,r.4             ; name
    s2                ; clock
    0                 ; file
    0                 ; block
    3<12+0            ; contents
    g2                ; size

d.                    ;
p.  <:fpnames:>       ;
p.  <:insertproc:>    ;
▶EOF◀