;===========================================================================
;                             cnetinfo
;===========================================================================
;
;  Prints info about the running cnet.devcie
;
;
; History:
;
; 11-4-97  v1.0 created by Bruce Abbott  (bhabbott@inhb.co.nz)
;
;

 output ram:cnetinfo


 include start.i    ; Amiga includes and startup code
 include printf.i   ; print string to file (ohandle)

 include pcmcia.i             ; card.resourse etc.
 include sanaii.i             ; the essential network stuff
 include cnet.i               ; CNet CN40BC hardware specs


_main:
   dos     output
   move.l  d0,ohandle
   beq     done
   move.l  execbase(pc),a3
   move.l  devicelist(a3),a2
searchloop:
   move.l  ln_succ(a2),d2
   beq     done
   move.l  ln_name(a2),a0     ; get device node from system list
   lea     devname(pc),a1
   bsr     strcmp
   beq.s   found
   move.l  d2,a2
   bra.s   searchloop
found:
   printf  <10,"device found at $%lx",10,10>,a2
   move.l  dd_stationaddress(a2),d0
   moveq   #0,d1
   move.w  dd_stationaddress+4(a2),d1
   printf  <"Station Address     = $%08lx%04lx",10,10>,d0,d1
   move.l  dd_romstationaddress(a2),d0
   moveq   #0,d1
   move.w  dd_romstationaddress+4(a2),d1
   printf  <"ROM station address = $%08lx%04lx",10,10>,d0,d1
   printf  <"rx buffer overflows = %ld",10,10>,dd_overflows(a2)
done:
   moveq  #0,d0
   rts

;=========================================
;     result = strcmp(str1,str2)
;      d0              a0   a1
;=========================================
;
strcmp:
  move.b (a0)+,d0
  beq.s  .end1
  cmp.b  (a1)+,d0
  beq.s  strcmp
.not:
  moveq  #-1,d0
  bra.s  .done
.end1:
  tst.b  (a1)+
  bne.s  .not
  moveq  #0,d0
.done:
  rts


devname:
 dc.b "cnet.device",0
 even
