| 126 | #define ALT 0x8 |
| 127 | |
| 128 | static char |
| 129 | BIOSgetch() |
| 130 | { |
| 131 | unsigned char scan, shift, ch; |
| 132 | const struct pad *kpad; |
| 133 | |
| 134 | long x; |
| 135 | |
| 136 | /* Get scan code. |
| 137 | */ |
| 138 | x = Crawcin(); |
| 139 | ch = x & 0x0ff; |
| 140 | scan = (x & 0x00ff0000L) >> 16; |
| 141 | /* Get shift status. |
| 142 | */ |
| 143 | shift = Kbshift(-1); |
| 144 | |
| 145 | /* Translate keypad keys */ |
| 146 | if (iskeypad(scan)) { |
| 147 | kpad = iflags.num_pad ? numpad : keypad; |
| 148 | if (shift & SHIFT) |
| 149 | ch = kpad[scan - KEYPADLO].shift; |
| 150 | else if (shift & CTRL) |
| 151 | ch = kpad[scan - KEYPADLO].cntrl; |
| 152 | else |
| 153 | ch = kpad[scan - KEYPADLO].normal; |
| 154 | } |
| 155 | /* Translate unassigned Alt-letters */ |
| 156 | if ((shift & ALT) && !ch) { |
| 157 | if (inmap(scan)) |
| 158 | ch = scanmap[scan - SCANLO]; |
| 159 | return (isprint(ch) ? M(ch) : ch); |
| 160 | } |
| 161 | return ch; |
| 162 | } |
| 163 | |
| 164 | static char |
| 165 | DOSgetch() |