INT 16H
INT 16h, INT 16H or INT 22 is shorthand for BIOS interrupt call 16hex, the 22nd interrupt vector in an x86-based computer system. The BIOS typically sets up a real mode interrupt handler at this vector that provides keyboard services. This interruption is responsible for control of the PC keyboard.
Features
This interruption is responsible for obtaining basic keyboard functionality, i.e. is responsible for collecting the keystrokes, obtain the status of the buffer of keyboard, etc. The standard encoding of the keyboard that offers the INT 16 h is a US keyboard. To adapt the coding of the INT 16h to another type of keyboard (for example, a Hebrew keyboard) must attend the scan-code of the key pressed, and perform suitable for interpreting the key that you want to.
101 letters or more keyboards, there are some keys to the INT 16h interprets them as expanded keys, which have a scan-code different to the normal keys (e.g., key pause).
List of services of the INT 16 h
Function | Function code(AH) | Device |
---|---|---|
Read key press | 00h | Keyboard |
Get the State of the keyboard buffer | 01h | Keyboard |
Get the State of the keyboard | 02h | Keyboard |
Establish repetition factor | 03h | Keyboard |
Simulate a keystroke | 05h | Keyboard |
Get the ID of the keyboard | 0Ah | Keyboard |
Read expanded keyboard character | 10h | Expanded keyboard |
Obtain status of the expanded keyboard buffer | 11h | Expanded keyboard |
Get expanded keyboard status | 12h | Expanded keyboard |
INT 16h AH=00h - read keystroke
Function | Function code(AH) | Device | Return | |
---|---|---|---|---|
Read key press | 00h | Keyboard | AH = Scan code of the key pressed down | AL = ASCII character of the button pressed |
Example:
; This example reads a key on the keyboard and if the key pressed is the "n" key makes modifications to that the content in to the be the n.
Home:
CALL leertecla; We call the function to read a key
MOV AH, 0Eh; Function teletype
INT 10h; We show the button on screen
JMP start; We make an eternal loop
leertecla:
XOR AX, AX; Function 0
INT 16h; We call on the keyboard
CMP AH, 27h; the scancode will match the "n" key scancode?
JE cambiarletra; Yes, so we changed the content of to the
RET; No, so we make no other operation
cambiarletra:
MOV A, 0A4h; We put the letter "n" in to the
RET; We return from the routine
See also
- IBM PC ROM BIOS