%include "inc:util.imp"
%include "82586:driver.inc"
%begin
%bytearray here,there(1:6)
%integer i
  printline("Press '.' to stop, anything else to transmit a packet.")
  etherextloop = 1
  etherprom = 1
  ethersavbf = 1
  etherstartup(nil)
  here = etherreceivedest
  there(1) = 0
  there(2) = 0
  there(3) = 16_aa
  there(4) = 16_12
  there(5) = 16_34
  there(6) = 16_56
  etheraccepttyperange(0,65535)
  %cycle
    i = testsymbol; %exitif i='.'
    %unless i<0 %start
      ethertransmitsize = 46
      ethertransmittype = 16_dead
      ethertransmitdest = there
      ethertransmitdata(1) = i
      ethertransmitdata(i) = i %for i = 2,1,46
      ethertransmitframe
    %finish
    %if etherframereceived(0) %start
      printstring("Received frame of size "); write(etherreceivesize,0)
      printstring(", type "); phex4(etherreceivetype)
      printstring(" to "); phex2(etherreceivedest(i)) %for i = 1,1,6
      printstring(" from "); phex2(etherreceivesource(i)) %for i = 1,1,6
      newline
      space %and phex2(etherreceivedata(i)) %for i = 1,1,26; newline
    %finish
  %repeat
  ethershutdown
  write(commands executed,0); write(commands failed,1)
  printline(" commands executed/failed")
  write(frames received,0); write(frames lost,1); write(frames discarded,1)
  printline(" frames received/lost/discarded")
  %unless extrabuffers=0 %start
    write(extrabuffers,0); printline(" packets exceeded maximum size")
  %finish
  write(bufferlowwater,0); write(desclowwater,1)
  printline(" buffer/descriptor low-water marks (high-water = 64)")
  %unless rxrestarts=0 %start
    printstring("Receive unit re-started "); write(rxrestarts,0)
    printline(" times")
  %finish
  %unless txrestarts=0 %start
    printstring("Command unit re-started "); write(txrestarts,0)
    printline(" times")
  %finish
  write(crcerrs,0) %and printline(" CRC errors") %unless crcerrs=0
  write(alnerrs,0) %and printline(" alignment errors") %unless alnerrs=0
  write(rscerrs,0) %and printline(" resource errors") %unless rscerrs=0
  write(ovrerrs,0) %and printline(" DMA errors") %unless ovrerrs=0
%end
