[comp.sys.ibm.pc.misc] Controlling mouse cursor

barry@gpu.utcs.utoronto.ca (Barry Lay) (03/25/91)

Hello,
  I am trying to change the mouse cursor in graphics mode with the code 
included below.  I have created a structure which contains what I understand
is needed by INT 33/9, and have written a routine to put the necessary values
into the appropriate registers to get the job done.  I can understand that if
I have the pointer to the screen and cursor masks confused I will get garbage,
but this routine does nothing at all.  That is, the cursor remains as an arrow
and all of my other mouse routines (like button press, etc) continue to work
as if nothing happened.

I am programming using MSC 6.00a, under DOS 4.01.  Eventually I will break
down and get a Windows development package, but for now I would like this
to work in DOS.  If there is a more appropriate news group for this, please
let me know.


struct POINTER_MASKS
{
    char ScreenMask[8], CursorMask[8];
};

typedef struct
{
    int HotX, HotY;
    struct POINTER_MASKS far * Masks;
} CURSOR;

#define MOUSE 33

void mouseCursor( CURSOR Cursor )
{
    union REGS regs;
    struct SREGS sregs;

    regs.x.ax=9;
    regs.x.bx=Cursor.HotX;
    regs.x.cx=Cursor.HotY;
    segread( &sregs );
    sregs.es=FP_SEG( Cursor.Masks );
    regs.x.dx=FP_OFF( Cursor.Masks );
    int86x( MOUSE, &regs, &regs, &sregs );
}

Any help would be much appreciated.
Barry

rkl@cbnewsh.att.com (kevin.laux) (03/25/91)

In article <1991Mar25.081620.10977@gpu.utcs.utoronto.ca>, barry@gpu.utcs.utoronto.ca (Barry Lay) writes:
	[trying to change mouse cursor shape deleted]

> struct POINTER_MASKS
> {
>     char ScreenMask[8], CursorMask[8];
      ^^^^	      ^		     ^
      int	     16             16
The masks are bit mapped blocks of 16 bit words
> };
> 
> #define MOUSE 33
		^^
		0x0033
Must be HEX not decimal; you were calling Int 21h Function 09h (display string),
which is why the mouse cursor never changed.

	[code deleted]

>     int86x( MOUSE, &regs, &regs, &sregs );
> }

Anyway, once you make the above changes, the code should work ok.  Your next
possible problem will be getting the data values in the masks to work out
right :-).

-- 
________________________________________________________________________________
	R. Kevin Laux				Email: rkl1@hound.att.com
	AT&T Bell Labs				Voice: (908) 949-1160
	Holmdel, NJ 07733			Fax:   (908) 949-0959