home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!usc!howland.reston.ans.net!hsdndev!binoc.bih.harvard.edu!rind
- From: rind@binoc.bih.harvard.edu (David Rind)
- Newsgroups: comp.lang.pascal
- Subject: Re: Stopping Control-C... I though I was...
- Message-ID: <2276@hsdndev.UUCP>
- Date: 14 Dec 92 20:35:37 GMT
- References: <1992Dec13.093306.7988@crash> <1992Dec14.022619.4357@uwasa.fi>
- Sender: usenet@hsdndev.UUCP
- Organization: Beth Israel Hospital, Harvard Medical School, Boston Mass., USA
- Lines: 54
-
- In article <1992Dec13.093306.7988@crash> tech@crash.cts.com
- (Don Bontemps) writes:
- >I wrote an application program that I did not want the user to be able
- >to exit via pressing <control-C>. I included the "setcbreak := true"
- >line to my source code. This stops <control-C> but does not stop
- ><control-break> (ie: the break on the pause key). Can someone tell me
- >how to prevent <control-break> from doing this? Thanks.....!
-
- I'm not certain whether the problem here is that you are in the IDE
- (where control-break works even if you set breaking off, since
- you need to be able to break out to the IDE) or whether you are
- having problems with the pause key itself.
-
- This latter question just came up a few weeks ago, and I mailed
- out this code fragment to several interested people. Since it
- may have come up again, I figured I'd post it.
-
- The problem is that the pause key actually pauses the computer
- via hardware. To reset the pause, you can use the timer interrupt
- to generate a reset process at every tick. The method here
- was taken from some computer magazine.
-
-
- Program TrapPause;
- Uses Dos;
- Var
- Timerint : Pointer;
- PauseFlag : Boolean;
-
- procedure PauseDetect(flags,CS,IP,AX,BX,CX,DX,SI,DI,DS,ES,BP: word);
- {This latches on to the system timer interrupt to detect if the
- pause key has been pressed, and if so to reset the system to allow
- operation to continue and to set Pauseflag = True}
- interrupt;
- begin
- If memw[$0:$418] and 8 = 8 then {Test bit 3}
- Begin
- Pauseflag := True;
- memw[$0:$418] := memw[$0:$418] and $F7; {Set bit 3 = 0}
- End;
- inline($9C/ {PushF}
- $3E/ {DS}
- $FF/$1E/timerint);{Far call to usual timer interrupt}
- end;
-
-
- Begin
- Getintvec($08,Timerint); {Save old interrupt for timer}
- Setintvec($08,@PauseDetect); {Redirect timer to PauseDetect}
- End.
-
- --
- David Rind
- rind@binoc.bih.harvard.edu
-