program Test;
uses CRT, Mouse;
var
  isExit: Boolean := FALSE;
  X, Y:   DWord;
  star:   Word := $0F2A;
  space:  Word := $0F00;

{-----------------------------------------------------------------------}
procedure MouseHnd(Mask, Buttons, X, Y, MovX, MovY: System.Word);
begin
  if Mask = $01 then begin
{    IncAngles(MovX, MovX);}
{    SetMousePos(0, 0);}
  end;
  GotoXY(1, 2);
  Writeln('XPos = ', MickyToText(X),', YPos = ', MickyToText(Y), '  ', MovX, ' ', MovY, '      ');
end;
{-----------------------------------------------------------------------}
procedure MyHnd(Mask, Buttons, X, Y, MovX, MovY: System.Word);
begin

end;

begin
 ClrScr;
 Writeln('Press Esc to exit');
 HideCursor;
 InitMouse;
 SetMouseRange(0, 0, 4*361, 8*180);
 SetMouseHandler($4B, MouseHnd);
 ShowMouse;
 repeat
  X := MickyToText(GetMouseX) + 1;
  Y := MickyToText(GetMouseY) + 1;
  if (LeftButtonPressed) and (Y > 2) and (Y < 25) then
    WriteAttr (X, Y, Star, 1);
  if (RightButtonPressed) and (Y > 2) and (Y < 25) then
    WriteAttr (X, Y, Space, 1);
  if Keypressed then

    isExit := ReadKey = #27;
 until isExit;
 ShowCursor;
 DoneMouse;
end.