home *** CD-ROM | disk | FTP | other *** search
- ; File......: AINT86.ASM
- ; Author....: Ted Means
- ; Date......: $Date: 15 Aug 1991 23:07:24 $
- ; Revision..: $Revision: 1.1 $
- ; Log file..: $Logfile: E:/nanfor/src/aint86.asv $
- ;
- ; This is an original work by Ted Means and is placed in the
- ; public domain.
- ;
- ; Modification history:
- ; ---------------------
- ;
- ; $Log: E:/nanfor/src/aint86.asv $
- ;
- ; Rev 1.1 15 Aug 1991 23:07:24 GLENN
- ; Forest Belt proofread/edited/cleaned up doc
- ;
- ; Rev 1.0 27 May 1991 13:21:48 GLENN
- ; Initial revision.
- ;
-
-
- ; This file is a part of the ft_int86() package. For complete
- ; documentation, read cint86.c, available elsewhere in the
- ; Nanforum Toolkit.
- ;
- ; This module should be compiled with TASM.
-
-
- Public __ftint86
-
- Segment _NanFor Word Public "CODE"
- Assume CS:_NanFor
-
- Proc __ftint86 Far
-
- Pop CX ; Remove return address from
- Pop DX ; stack
-
- Pop [CS:RegOfs] ; Get pointer to register
- Pop [CS:RegSeg] ; structure from stack
-
- Pop AX ; Get desired interrupt
-
- Push DX ; Put return address back onto
- Push CX ; stack to prevent underflow
-
- Push DS ; Save modified registers
- Push SI
- Push DI
- Push BP
-
- Mov AH,35h ; DOS service -- get vector
- Int 21h ; Call DOS
- Mov [CS:HndSeg],ES ; Store address of desired
- Mov [CS:HndOfs],BX ; interrupt handler
-
- LDS BX,[CS:RegPtr] ; Load pointer to register values
- Push [Word Ptr BX + 16] ; Put ES value on stack
- Push [Word Ptr BX + 14] ; Put DS value on stack
- Push [Word Ptr BX + 12] ; Put BP value on stack
- Push [Word Ptr BX + 10] ; Put DI value on stack
- Push [Word Ptr BX + 8] ; Put SI value on stack
- Push [Word Ptr BX + 6] ; Put DX value on stack
- Push [Word Ptr BX + 4] ; Put CX value on stack
- Push [Word Ptr BX + 2] ; Put BX value on stack
- Mov AX,[Word Ptr BX + 0] ; Get AX value
- Pop BX ; Get BX value
- Pop CX ; Get CX value
- Pop DX ; Get DX value
- Pop SI ; Get SI value
- Pop DI ; Get DI value
- Pop BP ; Get BP value
- Pop DS ; Get DS value
- Pop ES ; Get ES value
-
- PushF ; Simulate INT instruction by
- CLI ; using PushF and CLI
- Call [CS:Handler] ; Call the interrupt handler
-
- Push AX ; Save all registers to preserve
- Push BX ; the state of the CPU after
- Push CX ; the interrupt executed
- Push DX
- Push SI
- Push DI
- Push BP
- Push DS
- Push ES
- PushF
-
- LDS BX,[CS:RegPtr] ; Load pointer to register values
- Pop [Word Ptr BX + 18] ; Get saved registers and load
- Pop [Word Ptr BX + 16] ; into data structure
- Pop [Word Ptr BX + 14]
- Pop [Word Ptr BX + 12]
- Pop [Word Ptr BX + 10]
- Pop [Word Ptr BX + 8]
- Pop [Word Ptr BX + 6]
- Pop [Word Ptr BX + 4]
- Pop [Word Ptr BX + 2]
- Pop [Word Ptr BX + 0]
-
- Pop BP ; Restore registers
- Pop DI
- Pop SI
- Pop DS
- Ret
- Endp __ftint86
-
- Label Handler DWord
- HndOfs DW ?
- HndSeg DW ?
-
- Label RegPtr DWord
- RegOfs DW ?
- RegSeg DW ?
-
- Ends _NanFor
- End
-