home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / NCSATELN / TEL23SRC.ZIP / NET / ENET / DNDLL2.ASM < prev    next >
Encoding:
Assembly Source File  |  1991-05-15  |  3.8 KB  |  191 lines

  1. ;  1205, Wed 12 Sep 90
  2. ;
  3. ;  DNDLL2:  Interface to DECNET/DOS DLL
  4. ;
  5. ;  Nevil Brownlee,  n.brownlee@aukuni.ac.nz
  6. ;  Computer Centre,  University of Auckland.
  7. ;
  8. ;  int DLLfn (   /* Invoke DLL function */
  9. ;     int fn;           /* Function nbr */
  10. ;     struct dcb *dp);    /* Datalink Control Block */
  11. ;
  12. ;  void r_callback();  /* Receive callback routine */
  13. ;  void t_callback();  /* Transmit callback routine */
  14. ;               /* Callback routines point ds to dgroup,
  15. ;              then call a C routine passing the ucb */
  16. ;
  17. ;Microsoft EQU 1
  18. ;Lattice EQU 1
  19. ifndef Microsoft
  20.     ifndef Lattice
  21.         if2
  22.             %out
  23.             %out ERROR: You have to specify "/DMicrosoft" OR "/DLattice" on the
  24.             %out        MASM command line to determine the type of assembly.
  25.             %out
  26.         endif
  27.         end
  28.     endif
  29. endif
  30.  
  31. ;
  32. ifdef Microsoft
  33. X    EQU    6
  34.     DOSSEG
  35.     .MODEL    LARGE
  36. else
  37.     INCLUDE    DOS.MAC
  38.     SETX
  39. endif
  40. ;
  41. ifdef Microsoft
  42. ifdef TurboC                ; !!! NB
  43.         .code   dndll_text    ; TurboC needs to know the segment
  44. else                    ;    where the object is declared!
  45.         .code            ; Microsoft doesn't!
  46. endif
  47. ifdef Watcom
  48.         extrn   c_r_callback_:far
  49.         extrn   c_t_callback_:far
  50. else
  51.         extrn    _c_r_callback:far
  52.         extrn    _c_t_callback:far
  53. endif
  54. ;
  55. ;            .code
  56.         PUBLIC    _DLLfn,_r_callback,_t_callback
  57. else
  58.         PSEG
  59.         extrn    c_r_callback:far
  60.         extrn    c_t_callback:far
  61.         PUBLIC    DLLfn,r_callback,t_callback
  62. endif
  63. ;
  64. DLLINT        equ    069h    ; Id for the DECNET DLL driver Release 2.1
  65. ;                ;    Earlier releases used 6D!
  66. ;
  67. ifdef Microsoft
  68. _DLLfn        PROC    FAR
  69. else
  70. DLLfn        PROC    FAR
  71. endif
  72.     push    bp
  73.     mov bp,sp
  74.     push    si      ; Turbo uses index regs for register variables
  75.     push    di
  76.     mov ax,X[bp]    ; Release 2.1 puts fn code in AL,
  77.     mov ah,0Ah      ;    0Ah in AL
  78.                     ; Earlier releases put fn code in AH!
  79.     mov bx,X+2[bp]  ; dcb offset
  80.     mov cx,X+4[bp]  ; dcb segment
  81.     push    es
  82.     mov es,cx
  83.     int DLLINT      ; DECNET/DOS DLL process
  84.     pop     es
  85.     pop     di
  86.     pop     si
  87.     pop     bp
  88.     ret
  89. ifdef Microsoft
  90. _DLLfn        endp
  91. else
  92. DLLfn        endp
  93. endif
  94. ;
  95. ;
  96. ifdef Microsoft
  97. _r_callback    PROC    FAR
  98. else
  99. r_callback    PROC    FAR
  100. endif
  101.     push    ds          ; Save caller's registers
  102.     push    es
  103.     push    dx
  104. ifdef Watcom
  105.     push    ax          ; Preserve the AX register also for Watcom
  106. endif
  107.     mov     dx,dgroup   ; Point ds to dgroup
  108.     mov     ds,dx
  109. ifdef Watcom
  110.     MOV     DX,ES       ; Watcom C passes variables in registers
  111.     MOV     AX,BX       ;
  112. else
  113.     push    es          ; c_r_callback(&ucb);
  114.     push    bx
  115. endif
  116. ifdef Microsoft
  117. ifdef Watcom
  118.     call    c_r_callback_
  119. else
  120.     call    _c_r_callback
  121. endif
  122. else
  123.     call    c_r_callback
  124. endif
  125. ifndef Watcom
  126.     pop dx      ; Cut back stack
  127.     pop dx
  128. endif
  129. ifdef Watcom
  130.     pop ax
  131. endif
  132.     pop dx      ; Restore caller's registers
  133.     pop es
  134.     pop ds
  135.     ret
  136. ifdef Microsoft
  137. _r_callback    endp
  138. else
  139. r_callback    endp
  140. endif
  141. ;
  142. ;
  143. ifdef Microsoft
  144. _t_callback    PROC    FAR
  145. else
  146. t_callback    PROC    FAR
  147. endif
  148.     push    ds      ; Save segment registers
  149.     push    es
  150.     push    dx
  151. ifdef Watcom
  152.     push    ax      ; Preserve the AX register also for Watcom C
  153. endif
  154.     mov     dx,dgroup   ; Point ds to dgroup
  155.     mov     ds,dx
  156. ifdef Watcom
  157.     MOV     DX,ES       ; Watcom C passes variables in registers
  158.     MOV     AX,BX       ;
  159. else
  160.     push    es      ; c_t_callback(&ucb);
  161.     push    bx
  162. endif
  163. ifdef Microsoft
  164. ifdef Watcom
  165.     call    c_t_callback_
  166. else
  167.     call    _c_t_callback
  168. endif
  169. else
  170.     call    c_t_callback
  171. endif
  172. ifndef Watcom
  173.     pop dx      ; Cut back stack
  174.     pop dx
  175. endif
  176. ifdef Watcom
  177.     pop ax
  178. endif
  179.     pop dx      ; Restore caller's registers
  180.     pop es
  181.     pop ds
  182.     ret
  183. ifdef Microsoft
  184. _t_callback    endp
  185. else
  186. t_callback    endp
  187. endif
  188. ;
  189.     end
  190.  
  191.