Hi Chris::
Christopher Butler,
In a message on 29 July, wrote :
CB> How do I hook and/or chain an interrupt in C++? (using Turbo C++)
An excerpt of an ISR:
void interrupt myHook()
{
(*oldHook)(); /* Give the old ISR a chance */
/* Put your code here */
}
void interrupt* oldHook;
main()
{
oldHook=getvect(0x8); // 0x8 = timer interrupt
// You may try others ..
setvect(0x8,myHook);
keep(MEM,0); // MEM = amount of RAM your executable
// will occupy. Try big values for MEM
// and go on reducing it till your program crashes
// In other words fix MEM by trial and error ..
// There *is* a better method of getting a value
// for MEM but you can figure it out yourself
// once you understand the various segments in the
// program - DS, CS, SS and the heap.
}
Most DOS functions (int 21h) are non-reentrant so don't call them from
inside myHook().
The above example *chains* interrupt 0x8.
Let me know how you do with ISRs ( I am hoping you wanted that info for
writing your own ISRs ).
Bye
Rajesh
...
* ATP/Linux 1.50 * Never squat with your spurs on.
--- Maximus/2 3.01
---------------
* Origin: Kalptaru Net India. http://www.kalptaru.com . (6:606/31)
|