Toolbar customization dialog (take one).
[wine.git] / msdos / int16.c
blobda9102f96ec314baef6ad995d191a588e262e69f
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 DEFAULT_DEBUG_CHANNEL(int16)
18 /**********************************************************************
19 * INT_Int16Handler
21 * Handler for int 16h (keyboard)
23 * NOTE:
25 * KEYB.COM (DOS >3.2) adds functions to this interrupt, they are
26 * not currently listed here.
29 void WINAPI INT_Int16Handler( CONTEXT *context )
31 switch AH_reg(context) {
33 case 0x00: /* Get Keystroke */
34 /* Returns: AH = Scan code
35 AL = ASCII character */
36 TRACE(int16, "Get Keystroke\n");
37 CONSOLE_GetKeystroke(&AH_reg(context), &AL_reg(context));
38 break;
40 case 0x01: /* Check for Keystroke */
41 /* Returns: ZF set if no keystroke */
42 /* AH = Scan code */
43 /* AL = ASCII character */
44 TRACE(int16, "Check for Keystroke\n");
45 if (!CONSOLE_CheckForKeystroke(&AH_reg(context), &AL_reg(context)))
47 SET_ZFLAG(context);
49 else
51 RESET_ZFLAG(context);
53 break;
55 case 0x02: /* Get Shift Flags */
56 AL_reg(context) = 0;
58 if (GetAsyncKeyState(VK_RSHIFT))
59 AL_reg(context) |= 0x01;
60 if (GetAsyncKeyState(VK_LSHIFT))
61 AL_reg(context) |= 0x02;
62 if (GetAsyncKeyState(VK_LCONTROL) || GetAsyncKeyState(VK_RCONTROL))
63 AL_reg(context) |= 0x04;
64 if (GetAsyncKeyState(VK_LMENU) || GetAsyncKeyState(VK_RMENU))
65 AL_reg(context) |= 0x08;
66 if (GetAsyncKeyState(VK_SCROLL))
67 AL_reg(context) |= 0x10;
68 if (GetAsyncKeyState(VK_NUMLOCK))
69 AL_reg(context) |= 0x20;
70 if (GetAsyncKeyState(VK_CAPITAL))
71 AL_reg(context) |= 0x40;
72 if (GetAsyncKeyState(VK_INSERT))
73 AL_reg(context) |= 0x80;
74 TRACE(int16, "Get Shift Flags: returning 0x%02x\n", AL_reg(context));
75 break;
77 case 0x03: /* Set Typematic Rate and Delay */
78 FIXME(int16, "Set Typematic Rate and Delay - Not Supported\n");
79 break;
81 case 0x09: /* Get Keyboard Functionality */
82 FIXME(int16, "Get Keyboard Functionality - Not Supported\n");
83 /* As a temporary measure, say that "nothing" is supported... */
84 AL_reg(context) = 0;
85 break;
87 case 0x0a: /* Get Keyboard ID */
88 FIXME(int16, "Get Keyboard ID - Not Supported\n");
89 break;
91 case 0x10: /* Get Enhanced Keystroke */
92 TRACE(int16, "Get Enhanced Keystroke - Partially supported\n");
93 /* Returns: AH = Scan code
94 AL = ASCII character */
95 CONSOLE_GetKeystroke(&AH_reg(context), &AL_reg(context));
96 break;
99 case 0x11: /* Check for Enhanced Keystroke */
100 /* Returns: ZF set if no keystroke */
101 /* AH = Scan code */
102 /* AL = ASCII character */
103 TRACE(int16, "Check for Enhanced Keystroke - Partially supported\n");
104 if (!CONSOLE_CheckForKeystroke(&AH_reg(context), &AL_reg(context)))
106 SET_ZFLAG(context);
108 else
110 RESET_ZFLAG(context);
112 break;
114 case 0x12: /* Get Extended Shift States */
115 FIXME(int16, "Get Extended Shift States - Not Supported\n");
116 break;
118 default:
119 FIXME(int16, "Unknown INT 16 function - 0x%x\n", AH_reg(context));
120 break;