home *** CD-ROM | disk | FTP | other *** search
- ;--------------------------------------------------------------------
- ;
- ; REALINT.ASM
- ;
- ; ALTINTR - calls interrupts with a true INT call
- ;
- ; ALTINTR appeared in INFOPLUS.ASM by Andrew Rossmann, who modified
- ; the *ORIGINAL* code provided by Steve Grant. It has NOT been
- ; modified here, just extracted and placed in an ASM file by itself
- ;
- ; INFOPLUS.ASM contained many more functions and procedures than
- ; ALTINTR. It may be downloaded from BPROGA Lib2 as INFOP1.ZIP
- ;
- ; This, like the original, is released to the public domain
-
-
- .286P
- .8087
-
-
- CODE segment byte
- assume cs:CODE, es:NOTHING
- public ALTINTR
-
- ; Pascal format: procedure AltIntr(intno: byte; regs: registers); external;
-
- ALTINTRP proc far
-
- regaddr equ [bp + 6]
- intno equ [bp + 10]
-
-
- altcont:
- lds si,regaddr ;point DS:SI to regs
- mov cs:save_ds,ds ;save pointer for return
- mov cs:save_si,si
- cld ;go forward
- lodsw ;load AX and hold it
- push ax
- lodsw ;load BX
- mov bx,ax
- lodsw ;load CX
- mov cx,ax
- lodsw ;load DX
- mov dx,ax
- lodsw ;load BP
- mov bp,ax
- lodsw ;load SI and hold it
- push ax
- lodsw ;load DI
- mov di,ax
- lodsw ;load DS and hold it
- push ax
- lodsw ;load ES
- mov es,ax
- lodsw ;load Flags
- push ax
- popf
- pop ds ;get rest of regs
- pop si
- pop ax
- db 0cdh ;Int opcode
- intrpt db ? ;loaded with real interrupt
- pushf ;save flags and modified regs
- push es
- push di
- mov es,cs:save_ds ;get regs pointer into ES:DI
- mov di,cs:save_si
- cld ;go forward
- stosw ;save AX
- mov ax,bx
- stosw ;save BX
- mov ax,cx
- stosw ;save CX
- mov ax,dx
- stosw ;save DX
- mov ax,bp
- stosw ;save BP
- mov ax,si
- stosw ;save SI
- pop ax
- stosw ;save DI
- mov ax,ds
- stosw ;save DS
- pop ax
- stosw ;save ES
- pop ax
- stosw ;save Flags
- pop ds ;restore regs
- pop bp
- ret 6
-
- altintr:
- push bp
- mov bp,sp
- push ds ;save DS, because we screw it up
- mov al,intno ;get interrupt number to use
- mov cs:intrpt,al ;and modify our code
- jmp altcont ;continue with rest of code
-
- ;local storage
-
- save_ds dw ?
- save_si dw ?
-
- ALTINTRP endp
-
- code ends
- end