2 * DOS interrupt 33h handler
15 #include "debugtools.h"
17 DEFAULT_DEBUG_CHANNEL(int);
26 /**********************************************************************
29 * Handler for int 33h (MS MOUSE).
31 void WINAPI DOSVM_Int33Handler( CONTEXT86 *context )
33 switch (LOWORD(context->Eax)) {
35 TRACE("Reset mouse driver and request status\n");
36 AX_reg(context) = 0xFFFF; /* installed */
37 BX_reg(context) = 3; /* # of buttons */
38 memset( &mouse_info, 0, sizeof(mouse_info) );
41 FIXME("Show mouse cursor\n");
44 FIXME("Hide mouse cursor\n");
47 TRACE("Return mouse position and button status\n");
48 BX_reg(context) = mouse_info.but;
49 CX_reg(context) = mouse_info.x;
50 DX_reg(context) = mouse_info.y;
53 FIXME("Position mouse cursor\n");
56 FIXME("Define horizontal mouse cursor range\n");
59 FIXME("Define vertical mouse cursor range\n");
62 FIXME("Define graphics mouse cursor\n");
65 FIXME("Define text mouse cursor\n");
68 TRACE("Define mouse interrupt subroutine\n");
69 mouse_info.callmask = CX_reg(context);
70 mouse_info.callback = (FARPROC16)MAKESEGPTR(context->SegEs, LOWORD(context->Edx));
73 FIXME("Define screen region for update\n");
76 INT_BARF(context,0x33);
82 WORD mask,but,x,y,mx,my;
85 static void MouseRelay(CONTEXT86 *context,void *mdata)
87 MCALLDATA *data = (MCALLDATA *)mdata;
88 CONTEXT86 ctx = *context;
96 ctx.SegCs = SELECTOROF(data->proc);
97 ctx.Eip = OFFSETOF(data->proc);
99 DPMI_CallRMProc(&ctx, NULL, 0, 0);
102 void WINAPI DOSVM_Int33Message(UINT message,WPARAM wParam,LPARAM lParam)
105 unsigned Height, Width, SX=1, SY=1;
107 if (!VGA_GetMode(&Height,&Width,NULL)) {
108 /* may need to do some coordinate scaling */
112 mouse_info.x = LOWORD(lParam) * SX;
113 mouse_info.y = HIWORD(lParam) * SY;
119 case WM_LBUTTONDBLCLK:
120 mouse_info.but |= 0x01;
124 mouse_info.but &= ~0x01;
128 case WM_RBUTTONDBLCLK:
129 mouse_info.but |= 0x02;
133 mouse_info.but &= ~0x02;
137 case WM_MBUTTONDBLCLK:
138 mouse_info.but |= 0x04;
142 mouse_info.but &= ~0x04;
147 if ((mask & mouse_info.callmask) && mouse_info.callback) {
148 MCALLDATA *data = calloc(1,sizeof(MCALLDATA));
149 data->proc = mouse_info.callback;
150 data->mask = mask & mouse_info.callmask;
151 data->but = mouse_info.but;
152 data->x = mouse_info.x;
153 data->y = mouse_info.y;
154 DOSVM_QueueEvent(-1, DOS_PRIORITY_MOUSE, MouseRelay, data);