-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMYRATON.C
More file actions
67 lines (61 loc) · 1.87 KB
/
Copy pathMYRATON.C
File metadata and controls
67 lines (61 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* ------------------------------------------------------------------
* MYRATON.C - drop-in replacement for the 5 RATON.LIB functions that
* simso.c actually calls (ponraton, cursorraton, boizqraton,
* bocenraton, boderraton, estadoraton).
*
* WHY: RATON.LIB's own implementations don't work under this DOSBox
* build (confirmed via MTEST/MTEST2: a raw INT 33h call works fine in
* both text and graphics mode, but RATON.LIB's hayraton()/estadoraton()
* never report the mouse as present). These replacements use the same
* raw INT 33h calls directly, so they work wherever MTEST2 worked.
*
* Function signatures match raton.h exactly, so simso.c needs NO
* changes - just link this .OBJ instead of RATON.LIB.
* ------------------------------------------------------------------ */
#include <dos.h>
void ponraton(int x, int y)
{
union REGS r;
r.x.ax = 4; /* AX=4: set mouse cursor position */
r.x.cx = x;
r.x.dx = y;
int86(0x33, &r, &r);
}
void cursorraton(int mostrar)
{
union REGS r;
r.x.ax = mostrar ? 1 : 2; /* AX=1: show cursor, AX=2: hide cursor */
int86(0x33, &r, &r);
}
int boizqraton(void)
{
union REGS r;
r.x.ax = 3; /* AX=3: get position + button status */
int86(0x33, &r, &r);
return (r.x.bx & 0x01) != 0; /* bit 0 = left button */
}
int bocenraton(void)
{
union REGS r;
r.x.ax = 3;
int86(0x33, &r, &r);
return (r.x.bx & 0x04) != 0; /* bit 2 = middle button */
}
int boderraton(void)
{
union REGS r;
r.x.ax = 3;
int86(0x33, &r, &r);
return (r.x.bx & 0x02) != 0; /* bit 1 = right button */
}
void estadoraton(int *x, int *y, int *boizq, int *bocen, int *boder)
{
union REGS r;
r.x.ax = 3;
int86(0x33, &r, &r);
*x = r.x.cx;
*y = r.x.dx;
*boizq = (r.x.bx & 0x01) != 0;
*bocen = (r.x.bx & 0x04) != 0;
*boder = (r.x.bx & 0x02) != 0;
}