#include #define SEG 0x0000 #define OFFSET 0x0417 #ifndef ON #define ON 1 #define OFF 0 #endif /* Author: Larry Caruso Purpose: For anyone who has the problem of programming for a target machine with a keyboard like the standard PC, where the cursor keypad doubles as a numeric keypad. When the user needs the keypad for cursor actions, such as when using a menu, call numlock_toggle(OFF), and when the user needs the keypad for numeric entry, such as in a form called with a menu, call numlock_toggle(ON). */ void numlock_toggle(int state) { char far *p; unsigned char byte; FP_SEG(p) = SEG; FP_OFF(p) = OFFSET; byte = *p; switch (state) { case ON: byte |= 32; break; case OFF: byte &= 223; break; default: break; } *p = byte; }