home *** CD-ROM | disk | FTP | other *** search
- {$A+,B-,D+,E+,F-,G-,I+,L+,N-,O-,P-,Q-,R+,S+,T-,V-,X+,Y+}
- (* Corrected and adapted to BP7 jb/'94 *)
-
- PROGRAM NumLock;
- {**************************************************************************
- * * * NumLock, by Mark Rostek, P.O. Box 158, Garfield, NJ 07026 * * *
-
- The two procedures presented here will allow your own programs
- to set and clear the bit controlling the NumLock key at absolute
- address $0000:$0417.
-
- When this bit is set the number keypad will be active.
-
- NumLock will demonstrate the use of the two procedures "NumOn" and
- "NumOff." For the purposs of clarity, there is some redundency in the
- code.
-
- To use these two procedures just include them in your program and make
- appropriate calls when you wish to use the number keypad.
-
- **************************************************************************}
- USES
- Crt;
-
- CONST
- bit_position = 5; {bit controlling NumLock}
-
- VAR
- SetBit: byte Absolute $0040:$0017;
- Mask: byte;
-
- PROCEDURE NumOn;
- {*************************************************************************
- Sets the NumLock key
- ************************************************************************}
- CONST
- bit_position = 5; {bit controlling NumLock}
-
- VAR
- SetBit: byte Absolute $0040:$0017;
- Mask: byte;
-
- BEGIN
- Mask := 1 SHL bit_position;
- SetBit := SetBit OR Mask {sets the bit}
-
- END; {PROCEDURE NumOn}
- {═════════════════════════════════════════════════════════════════════════}
-
- PROCEDURE NumOff;
- {*************************************************************************
- Clears "Num Lock" key
- ************************************************************************}
- CONST
- bit_position = 5;
-
- VAR
- SetBit: byte Absolute $0040:$0017;
- Mask: byte;
-
- BEGIN
- Mask := 1 SHL bit_position;
- Mask := NOT Mask;
- SetBit := SetBit AND Mask {clears the bit}
-
- END; {PROCEDURE NumOff}
- {═════════════════════════════════════════════════════════════════════════}
-
- BEGIN {main}
- clrscr;
- NumOn;
- writeln('The keypad is now active. Use it to enter a number.');
- readln;
- writeln;
- writeln;
- NumOff;
- writeln('The keypad is off. Try it now.');
- readln
- END. {PROGRAM NumLock}
-