Skip to content
FreeDOSDeep Dive Published Updated 6 min readViews unavailable

FreeDOS MKEYB: A Small Resident Keyboard Mapper with Clear Limits

Use MKEYB's test, layout-switching, and interrupt options deliberately, while separating physical key mapping from DOS code-page and display configuration.

A DOS keyboard problem can have several causes. The physical keyboard may not match the active layout; the code page may not contain the character you intend to type; or the console font may fail to show the byte that the application received. Those are separate layers. FreeDOS supplies several keyboard mappers, and MKEYB is the deliberately small one. Its documentation describes it as a minimal resident program that leaves most key handling to the BIOS and exchanges only the keys needed by the selected national layout. That design is useful on a memory-constrained DOS machine, but it is not a substitute for checking the rest of the text path.

This article is about the FreeDOS MKEYB command documented by FreeDOS Help, not every DOS KEYB-compatible program. The documented footprint is approximately 500 bytes, with examples varying by layout: Russian 452 bytes, German 474, and Spanish 718. Treat those as documentation examples, not a promise about every executable build, configuration, or memory map. MKEYB is a resident program, so what matters operationally is what remains after installation, not just the size of MKEYB.EXE on disk.

Choose the keyboard and test before installing

The command form is mkeyb [options] code. A layout code is a compact identifier, not a DOS code-page number. The documented list includes GR for German, SP for Spanish, FR for French, UK for British English, RU for Russian, and distinct Turkish Q and F layouts (TR and TRF). Run MKEYB /L to inspect the layouts supported by the copy on your machine; consult its local /? output as well, because a later or repackaged binary may differ from an online help page.

For a non-resident trial, the documented /T option tests a selected keyboard driver without leaving it installed. The help page’s example is:

MKEYB GR /T

That is a better first step than repeatedly loading different resident keyboard programs. The test is a layout check, not a proof that your application, active code page, and screen font agree. Type a few layout-specific characters in the actual application you care about after installation, and record what appears and what the application saves. A successful screen display alone may conceal a byte-level mismatch in a file.

If the trial is appropriate, MKEYB GR loads the German mapper in the documented example. FreeDOS Help says MKEYB automatically loads itself as high as possible, so it does not require an added LH or LOADHIGH prefix. This is a behavior of the documented MKEYB, not a general rule for all keyboard TSRs. On a machine with upper-memory management unavailable, verify the conventional-memory cost with your normal DOS memory diagnostic rather than assuming it disappeared into an upper-memory block.

Know which interrupt path you are changing

MKEYB exposes /9 for its INT 9 handler and /G for its INT 16 handler; the documented negative forms disable those handlers. These options matter because keyboard input can be observed at different points in the BIOS path. A program that reads keystrokes through BIOS services may behave differently from software that works at a lower level or implements its own keyboard handler. The help page does not promise that every game, protected-mode program, or custom input loop will honor a selected MKEYB layout. Verify against the actual target program, especially if its key bindings are based on physical scan positions rather than typed characters.

The /E and /S options identify enhanced 101/102-key and standard 83/84-key keyboards, respectively. These are hardware-model declarations, not language choices. Do not use one as a generic cure for wrong punctuation. The option /Q is particularly easy to misread: FreeDOS Help describes it as quiet mode that absorbs all keyboard input. Avoid it during an interactive troubleshooting session unless that behavior is intentional and you have a recovery path.

Once MKEYB is resident, its documented switching keys are Ctrl+Alt+F1 for the international QWERTY mapping and Ctrl+Alt+F2 for the loaded national mapping. On some languages, right Control also switches. If the same physical key suddenly produces a different character, check the active mapping before replacing fonts or altering a batch file. These switch keys are part of MKEYB’s documented behavior; they are not universal DOS shortcuts.

Mapping is not encoding

MKEYB’s layout table decides how keystrokes are transformed. It does not, by itself, establish the console’s display code page or provide every glyph. The FreeDOS help cross-references CHCP, DISPLAY, CPIDOS, and the larger KEYB family precisely because localization spans multiple components. For example, the MKEYB list annotates Russian with CP866 and Spanish with CP850; that is a compatibility requirement for those documented layouts, not an automatic code-page switch performed by MKEYB RU or MKEYB SP. Confirm the code page independently before diagnosing an accent or Cyrillic character as a keyboard failure.

Some layouts need composition sequences. The help calls these COMBI tables: two successive keystrokes can produce an accented character. Spanish/Catalan is one example in the documentation. When evaluating a layout, test the composed character, not just the base letter and accent keys separately. Also verify behavior in the program that will consume it. An editor that treats the first keystroke as a command, rather than text input, can make a working composition table appear broken.

If a layout is not present, do not assume every FreeDOS keyboard driver accepts the same layout files. The larger KEYB uses KEYBOARD.SYS or a .KL file and has its own syntax and capabilities. MKEYB’s small design is a trade-off: it is appropriate when the supported built-in layout and BIOS-centered behavior fit the workload; it is not a drop-in replacement for every KEYB configuration.

A reversible field check

Record the existing keyboard program and code page. Use MKEYB /L and the installed binary’s help to confirm the intended code, then try MKEYB code /T. Install only after that check, exercise both national and international mappings, and test actual text entry in the intended application. The documented MKEYB /U unloads a previous MKEYB keyboard driver. Confirm the active mapping after unloading rather than assuming a different resident keyboard program was also removed.

No commands in this article were run against the reader’s system. The safe boundary is to keep the keyboard test reversible and to diagnose layout, byte encoding, and glyph display separately. That gives a small TSR its proper place in a FreeDOS localization workflow without making it responsible for problems outside the keyboard layer.

Related:

Sources:

Comments