Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!lll-lcc!ames!cit-vax!news
From: news@cit-vax.Caltech.Edu (Usenet netnews)
Newsgroups: comp.sys.ibm.pc
Subject: Re: Dos Calls and Interrupts
Message-ID: <1501@cit-vax.Caltech.Edu>
Date: Wed, 14-Jan-87 19:38:36 EST
Article-I.D.: cit-vax.1501
Posted: Wed Jan 14 19:38:36 1987
Date-Received: Thu, 15-Jan-87 21:53:59 EST
References: <216700005@orstcs.UUCP> <115@interlan.UUCP>
Reply-To: tim@tomcat.caltech.edu (Tim Kay)
Organization: California Institute of Technology
Lines: 44
Summary: ^C handler

Organization : California Institute of Technology
Keywords: TSR, DOS Re-entrancy
From: tim@tomcat.Caltech.Edu (Tim Kay)
Path: tomcat!tim

(1014-Larry Backman) writes:
>
>	Calling DOS from an ISR can be done safely; its tricky, and there
>	are a number of things to be taken into account.  However, you must
>	use undocumented DOS calls to do so.
>
>  [description of how to do it deleted]

I wonder if a ^C handler could be written that would kill the current
program even if the program isn't doing any dos calls.

Currently, if you hit ^Break or ^C, a bit is set.  Then when you call
dos, it checks the bit.  If set, the ^C handler is called, and your
program (by default) is terminated.  The problem is that many programs
don't make dos calls, and they can't be killed.  For example, if you
are running a Turbo Pascal program that gets into an infinite loop,
you have to reboot the machine.  (I know that there is a {$U+} switch,
but this makes the program run slower, so I would rather not use it.
My C compiler doesn't have the equivalent of {$U+}.)

Would it be possible to write a TSR program that notices when ^C is
hit and sets a bit.
The next time a clock interrupt happens (as described in the article),
both this bit and the dirty bit are checked.  If ^C has been hit, and
it is safe to call dos, then the handler should issue a dos terminate
call to terminate the interrupted program.

However, before the current program is terminated, this handler should check
the address of the ^C handler (int 23h) to see
if the current program is handling its own ^Cs.  If it is, then the
handler should let the current program take the ^C.

Does this make sense?  Has such a program been written?  Could it be done?
(Can you call terminate from inside the clock interrupt handler?)

Timothy L. Kay				tim@csvax.caltech.edu
Department of Computer Science
Caltech, 256-80
Pasadena, CA  91125