forked from fabiensanglard/SecondReality
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDEMO.PAS
executable file
·190 lines (156 loc) · 3.68 KB
/
DEMO.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
uses crt,t1,t2,t3,bkr,miek;
procedure setrgb(c,r,g,b:byte);
begin
port[$3c8] := c;
port[$3c9] := r;
port[$3c9] := g;
port[$3c9] := b;
end;
var frames : word;
procedure waitr;
begin
asm
mov bx,1
int 0fch
mov frames,ax
end;
end;
function dis_exit:boolean;
var a : byte;
begin
asm
mov bx,2
int 0fch
mov a,al
end;
if a = 0 then dis_exit := false else dis_exit := true;
end;
var f : file;
inx : word;
y,x,t : word;
tmppal,pal : array[0..768] of byte;
font : array[0..400*35] of byte;
fbuf : array[0..158*34] of byte;
scp,sss:word;
{$L routines.obj}
{ dx = Bground seg,
ax = pos seg,
si = pos ofs,
cx = font seg,
bx = font ofs }
procedure putrouts1;far;external;
procedure scr(pos:byte);
begin
case pos of
0:asm
mov dx,seg tausta
mov ax,seg wat1
mov si,offset wat1
mov cx,seg font
mov bx,offset fbuf
call putrouts1
end;
1:asm
mov dx,seg tausta
mov ax,seg wat2
mov si,offset wat2
mov cx,seg font
mov bx,offset fbuf
call putrouts1
end;
2:asm
mov dx,seg tausta
mov ax,seg wat3
mov si,offset wat3
mov cx,seg font
mov bx,offset fbuf
call putrouts1
end;
end;
end;
var frame : word;
co : word;
fadeout : boolean;
quit : word;
fp : word;
pf : word;
begin
asm
mov ax,$13
int $10
xor bx,bx
int 0fch
@a: mov ax,0
mov bx,6
int 0fch
cmp dx,0
jl @a
mov co,cx
end;
fillchar(fbuf,sizeof(fbuf),#0);
move(mem[seg(_miekka):ofs(_miekka)+10],pal,768);
move(mem[seg(_miekka):ofs(_miekka)+778],font,400*34);
for x := 0 to 255 do setrgb(x,0,0,0);
move(mem[seg(tausta):ofs(tausta)+778],mem[seg(tausta):ofs(tausta)],64000);
move(mem[seg(tausta):ofs(tausta)],mem[$a000:0],64000);
move(pal,tmppal,768);
fillchar(pal,768,#0);
for y := 0 to 63*2 do
begin
waitr;
if y and 1 = 1 then
begin
for x := 0 to 255 do
begin
setrgb(x,pal[x*3+0],pal[x*3+1],pal[x*3+2]);
for pf := 0 to 3 do if pal[x*3+pf] < tmppal[x*3+pf] then inc(pal[x*3+pf]);
end;
end;
scr(sss);
if sss = 2 then sss := 0 else inc(sss);
end;
asm
@a: mov ax,0
mov bx,6
int 0fch
cmp cx,CO
je @a
cmp bx,16
jl @a
end;
{######################################################################}
sss := 0;
scp := 0;
frame := 0;
quit := 0;
fadeout := false;
fillchar(tmppal,768,#0);
repeat
waitr;
asm
mov ax,0
mov bx,6
int 0fch
cmp dx,-11
jnz @a
mov fadeout,1
@a: end;
if fadeout then
begin
if fp = 64 then quit := 1 else inc(fp);
for x := 0 to 255 do
begin
setrgb(x,pal[x*3+0],pal[x*3+1],pal[x*3+2]);
for pf := 0 to 3 do if pal[x*3+pf] > tmppal[x*3+pf] then dec(pal[x*3+pf]);
end;
end;
scr(sss);
if sss = 2 then
begin
sss := 0;
move(fbuf[1],fbuf,sizeof(fbuf));
for x := 0 to 33 do fbuf[158+x*158] := font[x*400+scp];
if scp < 390 then inc(scp);
end else inc(sss);
until dis_exit or (quit = 1);
end.