Is it possible to customize the keyboard layout in DOS? I use a custom keyboard layout on modern computers and I am wondering if I can do the same on old.
FreeDOS includes a keyboard driver which has the ability to use individual keymap files, without needing any re-assembly or re-compilation (of programs at least). If you download the full USB installer from the linked page, and extract its contents, you’ll find:
Base/Keybwhich contains the keyboard driver itself
Base/Kpdoswhich contains sample keyboard layouts
Base/KCwhich contains the keyboard layout compiler, with lots of documentation
You should be able to write a
.KEY keyboard layout description for your custom layout, then compile it to a
.KL file using
KC, and finally load that with the
KEYB keyboard driver. The keyboard driver isn’t just for FreeDOS, it can be used with other DOS versions too.
There is a utility called KEYMAP.SYS which will do this. It allows keys to be replaced at the scan-code level. From the documentation:
KEYMAP.SYS v0.0 - A Keyboard Key Mapper KEYMAP.SYS allows you to change the layout of your keyboard. Your changes may be as simple as the swapping of the Ctrl and Caps Lock keys, or you can set up a completely new layout (like the Dvorak layout). You may create up to ten layouts, and switch among them at will. As provided, the software defines two layouts. The default is the Sholes layout, also known as the QWERTY layout. This is a standard layout, with no keys moved. The second provided layout is the Dvorak layout. SHOLES DVORAK 1 2 3 4 5 6 7 8 9 0 - = 1 2 3 4 5 6 7 8 9 0 = [ Q W E R T Y U I O P [ ] ' , . P Y F G C R L / ] A S D F G H J K L ; ' A O E U I D H T N S - Z X C V B N M , . / ; Q J K X B M W V Z To switch between layouts, hold down the Control, Alt, and Left Shift keys, then press a function key. F1 selects the default layout (Sholes). As provided, F2 selects the Dvorak layout. You can install up to ten different layouts, enabled by F1 through F10. To install a new layout, you will need a text editor and an assembler. The software is written for use with Borland's Turbo Assembler. To assemble it with a different assembler, you will probably have to edit the source code. This software works by hooking INT 15h, function 4Fh. This function is provided to allow keys to be remapped, but may not be present on machines with very old BIOS ROMs. Some software packages (notably games) take over the keyboard interrupt, disabling KEYMAP.SYS. While using such software, the keyboard will return to its standard layout.