
/* Simple mouse package.
   Copyright 1991 Dave Newman.
   Use for any purpose permitted as long
   as this copyright notice is included.*/
#include <dos.h>

int mouse_init()
   {
   union REGS regs;
   /* initialize mouse */
   regs.x.ax = 0;
   int86(0x33,&regs,&regs);
   return(regs.x.ax);
   }

void mouse_cursor(int value)
   {
   union REGS regs;
   /* turn mouse cursor on (1) or off (0) */
   if(value)
      regs.x.ax = 1;
   else
      regs.x.ax = 2;
   int86(0x33,&regs,&regs);
   }

void mouse_set_cursor(int x,int y)
   {
   union REGS regs;
   /* set mouse cursor to x,y position */
   regs.x.ax = 4;
   regs.x.cx = x;
   regs.x.dx = y;
   int86(0x33,&regs,&regs);
   }

void mouse_status(int *binfo,int *xinfo,int *yinfo)
   {
   union REGS regs;
   /* get mouse information on buttons
      being pressed and x,y position */
   regs.x.ax = 3;
   int86(0x33,&regs,&regs);
   *binfo = regs.x.bx;
   *xinfo = regs.x.cx;
   *yinfo = regs.x.dx;
   }

void mouse_text_cursor(int backround,int foreground)
   {
   union REGS regs;
   /* design text mouse cursor,
      similar to normal cursor */
   regs.x.ax = 10;
   regs.x.bx = 0;      /* software cursor */

   /* set backround color of mouse cursor */
   regs.x.cx = backround;

   /* set lines of cursor FFFF == Block */
   regs.x.dx = foreground;
   int86(0x33,&regs,&regs);
   }

