Location | Description | Size |
40:1Ah | Keyboard, Head of Buffer Pointer | word |
40:1Ch | Keyboard, End of Buffer Pointer | word |
40:1Eh | Keyboard, Buffer | 16 words |
If the value of location 40:1Ah points to the same address as in location 40:1Ch, there are no keys in the buffer.
40:1Ah as a key is removed from the buffer, that pointer is incremented by 2, until the last word of the buffer is reached. At the point it is reset to the start of the keyboard buffer area.
40:1Ch as a key is added from the buffer, that pointer is incremented by 2, until the last word of the buffer is reached. At the point it is reset to the start of the keyboard buffer area.
40:1Eh is 16 words FIFO buffer holds up to 15 keys.
The scan code is in the upper byte of the word.
The ASCII conversion of the scan code is in the lower byte of the word.
In the BIOS code, the keyboard buffer should be cleared before end of INT19h.
Keyboard Buffer Tool (for DOS)
>> Click Here to Download <<
The keyboard buffer, which was documented in this post, is managed under the legacy runtime environment (for example, like DOS). The 40:1A, 40:1C, and 40:1E are the information stored in the BIOS Data Area (BDA). For the detail info of BDA, please refer to the Chapter 6 of "The Undocumented PC: A Programmer's Guide to I/O, CPUs, and Fixed Memory Areas".
ReplyDeleteThe 40:1A, 40:1C, and 40:1E are not the keyboard buffer that is managed under the Efi environment. In an Efi Bios, there are DXE drivers which manage their own keyboard buffers. For a Ps2 keyboard driver, it manages its own keyboard buffer. For an usb keyboard driver, it also manages its own keyboard buffer.
Please note that the attached utility posted in this thread is used to reveal the info of 40:1A, 40:1C, and 40:1E, but not the keyboard buffers managed by the efi driver.
Hi Peter,
ReplyDeleteThanks for your comments.
Through your explanation that let me figure out how the keyboard buffer works.