Setting maximum keyboard repeat rate in DOS

When you hold a key down on a keyboard, it registers it as repeated presses of the same key (like a “turbo” button on a controller). There are two parameters involved: repeat rate (how fast the keystrokes are sent) and repeat delay (how long the keyboard waits after the first keypress before deciding that the user is holding the key down and repeated keystrokes should be issued). In DOS-based systems, these are typically configured using low-level BIOS services; some BIOS setup programs have an option to set the default rate, which can be later modified by programs/device drivers.

For most practical purposes, it is best to have the keyboard configured to maximum repeat rate and minimum delay; the minimum delay is still sufficiently high to not produce accidental double keystrokes, and maximum rate makes keyboard-based navigation (e.g., using arrow keys) faster. Furthermore, some programs and games (like certain Mortal Kombat versions) change the repeat rate to very low and forget to change it back, so it needs to be reset somehow, otherwise keyboard navigation is annoyingly slow.

There are two ways to change the repeat rate in DOS, both very simple and take effect immediately:

1) Use the MODE.COM utility

This utility exists in most DOS/Windows versions. To set the repeat rate to maximum, use:

MODE CON RATE=32 DELAY=1

‘CON’ stands for console (keyboard/screen), 32 is the maximum rate and 1 is the minimum delay. If you prefer something that’s not the maximum, you can experiment with different values. Note: for NT-based Windows versions, the parameters are slightly different: maximum rate is 31 and minimum delay is 0.

2) Write a small program

If you don’t have MODE.COM for some reason, you can achieve the same effect by the following assembly commands (select keyboard typematic rate/delay service, choose minimum delay and maximum rate, execute keyboard service, exit program):

mov ax, 0305h ; mov bx, 0000h ; int 16h ; mov ah, 4ch ; int 21h

Or, in hexadecimal:

B8 05 03 BB 00 00 CD 16 B4 4C CD 21

Simply use a HEX editor to create a file with exactly these 12 bytes, save it with a .COM extension and run it.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s