attach 'mouse'

! is a mouse present ?

x = call('mouse_pr')

if x

! yes it is

! turn on the mouse cursor

   x = call('mouse_sh')

   put do clear screen 

   put 'Move the mouse around and click the left / right buttons. Click both to end.' 

! loop until both buttons are pressed 

   a = 0

   while a < 30000 


! get the mouse status 

      b = call ('mouse_st')

! only print the mouse status if it changes

      if a <> b

         a = b

! print the mouse status 

         put at 35,12 , do clear end line 
         put a , do newline

      end if 

   end while

! turn off the mouse cursor

   put call('mouse_hi')

else
   put 'No mouse !'
   get x 
end if 

detach 'mouse' 

