home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / packetdrivers.tar.gz / pd.tar / src / ncret105.asm < prev    next >
Assembly Source File  |  1995-06-25  |  5KB  |  194 lines

  1. version    equ    0
  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-1992, Russell Nelson, Crynwr Software
  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    word public
  27.     assume    cs:code, ds:code
  28.  
  29. ;
  30. ;  Equates for controlling the ubnicps2 board
  31. ;
  32. SCR        equ    byte ptr 0ffffh
  33. SCR_GREEN    equ    1
  34. SCR_CA        equ    2
  35. SCR_LOOPBACK    equ    4
  36. SCR_RESET    equ    8
  37.  
  38. ;
  39. ;  Data segment
  40. ;
  41.  
  42.     public    int_no
  43. int_no        db    3,0,0,0        ; interrupt number. 
  44. base_addr    dw      0d000h,0    ; base segment for board (jumper set)
  45.  
  46.     public    driver_class, driver_type, driver_name, driver_function, parameter_list
  47. driver_class    db    BLUEBOOK, IEEE8023, 0        ;from the packet spec
  48. driver_type    db    11        ;from the packet spec
  49. driver_name    db    "NCR ET105",0    ;name of the driver.
  50. driver_function    db    2
  51. parameter_list    label    byte
  52.     db    1    ;major rev of packet driver
  53.     db    9    ;minor rev of packet driver
  54.     db    14    ;length of parameter list
  55.     db    EADDR_LEN    ;length of MAC-layer address
  56.     dw    GIANT    ;MTU, including MAC headers
  57.     dw    MAX_MULTICAST * EADDR_LEN    ;buffer size of multicast addrs
  58.     dw    0    ;(# of back-to-back MTU rcvs) - 1
  59.     dw    0    ;(# of successive xmits) - 1
  60. int_num    dw    0    ;Interrupt # to hook for post-EOI
  61.             ;processing, 0 == none,
  62.  
  63. enable_network:
  64. ;  connect to network
  65.     push    es
  66.     mov    es,base_addr
  67.     or    es:[SCR],SCR_LOOPBACK
  68.     pop    es
  69.     ret
  70.  
  71.  
  72. reset_586:
  73. ;  Reset the chip
  74.     push    es
  75.     mov    es,base_addr
  76.     or    es:[SCR],SCR_RESET
  77.     jmp    $+2
  78.     jmp    $+2
  79.     jmp    $+2
  80.     jmp    $+2
  81.     and    es:[SCR],not SCR_RESET
  82.     pop    es
  83.     ret
  84.  
  85.  
  86. doca:
  87. ;we may be called from places in which ds is unknown.
  88.     assume    ds:nothing
  89.     push    es
  90.     mov    es,base_addr
  91.     or    es:[SCR],SCR_CA
  92.     and    es:[SCR],not SCR_CA
  93.     xor    es:[SCR],SCR_GREEN    ;blink the led on each CA.
  94.     pop    es
  95.     ret
  96.     assume    ds:code
  97. ;yet, we really should assume ds==code for the rest of this stuff.
  98.  
  99. ;
  100. ; Here we include the code that is common between 82586 implementations.
  101. ; Everything above this is resident.
  102.     include    82586.asm
  103. ; Everything below this is discarded upon installation.
  104.  
  105.     public    usage_msg
  106. usage_msg    db    "usage: ncret105 [options] <packet_int_no> <hardware_irq> <base_addr> <Ethernet_address>",CR,LF,'$'
  107.  
  108.     public    copyright_msg
  109. copyright_msg    db    "Packet driver for the NCR ET105, version ",'0'+(majver / 10),'0'+(majver mod 10),".",'0'+version,".",'0'+i82586_version,CR,LF
  110.         db    "Portions Copyright 1988 The Board of Trustees of the University of Illinois",CR,LF,'$'
  111.  
  112. no_mem_msg    db    "No ET 105 found at that memory address",'$'
  113. no_eaddr_msg    db    "You must specify an Ethernet address for the ET 105",CR,LF
  114.         db    "Your card came with a pre-printed label giving the address assigned",CR,LF
  115.         db    "to this card.",CR,LF,'$'
  116.  
  117. check_board:
  118.     mov    SCP,0            ;16-bit bus internally.
  119.     mov    ax,base_addr
  120.     mov    cx,4000h-1        ;test all 16K minus the SCR.
  121.     call    memory_test
  122.     jz    have_mem
  123.     mov    dx,offset no_mem_msg
  124.     stc
  125.     ret
  126. have_mem:
  127.     mov    si,offset rom_address
  128.     mov    cx,EADDR_LEN
  129.     xor    ah,ah
  130. check_eaddr:
  131.     lodsb
  132.     or    ah,al
  133.     loop    check_eaddr
  134.     or    ah,ah            ;did we have all zeroes?
  135.     jne    have_eaddr
  136.     mov    dx,offset no_eaddr_msg
  137.     stc
  138.     ret
  139. have_eaddr:
  140.     clc
  141.     ret
  142.  
  143.  
  144. ;-> the assigned Ethernet address of the card.
  145.     extrn    rom_address: byte
  146.  
  147. get_address:
  148. ;get the address of the interface.
  149. ;enter with es:di -> place to get the address, cx = size of address buffer.
  150. ;exit with nc, cx = actual size of address, or cy if buffer not big enough.
  151.     ret
  152.  
  153.     public    parse_args
  154. parse_args:
  155.     mov    di,offset int_no
  156.     call    get_number
  157.     mov    di,offset base_addr
  158.     call    get_number
  159.     movseg    es,ds
  160.     mov    di,offset rom_address
  161.     call    get_eaddr
  162.     clc
  163.     ret
  164.  
  165.  
  166. int_no_name    db    "Interrupt number ",'$'
  167. base_addr_name    db    "Memory address ",'$'
  168.  
  169.  
  170.     public    print_parameters
  171. print_parameters:
  172.     mov    di,offset int_no
  173.     mov    dx,offset int_no_name
  174.     call    print_number
  175.     mov    ax,memory_begin
  176.     mov    cl,4
  177.     shr    ax,cl
  178.     add    base_addr,ax
  179.     push    ax
  180.     mov    di,offset base_addr
  181.     mov    dx,offset base_addr_name
  182.     call    print_number
  183.     pop    ax
  184.     sub    base_addr,ax
  185.     ret
  186.  
  187.     include    memtest.asm
  188.     extrn    get_hex: near
  189.     include    getea.asm
  190.  
  191. code    ends
  192.  
  193.     end
  194.