-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJOYTEST.PAS
121 lines (111 loc) · 2.61 KB
/
JOYTEST.PAS
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
program joy;
uses graph;
var sx, sy, sz, sv,
x, y, z, v : word;
sa, sb, sc, sd,
a, b, c, d : boolean;
gm, gd : integer;
procedure GetJoy (var x, y, z, W : word; var b1, b2, b3, b4 : boolean);
var myg : byte;
xx, yy, zz, ww : word;
label l;
begin
asm
mov ah, 84h
mov dx, 1
int 15h
mov xx, ax
mov yy, bx
mov zz, cx
mov ww, dx
mov cx, 10h
l:loop l
mov ah, 84h
mov dx, 0
int 15h
mov myg, al
end;
{ NEAISKU KA DARO }
{
if (myg and 1) = 1 then
if (myg and 2) = 2 then
if (myg and 4) = 4 then
if (myg and 8) = 8 then
}
x := xx;
y := yy;
z := zz;
w := ww;
if (myg and 16) = 16 then b1 := false else b1 := true;
if (myg and 32) = 32 then b2 := false else b2 := true;
if (myg and 64) = 64 then b3 := false else b3 := true;
if (myg and 128) = 128 then b4 := false else b4 := true;
end;
begin
initgraph (gm, gd, '');
setcolor (7);
moveto (250, 0);
outtext ('Joystick test');
moveto (285, 470);
outtext ('MK 2001');
moveto (18, 18);
outtext ('myg1');
moveto (18, 38);
outtext ('myg2');
moveto (18, 58);
outtext ('myg3');
moveto (18, 78);
outtext ('myg4');
setcolor (1);
rectangle (1, 104, 13, 272);
setcolor (8);
rectangle (52, 10, 585, 467);
setcolor (9);
rectangle (1, 15, 13, 25);
rectangle (1, 35, 13, 45);
rectangle (1, 55, 13, 65);
rectangle (1, 75, 13, 85);
sx := 2;
sy := 2;
repeat
getjoy (x, y, z, v, a, b, c, d);
x := 3 * x + 40; y := round (y * 2.5) ; v := v + 100;
if (x <> sx) or (y <> sy) then
begin
setcolor (0);
rectangle (sx - 2, sy - 2, sx + 2, sy + 2);
setcolor (15);
rectangle (x - 2, y - 2, x + 2, y + 2);
end;
if (v <> sv) then
begin
setcolor (0);
line (2, sv, 12, sv);
setcolor (9);
line (2, v, 12, v);
end;
if a <> sa then
begin
if a then setcolor (12) else setcolor (9);
rectangle (1, 15, 13, 25);
end;
if b <> sb then
begin
if b then setcolor (12) else setcolor (9);
rectangle (1, 35, 13, 45);
end;
if c <> sc then
begin
if c then setcolor (12) else setcolor (9);
rectangle (1, 55, 13, 65);
end;
if d <> sd then
begin
if d then setcolor (12) else setcolor (9);
rectangle (1, 75, 13, 85);
end;
sx := x; sy := y; sz := z; sv := v;
sa := a; sb := b; sc := c; sd := d;
until port [$60] = 1;
closegraph;
end.