Kermit FAQ - How Does the Numeric Keypad Work?

(Home) (Prev) (Next)

32 How Does the Numeric Keypad Work?

This discussion applies to MS-DOS Kermit. The situation with Kermit 95 is slightly different: In Kermit 95, the Num Lock key can be mapped directly and the PC numeric keypad is mapped to the VT terminal numeric keypad by default.

MS-DOS Kermit reads scan codes from the PC BIOS (but if you are using Windows, then all sorts of software layers are inserted between Kermit and BIOS, so matters are somewhat more uncertain.

The BIOS reports one scan code for a numeric keypad key when Num Lock is on, and a different code when Num Lock is off. All that MS-DOS Kermit is doing is reading the scan codes from (what it thinks is) the BIOS.

To use the PC's numeric keypad as if it were a VT terminal's numeric keypad in MS-DOS Kermit, you must make the appropriate key assignments, since they are not made by default. By default, when Num Lock is not on, the keys have the same assignments as the gray keys which have the same label (e.g. Home, End, Left Arrow, etc), for the benefit of 88-key keyboards.

To make the desired key assignments, you can use the VT300.INI file in the KEYBOARD subdirectory of the MS-DOS Kermit directory:

take keyboard\vt300.ini
The pertinent commands from this file are:
set key \850 \kkp0        ; Keypad 0 (Numlock)   Keypad 0
set key \338 \kkp0        ; Keypad 0 (Normal)    Keypad 0
set key \847 \kkp1        ; Keypad 1 (Numlock)   Keypad 1
set key \335 \kkp1        ; Keypad 1 (Normal)    Keypad 1
set key \848 \kkp2        ; Keypad 2 (Numlock)   Keypad 2
set key \336 \kkp2        ; Keypad 2 (Normal)    Keypad 2
set key \849 \kkp3        ; Keypad 3 (Numlock)   Keypad 3
set key \337 \kkp3        ; Keypad 3 (Normal)    Keypad 3
set key \843 \kkp4        ; Keypad 4 (Numlock)   Keypad 4
set key \331 \kkp4        ; Keypad 4 (Normal)    Keypad 4
set key \844 \kkp5        ; Keypad 5 (Numlock)   Keypad 5
set key \332 \kkp5        ; Keypad 5 (Normal)    Keypad 5
set key \845 \kkp6        ; Keypad 6 (Numlock)   Keypad 6
set key \333 \kkp6        ; Keypad 6 (Normal)    Keypad 6
set key \839 \kkp7        ; Keypad 7 (Numlock)   Keypad 7
set key \327 \kkp7        ; Keypad 7 (Normal)    Keypad 7
set key \840 \kkp8        ; Keypad 8 (Numlock)   Keypad 8
set key \328 \kkp8        ; Keypad 8 (normal)    Keypad 8
set key \841 \kkp9        ; Keypad 9 (Numlock)   Keypad 9
set key \329 \kkp9        ; Keypad 9 (Normal)    Keypad 9

set key \334  \kkpminus   ; Keypad +             Keypad -
set key \2382 \kkpcoma    ; ALT Keypad +         Keypad ,
set key \851  \kkpdot     ; Keypad . (Numlock)   Keypad .
set key \339  \kkpdot     ; Keypad . (normal)    Keypad .
set key \4365 \Kkpenter   ; Keypad Enter         Keypad Enter

                          ; F1                   PF1 (default Kermit)
                          ; Use GOLD.COM to make Num Lock work as PF1/Gold.
set key \325 \kPF1        ; This works with WPGGOLD.COM.

set key \4399 \kPF2       ; Keypad /             PF2
set key \311  \kPF3       ; Keypad *             PF3
set key \330  \kPF4       ; Keypad -             PF4 Key

You need the GOLD TSR to make the Num Lock key work like the DEC Gold key. The GOLD TSR is found in the same directory as the VT300.INI file.

The rest of the commands in the VT300.INI file set up the function keys and editing keys to be like the corresponding DEC VT220/320 keys.

But there is still one more piece to the puzzle. As noted, the VT keypad can be in one of two modes: numeric or application. It is the responsibility of the host application to send an escape sequence to put the keypad into the appropriate mode before attempting to read keystrokes from it. But some applications fail to do that and simply ASSUME that the keypad is in the right mode. In many cases this assumption is wrong. So MS-DOS Kermit has a command that lets you force the keypad into the desired mode:

SET TERMINAL KEYPAD { APPLICATION, NUMERIC }


Kermit FAQ / Columbia University / kermit@columbia.edu