| 122 | #define ALT_KEY 0x8 |
| 123 | |
| 124 | static char |
| 125 | BIOSgetch() |
| 126 | { |
| 127 | unsigned char scan, shift, ch; |
| 128 | const struct pad *kpad; |
| 129 | |
| 130 | KBDKEYINFO CharData; |
| 131 | USHORT IOWait = 0; |
| 132 | HKBD KbdHandle = 0; |
| 133 | |
| 134 | KbdCharIn(&CharData, IOWait, KbdHandle); |
| 135 | ch = CharData.chChar; |
| 136 | scan = CharData.chScan; |
| 137 | shift = CharData.fsState; |
| 138 | |
| 139 | /* Translate keypad keys */ |
| 140 | if (iskeypad(scan)) { |
| 141 | kpad = iflags.num_pad ? numpad : keypad; |
| 142 | if (shift & SHIFT_KEY) |
| 143 | ch = kpad[scan - KEYPADLO].shift; |
| 144 | else if (shift & CTRL_KEY) |
| 145 | ch = kpad[scan - KEYPADLO].cntrl; |
| 146 | else |
| 147 | ch = kpad[scan - KEYPADLO].normal; |
| 148 | } |
| 149 | /* Translate unassigned Alt-letters */ |
| 150 | if ((shift & ALT_KEY) && !ch) { |
| 151 | if (inmap(scan)) |
| 152 | ch = scanmap[scan - SCANLO]; |
| 153 | return (isprint(ch) ? M(ch) : ch); |
| 154 | } |
| 155 | return ch; |
| 156 | } |
| 157 | |
| 158 | static char |
| 159 | DOSgetch() |