home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / pascal / 7463 < prev    next >
Encoding:
Internet Message Format  |  1992-12-14  |  2.4 KB

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