From: "A.Appleyard" To: DJGPP AT DELORIE DOT COM Date: Thu, 21 Mar 1996 08:40:27 GMT Subject: Hooking interrupts Message-ID: In djgpp, IS there an easy way of hooking an interrupt? If I wrote a function:- int zxcvbnm(Regs&R){ ------------------------ }; is there a djgpp function like this?:- void* oldint21 = hook_interrupt(0x21,zxcvbnm); which would preserve the old 0x21 interrupt address in `oldint21', and divert the int21 route to do this when an int21 is called after that:- Save the registers in a Regs structure, named say R. Call function zxcvbnm with R as its argument. Restore the registers from R. If zxcvbnm returns 0, go back to the calling program now. If zxcvbnm returns non-zero, go to the old 0x21 interrupt address. (and also: reset_interrupt(0x21,oldint21); )