Fixed ugly disabled controls and black background in Write and Lotus
[wine/multimedia.git] / msdos / int16.c
blob8875ab550ba1fe969af03676adbaef507bc7626f
1 /*
2 * DOS interrupt 16h handler
3 */
5 #include <stdlib.h>
6 #include <string.h>
7 #include <unistd.h>
9 #include "config.h"
10 #include "module.h"
11 #include "console.h"
12 #include "wincon.h"
13 #include "debug.h"
14 #include "winuser.h"
16 /**********************************************************************
17 * INT_Int16Handler
19 * Handler for int 16h (keyboard)
21 * NOTE:
23 * KEYB.COM (DOS >3.2) adds functions to this interrupt, they are
24 * not currently listed here.
27 void WINAPI INT_Int16Handler( CONTEXT *context )
29 switch AH_reg(context) {
31 case 0x00: /* Get Keystroke */
32 /* Returns: AH = Scan code
33 AL = ASCII character */
34 TRACE(int16, "Get Keystroke\n");
35 CONSOLE_GetKeystroke(&AH_reg(context), &AL_reg(context));
36 break;
38 case 0x01: /* Check for Keystroke */
39 /* Returns: ZF set if no keystroke */
40 /* AH = Scan code */
41 /* AL = ASCII character */
42 TRACE(int16, "Check for Keystroke\n");
43 if (!CONSOLE_CheckForKeystroke(&AH_reg(context), &AL_reg(context)))
45 SET_ZFLAG(context);
47 else
49 RESET_ZFLAG(context);
51 break;
53 case 0x02: /* Get Shift Flags */
54 AL_reg(context) = 0;
56 if (GetAsyncKeyState(VK_RSHIFT))
57 AL_reg(context) |= 0x01;
58 if (GetAsyncKeyState(VK_LSHIFT))
59 AL_reg(context) |= 0x02;
60 if (GetAsyncKeyState(VK_LCONTROL) || GetAsyncKeyState(VK_RCONTROL))
61 AL_reg(context) |= 0x04;
62 if (GetAsyncKeyState(VK_LMENU) || GetAsyncKeyState(VK_RMENU))
63 AL_reg(context) |= 0x08;
64 if (GetAsyncKeyState(VK_SCROLL))
65 AL_reg(context) |= 0x10;
66 if (GetAsyncKeyState(VK_NUMLOCK))
67 AL_reg(context) |= 0x20;
68 if (GetAsyncKeyState(VK_CAPITAL))
69 AL_reg(context) |= 0x40;
70 if (GetAsyncKeyState(VK_INSERT))
71 AL_reg(context) |= 0x80;
72 TRACE(int16, "Get Shift Flags: returning 0x%02x\n", AL_reg(context));
73 break;
75 case 0x03: /* Set Typematic Rate and Delay */
76 FIXME(int16, "Set Typematic Rate and Delay - Not Supported\n");
77 break;
79 case 0x09: /* Get Keyboard Functionality */
80 FIXME(int16, "Get Keyboard Functionality - Not Supported\n");
81 /* As a temporary measure, say that "nothing" is supported... */
82 AL_reg(context) = 0;
83 break;
85 case 0x0a: /* Get Keyboard ID */
86 FIXME(int16, "Get Keyboard ID - Not Supported\n");
87 break;
89 case 0x10: /* Get Enhanced Keystroke */
90 TRACE(int16, "Get Enhanced Keystroke - Partially supported\n");
91 /* Returns: AH = Scan code
92 AL = ASCII character */
93 CONSOLE_GetKeystroke(&AH_reg(context), &AL_reg(context));
94 break;
97 case 0x11: /* Check for Enhanced Keystroke */
98 /* Returns: ZF set if no keystroke */
99 /* AH = Scan code */
100 /* AL = ASCII character */
101 TRACE(int16, "Check for Enhanced Keystroke - Partially supported\n");
102 if (!CONSOLE_CheckForKeystroke(&AH_reg(context), &AL_reg(context)))
104 SET_ZFLAG(context);
106 else
108 RESET_ZFLAG(context);
110 break;
112 case 0x12: /* Get Extended Shift States */
113 FIXME(int16, "Get Extended Shift States - Not Supported\n");
114 break;
116 default:
117 FIXME(int16, "Unknown INT 16 function - 0x%x\n", AH_reg(context));
118 break;