home *** CD-ROM | disk | FTP | other *** search
- {NUMLOCK.PAS}
- Program Demonstrate_NumLock;
- {
- Description: Program that demonstrates the forcing of the computer into
- and out of the NumLock-enabled state. The example can
- immediately be used for CapsLock, ScrollLock and Insert
- as well.
-
- Author: Eric Kammerer
- Application: IBM PC and compatibles
- Last revised: 12/03/87 19:00:30
- }
-
- { (c) Copyright 1986 by Eric Kammerer, All Rights Reserved }
-
- USES Crt, Turbo3;
-
- CONST
-
- NumLockOnMask = $20; {00100000 in binary}
- NumLockOffMask = $DF; {11011111 in binary}
-
- VAR
- PressedKey : CHAR;
-
- BEGIN
- PressedKey := ' ';
- ClrScr;
- Writeln('Press the "5" key to end the demonstration...');
- REPEAT
- REPEAT { Force NumLock }
- Mem [0000:$0417] := ( Mem [0000:$0417] OR NumLockOnMask );
- UNTIL (KeyPressed);
- Read (KBD, PressedKey);
- Write (PressedKey);
- UNTIL (PressedKey = '5');
- Mem [0000:$0417] := ( Mem [0000:$0417] AND NumLockOffMask );
- { Return keyboard to normal status }
- Writeln;
- Writeln ('Keyboard has returned to normal conditions');
- END.
-