/* mouse2.c */
#define MAXX 639
#define MINX 0
#define MAXY 399
#define MINY 0

SHORT mx,my;

mouse()
{
   char button;
   struct IntuiMessage *BdMsg;
   APTR Maddress;

   button=1;
   while(button){
      while (BdMsg = (struct IntuiMessage *)GetMsg(w->UserPort)){
         Maddress = BdMsg->IAddress;
         mx = BdMsg->MouseX;
         my = BdMsg->MouseY;
         if (mx>MAXX)
            mx=MAXX;
         if (mx<MINX)
            mx=MINX;
         if (my>MAXY)
            my=MAXY;
         if (my<MINY)
            my=MINY;
         button=(*((unsigned char *)0xbfe001)) & 0x40;
         ReplyMsg(BdMsg);
      }
   }
}
