This repository was archived by the owner on Oct 11, 2022. It is now read-only.
forked from nickelsworth/swag
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path0038.pas
More file actions
176 lines (157 loc) · 3.12 KB
/
Copy path0038.pas
File metadata and controls
176 lines (157 loc) · 3.12 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
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
unit MyMouse;
{ bare bones mouse unit used by the simulator -stolen from swag, sorta }
interface
uses dos;
var
mousex, mousey:integer;
procedure initmouse(var buttons:byte; var is:boolean);
Procedure showmouse;
Procedure hidemouse;
procedure getmousexy;
procedure mouseto80;
Procedure MouseExit;
function mouserightpressed:boolean; {??}
function mouseleftpressed:boolean;
function mouserightdown:boolean;
function mousebothdown:boolean;
function mouseleftdown:boolean;
implementation
Var
ExitPtr: pointer;
Regs: registers;
TempWord: word;
procedure initmouse(var buttons:byte; var is:boolean);
var msavailable:boolean;
msbuttons:byte;
begin
msavailable:=false;
Asm
MOV MsButtons,0
MOV AX,0000h
INT 33h
CMP AX,0000h
JE @Dne
CMP AX,0FFFFh
JNE @Dne
MOV MsAvailable,True
CMP BX,0002h
JE @Two
CMP BX,0003h
JE @Thr
CMP BX,0FFFFh
JE @Thr
@Two: MOV MsButtons,2
JMP @Dne
@Thr: MOV MsButtons,3
@Dne:
End;
buttons:=msbuttons;
is:=msavailable;
end;
Procedure showmouse; Assembler;
Asm
MOV AX,0001h
INT 33h
end;
Procedure Hidemouse; Assembler;
Asm
MOV AX,0002h
INT 33h
end;
procedure getmousexy; Assembler;
Asm
MOV AX,0003h
INT 33h
MOV mousex,CX
MOV mousey,DX
end;
procedure mouseto80;
begin
{makes it a number for 80x25 text mode}
mousex:=(mousex div 8)+1;
mousey:=(mousey div 8)+1;
end;
{dont know the diff between 'rghtDOWN and rightPRESSED'}
function mouseleftpressed:boolean;
begin
asm
MOV @Result,False
MOV AX,0005h
MOV BX,0000h
INT 33h
{MOV Count,BX} {what is count?}
MOV mousex,CX
MOV mousey,DX
CMP AX,1
JNE @Done
MOV @Result,True
@Done:
end;
end;
function mouserightpressed:boolean;
begin
asm
MOV @Result,False
MOV AX,0005h
MOV BX,0001h
INT 33h
{MOV Count,BX} {what is count?}
MOV mousex,CX
MOV mousey,DX
CMP AX,2
JNE @Done
MOV @Result,True
@Done:
end;
end;
function mouserightdown:boolean;
begin
asm
MOV @Result,False
MOV AX,0003h
INT 33h
MOV mousex,CX
MOV mousey,DX
CMP BX,2
JNE @Done
MOV @Result,True
@Done:
end;
end;
function mousebothdown:boolean;
begin
asm
MOV @Result,False
MOV AX,0003h
INT 33h
MOV MouseX,CX
MOV MouseY,DX
CMP BX,3
JNE @Done
MOV @Result,True
@Done:
end;
end;
function mouseleftdown:boolean;
begin
Asm
MOV @Result,False
MOV AX,0003h
INT 33h
MOV mousex,CX
MOV mousey,DX
CMP BX,1
JNE @Done
MOV @Result,True
@Done:
end;
end;
Procedure MouseExit;
begin
ExitProc:=ExitPtr;
end;
begin
ExitPtr:=ExitProc;
ExitProc:=@MouseExit;
End.