[ The PC Guide | Systems and Components Reference Guide | Keyboards | Keyboard Software Issues ] DOS Keyboard Controls Most people don't directly use DOS much any more; however, it still underlies Microsoft's consumer operating systems (much as they hate to admit this to anyone.) Therefore, one still must deal with it on occasion. And of course, there are plenty of older PCs out there still running DOS, perhaps in combination with Windows 3.x. The first thing to know about DOS's handling of the keyboard is that it knows the keyboard by a special name. Much as your first parallel printer port is "LPT1:", and your serial ports "COM1:" and "COM2:", DOS considers your keyboard and monitor, combined, to be the console, and names it "CON:". This name is a throwback to the "olden dayse" of computer terminals. :^) When you take input from "CON:" it comes from the keyboard; when you send output to it, it goes to the screen.
The tip above aside, you won't generally use "CON:" but it's still good to know it's there. There's also a DOS command designed specifically to manage certain settings associated with the "console": the "MODE" command. To see what this command is about, boot to DOS, or open a DOS window, and type "mode /?" to see the command's various options. As you see, "MODE" is used for changing settings for many different system devices. For "CON:" you can see that it can be used to set the number of columns and rows of the display (for DOS programs), or the typematic rate for the keyboard (see the section on the Typematic feature for more in general terms on that feature.). We are of course concerned with the keyboard here; to set the typematic controls, from DOS enter this command: "mode con: delay=<d> rate=<r>", where <d> and <r> are numbers for the typematic delay and repeat rate, respectively:
So where do these numbers come from? A weird formula. Take the rate number, subtract 1, convert it to a binary number and then exclusive-or the bits to negate them, resulting an a five-bit binary number. Then take the two high-order bits and call their value "Z", and the three low-order bits and call them "Y". The repeat rate then is simply:
So take "21" for example, the default value for many systems. Subtract one to get 20, which in binary is 10100. Invert that to get 01011. The two high-order bits are 01, so Z is 1, and the low-order bits are 011, so Y is 3. So the repeat rate is 240 / ((8+3) * (2^1)) = 240 / (11*2) = 10.9. Now, aren't you glad you asked? ;^) Why did they do all of this instead of just saying that the rate number was the value in characters per second? Well, engineers need to make a living too, don't they? ;^) Today, the use of the "MODE" command has mostly been replaced by equivalent Windows controls and settings. However, in some cases you may want to set the typematic controls within DOS. Note that the Windows settings for these values use the same bizarre numbering schemes, just hidden under a graphical Windows control. :^) Another useful DOS control for the keyboard is the "NUMLOCK" command. In DOS versions 6 or higher, you can put a line such as "NUMLOCK=ON" or "NUMLOCK=OFF" in the system's CONFIG.SYS file. This will cause the system to set the <Num Lock> status of the keyboard accordingly. There are also public-domain software utilities that will do the same thing, if you don't want to do it within CONFIG.SYS.
|