Added int 0x09 and int 0x33.
[wine] / msdos / int16.c
1 /*
2  * DOS interrupt 16h handler
3  */
4
5 #include <stdlib.h>
6 #include <string.h>
7 #include <unistd.h>
8
9 #include "config.h"
10 #include "module.h"
11 #include "console.h"
12 #include "wincon.h"
13 #include "debug.h"
14
15 /**********************************************************************
16  *          INT_Int16Handler
17  *
18  * Handler for int 16h (keyboard)
19  *
20  * NOTE:
21  * 
22  *    KEYB.COM (DOS >3.2) adds functions to this interrupt, they are
23  *    not currently listed here.
24  */
25
26 void WINAPI INT_Int16Handler( CONTEXT *context )
27 {
28    switch AH_reg(context) {
29
30    case 0x00: /* Get Keystroke */
31       /* Returns: AH = Scan code
32                   AL = ASCII character */   
33       TRACE(int16, "Get Keystroke\n");
34       CONSOLE_GetKeystroke(&AH_reg(context), &AL_reg(context));
35       break;
36
37    case 0x01: /* Check for Keystroke */
38       /* Returns: ZF set if no keystroke */
39       /*          AH = Scan code */
40       /*          AL = ASCII character */
41       TRACE(int16, "Check for Keystroke\n");
42       if (!CONSOLE_CheckForKeystroke(&AH_reg(context), &AL_reg(context)))
43       {
44           SET_ZFLAG(context);
45       }
46       else
47       {
48           RESET_ZFLAG(context);
49       }
50       break;
51
52    case 0x02: /* Get Shift Flags */      
53       FIXME(int16, "Get Shift Flags - Not Supported\n");
54       break;
55
56    case 0x03: /* Set Typematic Rate and Delay */
57       FIXME(int16, "Set Typematic Rate and Delay - Not Supported\n");
58       break;
59
60    case 0x09: /* Get Keyboard Functionality */
61       FIXME(int16, "Get Keyboard Functionality - Not Supported\n");
62       /* As a temporary measure, say that "nothing" is supported... */
63       AL_reg(context) = 0;
64       break;
65
66    case 0x0a: /* Get Keyboard ID */
67       FIXME(int16, "Get Keyboard ID - Not Supported\n");
68       break;
69
70    case 0x10: /* Get Enhanced Keystroke */
71       TRACE(int16, "Get Enhanced Keystroke - Partially supported\n");
72       /* Returns: AH = Scan code
73                   AL = ASCII character */   
74       CONSOLE_GetKeystroke(&AH_reg(context), &AL_reg(context));
75       break;
76   
77
78    case 0x11: /* Check for Enhanced Keystroke */
79       /* Returns: ZF set if no keystroke */
80       /*          AH = Scan code */
81       /*          AL = ASCII character */
82       TRACE(int16, "Check for Enhanced Keystroke - Partially supported\n");
83       if (!CONSOLE_CheckForKeystroke(&AH_reg(context), &AL_reg(context)))
84       {
85           SET_ZFLAG(context);
86       }
87       else
88       {
89           RESET_ZFLAG(context);
90       }
91       break;
92
93    case 0x12: /* Get Extended Shift States */
94       FIXME(int16, "Get Extended Shift States - Not Supported\n");
95       break;
96  
97    default:
98       FIXME(int16, "Unknown INT 16 function - 0x%x\n", AH_reg(context));   
99       break;
100
101    }
102 }
103