Search

Sponsored Links

Meta

Categories

Archives

Recent Posts

RSS Feeds

14
Feb

How the keyboard works?

Related Blog Items

Keyboard input follows an event path beginning with the keyboard controller chip and ending with characters being placed in a 30-byte array called the keyboard typeahead buffer(predefined system data i.e. 0×001E to 0×003D in BIOS Data Area). Up to 15 keystrokes can be held there at any given moment, because each keystroke generates 2 bytes - one is ASCII code and other byte is Scan code(all extended keys will have scan codes only,but no ASCII codes). The following events occur when the user presses a key:

  • The keyboard controller chip sends an 8-bit numeric scan code (sc) to the PC’s keyboard input port.
  • The input port is designed so that it triggers an interrupt, which is a predefined signal to the CPU that an input-output needs attention. The CPU responds by executing the INT 9h service routine.
  • The INT 9h service routine retrieves the keyboard Scan code (sc) from the input port and looks up the corresponding ASCII code (ac), if any. It inserts both the scan code and ASCII code into the keyboard typeahead buffer.If the Scan code has no matching ASCII code, then the ASCII code in the typeahead buffer is set to 0.
  • Once the Scan code and ASCII code are kept safely in the typeahead buffer, they stay until the current running program retrieves them. Current program retrieves the typeahead buffer either by INT 16h or INT 21h service routine.

 

 

Popularity: 6%

You need to log on to convert this article into PDF


Related Blog Items

No Comments

No comments yet.

Leave a comment

*
To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-spam image