home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / lan / driver6s / ni5210.asm < prev    next >
Assembly Source File  |  1990-03-15  |  4KB  |  131 lines

  1. version    equ    2
  2.  
  3.     include    defs.asm
  4.  
  5. ;Ported from Tim Krauskopf's micnet.asm, an assembly language
  6. ;driver for the MICOM-Interlan NI5210, by Russell Nelson.  Any bugs
  7. ;are due to Russell Nelson.
  8. ;Updated to version 1.08 Feb. 17, 1989 by Russell Nelson.
  9. ;Updated to support 1500 byte MTU April 27, 1989 By Brad Clements.
  10.  
  11. ;  Copyright, 1988, 1989, Russell Nelson
  12.  
  13. ;   This program is free software; you can redistribute it and/or modify
  14. ;   it under the terms of the GNU General Public License as published by
  15. ;   the Free Software Foundation, version 1.
  16. ;
  17. ;   This program is distributed in the hope that it will be useful,
  18. ;   but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. ;   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. ;   GNU General Public License for more details.
  21. ;
  22. ;   You should have received a copy of the GNU General Public License
  23. ;   along with this program; if not, write to the Free Software
  24. ;   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  25.  
  26. code    segment    byte public
  27.     assume    cs:code, ds:code
  28.  
  29. ;
  30. ;  Equates for controlling the MICOM board
  31. ;
  32. ;  I/O addresses, writing anything in AL trips these gates
  33. ;
  34. ;  First six addresses are the EPROM board Ether address (read)
  35. ;
  36. IORESET    EQU    0            ; reset the board
  37. IOCA    EQU    1            ; execute command which is in SCB
  38. IODIS    EQU    2            ; disable network connect
  39. IOENA    EQU    3            ; enable network
  40. IOINTON    EQU    4            ; enable interrupts
  41. IOINTOF    EQU    5            ; disable interrupts, '586 thinks it still ints
  42.  
  43. BASE_OFFSET    equ    0
  44. GET_ADDR_INC    equ    1
  45.  
  46. ;
  47. ;  Data segment
  48. ;
  49.  
  50.     public    int_no
  51. int_no        db    2,0,0,0        ; interrupt number. 
  52. io_addr        dw    0360h,0        ; I/O address for card (jumpers)
  53. base_addr    dw      0d000h,0    ; base segment for board (jumper set)
  54.  
  55.     public    driver_class, driver_type, driver_name, driver_function, parameter_list
  56. driver_class    db    1        ;from the packet spec
  57. driver_type    db    11        ;from the packet spec
  58. driver_name    db    "NI5210",0    ;name of the driver.
  59. driver_function    db    2
  60. parameter_list    label    byte
  61.     db    1    ;major rev of packet driver
  62.     db    9    ;minor rev of packet driver
  63.     db    14    ;length of parameter list
  64.     db    EADDR_LEN    ;length of MAC-layer address
  65.     dw    GIANT    ;MTU, including MAC headers
  66.     dw    MAX_MULTICAST * EADDR_LEN    ;buffer size of multicast addrs
  67.     dw    0    ;(# of back-to-back MTU rcvs) - 1
  68.     dw    0    ;(# of successive xmits) - 1
  69.     dw    0    ;Interrupt # to hook for post-EOI
  70.             ;processing, 0 == none,
  71.  
  72. lbca:
  73. doca:
  74. ;we may be called from places in which ds is unknown.
  75.     assume    ds:nothing
  76.     loadport
  77.     setport    IOCA
  78.     out    dx,al            ; send it
  79.     ret
  80.     assume    ds:code
  81. ;yet, we really should assume ds==code for the rest of this stuff.
  82.  
  83. ;
  84. ; Here we include the code that is common between 82586 implementations.
  85. ; Everything above this is resident.
  86.     include    82586.asm
  87. ; Everything below this is discarded upon installation.
  88.  
  89.     public    usage_msg
  90. usage_msg    db    "usage: ni5210 <packet_int_no> <int_no> <io_addr> <base_addr>",CR,LF,'$'
  91.  
  92.     public    copyright_msg
  93. copyright_msg    db    "Packet driver for the MICOM-Interlan NI5210, version ",'0'+majver,".",'0'+version,".",'0'+i82586_version,CR,LF
  94.         db    "Portions Copyright 1988 The Board of Trustees of the University of Illinois",CR,LF,'$'
  95.  
  96. check_board:
  97.     mov    SCP,1
  98.     mov    dx,io_addr    ; i/o address
  99.     add    dx,EADDR_LEN    ; look past the ethernet address.
  100.     in    al,dx
  101.     mov    bl,al        ; assemble pattern to check
  102.     inc    dx
  103.     in    al,dx
  104.     mov    bh,al
  105.     cmp    bx,05500h        ; pattern known to be there in ROM
  106.     jz    have_5210_io
  107.     pop    dx            ;drop our return address
  108.     mov    dx,offset no_5210_io_msg
  109.     jmp    error
  110. have_5210_io:
  111.  
  112.     mov    ax,base_addr
  113.     mov    cx,2000h        ;test only what we are going to use.
  114.     call    memory_test
  115.     jz    have_5210_mem
  116.     pop    dx            ;drop our return address
  117.     mov    dx,offset no_5210_mem_msg
  118.     jmp    error
  119. have_5210_mem:
  120.     ret
  121.  
  122.  
  123. no_5210_io_msg    db    "No 5210 found at that I/O address.",CR,LF,'$'
  124. no_5210_mem_msg    db    "No 5210 found at that memory address.",CR,LF,'$'
  125.  
  126.     include    memtest.asm
  127.  
  128. code    ends
  129.  
  130.     end
  131.