home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 March
/
Chip_1998-03_cd.bin
/
hry
/
Sinclair
/
SimDOS3
/
ZX2PC.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1996-09-24
|
2KB
|
127 lines
{$r-,s-,c-,v-,a+}
uses crt;
var pport:word;
p:array[0..50000]of byte;
f:file;
ii,a,b:byte;
lenp,len,i:word;
koniec:boolean;
function btt:byte;
var i,bt,vl:byte;
begin
if port[$60]=$1d then
koniec:=true
else
begin
bt:=0;
asm cli end;
for i:=0 to 7 do
begin
port[pport]:=255;
repeat
asm
mov dx,pport
add dx,1
in al,dx
and al,10100000b
xor al,128
mov vl,al
in al,$60
cmp al,$1d
jnz @dl
mov koniec,1
@dl:
end;
until ((vl and 128)<>0) or koniec;
port[pport]:=0;
if koniec then exit;
{ bt:=(bt shr 1) or ((vl and 32)shl 2);}
bt:=(bt shl 1)or ((vl and 32)shr 5);
repeat
asm
mov dx,pport
add dx,1
in al,dx
and al,10100000b
xor al,128
mov vl,al
end;
until (vl and 128)=0;
end;
btt:=bt;
end;
end;
begin
koniec:=false;
assign(f,'c:\zxtape.ltp');
rewrite(f,1);
pport:=memw[0:$408];
write(#10#13'Run ZX program and press Enter :');
port[pport]:=0;
readln;
asm cli end;
repeat
asm cli end;
a:=btt;
if koniec then
begin
close(f);
halt;
end;
b:=btt;
len:=word(a)+(word(b) shl 8);
writeln;
write(len-2:6,' ');
for i:=0 to len-1 do
p[i]:=btt;
lenp:=len-2;
a:=p[0];
if (a=0)and(lenp=17)then
begin
a:=p[1];
case a of
3:write('Bytes: ');
1:write('Number array: ');
2:write('Character array: ');
0:write('Program: ');
else writeln('░░░░░░░░░░░░░░░░');
end;
if a<4 then
begin
for i:=2 to 11 do
begin
write(chr(p[i]));
end;
case a of
0:begin
ii:=p[15] and $c0;
if ii=0 then write(' LINE ',p[14]+word(p[15]) shl 8);
end;
3:begin
write(' CODE ',p[14]+word(p[15]) shl 8,',',p[12]+word(p[13]) shl 8);
end;
end;
end;
end else
writeln('▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒');
blockwrite(f,lenp,2);
blockwrite(f,p,len);
asm sti end;
sound(1000);
delay(10);
nosound;
until koniec;
close(f);
end.