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

  1. TITLE 'NETBICC2.ASM'
  2. ;
  3. ;       These assembler routine provide an interface between the code
  4. ;       written in 'C' and the Multi Protocol Handler.
  5. ;
  6.  
  7. .model large
  8.  
  9. ;
  10. ;       Data Structures
  11. ;
  12. .data
  13.  
  14. ;
  15. ;       The Asynchronous Notification Routine Stack
  16. ;
  17. ;       Size of stack is
  18. STACK_SIZE      EQU     100h
  19. ;
  20.                 DW      STACK_SIZE      DUP     (?)
  21. STACK_START     DW      ?
  22.  
  23. ;
  24. ;       Area to save Multi Protocol Handler Stack Pointer
  25. ;
  26. SS_SAVE         DW      ?
  27. SP_SAVE         DW      ?
  28. ;
  29.  
  30. ;
  31. ;       Start of Code
  32. ;
  33.  
  34.  
  35. .code
  36.  
  37. EXTRN   _anr_c : FAR
  38.  
  39. PUBLIC  _ANR_ENTRY
  40.  
  41. _ANR_ENTRY      PROC    
  42.  
  43. ;
  44. ;       This routine is the ANR entry point.  It is called by the
  45. ;       Multi Protocol Handler, via a far call.  Before calling the main
  46. ;       ANR routine (written in 'C'), it sets up the Data Segment, saves
  47. ;       the Multi Protocol Handler's stack, and allocates a new stack.
  48. ;       Before returning to the Multi Protocol Handler, it restores its
  49. ;       stack.
  50. ;
  51. ;       The ANR routine (written in 'C') must not make use of the heap, 
  52. ;       nor should it try to access to access automatic variables declared
  53. ;       in main(), because the stack it has been allocated is NOT the same
  54. ;       as the standard 'C' stack.
  55. ;
  56.  
  57.         MOV     AX, DGROUP      ; Get Data Segement
  58.         MOV     DS, AX          ; Set up DS
  59.  
  60.         MOV     SS_SAVE, SS     ; Save Stack Pointers
  61.         MOV     SP_SAVE, SP     ;
  62.  
  63.         MOV     SS, AX          ; Set up Stack Segment
  64.         LEA     SP, STACK_START ; 
  65.  
  66.         PUSH    ES              ; The address of the ACB is passed as
  67.         PUSH    BX              ; a far pointer.
  68.  
  69.         CLD
  70.  
  71.         CALL    _anr_c          ; Call 'C' ANR routine
  72.                                 ; _ANR_C returns a parameter in AX
  73.  
  74.         MOV     SS, SS_SAVE     ; Restore Stack Pointers
  75.         MOV     SP, SP_SAVE
  76.  
  77.         RET
  78. _ANR_ENTRY      ENDP
  79.         END
  80.  
  81.