Selecting an ASCII Character for Software Text Cursor (68877)

The information in this article applies to:
    Microsoft Mouse driver for MS-DOS 9.0
    Microsoft Mouse driver for MS-DOS 6.x
    Microsoft Mouse driver for MS-DOS 7.x
    Microsoft Mouse driver for MS-DOS 8.x

This article was previously published under Q68877


The "Microsoft Mouse Programmer's Reference" states that the software text cursor defined in mouse function 10 is one of the 256 characters in the ASCII character set. It makes no mention of how the character is selected.


The software text cursor is created by ANDing (bitwise) the screen mask with the displayed character scan line. The result of this operation is then XORed with the cursor mask to create the cursor.

The low-order bits (0 through 7) in the cursor and screen mask are used to specify the ASCII character to be used for the mouse cursor.

The following program displays a white diamond (ASCII 4) on a black background on a standard text screen:
#include <dos.h>
#include <graph.h>
#include <stdio.h>

union REGS iregs, oregs;

     _setvideomode(_DEFAULTMODE); /* select std text mode */ = 0;
     int86(0x33, &iregs, &oregs); /* initialize mouse */ = 10; /* choose mouse function 10 */
     iregs.x.bx = 0;  /* select software text cursor */ = 0x0000;
                     /*  The screen mask 0x0000, when ANDed
                         with the displayes word, produced a
                         blank background to be XORed with. */
     iregs.x.dx = 0x0704;
                     /*  The cursor mask 0x0704, when XORed
                         with the result from above will set
                         a black background with a white
                         foreground (07).  The low-order bits
                         will select the diamond character.

                         *NOTE:  the low-order bits for the
                              cx and dx registers must be the
                              same. */
     int86(0x33, &iregs, &oregs);  /* call the function */ = 1;
     int86(0x33, &iregs, &oregs); /* show mouse cursor */

     getch(); /* pause here while waiting for a keystroke */


Modification Type: Major Last Reviewed: 9/24/2003
Keywords: KB68877