Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!tut.cis.ohio-state.edu!purdue!haven!udel!udccvax1!mikej From: mikej@vax1.acs.udel.EDU (Michael Jacobs) Newsgroups: comp.sys.ibm.pc Subject: Re: chaining interrupts Keywords: chaining interrupts Message-ID: <5026@udccvax1.acs.udel.EDU> Date: 16 Nov 89 04:58:28 GMT References: <4543@solo5.cs.vu.nl> Reply-To: mikej@vax1.acs.udel.EDU (Michael Jacobs) Organization: Yoyodyne Propulsion Systems Lines: 64 > I have written several own interrupt handlers for the ibm pc, >and I wonder if it's possible to use the old interrupt routines by >chaining from the new one. One way to do this is by setting the old >vector on the address of an other interrupt number. A disadvantage >of this method is that you don't always know which interrupt is free >and you can run out of all possible interrupts. > So is there an other way, from TP4 for instance: > jmp oldvector (with inline code) >doesn't succeed. I was playing with interrupts last night and just worked it out. I have succeeded in replacing interrupt $1C (the clock updater), and then, inside my routine, calling the clock updated (so it gets done), then returning safely. in turbo 5.5 (it would work in tp >= 4.0 I would think): {$m 1024,0,0} { this program installs the interrupt replacement, and since we want the code to stay in memory so it can be used, we'll have to use the KEEP command, so we don't want a big stack and heap clogging memory } uses dos; { getintvec and setintvec are in unit dos } var ticksave : pointer; { this holds onto the old interrupt vector } procedure tick; interrupt; { this is what would get called instead } begin inline ( $50/$bb/ticksave/$ff/$1f ) { call tick routine } { what this does is PUSH AX MOV BX, OFFSET ticksave CALL [BX] (intersegment call) I push AX, because at the end of the old clock updating stuff, there will be an IRET which pops the offset (IP), the segment (CS), and the flags. since the flags are irrelevent in this case, i just pushed the garbage in AX } { your code here... } end; var X : pointer; begin getintvec ( $1C, ticksave ); { get the old vector and remember it } x := @tick; { the address of tick is the new vector } setintvec ( $1c, x ); { set it } keep ( 0 ) { end the program but keep all this } end. { BS in memory } fun, huh? -- Mike J | The Grey Sysop... | Phone...RING!...yep yep yep yep yep! |