2 * DOS interrupt 33h handler
16 #include "debugtools.h"
18 DEFAULT_DEBUG_CHANNEL(int);
27 /**********************************************************************
30 * Handler for int 33h (MS MOUSE).
32 void WINAPI INT_Int33Handler( CONTEXT86 *context )
34 switch (LOWORD(context->Eax)) {
36 TRACE("Reset mouse driver and request status\n");
37 AX_reg(context) = 0xFFFF; /* installed */
38 BX_reg(context) = 3; /* # of buttons */
39 memset( &mouse_info, 0, sizeof(mouse_info) );
42 FIXME("Show mouse cursor\n");
45 FIXME("Hide mouse cursor\n");
48 TRACE("Return mouse position and button status\n");
49 BX_reg(context) = mouse_info.but;
50 CX_reg(context) = mouse_info.x;
51 DX_reg(context) = mouse_info.y;
54 FIXME("Position mouse cursor\n");
57 FIXME("Define horizontal mouse cursor range\n");
60 FIXME("Define vertical mouse cursor range\n");
63 FIXME("Define graphics mouse cursor\n");
66 FIXME("Define text mouse cursor\n");
69 TRACE("Define mouse interrupt subroutine\n");
70 mouse_info.callmask = CX_reg(context);
71 mouse_info.callback = (FARPROC16)MAKESEGPTR(context->SegEs, LOWORD(context->Edx));
74 FIXME("Define screen region for update\n");
77 INT_BARF(context,0x33);
83 WORD mask,but,x,y,mx,my;
86 static void MouseRelay(CONTEXT86 *context,void *mdata)
88 MCALLDATA *data = (MCALLDATA *)mdata;
89 CONTEXT86 ctx = *context;
97 ctx.SegCs = SELECTOROF(data->proc);
98 ctx.Eip = OFFSETOF(data->proc);
100 DPMI_CallRMProc(&ctx, NULL, 0, 0);
103 void WINAPI INT_Int33Message(UINT message,WPARAM wParam,LPARAM lParam)
106 unsigned Height, Width, SX=1, SY=1;
108 if (!VGA_GetMode(&Height,&Width,NULL)) {
109 /* may need to do some coordinate scaling */
113 mouse_info.x = LOWORD(lParam) * SX;
114 mouse_info.y = HIWORD(lParam) * SY;
120 case WM_LBUTTONDBLCLK:
121 mouse_info.but |= 0x01;
125 mouse_info.but &= ~0x01;
129 case WM_RBUTTONDBLCLK:
130 mouse_info.but |= 0x02;
134 mouse_info.but &= ~0x02;
138 case WM_MBUTTONDBLCLK:
139 mouse_info.but |= 0x04;
143 mouse_info.but &= ~0x04;
148 if ((mask & mouse_info.callmask) && mouse_info.callback) {
149 MCALLDATA *data = calloc(1,sizeof(MCALLDATA));
150 data->proc = mouse_info.callback;
151 data->mask = mask & mouse_info.callmask;
152 data->but = mouse_info.but;
153 data->x = mouse_info.x;
154 data->y = mouse_info.y;
155 Dosvm.QueueEvent(-1, DOS_PRIORITY_MOUSE, MouseRelay, data);