home *** CD-ROM | disk | FTP | other *** search
- DOSSEG
- .MODEL large, C
- .CODE
- ;
- old13 dd 0
- flag13 dd 0
- ;
- spy13 proc far
- ;
- push ds
- push si
- lds si, cs:flag13 ;set flag if FILIO
- inc word ptr [si]
- pop si
- pop ds
-
- pushf ;simulate int 0x13
- call [old13]
-
- push ds
- push si
- lds si, cs:flag13 ;we are now leaving DOS
- dec word ptr [si]
- pop si
- pop ds
-
- iret
-
- spy13 endp
- ;
- ;
- public init13
- init13 proc far uses ds, ioflag:ptr word, intrpt:word
- lds bx, ioflag
- mov WORD PTR cs:flag13, bx
- mov WORD PTR cs:flag13+2, ds
-
- mov ax, intrpt
- shl ax, 1
- shl ax, 1
- mov bx,ax
- xor ax,ax
- mov ds,ax
- mov ax, [bx]
- mov WORD PTR cs:old13, ax ; save org interrupt 21
- mov ax, [bx + 2]
- mov WORD PTR cs:old13 + 2, ax
- cli
- mov ax, offset spy13
- mov [bx], ax
- mov ax, seg spy13
- mov [bx + 2], ax
- sti
-
- ret
-
- init13 endp
- ;
- ;
- public term13
- term13 proc far uses ds, intrpt:word
-
- mov ax, intrpt
- shl ax, 1
- shl ax, 1
- mov bx,ax
- xor ax,ax
- mov ds,ax
- mov ax, WORD PTR cs:old13 ; restore org interrupt 13
- mov [bx], ax
- mov ax, WORD PTR cs:old13 + 2
- mov [bx + 2], ax
-
- ret
-
- term13 endp
-
-
- END
-