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

  1. majver        equ    6        ;version number of the infrastructure.
  2.  
  3. MAX_ADDR_LEN    equ    16        ;maximum number of bytes in our address.
  4.  
  5. MAX_HANDLE    equ    10        ;maximum number of handles.
  6.  
  7. MAX_P_LEN    equ    8        ;maximum type length
  8.  
  9. MAX_MULTICAST    equ    8        ;maximum number of multicast addresses.
  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. HT    equ    09h
  27. CR    equ    0dh
  28. LF    equ    0ah
  29.  
  30. ;
  31. ;  Packet Driver Error numbers
  32. NO_ERROR    equ    0        ;no error at all.
  33. BAD_HANDLE    equ    1        ;invalid handle number
  34. NO_CLASS    equ    2        ;no interfaces of specified class found
  35. NO_TYPE        equ    3        ;no interfaces of specified type found
  36. NO_NUMBER    equ    4        ;no interfaces of specified number found
  37. BAD_TYPE    equ    5        ;bad packet type specified
  38. NO_MULTICAST    equ    6        ;this interface does not support
  39.                     ;multicast
  40. CANT_TERMINATE    equ    7        ;this packet driver cannot terminate
  41. BAD_MODE    equ    8        ;an invalid receiver mode was specified
  42. NO_SPACE    equ    9        ;operation failed because of
  43.                     ;insufficient space
  44. TYPE_INUSE    equ    10        ;the type had previously been accessed,
  45.                     ;and not released.
  46. BAD_COMMAND    equ    11        ;the command was out of range, or not
  47.                     ;implemented
  48. CANT_SEND    equ    12        ;the packet couldn't be sent (usually
  49.                     ;hardware error)
  50. CANT_SET    equ    13        ;hardware address couldn't be changed
  51.                     ;(more than 1 handle open)
  52. BAD_ADDRESS    equ    14        ;hardware address has bad length or
  53.                     ;format
  54. CANT_RESET    equ    15        ;Couldn't reset interface (more than
  55.                     ;1 handle open).
  56.  
  57. ;a few useful Ethernet definitions.
  58. RUNT        equ    60        ;smallest legal size packet, no fcs
  59. GIANT        equ    1514        ;largest legal size packet, no fcs
  60. EADDR_LEN    equ    6        ;Ethernet address length.
  61. ARCADDR_LEN    equ    1
  62.  
  63. ;The following two macros are used to manipulate port addresses.
  64. ;Use loadport to initialize dx.  Use setport to set a specific port on
  65. ;the board.  setport remembers what the current port number is, but beware!
  66. ;setport assumes that code is being executed in the same order as the
  67. ;code is presented in the source file.  Whenever this assumption is violated,
  68. ;you need to enter another loadport.  Some, but not all examples are:
  69. ;in a loop with multiple setports, or a backward jump over a setport, or
  70. ;a forward jump over a setport.  If you have any doubt, consult the
  71. ;individual driver sources for examples of usage.  If you suspect that
  72. ;you have too few loadports, define the symbol "no_confidence".  This will
  73. ;force a loadport before every setport.
  74. loadport    macro
  75.     mov    dx,io_addr
  76. port_no    =    0
  77.     endm
  78.  
  79. ;change the port number from the current value to the new value.
  80. setport    macro    new_port_no
  81.     ifdef    no_confidence        ;define if you suspect that you don't
  82.         loadport        ;  have enough loadports, i.e. dx is
  83.     endif                ;  set to the wrong port.
  84.     if    new_port_no - port_no EQ 1
  85.         inc    dx
  86.     else
  87.         if    new_port_no - port_no EQ -1
  88.             dec    dx
  89.         else
  90.             if    new_port_no - port_no NE 0
  91.                 add    dx,new_port_no - port_no
  92.             endif
  93.         endif
  94.     endif
  95. port_no    =    new_port_no
  96.     endm
  97.  
  98. segmoffs    struc            ; defines offs as 0, segm as 2
  99. offs        dw    ?
  100. segm        dw    ?
  101. segmoffs    ends
  102.