Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!husc6!seismo!mcnc!ecsvax!tcamp From: tcamp@ecsvax.UUCP Newsgroups: micro.ibm,comp.sys.ibm.pc Subject: Intercepting a PC interrupt Message-ID: <3335@ecsvax.UUCP> Date: Thu, 4-Jun-87 12:09:15 EDT Article-I.D.: ecsvax.3335 Posted: Thu Jun 4 12:09:15 1987 Date-Received: Sat, 6-Jun-87 08:39:44 EDT Organization: UNC Educational Computing Service Lines: 31 Keywords: I need help Xref: utgpu junk:5199 comp.sys.ibm.pc:4026 I need some help writing a routine to intercept a PC interrupt. The interrupt I want to intercept is 1Ch--the user-available clock tick. I want to do some things in the background. I want to call a c function from this interrupt. I'm using Mark Williams C on IBM-compatible machine. So far I have written an assembly-language routine that saves the registers, restores the DS register to that of my program area (where the c routines are), calls the C function, then restores the registers before issuing an IRET instruction. When I call a null, or simple, c function, this seems to work o.k. But when a call a slightly more complex function which in turn calls a function which passes parameters on the stack, the stack stack seems to get clobbered, and the thing fails. I'm not sure if this is because (a) I need to set up a new stack every time the interrupt routine is issued (any suggestions?) or (b) the intercept routine is now so large that it is being interrupted by itself. Maybe I should CLI and disable interrupts, but when I try this in the routine, nothing seems to work. This probably sounds like a hopeless mess. Any suggestions as to diagnostics or possible remedies? -Ted A. Campbell Duke University Durham, NC email: tcamp@ecsvax