home *** CD-ROM | disk | FTP | other *** search
- ;
- ; XCintf.asm Assembler language interface module to XCBUNDLD.C
- ;
- ; Dependent on the C compiler and the model
- ;
- ; Build instructions:
- ; MASM XCINTF,, /Dmodel;
- ;
- ;
- ; (C) Copyright 19896 SOuth Mountain Software Inc.
- ; All Rights Reserved
- ;
- ;
- ; C functions XCbundld.C XCintf.ASM
- ;
- ; xc_entr() xc_up() xc_findv()
- ; xc_exit() xc_down() xc_retv()
- ;
- ; revision 2.0 Version updated
-
- ;
- ; ===============================================================
- ; References
- ; ===============================================================
- ;
-
- INCLUDE ECLMACRO.INC ; Default ECL assembler macros
-
- EXTRN XCOMMS : FAR ; Interrupt entry
- ;
- ; ===============================================================
- ; Definitions
- ; ===============================================================
- ;
-
- NULL EQU 00h ; End of copyright message string
- CR EQU 0Dh ; Carriage return
- LF EQU 0Ah ; Line feed
-
- DEFAULT_XCOMMS EQU 7Fh ; Assumed this to be XCOMMS vector
- LOW_INTERRUPT EQU 41h ; This is the last one to search
- XCOMMS_ID EQU 0A66Ah ; Signature
-
-
- modstart xcintf ; Start the module
-
- ; ===============================================================
- ; Local data
- ; ===============================================================
- ;
-
- Copyr: DB "XCOMMS revision 3.0", CR, LF
- DB "Copyright (C) 1989, South Mountain Software Incorporated", CR, LF
- DB NULL
-
-
- ;
- ; ===============================================================
- ; Global procedures
- ; ===============================================================
- ;
- ; xc_findv Link the XCOMMS guy
- ; xc_retv Return the XCOMMS vector (set to 0000:0000)
-
- ;
- ; ===============================================================
- ; xc_findv Link the XCOMMS guy
- ; ===============================================================
- ;
- ;
- ;
- ; Input Description
- ; -------------- ---------------------------
- ; int buffers Buffers to allocate
- ; char *buffaddr Base address of buffers
- ;
- ; Output Description
- ; -------------- ---------------------------
- ; CY = NC OK - linked successfully
- ; AX = 00
- ; CY = C Error - used by XCOMMS (or anything else)
- ; AX = 01 Already installed
- ; AX = 02 All vectors used - none are available
- ;
- ; Registers used Description
- ; -------------- ---------------------------
- ; CX Interrupt vector list counter
- ; ES, DX The vector segment register
- ; BX The vector offset
- ; ===============================================================
- ;
-
-
- entry xc_findv
- pushreg
-
- PUSH ES
- PUSH DX
- PUSH CX
- PUSH BX
-
- ;
- ; Examine all of the available interrupt vectors between
- ; xcomms_int and LOW_INTERRUPT. If XCOMMS is already
- ; installed, an error code is returned. Otherwise, the
- ; vector number is stored (in xcomms_int) and the
- ; previous contents forgotten. THE TSR VERSION OF XCOMMS MUST
- ; ALWAYS KEEP ITS VECTOR!
- ;
- MOV CX, (DEFAULT_XCOMMS - LOW_INTERRUPT) + 1
- _XL_try_again:
- MOV AL, BYTE PTR CS:xcomms_int
- getvec
- MOV AX, BX
- OR AX, DX
- JNE _XL_loop ; Someone used it!
-
- MOV AL, BYTE PTR CS:xcomms_int ; Initialize XCOMMS kernal
- MOV BX, OFFSET XCOMMS
- MOV DX, SEG XCOMMS
- setvec
- CLC
- loadint1 CX ; Load buffers from stack
- loadptr2 ; Load buffer address in DX:BX
- MOV AX, 0002h
- DB 0CDh ; <int> XCOMMS
- xcomms_int DB DEFAULT_XCOMMS ; Interrupt vector to XCOMMS
- MOV AX, 00h
- JMP SHORT _XL_Exit
-
- _XL_loop: ; Who owns the vector?
- MOV ES, DX
- CMP WORD PTR ES:[BX+2], XCOMMS_ID
- MOV AX, 01h
- JE _XL_Error ; XCOMMS is already there???
- DEC cs:xcomms_int ; Look for another vector
- LOOP _XL_try_again
- MOV AX, 02h ; None are available
- _XL_Error:
- STC
- _XL_Exit:
- POP BX
- POP CX
- POP DX
- POP ES
- popreg
- RET
- endit xc_findv
-
-
- ; ===============================================================
- ; xc_retv Return the XCOMMS vector (set to 0000:0000)
- ; ===============================================================
- ;
- ;
- ;
- ; Input Description
- ; -------------- ---------------------------
- ; Not applicable
- ;
- ; Output Description
- ; -------------- ---------------------------
- ; CY = NC OK - unlinked successfully
- ; AL = 00
- ;
- ; Registers used Description
- ; -------------- ---------------------------
- ; Not applicable
- ; ===============================================================
- ;
-
-
- entry xc_retv
- MOV BX, 0
- MOV DX, 0
- MOV AL, byte ptr cs:xcomms_int
- setvec
- RET
- endit xc_retv
- modend xcintf ; End module
-
- END
-
-