[alt.msdos.programmer] Interrupt Handlers

mocker@tomato.ucsb.edu (Mocker) (05/31/90)

In article <1990May30.182420.14595@athena.mit.edu> news@athena.mit.edu (News system) writes:

>   I am trying to write an interrupt handler to trap some but not all of the
>   of the Int 21h functions (6 and 0B).  What is the proper way to pass calls
>   to the old handler for functions I don't want to trap?
>   I'm able to trap Int 5 (print screen), chain to the old prt scr, and restore
>   it but when I try to do the same thing for Int 21h my machine hangs.
>   Add to this the complication that I've never written asm for MSDOS before (but
>   I am familiar with interrupt schemes on other processors).
>   Thanks in advance even if it is only a good reference I can go to (Microsoft
>   Press' Advanced MSDOS Programming by Ray Duncan had almost but not quite every
>   thing I need.
>   Chris Cimino, MD    Internet: ccimino@hstbme.mit.edu
>   From: ccimino@hstbme.mit.edu (c cimino)
>   Path: hstbme.mit.edu!ccimino


How about somethig like this:

OLD21_ADDR	DD	?	; YOU HAVE TO GET THIS ADDRESS

INT21_HANDLER	PROC	FAR
	PUSHF
	CMP	AH,6
	JZ	SPECIAL
	CMP	AH,0BH
	JZ	SPECIAL
	
GOTO_OLD_INT21:
	POPF
	JMP	DWORD PTR CS:OLD21_ADDR

SPECIAL:
	POPF
	; INSERT YOUR JUNK HERE
	IRET
INT21_HANDLER	ENDP


...JUST A THOUGHT...
--
there's still lofty dreams...| 6600mock@ucsbuxa.ucsb.edu 
meager desires...            | mocker@cs.ucsb.edu
still sillyness...           | Joseph D. Mocker