uses screen, memory, crt, dos;

const
VGA=$a000;

Procedure DodecBGTable(x0,y0: word; buf1:word);
var
x,y:integer;
r:single;
u,v:byte;
begin
    for y:=0 to 99 do
     for x:=0 to 319 do
       begin
          r:=sqrt((y*2-y0)*(y*2-y0)+(x-x0)*(x-x0));
          v:= byte(((X-x0)*192) div (256-round(128-r)));
          u:= byte(((Y*2-y0)*192) div (256-round(128-r)));
          memw[buf1:word((x+y*320) shl 1)]:=v+u*256;
       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);

  DodecBGTable(160,100,vaddr);

  save_data('dod_tbl.bin', 64000, vaddr);

   WriteLn('Done');


readkey;


end.