Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!rutgers!netnews.upenn.edu!vax1.cc.lehigh.edu!lukrw From: lukrw@vax1.cc.lehigh.edu Newsgroups: comp.lang.pascal Subject: Re: Problems with interrupt handler for interrupt 08 or 1C in TP 6.0 Message-ID: <139.2787282f@vax1.cc.lehigh.edu> Date: 6 Jan 91 18:37:51 GMT References: <11648@j.cc.purdue.edu> Organization: Lehigh University Lines: 49 In article <11648@j.cc.purdue.edu>, zhou@brazil.psych.purdue.edu (Albert Zhou) writes: > If the program (say, WordPerfect) you are using happens to call Int 1C, when > your TSR is in the middle of running, you will get stuck. > > procedure yourintproc; > interrupt > begin > set Int 1c to the old vector; > (so that the interrupted program can do its own clock interrrupt) > do your things; > > set Int 1c back to @yourintproc; > end; Please, do not try this. I don't know what he's getting at (sorry Albert), but this will definitely not do anything healthy. A more correct procedure for using int 1c is as follows: var saveint: pointer; procedure intproc; interrupt; begin {...Do interrupt processing} inline($9c/$ff/$1e/saveint); {Chain to old interrupt} end; begin {main} getintvec($1c, saveint); {Save old interrupt} setintvec($1c, @intproc); {Install new interrupt handler} {....Do main processing} setintvec($1c, saveint); {Restore old interrupt} end. Note to Per: If you are not using a similar inline call to chain to the old interrupt, that may be part of the problem. That simulates an int by doing a pushf/call to the old routine. The other thing to be very careful of is the stack size at the time of the interrupt. It is very unpredictable, and you may be running out and not know it. Be sure to turn off all runtime check to help keep your interrupt from overflowing the stack, and keep the processing to an absolute minimum (try not to use any procedures or local variables as well). It is possible to switch to an alternate stack using an assembly routine, which would make things much safer. Email me for the procedure if you need it. -- Kevin