-
Notifications
You must be signed in to change notification settings - Fork 1
/
pcredz.pas
319 lines (274 loc) · 5.28 KB
/
pcredz.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
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
{
WASTED YEARS / Iron Maiden
From the coast of gold, across the seven seas,
I'm travellin on for and wide
But now it seems, I'm just a stranger to myself
And all the things I sometimes do, it isn't me but someone else
I close my eyes, and think of home
Another city goes by in the night
Ain't it funny how it is, you never miss it 'til its gone away
And my heart is lying there and will be 'til my dying day
So understand
Don't waste your time always searching for those wasted years
Face up... make your stand
And realise you're living in the golden years
Too much time on my hands, I got you on my mind
Can't ease this pain, so easily
When you can't find the words to say it's hard to make it through another day
And it just makes me wanna cry and throw my hands up to the sky
}
unit PCredz;
interface
procedure ShowCredits;
procedure Sync;
implementation
uses
XGfx,PProcs,Xbuf,XKey;
type
pbyte = ^byte;
TPeople = record
Pic : pointer;
Text : pointer;
end;
procedure P1;external;
{$L p1.obj}
procedure P2;external;
{$L p2.obj}
procedure P3;external;
{$L p3.obj}
procedure P4;external;
{$L p4.obj}
procedure t1;external;
{$L t1.obj}
procedure t2;external;
{$L t2.obj}
procedure t3;external;
{$L t3.obj}
procedure t4;external;
{$L t4.obj}
const
imgWidth = 66;
imgHeight = 71;
maxpeople = 4;
people : array[1..maxpeople] of TPeople =
(
(Pic:@p1; Text:@t1),
(Pic:@p2; Text:@t2),
(Pic:@p3; Text:@t3),
(Pic:@p4; Text:@t4)
);
outColor = 200;
outOffs = 80;
MurderIntentions : boolean = false;
var
NullPalette : array[1..256*3] of byte;
procedure Pal;external;
{$L pal.obj}
procedure BIOSFntProc;external;
{$L polyfnt.obj}
function IHaveToSayTheWords:boolean;
begin
if keypressed then MurderIntentions := true;
IHaveToSayTheWords := MurderIntentions;
end;
procedure putchar(x,y:word; c:char);
var
ix,iy:word;
p:pbyte;
color:byte;
begin
p := @biosfntproc;
inc(word(P),byte(c)*8);
for iy:=0 to 7 do begin
for ix:=0 to 7 do begin
if (p^ and (1 shl (7-ix))) > 0 then color := outColor
else color := 0;
mem[segA000:((iy+y)*320)+(ix+x)] := color;
end;
inc(word(P));
end;
end;
procedure putstr(x,y:word; s:string);
var
b:byte;
begin
for b:=1 to length(s) do putchar(x+((b-1)*8),y,s[b]);
end;
procedure putimg(p:pointer);assembler;
asm
cld
push ds
mov ax,SegA000
mov es,ax
xor di,di
lds si,p
lodsw
mov bx,ax
mov dx,320
sub dx,bx
lodsw
mov cx,ax
@loop:
push cx
mov cx,bx
rep movsb
add di,dx
pop cx
loop @loop
pop ds
end;
procedure SetPalette(Pal:pointer);assembler;
asm
cld
mov dx,$3C8
mov cx,256*3
push ds
lds si,Pal
xor al,al
out dx,al
inc dx
repz outsb
pop ds
end;
procedure GetPalette(P:Pointer); assembler;
asm
cld
mov dx,$3C7
mov cx,256*3
les di,P
xor al,al
out dx,al
inc dl
inc dl
repz insb
end;
procedure SmoothPalette(P:Pointer);
var
CP : array[1..256*3] of byte;
b : boolean;
begin
GetPalette(@CP);
b := false;
repeat
if b then asm
mov dx,3dah
@1:
in al,dx
test al,8
jne @1
@2:
in al,dx
test al,8
je @2
xor al,al
mov b,al
end else b := true;
asm
les di,P
push ds
mov ax,ss
mov ds,ax
lea si,cp
mov cx,768
@loop:
mov al,byte ptr [si]
cmp al,es:[di]
je @continue
ja @dec
inc byte ptr [si]
jmp @continue
@dec:
dec byte ptr [si]
@continue:
inc di
inc si
loop @loop
pop ds
end;
SetPalette(@CP);
until BufCmp(CP,P^,768);
end;
procedure Sync;assembler;
asm
mov dx,3dah
@1:
in al,dx
test al,8
jne @1
@2:
in al,dx
test al,8
je @1
end;
type
PWord = ^word;
procedure tty(p:PChar);
var
pw:PWord;
w:word;
x,y:word;
timer:pword;
start:word;
begin
timer := Ptr(Seg0040,$6c);
x := outOffs;
y := 0;
repeat
if IhaveToSayTheWords then exit;
putchar(x,y,'_');
case p[0] of
#27 : exit;
#13 : begin
putchar(x,y,' ');
inc(y,8);
x := outOffs;
putchar(x,y,'_');
end;
#8 : begin
putchar(x,y,' ');
dec(x,8);
putchar(x,y,'_');
end;
else begin
putchar(x,y,p[0]);
inc(x,8);
putchar(x,y,'_');
end;
end; {case}
inc(word(P));
pw := pword(P);
w := pw^;
if w > 3 then w := 3;
start := timer^;
while timer^-start < w do ;
inc(word(P),2);
until false;
end;
procedure ShowCredits;
var
b:byte;
w:word;
begin
asm
mov ax,13h
int 10h
end;
MurderIntentions := false;
SetPalette(@nullpalette);
repeat
for b:=1 to maxpeople do begin
putimg(people[b].pic);
SmoothPalette(@Pal);
smoothpalette(@pal);
tty(people[b].text);
if IHaveToSayTheWords then break;
for w:=1 to 100 do Sync;
SmoothPalette(@NullPalette);
FillChar(Mem[SegA000:0],64000,0);
end;
if IHaveToSayTheWords then break;
until false;
end;
begin
FillChar(nullpalette,SizeOf(nullpalette),0);
end.