uses screen, memory, crt, dos;

const
VGA=$a000;


procedure precals(where:word); {precalc tables}
var x,y,xt,z:integer;
begin
for y:=0 to 255 do
for x:=0 to 255 do begin
      z:=y shl 1 +1;
      xt:=((x-160)*128 div z);
      mem[where:word((x-160)*256+y)]:=byte(xt);
end;
end;

procedure save_data(name:string; size:longint; from:word);
var fw1:file;
i:word;
begin
Assign(fw1, name);
Rewrite(fw1,1);
Reset(fw1, 1);
for i:=0 to size-1 do BlockWrite(fw1, mem[from:i], 1);
Close(fw1);
end;


var
fw1,fw2:file;

c, i, x,y,n,m,yy,xx:word;
fr:file;
col, r,g,b:byte;
size:word;

begin
SetUpVirtual(scr,vaddr);
SetUpVirtual(scr2, vaddr2);
SetUpVirtual(scr3, vaddr3);

Precals(vaddr);

save_data('floor.bin', 65536, vaddr);

WriteLn('Done');


readkey;


end.