Microsoft KB Archive/51079

Storage of Keyboard Buffer (F3) Information PSS ID Number: Q51079 Article last modified on 01-20-1993 PSS database name: O_MSDOS

3.00 3.10 3.20 3.21 3.22 3.30 4.00 4.01

MS-DOS

Question:

Where is the MS-DOS keyboard buffer (F3) stored? I want to either restore it or ensure that it does not get overwritten.

Response:

The MS-DOS keyboard buffer is located in the transient portion of COMMAND.COM. This means that it is typically located somewhere in high memory. Transient means that if your application requires a lot of conventional RAM and overwrites this portion of COMMAND.COM, it will be loaded again into RAM when your application terminates.

Exactly where the transient portion of COMMAND.COM is located in high conventional RAM depends on the amount of conventional RAM your system has. Furthermore, the actual reserved area for this buffer within the transient portion of COMMAND.COM is not necessarily at the same offset for different versions of MS-DOS. Even if you knew the actual offset within the transient portion, there is no guarantee that when the transient portion is reloaded into high memory, it will be stored at the same place in high memory as it was previously.

Therefore, if you wish to preserve the MS-DOS keyboard buffer while running an application that overwrites the transient portion of COMMAND.COM, you must do one of the following:


 * 1) Use a public domain utility that is a command-line editor and preserves the MS-DOS keyboard buffer by storing its own information.
 * 2) Write a utility yourself that performs this functionality.

Please note that before MS-DOS stores any characters in its keyboard buffer, the ROM BIOS also records the characters as scan/ASCII pairs in its own buffer located at 0040:001EH in memory. This circular buffer is only 32 bytes long meaning it can store only 16 scan/ASCII character pairs. You might be able to copy/interpret the scan/ASCII pairs there and save the characters in your own buffer within your application.

Additional reference words: 3.00 3.10 3.20 3.21 3.22 3.30 4.00 4.01

Copyright Microsoft Corporation 1993.