-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTUIMOUSE.CPP
96 lines (89 loc) · 1.63 KB
/
TUIMOUSE.CPP
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
extern "C" void far InstallGraphicsMouse(void);
extern "C" void far DeleteGraphicsMouse(void);
extern "C" void far ShowGraphicCursor(void);
extern "C" void far HideGraphicCursor(void);
#define LABEL(x) } x: asm {
int MousePresent=0;
int GraphMouse=0;
int MouseInit(void)
{
int x;
asm {
mov ax,0
int 33h
cmp ax,0xFFFF
je __ok
xor bx,bx
LABEL(__ok)
mov ax,bx
};
x = _AX;
if (x) MousePresent=1;
return x;
};
void SetGraphMouse(void) {
if (MouseInit()==0) return;
InstallGraphicsMouse();
GraphMouse=1;
};
void ResetGraphMouse(void) {
if (!MousePresent) return;
DeleteGraphicsMouse();
GraphMouse=0;
};
int MouseReset(void)
{
asm {
mov ax,0
int 33h
cmp ax,0xFFFF
je __ok
xor bx,bx
LABEL(__ok)
mov ax,bx
};
return _AX;
};
void MouseShow( void )
{
if (GraphMouse) {
ShowGraphicCursor();
} else {
asm {
mov ax,0001h
int 33h
};
};
};
void MouseHide( void )
{
if (GraphMouse) {
HideGraphicCursor();
} else {
asm {
mov ax,0002h
int 33h
};
};
};
void MouseGetStatus(int &x, int &y, int& buttons )
{
int xx,yy,bb;
asm {
mov ax,0003h
int 33h
mov xx,cx
mov yy,dx
mov bb,bx
};
x=xx; y=yy; buttons=bb;
};
void PlaceMouse(int x, int y )
{
asm {
mov ax,0004h
mov cx,x
mov dx,y
int 33h
};
};