Article View: comp.os.msdos.programmer
Article #231getting scan-code and shift-state from the keyboard
From: David L. Huestis
Date: Wed, 05 Aug 1992 03:57
Date: Wed, 05 Aug 1992 03:57
21 lines
1237 bytes
1237 bytes
I would like to read characters one at a time from the keyboard type- ahead buffer from a program written in C. Microsoft C provides two functions: getch() and _bios_keybrd() if( ( bits9 = getch() ) == 0 ) bits9 = 0x0100 | getch() ; bits16 = _bios_keybrd( _NKEYBRD_READ ) ; _bios_keybrd returns much more information for special keys and keys modified by multiple shifts, but both do a lot of translation. I realize that I could write an interrupt handler to deal with each keystroke. I could also try _bios_keybrd( _NKEYBRD_SHIFTSTATUS ) but I would suppose that the result would not refer to old keystrokes already in the buffer. My questions are: 1. What is actually stored in the buffer? (as reported by _bios_keybrd, or shift-state + scan-code) 2. Are there a well-known approaches to this problem?
Technical Details
Message-ID:
<QD6EHT@MPLVAX.SRI.COM>Path:
arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!unix!MPLVAX.SRI.COM!MPLMGRShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!unix!MPLVAX.SRI.COM!MPLMGR From: MPLMGR@MPLVAX.SRI.COM (David L. Huestis) Newsgroups: comp.os.msdos.programmer Subject: getting scan-code and shift-state from the keyboard Message-ID: <QD6EHT@MPLVAX.SRI.COM> Date: 5 Aug 92 03:57:12 GMT Sender: news@unix.SRI.COM Organization: Molecular Physics Laboratory, SRI International, Menlo Park, CA Lines: 21