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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
| { обна}
{ Programming in TP 7.0 }
uses crt,ADVHSC; { ADVHSC.TPU need for playing HSC sounds }
const
ball: array [0..63] of byte =
(0,00,44,44,44,44,00, 0,
00,44,44,44,44,44,44,00,
44,44, 0,44,44, 0,44,44,
44,44,00,44,44,00,44,44,
44,44,44,44,44,44,44,44,
44,00,44,44,44,44,00,44,
00,44,00,00,00,00,44,00,
0,00,44,44,44,44,00, 0);
MAXSTARS = 120;
var
soundleft: byte;
ballx, bally, balloy, ballox : real;
scorep1, scorep2, p1, p2, speed : integer;
gameover, p1up, p1down, p2up, p2down : boolean;
ballxi, ballyi : real;
total: longint;
counter: integer;
stars: array[0..MAXSTARS] of longint;
starsi: array[0..MAXSTARS] of byte;
procedure SetVga;
begin
asm
mov ax, 13h
int 10h
end;
end;
procedure ResetVga;
begin
asm
mov ax, 03h
int 10h
end;
end;
procedure SetColor(col,r,g,b:byte);
begin
port[$3c8]:=col;
port[$3c9]:=r;
port[$3c9]:=g;
port[$3c9]:=b;
end;
procedure DrawScore;
var
i,j,k: integer;
begin
for k:=1 to scorep1 do
for i := 0 to 7 do
for j := 0 to 7 do
mem[ $a000 : ((i + 191) * 320) - 8 + j + k * 15] := ball[(i * 8) + j];
for k:=1 to scorep2 do
for i := 0 to 7 do
for j := 0 to 7 do
mem[ $a000 : ((i + 192) * 320) +j - (k * 15)] := ball[(i * 8) + j]+ 16;
end;
procedure DrawStarfield;
var
i : integer;
begin
for i := 0 to MAXSTARS do mem[$a000: stars[i]]:=0;
for i := 0 to MAXSTARS do begin
case starsi[i] of
0 : stars[i] := stars[i] - 1;
1 : stars[i] := stars[i] - 2;
2 : stars[i] := stars[i] - 3;
end;
if (stars[i] < 0) then stars[i] := 63999-320*9;
mem [$a000 : stars[i]] := 31 - ((2 - starsi[i]) * 5);
end;
end;
procedure wait; assembler;
asm
push ax
push dx
mov dx, $03da
@wait:
in al, dx
and al, $08
jz @wait
pop dx
pop ax
end;
procedure InitStarfield;
var
i : integer;
begin
for i := 0 to MAXSTARS do stars[i] := random(64000-320*9);
for i := 0 to MAXSTARS do starsi[i] := random(3);
end;
procedure InitGame;
begin
InitStarfield;
FOR TOTAL:=0 TO 63999 DO MEM[$A000:TOTAL]:=0;
DrawScore;
ballx := 160 - 4;
bally := 100 - 4;
ballxi := 0.65;
ballyi := 0.65;
p1 := 80;
p2 := 80;
p2up:=false;
p2down:=false;
gameover := false;
end;
procedure DrawScreen;
var
i,j: integer;
h,m,s,u,h1,m1,s1,u1:word;
begin
wait;
DrawStarfield;
for i:= 0 to 1 do
for j:=0 to 199 do begin
mem[$a000: j*320+i]:=0;
mem[$a000: j*320+i+318]:=0;
end;
for i := 0 to 39 do begin
mem[ $a000 : ((i + p1) * 320) ] := 31;
mem[ $a000 : ((i + p1) * 320) + 1 ] := 26;
mem[ $a000 : ((i + p2) * 320) + 318 ] := 31;
mem[ $a000 : ((i + p2) * 320) + 319 ] := 26;
end;
for i := 0 to 7 do
for j := 0 to 7 do
mem[ $a000 : ((i + round(balloy)) * 320) + j + round(ballox)] := 0;
for i := 0 to 7 do
for j := 0 to 7 do
mem[ $a000 : ((i + round(bally)) * 320) + j + round(ballx)] := ball[(i * 8) + j];
if gameover=true then begin
delay(800);
for j:=1 to 30 do begin
for i:=1 to 255 do begin
port[$3c7]:=i;
setcolor(i,(9* port[$3c9]) div 10,(9 * port[$3c9]) div 10,(9 * port[$3c9]) div 10);
end;
delay(100);
end;
end;
end;
procedure MainLoop;
var
me: longint;
oldkey: byte;
begin
balloy:=bally;
ballox:=ballx;
repeat
oldkey:=port[$60];
case port[$60] of
30: begin p1up:=true; p1down:=false; end;
44: begin p1down:=true; p1up:=false; end;
128+30: p1up:=false;
128+44: p1down:=false;
80: begin p2down:=true; p2up:=false; end;
72: begin p2up:=true; p2down:=false; end;
170: begin p2up:=false; p2down:=false; end;
200: p2up:=false;
208: p2down:=false;
12: if speed < 100 then speed:=speed + 1;
13: if speed > 0 then speed:=speed - 1;
1: GameOver:=true;
end;
while keypressed do readkey;
delay(2);
until port[$60]=oldkey;
delay(5);
if (soundleft > 0) then soundleft := soundleft - 1
else nosound;
if (soundleft = 1) then sound(300);
ballx := ballx + ballxi;
bally := bally + ballyi;
if p1up then begin
p1 := p1 - 3;
if (p1 < 0) then p1 := 0;
end;
if p1down then begin
p1 := p1 + 3;
if (p1 > (190 - 40)) then p1 := (190 - 40);
end;
if p2up then begin
p2 := p2 - 3;
if (p2 < 0) then p2 := 0;
end;
if p2down then begin
p2 := p2 + 3;
if (p2 > (190 - 40)) then p2 := (190 - 40);
end;
if (bally < 0) then begin
bally := 0;
ballyi := -(ballyi - 0.2);
sound(400);
soundleft := 2;
end;
if (bally > (190 - 8)) then begin
bally := (190 - 8);
ballyi := -(ballyi + 0.2);
sound(300);
soundleft := 2;
end;
if (ballx < 2) then begin
if (((bally + 7) >= p1) and ((bally - 7) <= (p1 + 40))) then begin
ballx := 2;
ballxi := -(ballxi - 0.3);
sound(600);
soundleft := 4;
if ((bally - 4) < p1) then ballyi := ballyi - 1;
if ((bally + 12) > (p1 + 40)) then ballyi := ballyi + 1;
end
else begin
scorep2:=scorep2+1;
InitGame;
end;
end;
if (ballx > (320 - 10)) then begin
if (((bally + 7) >= p2) and ((bally - 7) <= (p2 + 40))) then begin
ballx := (320 - 10);
ballxi := -(ballxi + 0.3);
sound(800);
soundleft := 4;
if ((bally - 4) < p2) then ballyi := ballyi - 1;
if ((bally + 12) > (p2 + 40)) then ballyi := ballyi + 1;
end
else begin
scorep1:=scorep1+1;
InitGame;
end;
end;
if (scorep1> 4) or (scorep2 >4) then Gameover:=true;
DrawScreen;
end;
begin
resetvga;
clrscr;
asm
mov ah, $01
mov ch, $20
mov cl, $20
int 10h
end;
LOADSONG('MUSIC1.HSC');
PLAYSONG;
port[$60]:=$f3;
delay(1);
port[$60]:=0;
scorep1:=0;
scorep2:=0;
setcolor(7,0,0,0);
writeln('Space tennis v1.01');
writeln('Copyright 3D Clone Interactive');
writeln;
writeln;
for counter:=0 to 63 do begin
setcolor(7,counter,0,0);
delay(30);
end;
writeln;
delay(1500);
textcolor(1);
writeln;
writeln(' Space tennis, Het digitale avontuur':44);
writeln(' De speler die het eerste 5x scoort wint':48);
writeln;
writeln('Bediening: Speler 1: A: Verplaats racket omhoog, Z: Verplaats racket omlaag');
writeln(' Speler 2: ',chr(24),': Verplaats racket omhoog, ',chr(25),
': Verplaats racket omhoog');
writeln;
writeln(' Om te stoppen druk onder het spel op ESC');
for counter:=0 to 63 do begin
setcolor(1,counter div 4,counter div 2,counter);
delay(30);
end;
readkey;
SetVga;
InitGame;
while not gameover do MainLoop;
ResetVga;
nosound;
textcolor(7);
FADESONG;
DELAY(2000);
STOPSONG;
CLEARMEM;
delay(1500);
textcolor(1);
gotoxy (2,2);
write('3D Clone Interactive voor al uw demo',chr(39),'s en spelen');
gotoxy (2,4);
textcolor(14);
write('Nederland');
gotoxy (2,6);
write('Zwolle 8022AE');
gotoxy (2,8);
write('Tel 038-4534302');
textcolor(4);
gotoxy (20,4); write('°°°°°° °°°°°° °°°° °° °°°°° °° °° °°°°°° ');
gotoxy (20,5); write(' °°° °° °° °° °° °° °° °° °°°° °° °°° ');
gotoxy (20,6); write('°°°°°° °° °° °° °° °° °° °° °° °° °°°°°° ');
gotoxy (20,7); write(' °°° °° °° °° °° °° °° °° °° °°°° °°° ');
gotoxy (20,8); write('°°°°°° °°°°°° °°°° °°°°° °°°°° °° °° °°°°°° ');
for counter:=0 to 63 do begin
setcolor(1,counter div 4,counter div 2,counter);
delay(30);
end;
end. |