Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
en:ibm:prcp:kbd:charin [2014/05/13 13:42] – created valerius | en:ibm:prcp:kbd:charin [2016/09/15 02:17] (current) – valerius | ||
---|---|---|---|
Line 1: | Line 1: | ||
==== KbdCharIn ==== | ==== KbdCharIn ==== | ||
- | **Bindings**: | + | **Bindings**: |
- | + | ||
- | C: | + | |
- | <code c> | + | |
- | typedef struct _KBDKEYINFO { /* kbci */ | + | |
- | UCHAR chChar; | + | |
- | UCHAR chScan; | + | |
- | UCHAR fbStatus; | + | |
- | UCHAR bNlsShift; | + | |
- | USHORT | + | |
- | ULONG time; /* Time stamp of keystroke (ms since ipl) */ | + | |
- | }KBDKEYINFO; | + | |
- | + | ||
- | #define INCL_KBD | + | |
- | + | ||
- | USHORT | + | |
- | + | ||
- | PKBDKEYINFO | + | |
- | USHORT | + | |
- | HKBD | + | |
- | + | ||
- | USHORT | + | |
- | </ | + | |
- | + | ||
- | Asm: | + | |
- | <code asm> | + | |
- | KBDKEYINFO struc | + | |
- | kbci_chChar | + | |
- | kbci_chScan | + | |
- | kbci_fbStatus | + | |
- | kbci_bNlsShift db ? ;Reserved (set to zero) | + | |
- | kbci_fsState | + | |
- | kbci_time | + | |
- | KBDKEYINFO ends | + | |
- | + | ||
- | EXTRN KbdCharIn: | + | |
- | INCL_KBD | + | |
- | + | ||
- | PUSH@ OTHER | + | |
- | PUSH | + | |
- | PUSH | + | |
- | CALL | + | |
- | + | ||
- | Returns WORD | + | |
- | </ | + | |
This call returns a character data record from the keyboard. | This call returns a character data record from the keyboard. | ||
Line 51: | Line 7: | ||
KbdCharIn (CharData, IOWait, KbdHandle) | KbdCharIn (CharData, IOWait, KbdHandle) | ||
- | CharData (PKBDKEYINFO) - output | + | //CharData// (**PKBDKEYINFO**) - output |
Address of the character data structure: | Address of the character data structure: | ||
- | asciicharcode (UCHAR) | + | //asciicharcode// (**UCHAR**) |
ASCII character code. The scan code received from the keyboard is translated to the ASCII character code. | ASCII character code. The scan code received from the keyboard is translated to the ASCII character code. | ||
- | scancode (UCHAR) | + | //scancode// (**UCHAR**) |
Code received from the keyboard. The scan code received from the keyboard is translated to the ASCII character code. | Code received from the keyboard. The scan code received from the keyboard is translated to the ASCII character code. | ||
- | status (UCHAR) | + | //status// (**UCHAR**) |
State of the keystroke event: | State of the keystroke event: | ||
Line 74: | Line 30: | ||
|0 1 |= Shift status returned without character. | | |0 1 |= Shift status returned without character. | | ||
- | reserved (UCHAR) | + | //reserved// (**UCHAR**) |
NLS shift status. Reserved, set to zero. | NLS shift status. Reserved, set to zero. | ||
- | shiftkeystat (USHORT) | + | //shiftkeystat// (**USHORT**) |
Shift key status. | Shift key status. | ||
Line 98: | Line 54: | ||
|0 |Right Shift key down | | |0 |Right Shift key down | | ||
- | time (ULONG) | + | //time// (**ULONG**) |
Time stamp indicating when a key was pressed. It is specified in milliseconds from the time the system was started. | Time stamp indicating when a key was pressed. It is specified in milliseconds from the time the system was started. | ||
- | IOWait (USHORT) - input | + | //IOWait// (**USHORT**) - input |
Wait if a character is not available. | Wait if a character is not available. | ||
Line 108: | Line 64: | ||
|1 |Requestor gets an immediate return if no character is available. | | |1 |Requestor gets an immediate return if no character is available. | | ||
- | KbdHandle (HKBD) - input | + | //KbdHandle// (**HKBD**) - input |
Default keyboard or the logical keyboard. | Default keyboard or the logical keyboard. | ||
- | rc (USHORT) - return | + | //rc// (**USHORT**) - return |
Return code descriptions are: | Return code descriptions are: | ||
Line 126: | Line 82: | ||
* On an enhanced keyboard, the secondary enter key returns the normal character 0DH and a scan code of E0H. | * On an enhanced keyboard, the secondary enter key returns the normal character 0DH and a scan code of E0H. | ||
* Double-byte character codes (DBCS) require two function calls to obtain the entire code. | * Double-byte character codes (DBCS) require two function calls to obtain the entire code. | ||
- | * If shift report is set with KbdSetStatus, | + | * If shift report is set with [[en: |
* Extended ASCII codes are identified with the status byte, bit 1 on and the ASCII character code being either 00H or E0H. Both conditions must be satisfied for the character to be an extended keystroke. For extended ASCII codes, the scan code byte returned is the second code (extended code). Usually the extended ASCII code is the scan code of the primary key that was pressed. | * Extended ASCII codes are identified with the status byte, bit 1 on and the ASCII character code being either 00H or E0H. Both conditions must be satisfied for the character to be an extended keystroke. For extended ASCII codes, the scan code byte returned is the second code (extended code). Usually the extended ASCII code is the scan code of the primary key that was pressed. | ||
* A thread in the foreground session that repeatedly polls the keyboard with KbdCharIn (with no wait), can prevent all regular priority class threads from executing. If polling must be used and a minimal amount of other processing is being performed, the thread should periodically yield to the CPU by issuing a DosSleep call for an interval of at least 5 milliseconds. | * A thread in the foreground session that repeatedly polls the keyboard with KbdCharIn (with no wait), can prevent all regular priority class threads from executing. If polling must be used and a minimal amount of other processing is being performed, the thread should periodically yield to the CPU by issuing a DosSleep call for an interval of at least 5 milliseconds. | ||
Line 138: | Line 94: | ||
* Status can be 0 or 40H | * Status can be 0 or 40H | ||
* KbdHandle is ignored. | * KbdHandle is ignored. | ||
+ | |||
+ | === C bindings === | ||
+ | |||
+ | <code c> | ||
+ | typedef struct _KBDKEYINFO { /* kbci */ | ||
+ | UCHAR chChar; | ||
+ | UCHAR chScan; | ||
+ | UCHAR fbStatus; | ||
+ | UCHAR bNlsShift; | ||
+ | USHORT | ||
+ | ULONG time; /* Time stamp of keystroke (ms since ipl) */ | ||
+ | }KBDKEYINFO; | ||
+ | |||
+ | #define INCL_KBD | ||
+ | |||
+ | USHORT | ||
+ | |||
+ | PKBDKEYINFO | ||
+ | USHORT | ||
+ | HKBD | ||
+ | |||
+ | USHORT | ||
+ | </ | ||
+ | |||
+ | === MASM bindings === | ||
+ | |||
+ | <code asm> | ||
+ | KBDKEYINFO struc | ||
+ | kbci_chChar | ||
+ | kbci_chScan | ||
+ | kbci_fbStatus | ||
+ | kbci_bNlsShift db ? ;Reserved (set to zero) | ||
+ | kbci_fsState | ||
+ | kbci_time | ||
+ | KBDKEYINFO ends | ||
+ | |||
+ | EXTRN KbdCharIn: | ||
+ | INCL_KBD | ||
+ | |||
+ | PUSH@ OTHER | ||
+ | PUSH | ||
+ | PUSH | ||
+ | CALL | ||
+ | |||
+ | Returns WORD | ||
+ | </ | ||
+ | |||