%endoflist
! Ethernet and Filestore communication
@16_035c4 %short      USERNO
@16_0372c %byte       CYLOCK,FSPORT
@16_03fa8 %byte       LDTE,LSAP,RDTE,RSAP
@16_010f8 %routine    ETHEROPEN(%integer port,remote)
@16_010fc %routine    ETHERCLOSE(%integer port)
@16_01100 %routine    ETHERWRITE(%integer port,%bytename buf,%integer size)
@16_01104 %integerfn  ETHERREAD(%integer port,%bytename buf,%integer max)
@16_01108 %integerfn  FCOMM(%integer cn,%string(255)s)
@16_0110c %routine    FCOMMW(%integer c,%string(255)p,%bytename b,%integer len)
@16_01110 %integerfn  FCOMMR(%integer c,%string(255)p,%bytename b,%integer max)
@16_03730 %integer    ERR
@16_03734 %integer    DTX
@16_03738 %integer    RDY
@16_0373c %integer    STX
@16_03740 %integer    ACK
@16_03744 %integer    NAK
@16_7fffc %byte       ETHS
@16_7fffd %byte       ETHD
@16_7ffff %byte       ETHC
%routine              TWAIT
  %cycle; %repeatuntil eths&8#0
%end
%routine              DISABLE BROADCASTS
%constinteger bof=10
  twait; ethc = bof; twait
%end
%routine              ENABLE BROADCASTS(%integer channel)
%constinteger bon=9
  twait; ethc = bon; twait; ethd = channel; twait
%end
%integerfn            ETHERSTATION
@16_372e %short station
%constinteger esa=5
  station = 0; twait; ethc = esa; twait
  %cycle
    %result = station %unless station=0
  %repeat
%end
%routine              ETHERDTX(%integer port)
%integer bit
  bit = 1<<port
  %if bit=0 %or rdy&bit#0 %or ack&bit=0 %start
    selectoutput(0); printstring("*Naughty call on ETHERDTX(")
    write(port,0); printstring(") - RDY="); printsymbol(rdy>>port&1+'0')
    printstring(", ACK="); printsymbol(Ack>>port&1+'0'); newline; %return
  %finish
  twait; ethc = 16_30; twait; ethd = port; twait
%end
%list
