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

⟦9778f21da⟧ TextFile

    Length: 60672 (0xed00)
    Types: TextFile
    Names: »hcdrivert«

Derivation

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

TextFile

     (hcdriverpr=slang list.no xref.no;
     hcdriverpr)       ;
b.   g2 w.             ;
s.   a82,b54,c3,h50,i100 w.;
;.**************************************************************************
;          DRIVER
;***************************************************************************
     c0=-1             ; c0>=0 test.  c0<0 normal use as driver
     c1=-c0            ;
     c2= -1            ; c2>0 for rhdriver and normal use
     c3= -c2*c1        ; c3>0 for hcdriver and normal use

;. 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
     a25=106           ; a25=start of save area
     a48=10            ; max numbers of buserrors
     a50= 21<3         ; level 21
     a51= 22<3         ; level 22
     a53=5             ;
     a54= a53*4        ; time out limit for mess, buff
     a55= a53*20       ; 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
     ;                -5  address request(mbuf)
     ;                -6  mbuf copy request
     ;                -7  mbuf copy completed
     ;                -8  mon call completed answer in receiver field
     ;                -9  answer (buffer not transmited)
     ;                -10 buffer containing a mbuf address
     ;                -11 child copy buffer
     ;                -12 an answer mirror buf
     ;                -13 stop i. p. buf
\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
;
;    output
;   2.0001 a send buffer request is sent
;   2.0010 a buffer is sent
;   2.0100 a send data request is sent
;   2.1000 data is sent
;
;     input
;   2.0001 an input buffer request is received
;   2.0010 a start input buffer is sent
;   2.0100 an input data request is received
;   2.1000 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
     a69=18            ; buffer link for mirror buf:  next
     a70=20            ;                              prev
     a71=22            ; reciver (mirror buf)
     a72=24            ; sender  (mirror buf)
     a73=26            ; result
     a74=28            ; status
     a80=a74-a60+2     ; 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
;
;
     a81=16            ;
     a82=100           ; number of links
\f


b51: rs. w3     h7.    ; save own process descr addr
c.   c3                ;
     al  w0     0      ; interrupt mask:=0
     al. w3     b44.   ; interrupt address
     jd         1<11+0 ; set interupt
z.                     ;
     jd         1<11+28; set monitor mode
     al  w0     6      ;
     rl. w3     h7.    ; w3:=own proc desr
     hs  w0  x3+104    ; disable interrupt level:=6
     rl  w1  x3+22     ;
     rs. w1     h11.   ; save first of program
     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
     al  w0     4      ;
     jd         1<11+32; set own process descr addr in monitor
c.   c1                ;
     rl  w3     8      ; w3:=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
z.                     ;
c.   c3                ;
     al  w0     2      ;
     jd         1<11+30; set cpu1
     al  w0     2      ;
     al. w2     b51.   ; w2:=proc start
     rl. w3     h5.    ;
     jl. w3  x3+b51.   ; goto autoload HC8000
z.                     ;
     jl. w3     b50.   ; init free chains
c.   c0                ;
     al. w3     h23.   ;
     jd         1<11+4 ;
     sh  w0     0      ;
     jl.        -6     ;
     rl  w2     0      ;
     rl  w3  x2+22     ; w3:= first addr
     wa  w3  x2+98     ; +base
     al  w2  x3        ;
     al  w3  x3+6      ;
     rs. w3     h0.    ; input location
     al  w3  x3+8      ;
     rs. w3     h1.    ; output location
     al  w0     0      ;
     al  w3  x2        ;
     al  w2     0      ;
     rs  w0  x3        ; clear interrupt table
     al  w2  x2+2      ;
     al  w3  x3+2      ;
     sh  w2     32     ;
     jl.        -8     ;
z.                     ;
     jl. w3     b18.   ; send time out limit to clock
\f


i0:  rl. w1     h4.    ; w1:=output-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     h8.    ; w1:=input-state
     sz  w1     2.1010 ; if a ready for input is sent then
     jl.        i3.    ; goto wait event
     so  w1     2.0001 ; else if an input buffer request is not sent then
     jl.        i2.    ; goto test data
     al  w0     8      ; 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.0100 ; 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.        i48.   ; return 2: goto send input data ready signal
i3:  al  w2     0      ;
c.   c0                ;
     al  w0     0      ;
     rl. w3     h0.    ;
     rx  w0  x3+2      ; w0:=last 'external interrupt' if any
     sn  w0     0      ; if no input interrupt then
     rx  w0  x3+12+a81 ; test input request
     sn  w0     0      ;
     rx  w0  x3+10     ; test output interrupt
z.                     ;
     je.        2      ; interrupt level:=26
c.   c0                ;
     sn  w0     0      ; if no 'external interrupt' then
z.                     ;
     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
     se  w0     0      ; if not message then
     jl.        i50.   ; goto i50
     rs. w2     h2.    ; else save buf addr
     rl  w0  x2+a40    ; w0:=buffer status
     sn  w0     -14    ; if interrupt 16,18 or 20 then
     jl.        i4.    ; goto serve interrupt
     sl  w0     -7     ; if mbuf address or
     sn  w0     -4     ; served mirrorbuffer then
     jl.        i7.    ; goto search waiting chain
     jd         1<11+26; get event
     jl.        i11.   ; goto link buff
i4:  jl. w3     b54.   ;
     rl  w0  x2+a8     ;
     jl. w3     b39.   ; remove buff
     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     h8.    ; w3:=input-state
     sz  w3     2.1010 ; 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
     ls  w0     -19    ;
     sn  w0     15     ; if mondump o. c. then
     jl.        i12.   ; goto i12
     se  w0     8      ; if not i-o mess then
     jl.        i0.    ;  goto next event
     jl. w3     b7.    ; get i-o mess type
     ls  w0     -16    ;
     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:  rx  w1     4      ; save w1
     jl. w3     b5.    ; remove buf
     rx  w1     4      ; restore w1
     jl. w3     b10.   ; search link with buf.w2
     jl.        i68.   ; not found: goto remove buf
     jl.        i10.   ; found:
i9:  al  w3     -12    ;
     sn  w0     -1     ; if copy buf then
     rs  w3  x2+a40    ; set buffer state to answer mirror buf
i10: al  w0     0      ; set link state
     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.0001 ;
     lo. w0     h4.    ; set output-state
     rs. w0     h4.    ;
     jl. w3     b21.   ; set link state
     jl.        i0.    ; goto next event
i20: jl. w3     b8.    ; get transfer-id from last data in
     jl. w3     b16.   ; search transfer-id
     jl.        i21.   ; not found: goto seaech transfer-id o. c.
     jl.        i22.   ; else goto i22
i21: jl. w3     b15.   ; search transfer-id o.c. in case answer mirror buf
     jl.        i0.    ; if not found then goto next event
i22: rs. w1     h6.    ; set current output link
     rl. w0     h3.    ; w0:=last di value
     rs  w0  x1+a64    ;
     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.0010 ;
     rs. w0     h4.    ; set output-state
     jl. w3     i39.   ; goto next event
\f


     al  w0     0      ;
     rs. w0     h4.    ; set i-o state   (to nothing output pendling)
     rl. w1     h6.    ; w1:=current output link addr
     rl  w2  x1+a63    ; w2:=buffer addr
     rl  w0  x2+a40    ; w0:=buf.status
     se  w0     -6     ; if mbuf copy request or
     sn  w0     -1     ; a buf from copy then
     jl.        i32.   ; goto i32
     sn  w0     -5     ; if a mbuf address request then
     jl.        i37.   ; goto i37 else
     sn  w0     0      ; 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
     jl. w3     b39.   ; return buf
     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
     sz  w0     -8     ; 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
     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  w0  x1+a62    ; w0:=link state
                       ;     se  w0     10     ; if real buff then
                       ;     jl.        i36.   ; goto i36 else
     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.0100 ;
     rs. w0     h4.    ; set output-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  w0  x1+a62    ;
     sz  w0     2.0010 ; if linkstate<>2 and
     sz  w0     2.0101 ; linkstate<>10 then
     jl.        i0.    ; 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
     rs. w0     h4.    ; set output-state
     rl. w1     h6.    ; save current link
     jl. w3     i39.   ; goto next event
     al  w0     0      ;
     rs. w0     h4.    ; set ouptut-state to nothing pendling
     rl. w1     h6.    ; w1:=link
     rl  w2  x1+a63    ; w2:=buf
     rl  w0  x1+a62    ; w0:=linktype
     sl  w0     8      ; if mirror link then
     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  w2     0      ;
     jd         1<11+126; get buffer
     sn  w2     0      ;
     jl.        i40.   ;
     rs. w2     h2.    ; curr buf
     jl. w3     b28.   ; link buf
     dl  w0  x2+a2     ; w0.w3:=buffer link
     ds  w0  x1+a70    ; save buffer link before the buffer transfer
     dl  w0  x2+a6     ; save sender,receiver
     ds  w0  x1+a72    ;
     al  w0     a54    ;
     rs  w0  x1+a68    ; set time out limit
     al  w0     2.0001 ;
     jl. w3     b3.    ; goto set input-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
     al  w0     2.1110 ;
     jl. w3     b2.    ; remove input state
     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.0010 ;
     jl. w3     b3.    ; set input-state
     jl. w3     b29.   ; change link state
     jl. w3     i49.   ; goto to next event
\f


     al  w0     2.1101 ;
     jl. w3     b2.    ; remove input state
     rl. w1     h14.   ;
     rl  w2  x1+a63    ; w2:=buff
     dl  w0  x1+a70    ; restore buffer link
     ds  w0  x2+a2     ;
     dl  w0  x1+a72    ; restore sender,receiver
     ds  w0  x2+a6     ;
     rl  w0  x2+a40    ; w0:=buf.state
c.   c3                ;
     jl. w3     b46.   ;
z.                     ;
     sn  w0     0      ; if message then
     jl.        i43.   ; goto i43
     sn  w0     -5     ; if mbuf address request then
     jl.        i66.   ; move buffer to master
     se  w0     -6     ; if mbuf copy requeset or
     sn  w0     -1     ; a mirror buf from copy o.c. then
     jl.        i44.   ; goto i44
     sn  w0     -4     ; if  state= -4 then
     jl.        i47.   ; goto i47
     jl. w3     b11.   ; else search mbuf-id
     jl.        i47.   ; not found: goto search transfer-id
     jl.        i52.   ;
i47: rl  w0  x1+a64    ;
     la. w0     h20.   ; w0:=transfer id
     jl. w3     b17.   ; search buffer in chains
     jl.        i50.   ; not found: return buffer
                       ; w1=chain.real buf
                       ; w2=mirror buff
                       ; (h14)=chain.mirror buff
i52: rl  w0  x2+a40    ; w0:= buf state
     rs. w1     h24.   ; save chain.real buff
     sn  w0     -11    ; if a child copy buffer then
     jl.        i41.   ; goto i41
     se  w0     -8     ; if mon completed or
     sn  w0     -10    ; mbuf address then
     jl.        i41.   ; goto i41
     al  w0     1      ;
     rl  w3  x1+a73    ;
     sn  w3     0      ; if not any result yet then
     rs  w0  x1+a73    ; set result 1 (the buffer is only waiting for an answer)
     al. w1     h9.    ; w1:=answer area
     al  w2  x2+a8     ;
     jl. w3     b35.   ; goto move eigth words
     rl. w1     h24.   ; w1:=chain.real buf
     al  w2  x2-a8     ; w2:=mirror buff
     jl. w3     b34.   ; goto set result in chain.real buff
     rl. w1     h14.   ;
     jl. w3     b39.   ; remove mirror buff 
     jl. w3     b9.    ; remove chain
     rl. w1     h24.   ; w1:=chain:=real buff
     rl  w2  x1+a63    ; w2:=real buff
     jl.        i75.   ; goto set and test result
i41: rl  w1  x1+a63    ; w3:=real buff
     rs  w0  x1+a40    ; set buffer state to mbuf address
     al  w1  x1+a8     ;
     al  w2  x2+a8     ;
     jl. w3     b35.   ; move message (or answer)
     al  w2  x2-a8     ;
     rl. w1     h14.   ; w1:=chain.mirror
     jl. w3     b39.   ; remove mirror buf
     jl. w3     b9.    ; remove mirror chain
     rl. w1     h24.   ; w1:=chain.real buff
     rl  w2  x1+a63    ; w2:=real buf
     jl. w3     b9.    ; remove chain
     jl.        i66.   ; goto move buffer to master
\f


i43: al  w0     -3     ;
     rs  w0  x2+a40    ; buffer state:=mirror buffer (normal)
     dl  w0  x2+a6     ; change sender/receciver.this computer
     rx  w0  x2+a34    ;
     rx  w3  x2+a36    ;  with sender/reciever.other comp.
     rs  w3  x2+a4     ;
     sz  w0     -8     ; if address then
     rs  w0  x2+a6     ; save receiver
     jl.        i66.   ; and move buffer to master
i44: bz  w0  x2+a8     ;
     se  w0     3      ; if not input message then
     jl.        i46.   ; goto test output
     jl. w3     b30.   ; else  buffer state:=output
     jl.        i0.    ; i. e. it is a mirror buf
i46: se  w0     5      ; if not output message then
     jl.        i43.   ; move buf to master
     jl. w3     b31.   ; buffer state:=input (i.e. it is a mirror buf)
     al  w0     2.0100 ;
     jl. w3     b3.    ; set input-state
     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
i48: rs. w1     h14.   ; set current link
     al  w0     2.1011 ;
     jl. w3     b2.    ; remove input state
     rl  w2  x1+a63    ; w2:=buf
     jl. w3     b47.   ; 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    ;
     ds. w0     h16.   ; set next input addr
     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.1000 ;
     jl. w3     b3.    ; set input-state
     jl. w3     i49.   ; set return point and goto next event
                       ;
     al  w0     2.0111 ;
     jl. w3     b2.    ; remove input state
     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     h12.   ;
     jd         1<11+18; remove buff
     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  w3  x1+a68    ; time out limit:=
     al. w3  x3-a53    ; time out limit-  1 slice
     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
     sz  w1     -8     ; if not an answer then
     jl.        i62.   ;
     jl.        i7.    ; else goto search link
i62: se. w1  (  h7.)   ; if receiver<>this proc then
     jl.        i64.   ; goto i64
i68: jl. w3     b39.   ; remove buff
     jl.        i0.    ; goto next event
i67: am         -1     ; set result 3          address error
i64: al  w0     4      ; set result 4          rejected (buserror)
     rs  w0  x1+a73    ; set result
     rl  w0  x1+a62    ; w0:=link state
     sn  w0     7      ; if waiting for answer buf then
     jl.        i0.    ; goto next event
     jl.        i75.   ; goto send answer
i66: al. w3     h10.   ;
     jd         1<11+34; move buf to master proc
     jl.        i0.    ; goto next event
                       ;
i69: al  w0     1      ;
     rs  w0  x1+a73    ; set result=1
     al  w0     0      ;
     rs  w0  x1+a74    ; and set status
     rl  w0  x2+a40    ;
     sn  w0     -11    ; if a child copy buffer then
     jl.        i75.   ; goto send answer
     rl  w0  x1+a62    ; w0:=link type
     sl  w0     7      ; if mirror buf then
     jl.        i70.   ; goto i70
     jl. w3     b27.   ; else set link state=wait for answer
     jl.        i0.    ; and goto next event
i70: rl  w0  x2+a40    ;
     se  w0     -6     ; if not mbuf copy buffer then
     jl.        i9.    ; make buffer ready to be output
     al  w0     -7     ; else  buffer state:=mbuf copy completed
     rs  w0  x2+a40    ; and
     jl.        i66.   ; move buffer to master
i75:                   ; send answer and remove chain
     jl. w3     b36.   ; send answer
     jl. w3     b9.    ; remove chain
     jl.        i0.    ;
                       ;
i12: al  w3     2.11111; core dump from o. c.
     ls  w3     19     ;
     ds. w0  (  h1.)   ;
     je. w3     b0.    ; send ready message
     jl.        2      ;
     al. w2     b49.   ; addr for input monitor o.c.
     al  w2  x2+2000   ;
     al  w1     0      ;
     ds. w2  (  h0.)   ;
     rl. w1     h7.    ;
     rl  w0  x1+a25+4  ; wait for interrupt 18
     se  w0     18     ;
     jl.        -4     ;
     jl. w3     b1.    ; input
     je.        2      ;
     je.        2      ;
     jl         -2     ; halt
\f


m.   var area          ;
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                 ; output-state
h5:  b49               ; next register value at data-out
h6:  0                 ; current output link
h7:  0                 ; own proc descr addr
h8:  0                 ; input-state
h9:  0,r.8             ; message
h10: <:rhmaster:>,0,0  ;
h11: 0                 ; first of proc
h12: 0,r.8             ; pseudo message
h13: <:hcdriver:>,0,0,0; own 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
h21: <:clock:>,0,0,0   ;
h22: 0                 ; next link
h23: <:rhmi:>,0,0,0,0  ; receiver name
h24: 0                 ; chain address
h28: 0                 ; output return addr
h29: 0                 ; input return point
h31: 0,0               ; activ link chain head
h32: 0,0               ; free links head
\f


c.   c1                ;
     ;;
     ;
     ;
     ; 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
                       ;*** exception instructions does not work yet
                       ;    xs.        g4.    ; save ex:=ex;
                       ;    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
c.   -1                ;
     bz. w3     g4.    ;
     al  w0  x3+48     ; set exception text
     al. w3     b52.   ;
     rs  w0  x3+14     ;
z.                     ;
     rl. w3     g3.    ;
     jl      x3+0      ;
f3:  rl. w3     g3.    ;
     jl      x3+2      ; and return
g0:  1<23 + a51 +2.001 ;
g1:  0                 ;
g3:  0                 ;
g4:  0                 ; exception value;
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
                       ;*** exception instruction does not work
                       ;    xs.        g4.    ; save ex:=ex
                       ;     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
c.   -1                ;
     bz. w3     g4.    ; write ex value
     al  w3  x3+48     ;
     ls  w3     8      ;
     al  w0  x3+105    ; <:i:>
     ls  w0     8      ;
     al. w3     b52.   ;
     rs  w0  x3+16     ;
z.                     ;
     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
g4:                    ; exception value;
e.                     ;
z.                     ;
\f


c.   c0                ; code for simulation of input output
b.   f5,g5 w.          ; output to hc
b0:  al  w0     18     ;
     rs. w3     g3.    ;
     rl. w3     h1.    ;
     rs  w0  x3+4      ;
     rl. w0     h5.    ; w0:=do reg value
     rs  w0  x3-2      ;
     rl. w3     g3.    ;
     jl      x3+2      ;
g3:  0                 ;
e.                     ;
b.   f5,g5 w.          ; input
b1:  ds. w1     g1.    ;
     ds. w3     g3.    ;
     rl. w1     h0.    ;
     rl  w3  x1+6+a81  ; do reg value
     rs. w3     h3.    ;
     sh  w3     0      ; if nothing to transfer then
     jl.        f5.    ; return
     rl  w2  x1+8+a81  ; w2:=from address
     rl  w1  x1        ; w1:= to address
f0:  rl  w0  x2        ;
     rs  w0  x1        ;
     al  w1  x1+2      ;
     al  w2  x2+2      ;
     al  w3  x3-2      ;
     sl  w3     1      ; if more to transfer then
     jl.        f0.    ; goto f0
     rl. w1     h0.    ;
     al  w0     16     ;
     rs  w0  x1+2      ; set input finis
     al  w0     20     ;
     rs  w0  x1+10+a81 ; set output finis
f5:  dl. w1     g1.    ;
     dl. w3     g3.    ;
     jl      x3+2      ; return
g0:  0                 ;
g1:  0                 ;
g2:  0                 ;
g3:  0                 ;
e.                     ;
;.
; controller table level 26,27,28 and 29
;
;  *---------------*---------------*---------------*---------------*
;  ! di reg val    ! input addr    !  interrupt    !     26        !
;  !   RH8000      !               !  level        !               !
;  *---------------*---------------*---------------*---------------*
;  ! do reg val    ! output addr   !  interrupt    !     27        !
;  !   RH8000      !               !  level        !               !
;  *---------------*---------------*---------------*---------------*
;  ! di reg val    ! input addr    !  interrupt    !     28        !
;  !   HC8000      !               !  level        !               !
;  *---------------*---------------*---------------*---------------*
;  ! do reg val    ! output addr   !  interrupt    !     29        !
;  !   HC8000      !               !  level        !               !
;  *---------------*---------------*---------------*---------------*
z.                     ;
\f


     ;;
     ;
     ;
     ;
     ; remove input-state
     ; w0=state
     ;
b.   f5,g5 w.          ;
b2:                    ;
     la. w0     h8.    ;
     rs. w0     h8.    ;
     jl      x3        ; return
e.                     ;
     ;; set input-state
     ; w0=state
b.w.                   ;
b3:  lo. w0     h8.    ;
     rs. w0     h8.    ;
     jl      x3        ;
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.          ;
b47:                   ;
     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


     ;; insert a link
     ; w1=element, w2=head
     ; return: w1,w2 unchanged, w3 prev element
b.   g5 w.             ;
b4:  rs. w3     g3.    ;
     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.     (  g3.)   ; return
g3:  0                 ;
e.                     ;
                       ;
     ;; remove a link
     ; w1=element
     ; return: w1,w2 unchanged,  w3=next element
b.   g5 w.             ;
b5:  rs. w3     g3.    ;
     rl  w3  x1+0      ;
     rx  w1  x1+2      ;
     rs  w3  x1+0      ;
     rx  w1  x3+2      ;
     rs  w1  x1+0      ;
     jl.     (  g3.)   ;
g3:  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.                     ;
     ;; 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
b.   g5 w.             ;
b9:  rs. w3     g3.    ;
     jl. w3     b5.    ; remove link
     rs. w3     h22.   ; save next element
     rs. w2     h2.    ; save current buffer
     al. w2     h32.   ; free chain head
     jl. w3     b4.    ; insert link
     rl. w2     h2.    ;
     jl.     (  g3.)   ; 
g3:  0                 ;
e.                     ;
\f


     ;; search a link with buf.w2
     ; call: w2=buf
     ; return w0,w2,w3 unchanged
     ;         w1=link  if found
     ;         w1=link chain head if not found
b.   f5,g5 w.          ;
b10:                   ;
     al. w1     h31.   ; w1:=first link addr
     jl.        f1.    ; goto test
f0:  sn  w2  (x1+a63)  ; if w2=buf.link then
     jl      x3+2      ; return 2
f1:  rl  w1  x1        ; w1:=next
     se. w1     h31.   ; if more to compare then
     jl.        f0.    ; goto f0
     jl      x3        ; else return 0
e.                     ;
     ;; search a chain  with mbuf-id = mbuf-id.buffer
     ; if child copy buf then 7 words is compared
     ; call:   w2=buf, w3=return
     ; return0 w0 mbuf-if.buffer, w2 unchanged, w1=chain head
     ; return2:w0 mbuf-if.buffer, w2      -   , w1=chain
b.   f5,g5 w.          ;
b11: rs. w1     g1.    ;
     rs. w3     g3.    ;
     al  w3  x3+2      ;
     rs. w3     g4.    ;
     rl  w0  x2+a40    ;
     al. w1     h31.   ;
     jl.        f1.    ;
f0:  sn. w1  (  g1.)   ; if current chain then
     jl.        f1.    ; goto next chain
     sn  w0     -11    ; if child copy buffer then
     jl. w3     f3.    ; compare 7 words else
     rl  w3  x1+a63    ; compare mbuf-id
     rl  w3  x3+a18    ;
     sn  w3  (x2+a18)  ; if mbuf-id.buffer = mbuf-id.w1 then return2 else
     jl.     (  g4.)   ; return2 else
f1:  rl  w1  x1        ; next mbuf
     se. w1     h31.   ;
     jl.        f0.    ;
     jl.     (  g3.)   ;
g1:  0                 ;
g3:  0                 ;
g4:  0                 ;
f3:  rs. w3     g5.    ;
     rl  w3  x1+a63    ;
     rl  w0  x3+a8     ;
     se  w0  (x2+a8)   ;
     jl.     (  g5.)   ;
     rl  w0  x3+a10    ;
     se  w0  (x2+a10)  ;
     jl.     (  g5.)   ;
     rl  w0  x3+a12    ;
     se  w0  (x2+a12)  ;
     jl.     (  g5.)   ;
     rl  w0  x3+a16    ;
     se  w0  (x2+a16)  ;
     jl.     (  g5.)   ;
     rl  w0  x3+a18    ;
     se  w0  (x2+a18)  ;
     jl.     (  g5.)   ;
     rl  w0  x3+a20    ;
     se  w0  (x2+a20)  ;
     jl.     (  g5.)   ;
     rl  w0  x3+a22    ;
     se  w0  (x2+a22)  ;
     jl.     (  g5.)   ;
     jl.     (  g4.)   ;
g5:  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
     jl.        f1.    ; then goto return 0
f0:  sn  w0  (x1+a62)  ; if link is in state.w0
     jl.        f2.    ; goto return 2;
f1:  rl  w1  x1        ;
     se. w1     h31.   ; if more links then
     jl.        f0.    ; get next
     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.   f5,g5 w.          ;
     ;; search a link  with transfer-id  o. c. = w0
     ; and buffer state = -12   (answer mirror buf)
     ; if found then return 2
     ; else return 0
     ; return: w0, w2 unchanged.  w1=link
b15:                   ;
     rs. w3     g3.    ;
     al  w3  x3+2      ;
     rs. w3     g4.    ;
     al. w1     h31.   ; w1:=link head for input
     jl.        f1.    ;
f0:  rl  w3  x1+a64    ;
     la. w3     h20.   ; w3:=transfer id
     se  w0  x3        ; if link state not equal then
     jl.        f1.    ; goto next link else
     rl  w3  x1+a63    ; w3:=buf
     rl  w3  x3+a40    ; w3:=buffer state
     sn  w3     -12    ; if buffer state=-12 then
     jl.     (  g4.)   ; return2 else
f1:  rl  w1  x1        ;
     se. w1     h31.   ; if more links then
     jl.        f0.    ; get next
     jl.     (  g3.)   ;
g3:  0                 ;
g4:  0                 ;
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  x3+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     a53    ; w3,w0:=mode,delay
     al. w1     h12.   ;w1:=buf
     ds  w0  x1+2      ;
     al. w3     h21.   ;
     jd         1<11+16;
     rs. w2     h17.   ; save buf addr
     jl.     (  g3.)   ;
g3:  0                 ;
e.                     ;
\f


b.   g5,f5 w.          ;
b19:                   ; return buf to master (after time out)
     rs. w3     g3.    ; save return
     al  w3     512    ; w3:=2.0010 0000 0000
     rs  w3  x1+a74    ; set status
     al  w0     1      ;
     rs  w0  x1+a73    ; set result
     rl  w2  x1+a63    ; w2:=buff
     al  w0     -9     ; set buffer state to
     rs  w0  x2+a40    ; error answer
     jl. w3     b36.   ; send answer
     rl  w3  x1+a62    ; w3:=mbuf state
     al  w0     0      ;
     sn  w3     0      ; if nothing is done then
     jl.        f4.    ; let i-o state unchanged
     se  w3     10     ; else if mbuf is waiting
     sh  w3     2      ; for output then
     jl.        f3.    ; goto set output state
f0:  so  w3     2.11   ; if not inputbuffer
     jl.        f1.    ; goto f1
     al  w0     2.0011 ;
     jl.        f2.    ;
f1:  al  w3  x3-7      ; else set w0 to 2.1101 or
     ac  w0  x3        ; 2.1110 and
f2:  jl. w3     b2.    ; goto remove input state
     jl.        f4.    ;
f3:  rs. w0     h4.    ;
f4:  jl. w3     b9.    ; remove link and insert link in free chain
     rl. w1     h22.   ; w1:=next element
     jl.     (  g3.)   ; return
g3:  0                 ;
e.                     ;
b.w.                   ; set result
b32: rl  w0  x2+a4     ; w0:=result or receiver
     sz  w0     -8     ; if receiver then
     al  w0     0      ; set result 0
b33: rs  w0  x1+a73    ; 
     jl      x3        ; return
e.                     ;
\f


     ;; compare and set result
b.w.                   ;
b34: rl  w0  x2+a4     ; w0:=result.mirror buff
     sz  w0     -8     ;
     al  w0     0      ;
     sh  w0  (x1+a73)  ;
     rl  w0  x1+a73    ; w0:=higthest result
     jl.        b33.   ; and return vie b21
e.                     ;
\f


     ;; move eigth words from core.w2 to core.w1
b.   g3 w.             ;
b35: rs. w3     g3.    ;
     dl  w0  x2+2      ;  move
     ds  w0  x1+2      ;
     dl  w0  x2+6      ;
     ds  w0  x1+6      ;
     dl  w0  x2+10     ;
     ds  w0  x1+10     ;
     dl  w0  x2+14     ;
     ds  w0  x1+14     ;
     jl.     (  g3.)   ; return
g3:  0                 ;
e.                     ;
     ;; send answer
b.   f6,g6 w.          ;
b36: ds. w1     g1.    ;
     ds. w3     g3.    ;
c.   -1                ;
     al. w3     h23.   ;
     rl  w2  x2+a6     ; w2:=sender
     dl  w1  x2+2      ;
     ds  w1  x3+2      ; move sender name
     dl  w1  x2+6      ;
     ds  w1  x3+6      ;
     dl. w2     g2.    ; w1:=chain , w2:=buf
z.                     ;
     rl. w3     h9.    ;
     ac. w0  (  h7.)   ;
     rs  w0  x2+a4     ; set hcdriver as receiver
     rl  w0  x1+a74    ;
     lo  w0  x3        ; set status
     rs  w0  x3        ;
     rl  w0  x1+a73    ; w0:=result
     al. w1     h9.    ; w1:=answer
     jd         1<11+22; send answer
     dl. w1     g1.    ;
     dl. w3     g3.    ;
     jl      x3        ; return
g0:  0                 ;
g1:  0                 ;
g2:  0                 ;
g3:  0                 ;
e.                     ;
     ;; remove buff
b.   f3,g1 w.          ;
b39:                   ;
     jd         1<11+126; remove buffer
     jl      x3        ;
e.                     ;

b54: jl.        b46.   ; step
\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.    ;
     jl. w3     b46.   ;
     sz  w0     2.111  ; if already linked then
     jl.        f0.    ; goto f0
     rl. w1     h32.   ; else get a free link
     jl. w3     b5.    ;
     al. w2     h31.   ; and insert in
     jl. w3     b4.    ; activ queque
     rs  w0  x1+a62    ;
     ld  w0     -100   ;
     ds  w0  x1+a64    ; clear mbuf
     ds  w0  x1+a67    ;
     ds  w0  x1+a69    ;
     ds  w0  x1+a73    ;
     rs  w0  x1+a74    ;
     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+a80    ; w1:=next link
     sh  w0     a82    ;
     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     3      ;                3: ready for receiving data
     ds. w0     g0.    ;
     rl  w3  x1+a62    ; w3:=io-mess-type
     rl  w0  x2+a40    ; w0:=buffer state
     sn  w0     -12    ; if buffer state=answer mirror buf then
     al  w3     8      ; load mirror type
     rl. w0     h20.   ; w0:=mask for extracting transfer-id
     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.                     ;
c.   c3                ;
\f


b.   g11,f10 w.        ; program interrupt
     g0=8              ; number of reg.
     g1=9              ; number of digits per reg
b44: 0,r.g0            ; register values
     je.        2      ;
     al  w1     32     ;
     al. w2     g8.    ; first of buff
f1:  rs  w1  x2        ;
     al  w2  x2+2      ;
     se. w2     g9.    ;
     jl.        f1.    ;
     al. w1     b44.   ; w1:= addr of first reg val
     al. w2     g8.    ;
     al  w2  x2-2      ;
     rs. w2     g7.    ;
f2:  rl. w2     g7.    ; w2 := 
     al  w2  x2+(:g1<1:); next in buff
     rs. w2     g7.    ;
     al  w3     32     ;
     rl  w0  x1        ;
     sn. w1     b44.+10; if ic then
     ws. w0     h11.   ; w0:=relative ic
     sl  w0     0      ; if val >= 0 then
     jl.        f3.    ; goto f3
     al  w3  x3+13     ;
     ac  w0  (  0)     ;
f3:  rs. w3     g6.    ;
f4:  al  w3     0      ;
     wd. w0     g3.    ; w3:= next digit
     al  w3  x3+48     ;
     rs  w3  x2        ;
     al  w2  x2-2      ;
     se  w0     0      ; if more digits then
     jl.        f4.    ; goto f4
     rl. w3     g6.    ; else
     rs  w3  x2        ; set sign
     al  w1  x1+2      ; w1:=next reg addr
     sh. w1     b44.+(:(:g0-1:)<1:); if all reg val is coverted then
     jl.        f2.    ; goto f2
     al. w3     g8.    ;
     al. w2     g9.    ; output buffer
f6:  rl  w1  x3        ;
     ls  w1     8      ;
     lo  w1  x3+2      ;
     ls  w1     8      ;
     lo  w1  x3+4      ; w1:= next 3 digits
     rs  w1  x2        ;
     al  w2  x2+2      ;
     al  w3  x3+6      ;
     se. w3     g9.    ;
     jl.        f6.    ;
     al. w1     g4.    ; w1:= mess area
     al. w2     g9.    ; first of buff
     al. w3     g10.   ; last of buff
     ds  w3  x1+4      ;
     al. w3     g5.    ;
     jd         1<11+16;
     al. w1     g11.   ;
     jd         1<11+18;
     dl. w1     b44.+2 ;
     dl. w3     b44.+6 ;
     jl.        0      ;
     jl.     (  b44.+10); return to program
g3:  10                ;
g4:  5<12+0            ; mess
     0,r.7             ;
g5:  <:console1:>,0,0,0;
g6:  32                ; sign
g7:  0                 ; buffer position
g8:  0,r.(:g0*g1:)     ;
g9:  0,r.(:g0*g1/3:)   ;
g10: 10<16             ;
g11: 0,r.8             ;
e.                     ;
b.   f10,g10 w.        ;  internal testprint
     g7=16             ;
b46:                   ; testoutput
     ds. w1     g1.    ;
     rs. w2     g2.    ;
     rx. w3     g3.    ;
     se  w3     0      ;
     jl.        f0.    ;
     rl. w3     g4.    ;
     wa. w3     h11.   ;
     rs. w3     g5.    ;
     rl. w2     h7.    ;
     rl  w2  x2+24     ;
     al  w2  x2-g7     ;
     rs. w2     g6.    ;
     rl. w2     g2.    ;
f0:  ds  w1  x3+2      ;
     rs  w2  x3+4      ;
     rl. w2     g3.    ;
     ws. w2     h11.   ;
     rs  w2  x3+6      ;
     rl. w1     h4.    ;
     rl. w2     h8.    ;
     ds  w2  x3+10     ;
     dl  w2     110    ;
     ds  w2  x3+14     ;
c.   -1                ;
     rl. w2     g2.    ;
     sh  w2     2000   ;
     jl.        f1.    ;
     rl  w2  x2+a18    ;
     rs  w2  x3+8      ;
z.                     ;
f1:  al  w3  x3+g7     ;
     sl. w3  (  g6.)   ;
     rl. w3     g5.    ;
     rx. w3     g3.    ;
     rl. w2     g2.    ;
     dl. w1     g1.    ;
     jl      x3        ;
g0:  0                 ;
g1:  0                 ;
g2:  0                 ;
g3:  0                 ;
g4:  b45               ;
g5:  0                 ;
g6:  0                 ;
e.                     ;
z.                     ;

\f


c.   c3                ;
b.   f40,g20 w.        ;
b49:                   ;
     rs. w3     g10.   ;
     wa. w2     g7.    ; w2:=mon input addr.
     rs. w2     g7.    ;
     al. w1     g0.    ;
     al. w3     g1.    ;
     jd         1<11+42; lookup(<:kkmon8004:>)
     se  w0     0      ; if not found then
     jl.        f31.   ; goto f31
     rl. w2     g0.    ; w2:=
     ls  w2     9      ; monitor size
     rs. w2     g9.    ;
     rl. w1     g7.    ; first byte
     wa  w2     2      ; last addr
     ds. w2     g4.    ;
     al. w3     g1.    ;
     jd         1<11+52;
     jd         1<11+8 ; create and reserve(<:kkmon8004:>)
     se  w0     0      ; if error then
     jl.        f32.   ; goto f32
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.        f33.   ; goto f33
     rl  w2  x1+2      ; w2:=number of halfwords
     al  w2  x2+512    ;
     sh. w2  (  g9.)   ; if data missing then
     jl.        f1.    ; try agian
     jd         1<11+64; remove arrea proc
     jd.        2      ;
     al  w2     -1     ; start output section
     rs. w2     h5.    ;
     jl. w3     b0.    ; start HC8000
     je.        f35.   ;
f3:  jl. w3     f19.   ; wait interrupt
     se  w0     18     ;
     jl.        f3.    ;
     jl. w3     f18.   ; get ready signal
     al  w3     4      ;
     al. w0     g6.    ;
     rs. w3     h5.    ;
     ds. w0  (  h1.)   ;
     jl. w3     b0.    ; send data transfer request
     je.        f35.   ;
     al  w1     0      ;
f7:  jl. w3     f19.   ; wait interrupt
     sl  w0     16     ; if interrupt level<16 or
     sl  w0     21     ;    interrupt level>20 then
     jl.        f7.    ; goto wait
     al  w1  x1+1      ;
     sn  w0     18     ; if ready signal then
     jl. w3     f18.   ; load signal
     sh  w1     1      ; if not both interrupt received then
     jl.        f7.    ; goto wait
     al. w0     h30.   ;
     rl. w3     g4.    ; w3:=last addr
     ws  w3     0      ; w3:=number of halfwords
     rs. w3     h5.    ;
     ds. w0  (  h1.)   ;
     jl. w3     b0.    ; start output to HC8000
     je.        f35.   ;
     al  w1     0      ;
f9:  jl. w3     f19.   ; wait interrupt
     sl  w0     16     ; if interrupt level<16 or
     sl  w0     21     ;    interrupt level>20 then
     jl.        f9.    ; goto wait
     al  w1  x1+1      ;
     sn  w0     18     ; if ready signal then
     jl. w3     f18.   ; load signal
     sh  w1     1      ; if not both interrupt received then
     jl.        f9.    ; goto wait
     je.     (  g10.)  ; return
                       ;
\f


f18: rs. w3     g8.    ;
     jl. w3     b1.    ; get input mess
     je.        f35.   ;
     jl.     (  g8.)   ;
                       ;
f19: al  w2     0      ; wait
     jd         1<11+24; wait
     rl  w0  x2+a8     ; w0:=int level
     jd.        b39.   ; remove buf  and return
g11: <:monitor program do not exist<10>      :>;
g12: <:create area proc(monitor) error<10>   :>;
g13: <:input error - monitor <10>            :>;
b52:                   ;
g15: <:buseror at 2901 ex =           <10>   <0>:>;
g16: <:s:>,0,0,0,0     ;
g17: 1<13+1,<:finis:>,0,0,0,0,0;
g18: g12-g11           ;
g19: 5<12,0,r.7        ;
g20: <:console1:>,0,0  ;
     ;; error
f31: am         g11-g12;
f32: am         g12-g13;
f33: am         g13-g15;
f35: al. w2     g15.   ;
     al. w1     g19.   ; w1:=mess addr
     rl. w3     g18.   ; w3:=mess length
     wa  w3     4      ;
     al  w3  x3-2      ;
     ds  w3  x1+4      ;
     al. w3     g20.   ; w3:=name addr
     jd         1<11+16;
     jd         1<11+18;
     jd         1<11+4 ; if process exist then
     se  w0     0      ;
     jd         1<11+64; remove process
     al. w1     g17.   ;
     al. w3     g16.   ;
     jd         1<11+16;
     jd         1<11+18;
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:  1,1               ; number of shares
g7:  b45               ; input start addr
g8:  0,r.8             ;
g9:  0                 ; share length
g10: 0                 ; return
e.                     ;
z.                     ;
m.   link area         ;

h30:                   ;
c.   c3                ;
b.   g5,f5 w.          ;
g0:  8388600           ;
g1:  1<23+22<3+2.001   ;
g2:  0                 ;
     rl. w2     g0.    ;
     rs  w2     248    ;
     rs  w2     274    ;
     al  w3     18     ;
     rs  w3     124    ;
     al. w3     f2.    ;
     al  w2     -40    ;
     do. w2  (  g1.)   ;
     jl.        f2.    ;
f2:  jl.        2,r.1000;
e.                     ;
z.                     ;
     jl.        2,r.(:(:a82+1:)*a80>1:); buffer start addr
c.   c3                ;
     jl.        8      ;
m.   b45               ;
     b45=k             ;
z.                     ;
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◀