home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 11 / 11.iso / n / n002 / 4.ddi / ECLSRCA.ZIP / XCINTF.ASM < prev    next >
Encoding:
Assembly Source File  |  1989-08-16  |  6.2 KB  |  185 lines

  1. ;
  2. ;       XCintf.asm      Assembler language interface module to XCBUNDLD.C
  3. ;
  4. ;       Dependent on the C compiler and the model
  5. ;
  6. ;       Build instructions:
  7. ;               MASM  XCINTF,, /Dmodel;
  8. ;
  9. ;
  10. ;       (C) Copyright 19896 SOuth Mountain Software Inc.
  11. ;       All Rights Reserved
  12. ;
  13. ;
  14. ;               C functions     XCbundld.C      XCintf.ASM
  15. ;
  16. ;               xc_entr()       xc_up()         xc_findv()
  17. ;               xc_exit()       xc_down()       xc_retv()
  18. ;
  19. ;       revision 2.0        Version updated
  20.  
  21. ;
  22. ;       ===============================================================
  23. ;       References
  24. ;       ===============================================================
  25. ;
  26.  
  27.         INCLUDE ECLMACRO.INC            ; Default ECL assembler macros
  28.  
  29.         EXTRN   XCOMMS : FAR            ; Interrupt entry
  30. ;
  31. ;       ===============================================================
  32. ;       Definitions
  33. ;       ===============================================================
  34. ;
  35.  
  36. NULL            EQU     00h             ; End of copyright message string
  37. CR              EQU     0Dh             ; Carriage return
  38. LF              EQU     0Ah             ; Line feed
  39.  
  40. DEFAULT_XCOMMS  EQU     7Fh             ; Assumed this to be XCOMMS vector
  41. LOW_INTERRUPT   EQU     41h             ; This is the last one to search
  42. XCOMMS_ID       EQU     0A66Ah          ; Signature
  43.  
  44.  
  45.             modstart    xcintf              ; Start the module
  46.         
  47. ;       ===============================================================
  48. ;       Local data
  49. ;       ===============================================================
  50. ;
  51.  
  52. Copyr:  DB      "XCOMMS revision 3.0", CR, LF
  53.         DB      "Copyright (C) 1989, South Mountain Software Incorporated", CR, LF
  54.         DB      NULL
  55.  
  56.  
  57. ;
  58. ;       ===============================================================
  59. ;       Global procedures
  60. ;       ===============================================================
  61. ;
  62. ;       xc_findv        Link the XCOMMS guy
  63. ;       xc_retv         Return the XCOMMS vector (set to 0000:0000)
  64.  
  65. ;
  66. ;       ===============================================================
  67. ;       xc_findv         Link the XCOMMS guy
  68. ;       ===============================================================
  69. ;
  70. ;       
  71. ;
  72. ;       Input           Description
  73. ;       --------------  ---------------------------
  74. ;       int buffers     Buffers to allocate
  75. ;       char *buffaddr  Base address of buffers
  76. ;
  77. ;       Output          Description
  78. ;       --------------  ---------------------------
  79. ;       CY = NC         OK - linked successfully
  80. ;            AX = 00    
  81. ;       CY = C          Error - used by XCOMMS (or anything else)
  82. ;            AX = 01    Already installed
  83. ;            AX = 02    All vectors used - none are available
  84. ;
  85. ;       Registers used  Description
  86. ;       --------------  ---------------------------
  87. ;       CX              Interrupt vector list counter
  88. ;       ES, DX          The vector segment register
  89. ;       BX              The vector offset
  90. ;       ===============================================================
  91. ;
  92.  
  93.  
  94.                 entry           xc_findv
  95.                 pushreg
  96.  
  97.                 PUSH    ES
  98.                 PUSH    DX
  99.                 PUSH    CX
  100.                 PUSH    BX
  101.  
  102. ;
  103. ;       Examine all of the available interrupt vectors between
  104. ;       xcomms_int and LOW_INTERRUPT.  If XCOMMS is already
  105. ;       installed, an error code is returned.  Otherwise, the
  106. ;       vector number is stored (in xcomms_int) and the 
  107. ;       previous contents forgotten.  THE TSR VERSION OF XCOMMS MUST
  108. ;       ALWAYS KEEP ITS VECTOR!
  109. ;
  110.                 MOV     CX, (DEFAULT_XCOMMS - LOW_INTERRUPT) + 1
  111. _XL_try_again:
  112.                 MOV     AL, BYTE PTR CS:xcomms_int
  113.                 getvec
  114.                 MOV     AX, BX
  115.                 OR      AX, DX
  116.                 JNE     _XL_loop                ; Someone used it!
  117.  
  118.                 MOV     AL, BYTE PTR CS:xcomms_int ; Initialize XCOMMS kernal
  119.                 MOV     BX, OFFSET XCOMMS
  120.                 MOV     DX, SEG XCOMMS
  121.                 setvec
  122.                 CLC
  123.                 loadint1 CX                     ; Load buffers from stack
  124.                 loadptr2                        ; Load buffer address in DX:BX
  125.                 MOV     AX, 0002h
  126.                 DB      0CDh                    ; <int> XCOMMS
  127. xcomms_int      DB      DEFAULT_XCOMMS          ; Interrupt vector to XCOMMS
  128.                 MOV     AX, 00h
  129.                 JMP     SHORT _XL_Exit
  130.  
  131. _XL_loop:                                       ; Who owns the vector?
  132.                 MOV     ES, DX
  133.                 CMP     WORD PTR ES:[BX+2], XCOMMS_ID
  134.                 MOV     AX, 01h
  135.                 JE      _XL_Error               ; XCOMMS is already there???
  136.                 DEC     cs:xcomms_int              ; Look for another vector
  137.                 LOOP    _XL_try_again
  138.                 MOV     AX, 02h                 ; None are available
  139. _XL_Error:
  140.                 STC
  141. _XL_Exit:
  142.                 POP     BX
  143.                 POP     CX
  144.                 POP     DX
  145.                 POP     ES
  146.                 popreg
  147.                 RET
  148.                 endit           xc_findv
  149.  
  150.  
  151. ;       ===============================================================
  152. ;       xc_retv         Return the XCOMMS vector (set to 0000:0000)
  153. ;       ===============================================================
  154. ;
  155. ;       
  156. ;
  157. ;       Input           Description
  158. ;       --------------  ---------------------------
  159. ;       Not applicable
  160. ;
  161. ;       Output          Description
  162. ;       --------------  ---------------------------
  163. ;       CY = NC         OK - unlinked successfully
  164. ;            AL = 00    
  165. ;
  166. ;       Registers used  Description
  167. ;       --------------  ---------------------------
  168. ;       Not applicable
  169. ;       ===============================================================
  170. ;
  171.  
  172.  
  173.                 entry           xc_retv
  174.                 MOV     BX, 0
  175.                 MOV     DX, 0
  176.                 MOV     AL, byte ptr cs:xcomms_int
  177.                 setvec
  178.                 RET
  179.                 endit           xc_retv
  180.         modend     xcintf               ; End module
  181.  
  182.         END
  183.  
  184.  
  185.