2 * DOS interrupt 33h handler
9 #include "debugtools.h"
11 DEFAULT_DEBUG_CHANNEL(int)
19 /**********************************************************************
22 * Handler for int 33h (MS MOUSE).
24 void WINAPI INT_Int33Handler( CONTEXT86 *context )
26 MOUSESYSTEM *sys = (MOUSESYSTEM *)DOSVM_GetSystemData(0x33);
28 switch (AX_reg(context)) {
30 TRACE("Reset mouse driver and request status\n");
31 AX_reg(context) = 0xFFFF; /* installed */
32 BX_reg(context) = 3; /* # of buttons */
33 sys = calloc(1,sizeof(MOUSESYSTEM));
34 DOSVM_SetSystemData(0x33, sys);
37 TRACE("Return mouse position and button status\n");
38 BX_reg(context) = sys->but;
39 CX_reg(context) = sys->x;
40 DX_reg(context) = sys->y;
42 case 0x0C: /* Define interrupt subroutine */
43 TRACE("Define mouse interrupt subroutine\n");
44 sys->callmask = CX_reg(context);
45 sys->callback = (FARPROC16)PTR_SEG_OFF_TO_SEGPTR(ES_reg(context), DX_reg(context));
48 INT_BARF(context,0x33);
54 WORD mask,but,x,y,mx,my;
57 static void MouseRelay(LPDOSTASK lpDosTask,CONTEXT86 *context,void *mdata)
59 MCALLDATA *data = (MCALLDATA *)mdata;
60 CONTEXT86 ctx = *context;
62 EAX_reg(&ctx) = data->mask;
63 EBX_reg(&ctx) = data->but;
64 ECX_reg(&ctx) = data->x;
65 EDX_reg(&ctx) = data->y;
66 ESI_reg(&ctx) = data->mx;
67 EDI_reg(&ctx) = data->my;
68 CS_reg(&ctx) = SELECTOROF(data->proc);
69 EIP_reg(&ctx) = OFFSETOF(data->proc);
71 DPMI_CallRMProc(&ctx, NULL, 0, 0);
74 void WINAPI INT_Int33Message(UINT message,WPARAM wParam,LPARAM lParam)
76 MOUSESYSTEM *sys = (MOUSESYSTEM *)DOSVM_GetSystemData(0x33);
80 sys->x = LOWORD(lParam);
81 sys->y = HIWORD(lParam);
87 case WM_LBUTTONDBLCLK:
96 case WM_RBUTTONDBLCLK:
105 case WM_MBUTTONDBLCLK:
115 if ((mask & sys->callmask) && sys->callback) {
116 MCALLDATA *data = calloc(1,sizeof(MCALLDATA));
117 data->proc = sys->callback;
118 data->mask = mask & sys->callmask;
119 data->but = sys->but;
122 DOSVM_QueueEvent(-1, DOS_PRIORITY_MOUSE, MouseRelay, data);