uses Crt,Graph;
var p,pc: Pointer;
grm,grd,x,y,x0,y0,lx,ly,hx,hy:integer;
size,c:word; ch:char;
BEGIN
write('vvedite radiysu:');
read(lx,ly);
hx:=5; hy:=5;
grd:=0; InitGraph (grd,grm,'D:\Tp\Bgi');
size:=ImageSize (0,0,lx,ly);
GetMem (pc,size); GetMem (p,size);
SetFillStyle (1,2);
GetImage (0,0,lx,ly,p^);
x:=0; y:=0;
fillellipse(lx div 2,ly div 2,lx div 2 ,ly div 2);
GetImage (0,0,lx,ly,pc^);
Repeat
ch:=ReadKey;
If Ord(ch)=0
then
begin
ch:=ReadKey;
x0:=x; y0:=y;
Case Ord(ch) of
77: If x<getmaxx-hx
then x:=x+hx;
75: If x>hx
then x:=x-hx;
72: If y>hy
then y:=y-hy;
80: If y<getmaxy-hy
then y:=y+hy
end;
If (x<>x0) OR (y<>y0)
then begin
PutImage (x0,y0,p^,0);
GetImage (x,y,x+lx,y+ly,p^);
PutImage (x,y,pc^,0);
end
end
else if ord(ch)=32 then
for x:=x to x+4 do
begin
x0:=x; y0:=y;
PutImage (x0,y0,p^,0);
GetImage (x,y,x+lx,y+ly,p^);
PutImage (x,y,pc^,0);
end;
until Ord(ch)=27;
CloseGraph
END.