This article has multiple issues. Please help to improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages)
Most DOS .sys files are real mode device drivers. Certain files using this extension are not, however: MSDOS.SYS and IO.SYS are core operating system files in MS-DOS and Windows 9x. The CONFIG.SYS text file contains various configuration options and specifies what device drivers will be loaded. COUNTRY.SYS is a binary database containing country and codepage related information for use with the CONFIG.SYS COUNTRY directive and the NLSFUNC driver, whereas KEYBOARD.SYS is a binary database containing keyboard layout related information including short P-code sequences to be executed by an interpreter inside the KEYB keyboard driver.
[...] In fact, the format is basically the same in MS-DOS 3.3 - 8.0, PC DOS 3.3 - 2000, including Russian, Lithuanian, Chinese and Japanese issues, as well as in Windows NT, 2000, and XP [...]. There are minor differences and incompatibilities, but the general format has not changed over the years. [...] Some of the data entries contain normal tables [...]. However, most entries contain "executable code" interpreted by some kind of P-code interpreter at *runtime*, including conditional branches and the like. This is why the KEYB driver has such a huge memory footprint compared to table-driven keyboard drivers which can be done in 3 - 4 Kb getting the same level of functionality except for the interpreter. [...]
[...] Matthias [R.] Paul [...] warns that the IBM PC DOS version of the keyboard driver uses some internal procedures that are not recognized by the Microsoft driver, so, if possible, you should use the IBM versions of both KEYB.COM and KEYBOARD.SYS instead of mixing Microsoft and IBM versions [...](NB. What is meant by "procedures" here are some additional byte codes in the IBM KEYBOARD.SYS file not supported by the Microsoft version of the KEYB driver.)