home *** CD-ROM | disk | FTP | other *** search
- ; The source code provided herein remains the property of Rick
- ; Spence and Software Design Consultants. You are, however, free to
- ; use it, but please do not republish.
-
-
- ; RICKA.ASM - Rick Spence's Assembler code from the Advanced C
- ; presentation, 1990 Devcon
- ;
- ; Program 9 - 9 Assembly Language Version of int86
-
- PUBLIC _aint86 ; Assembly version of int86
-
- _code SEGMENT BYTE PUBLIC 'CODE'
-
- ASSUME CS:_code
-
- ; _aint86(int int_num, union REGS *in_regs, union REGS *out_regs)
-
-
- regs_word STRUC
-
- AX_REG DW 0
- BX_REG DW 0
- CX_REG DW 0
- DX_REG DW 0
- SI_REG DW 0
- DI_REG DW 0
- FLAGS_REG DW 0
-
- regs_word ENDS
-
-
- _aint86 PROC FAR
-
- PUSH BP
- MOV BP, SP
-
- PUSH DS
- PUSH ES
- PUSH SI
- PUSH DI
-
- ; get int_num
- MOV AX, WORD PTR [BP + 06]
-
- ; Write over second byte of INT instruction
- MOV CS: BYTE PTR int_lab + 1, AL
-
- ; Pointer to input registers.
- LDS SI, DWORD PTR [BP + 08]
-
- ; load in regs
- MOV AX, [SI.AX_REG]
- MOV BX, [SI.BX_REG]
- MOV CX, [SI.CX_REG]
- MOV DX, [SI.DX_REG]
- MOV DI, [SI.DI_REG]
- MOV SI, [SI.SI_REG] ; This must be last ...
-
- ; Assemble INT 0, overwrite the actual interrupt vector!
-
- int_lab:
- INT 0
-
- PUSHF
-
- ; Save SI so we can use it to point to the out regs
- PUSH SI
-
- ; out regs
- LDS SI, DWORD PTR [BP + 0CH]
-
- MOV [SI.AX_REG], AX
- MOV [SI.BX_REG], BX
- MOV [SI.CX_REG], CX
- MOV [SI.DX_REG], DX
- MOV [SI.DI_REG], DI
-
- ; GET saved SI into AX so we can save it back
- POP AX
- MOV [SI.SI_REG], AX
-
- ; now pop flags we saved off stack
- POP AX
- MOV [SI.FLAGS_REG], AX
-
- ; And finally, we return
- POP DI
- POP SI
- POP ES
- POP DS
-
- POP BP
- RET
-
- _aint86 ENDP
-
- _code ENDS
-
- END
-
-
-