411 REFERENCE · Wikibooks
NEC PC Programmers Reference/PC-98xx Series Programmers Reference/Interrupt 0x18 - Keyboard
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
The Keyboard BIOS emits an Interrupt 0x9 when key is pressed. Keyboard data may be treated by invoking INT 0x18.
How BIOS Manages Keys
BIOS maintains an array of data ("keyboard status table"), with a bit for each key. When key is down, bit is 1; when up, bit is 0. When key is pressed, index of key in input status array is combined with code for SHIFT status to produce key scan code (which is how programs recognize keys).
PC-98 Keyboard BIOS is IBM-compliant.
List of Key Access Commands
AHCommandPurposeUse0x1Sense First KeyQueries keyboard for keypresses. Returns key at back of buffer.Returns
Key scan code to AH
JIS code of key to AL
BX = 0 if buffer empty; 1 if presses queued.0x2Examine Modifier KeysReturns status of key modifiers (SHIFT, CTRL, GRPH, CAPSLOCK, KANA)Returns modifier status byte in AL
SHIFT down = b0
CAPS = b1
KANA = b2
GRPH = b3
CTRL = b40x3Initialize KeyboardInstall built-in keyboard driver interface. Sets aside memory for BIOS use of keyboard; resets uPD8251A.0x4Get Key Group StatusQueries the keyboard state table for the immediate state of a set of keys. Returns the byte for the key group requested, which in turn can be masked with logical AND to find the state of individual keys.key group number to AL
Returns
key group status byte to AH0x5Sense Last KeyQueries keyboard for keypresses. Returns key at front of buffer.Returns
Key scan code to AH
JIS code of key to AL
BX = 0 if buffer empty; 1 if presses queued.0x6Init Keyboard Buffer / Pending Keys ClearSets up keyboard buffer. Calling this will clear the buffer.0x7Handle First KeyGet the first key pressed not yet handled and removes it from the buffer.Returns
AH = key scan code
AL = JIS code of key
BL = key modifiers byte0x8Handle Last KeyGets the last key pressed and removes it from the buffer.Returns
AH = key scan code
AL = JIS code of key
BL = key modifiers byte0x9Simulate Key PressCreates a simulated keypress by filling the keyboard buffer with designated data. AL = desired key code
BL = modifier keys state byte
Returns
Key scan code to AH
JIS code of key to AL