Using keyboard under C
I want to know how to use keyboard entries under C without using "bios.h".
Maybe something like using the 0x16 interrupt...
I dont know
Help me please
Thanx
creativity is the key:)
In C, it''s recommended that you use library functions to access the keyboard input. The library functions will perform the necessary system calls.
If you are intent on using the bios keyboard functions on the x86 platform they are:
INT 16H, AH = 00H -- read character
On return:
AH = scan code
AL = ASCII character
INT 16H, AH = 01H -- read status
On return:
flags - zero flag set if no character available
AH = scan code if zero flag not set
AL = ASCII character if zero flag not set
INT 16H, AH = 02H -- read flags
On return:
AH = reserved
AL = Shift Status Byte
Character is not removed from keyboard buffer.
INT 16H, AH = 12H -- read flags
On return:
AH = Extended Shift Status Byte
AL = Shift Status Byte
Character is not removed from keyboard buffer.
Shift Status Byte:
bit 7: insert state locked active
bit 6: caps lock key active
bit 5: num lock key active
bit 4: scroll lock key active
bit 3: alt key held down
bit 2: ctrl key held down
bit 1: left shift key held down
bit 0: right shift key held down
Extended Shift Status Byte:
bit 7: SysRq key held down
bit 6: Caps Lock key held down
bit 5: Num Lock key held down
bit 4: Scroll Lock key held down
bit 3: Right Alt key held down
bit 2: Right Ctrl key held down
bit 1: Left Alt key held down
bit 0: Left Ctrl key held down
If you are intent on using the bios keyboard functions on the x86 platform they are:
INT 16H, AH = 00H -- read character
On return:
AH = scan code
AL = ASCII character
INT 16H, AH = 01H -- read status
On return:
flags - zero flag set if no character available
AH = scan code if zero flag not set
AL = ASCII character if zero flag not set
INT 16H, AH = 02H -- read flags
On return:
AH = reserved
AL = Shift Status Byte
Character is not removed from keyboard buffer.
INT 16H, AH = 12H -- read flags
On return:
AH = Extended Shift Status Byte
AL = Shift Status Byte
Character is not removed from keyboard buffer.
Shift Status Byte:
bit 7: insert state locked active
bit 6: caps lock key active
bit 5: num lock key active
bit 4: scroll lock key active
bit 3: alt key held down
bit 2: ctrl key held down
bit 1: left shift key held down
bit 0: right shift key held down
Extended Shift Status Byte:
bit 7: SysRq key held down
bit 6: Caps Lock key held down
bit 5: Num Lock key held down
bit 4: Scroll Lock key held down
bit 3: Right Alt key held down
bit 2: Right Ctrl key held down
bit 1: Left Alt key held down
bit 0: Left Ctrl key held down
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement