A Brief Int 09h Overview
The BIOS Int 09h interrupt service routine processes the incoming scancode as follows:
- The routine reads the scancode from the keyboard I/O port (060h).
- Interrupts are enabled, the CARRY is set, and the Keyboard Translation Hook function (Int 15h, Fcn 4Fh) is called. An application can take over this hook and insert its own handler. If this call returns with carry clear, Int 09h stops processing and returns. If the carry is set, Int 09h proceeds with step 3.
- The routine checks for a Break (MENU Make ScanCode with CTRL Active). If the Break is detected, Int 09h clears the keyboard input buffer and calls Int 1Bh, described on page 3-130. (A "dummy" scancode of "00h/00h" is entered into the keyboard input buffer.)
- The Int 09h routine translates the scancode and enters the scancode and its ASCII equivalent into the keyboard input buffer. Some scancodes have no ASCII equivalent. In this case, Int 09h does one of the following:
- Discard the scancode (enter no data into the keyboard input buffer). If [LSHFT], [RSHFT], [Ctrl], [Alt], [Caps Lock], or [Scroll Lock] is detected, the state of the keyboard is updated, but the scancode is discarded.
- Enter a two-byte pair "00h/XXh" into the keyboard input buffer. "XXh" may be the original scancode, or it may be a translated hexadecimal code for the key or key combination pressed.
Once a scancode/ASCII pair has been entered into the keyboard input buffer, an application can read the data by calling Int 16h. Depending on which Int 16h function is called, a further translation (or even a keycode discard) is possible.