Keyboard numbers vs Numeric keypad keys

keyboardkeyboard-layout

This is a 2 part question:

  1. What is the difference between keyboard numbers and numberpad keys. I understand they must be treated at least slightly differently since shift + 5 on the keypad doesn't give me a percent sign and I can't use the number row for unicode input.

If I'm reading this right the keypad scancodes would be mapped to the combination of numlock and the escaped scancode for the keypad and the OS or BIOS even would output the same ascii character for both scancode inputs.

Does this sound correct? At what level does the translation take place that results in both inputs yielding the number "1" for example, even before a full OS has loaded. (Keyboard controller? CPU interrupt reception?)

  1. Why can I not buy a usb (or ps2) numpad that maps to the number row instead of the keypad. If I want shift 7 to always be "&" even on the keypad, does this violate a standard or something because I can't find one. The only option I see is programmable keypads right now.

Bonus: Is there better terminology to use when asking this question?

Best Answer

According to sources that list keyboard scancodes, the number keys are scanned with completely different codes. This makes sense, as I've used a great many programs that use the two sets of number keys for different purposes. When playing the game XEvil, for example, I steer with the keypad keys and fire with the number row.

As an example, 0x73 is number pad 5, and 0x2e is number row 5. Similarly, ctrl-5, alt-5, and shift-5 each have two scancodes. And so on.

There's nothing stopping anyone from building a numeric keypad that maps to the scan codes for the number row. Or anything else, for that matter. It's just that people haven't done it. I would guess due to demand.

There's similarly nothing stopping you from changing your own keyboard mapping. I sometimes have made number pad digits 4, 2, 8, and 6 map to h, j, k, and l for use with vi.

Related Question