home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 8 / CDASC08.ISO / NEWS / 554 / JUIN / NOPAUSE.PAS < prev    next >
Pascal/Delphi Source File  |  1993-10-07  |  2KB  |  84 lines

  1. {─ Fido Pascal Conference ────────────────────────────────────────────── PASCAL ─
  2. Msg  : 250 of 362
  3. From : Wilbert van Leijen                  2:281/256.14         28 May 93  20:01
  4. To   : John Pittman                        1:100/602.2
  5. Subj : Pause Key
  6. ────────────────────────────────────────────────────────────────────────────────
  7. 19 May 93, John Pittman writes to All:
  8.  
  9.  JP>         Does anyone know how to disable the pause key? We have a TVision
  10.  JP> (TP6) application that the users sometimes hit the pause and leave the
  11.  JP> room. This would be OK, but the application normally is pulling
  12.  JP> information from the com port durring idle. Pause kills this. Any
  13.  JP> suggestions?
  14.  
  15. Hook onto the keyboard interrupt and swallow each keypress of Pause.}
  16.  
  17. uses Dos;
  18.  
  19. {$R-,S- }
  20.  
  21. {.$DEFINE DEBUG }
  22.  
  23. Var
  24.   SavedInt9 : Pointer;
  25.  
  26. Procedure EatPauseKey; Interrupt; Assembler;
  27.  
  28. Const
  29.   pause        = $61;                  { Pause make code }
  30.   KbdPort      = $60;                  { Keyboard port }
  31.   KbdCtrlPort  = $61;                  { Keyboard control port }
  32.   PIC          = $20;                  { 8259 Interrupt controller }
  33.   EOI          = $20;                  { End-of-interrupt }
  34.  
  35. ASM
  36.         STI
  37.         IN     AL, KbdPort
  38.         AND    AL, 01111111b
  39.         CMP    AL, pause
  40.         JNE    @1
  41.  
  42. {$IFDEF DEBUG }
  43.         MOV    AL, 7
  44.         INT    29h
  45. {$ENDIF }
  46.         IN     AL, KbdCtrlPort
  47.         MOV    AH, AL
  48.         OR     AL, 10000000b
  49.         OUT    KbdCtrlPort, AL
  50.         XCHG   AH, AL
  51.         OUT    KbdCtrlPort, AL
  52.         CLI
  53.         MOV    AL, EOI
  54.         OUT    PIC, AL
  55.         JMP    @2
  56.  
  57. @1:     PUSHF
  58.         CALL   DWord Ptr [SavedInt9]
  59. @2:
  60. end;  { EatPauseKey }
  61.  
  62. Procedure TrashTest;
  63.  
  64. Var
  65.   s            : String;
  66.  
  67. Begin
  68.   WriteLn('Enter some characters.  Pause key is disabled!');
  69. {$IFDEF DEBUG }
  70.   WriteLn('You''ll hear a beep to confirm pressing the <Pause> key.');
  71. {$ENDIF }
  72.   WriteLn('Empty line quits.');
  73.   Repeat
  74.     ReadLn(s);
  75.     WriteLn(s);
  76.   Until s = '';
  77. end;  { Loop }
  78.  
  79. Begin
  80.   GetIntVec(9, SavedInt9);
  81.   SetIntVec(9, @EatPauseKey);
  82.   TrashTest;
  83.   SetIntVec(9, SavedInt9);
  84. end.