Wednesday, May 26, 2010

What happened when we hit a keyboard?

What happened when we hit a keyboard?

When we hit keyboard Hardware interrupt 9 is called by system. Then the BIOS software interrupt 16 is called and this routine will execute. This interrupt routine will store our keyboard information into a specified memory location called Bios data area (BIOS Data Area at 0x0040:0x0000.). After this, a signal is returned back to keyboard. (This signal is used to switch on/of the number lock, caps Lock LED’s etc).

The keyboard information is stored at following location.

0x0040:0x17

2 bytes

Keyboard status flag

0x0040:0x19

1 bytes

Alt + Numpad data

0x0040:0x1A

2 bytes

Keyboard buffer head

0x0040:0x1C

2 bytes

Keyboard buffer tail

0x0040:0x1E

32 bytes

Keyboard buffer

For Example: To find our CapsLock status.
6th Bit of 0x0040:0x17 will indicate current status of CapsLock.
If 0 = CapsLock off ,if  1 - CapsLock on.

 

No comments: