home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / sampler / 02 / keys_etc / numlock.pas next >
Encoding:
Pascal/Delphi Source File  |  1988-09-06  |  1.1 KB  |  43 lines

  1. {NUMLOCK.PAS}
  2. Program Demonstrate_NumLock;
  3. {
  4. Description:  Program that demonstrates the forcing of the computer into
  5.               and out of the NumLock-enabled state. The example can
  6.               immediately be used for CapsLock, ScrollLock and Insert
  7.               as well.
  8.  
  9. Author:       Eric Kammerer
  10. Application:  IBM PC and compatibles
  11. Last revised: 12/03/87  19:00:30
  12. }
  13.  
  14. { (c) Copyright 1986 by Eric Kammerer, All Rights Reserved }
  15.  
  16. USES Crt, Turbo3;
  17.  
  18. CONST
  19.  
  20.    NumLockOnMask  = $20;   {00100000 in binary}
  21.    NumLockOffMask = $DF;   {11011111 in binary}
  22.  
  23. VAR
  24.    PressedKey : CHAR;
  25.  
  26. BEGIN
  27.  PressedKey := ' ';
  28.  ClrScr;
  29.  Writeln('Press the "5" key to end the demonstration...');
  30.  REPEAT
  31.   REPEAT { Force NumLock }
  32.    Mem [0000:$0417] := ( Mem [0000:$0417] OR NumLockOnMask );
  33.   UNTIL (KeyPressed);
  34.   Read (KBD, PressedKey);
  35.   Write (PressedKey);
  36.  UNTIL (PressedKey = '5');
  37.  Mem [0000:$0417] := ( Mem [0000:$0417] AND NumLockOffMask );
  38.            { Return keyboard to normal status }
  39.  Writeln;
  40.  Writeln ('Keyboard has returned to normal conditions');
  41. END.
  42. 
  43.