program rotations;

uses crush13h,crt;

var count,add:word;
    x,y:integer;
    c:char;

begin
     video_mode ( $13);
     initvirt;
     inittables;

     loadpcx ('..\..\..\neopaint\pcx\moia95_2.pcx',vp[2]);

     {move (mem[vp[2]:0],mem[vp[1]:0],64000);}

     count:=0;
     add:=5;

     repeat
     count:=count+add;
     if count>1799 then count:=count-1259;



     for y:=-100 to 100 do
         begin
              for x:=-160 to 160 do
                  begin

                  mem[vga:320*round(100-y)+round(160+x)]:=
                  mem[vp[2]:320*round(100-y*sines^[count])+round(160+x*cosines^[count])];

                  {mem[vp[1]:320*round(100-y*sines^[count])+round(160+x*cosines^[count])]:=
                  mem[vp[2]:320*round(100-y)+round(160+x)];
                  }
                  {mem[vga:320*round(100-y*cosines^[count]*cosines^[count])+round(160+x*cosines^[count])]:=
                  mem[vp[2]:320*round(100-y)+round(160+x)];
                  }
                  {mem[vga:320*round(100-y*sines^[count])+round(160+x*sines^[count])]:=
                  mem[vp[2]:320*round(100-y)+round(160+x)];
                  }
                  {mem[vga:320*round(100-y)+round(160+x)]:=
                  mem[vp[2]:320*round(100-(y-sines^[count]))+round(160+(x-cosines^[count]))];
                  }
                  {mem[vga:320*round(100-y)+round(160+x)]:=
                  mem[vp[2]:320*round(100-(y*count-sines^[round(y*count)]))+round(160+(x*count-cosines^[round(x*count)]))];
                  }
                  {mem[vga:320*round(100-y)+round(160+x)]:=
                  mem[vp[2]:320*round(100-(y*sines^[count]*5))+round(160+(x*cosines^[count]*5))];
                  }
                  {mem[vp[1]:320*(100-y)+(160+x)]:=
                  mem[vp[2]:320*round(100-(Y*Cosines^[count]-X*Sines^[count]))+
                  round(160+(X*Cosines^[count]+Y*Sines^[count]))];
                  }
                  end;
         end;
     {move (mem[vp[1]:0],mem[vga:0],64000);}
     waitvbl;

     if keypressed=true then c:=readkey;
     until c=#27;

     cleartables;
     closevirt;
     video_mode ( 03);
end.
