| 311 | } |
| 312 | |
| 313 | static char |
| 314 | DOSgetch(void) |
| 315 | { |
| 316 | union REGS regs; |
| 317 | char ch; |
| 318 | struct pad(*kpad)[PADKEYS]; |
| 319 | |
| 320 | regs.h.ah = DIRECT_INPUT; |
| 321 | intdos(®s, ®s); |
| 322 | ch = regs.h.al; |
| 323 | |
| 324 | #ifdef PC9800 |
| 325 | if (ch < 0) /* KANA letters and GRPH-shifted letters(?) */ |
| 326 | ch = 0; /* munch it */ |
| 327 | #else |
| 328 | /* |
| 329 | * The extended codes for Alt-shifted letters, and unshifted keypad |
| 330 | * and function keys, correspond to the scan codes. So we can still |
| 331 | * translate the unshifted cursor keys and Alt-letters. -3. |
| 332 | */ |
| 333 | if (ch == 0) { /* an extended key */ |
| 334 | regs.h.ah = DIRECT_INPUT; |
| 335 | intdos(®s, ®s); /* get the extended key code */ |
| 336 | ch = regs.h.al; |
| 337 | |
| 338 | if (iskeypad(ch)) { /* unshifted keypad keys */ |
| 339 | kpad = (void *) (iflags.num_pad ? numpad : keypad); |
| 340 | ch = (*kpad)[ch - KEYPADLO].normal; |
| 341 | } else if (inmap(ch)) { /* Alt-letters */ |
| 342 | ch = scanmap[ch - SCANLO]; |
| 343 | if (isprint(ch)) |
| 344 | ch = M(ch); |
| 345 | } else |
| 346 | ch = 0; /* munch it */ |
| 347 | } |
| 348 | #endif |
| 349 | return (ch); |
| 350 | } |
| 351 | |
| 352 | char |
| 353 | switchar(void) |