www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/03/21/03:48:13

From: "A.Appleyard" <A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk>
To: DJGPP AT DELORIE DOT COM
Date: Thu, 21 Mar 1996 08:40:27 GMT
Subject: Hooking interrupts
Message-ID: <A2B885755D@fs2.mt.umist.ac.uk>

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); )

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019