alanm@cognos.uucp (Alan Myrvold) (01/14/89)
I use an IBM PS/2 Model 50. When I boot the machine, the Num Lock light is on, and the numeric keypad functions as (you guessed it) a numeric keypad. Yes, there is a cluster of cursor and control keys, but I'm used to using the cursor keys on the numeric keypad. My Question : Is there any way in software (.ASM, .C, .BAS or whatever) to toggle the Num Lock key ? Any suggestions would be profoundly appreciated. - Alan --- Alan Myrvold 3755 Riverside Dr. uunet!mitel!sce!cognos!alanm Cognos Incorporated P.O. Box 9707 alanm@cognos.uucp (613) 738-1440 x5530 Ottawa, Ontario CANADA K1G 3Z4
ppa@hpldola.HP.COM (Paul P. Austgen) (01/18/89)
Here's some C sources. (^M is carriage return, ignore) /* By request, here's 6 lines of C to turn the NumLock off */ typedef unsigned char (far *MEM ); /* Number lock function in C --- * Sets number lock to OFF * Assumes keyboard flag is at 0000:0417H in Model 60 * Check your documentation and change * segment and offset below if not * Written by Fran Horvath. * Has no effect if NUMLOCK is already off. */ num_lock() { MEM charset = ( (MEM) ( 0x0000L << 16 ) ) + 0x0417L; *charset &= 0xDF ; /* Turns Num Lock off if on */ } main() { num_lock(); } /* By request, here's 6 lines of C to turn the NumLock on */ /* Based on Fran Horvath's routine to turn it off. */ /* Converted by Howard Sanner, 28 Jan 88. */ typedef unsigned char (far *MEM); /* Number lock function in C --- * Sets number lock to ON. * Assumes keyboard flag is at 0000:0417H in Model 60 * Check your documentation and change * segment and offset below if not. * Also works fine on PCs and ATs. */ num_lock() { MEM charset = ((MEM)(0x0000L << 16 )) + 0x0417L; *charset |= 0x20; /* Turns Num Lock on if off */ /* Change the above line to: *charset &= 0xDF; to turn num lock OFF if it is ON. */ } main() { num_lock(); }