Selecting an ASCII Character for Software Text Cursor

Last reviewed: September 16, 1996
Article ID: Q68877
The information in this article applies to:
  • Microsoft Mouse Driver for MS-DOS, versions 6.x, 7.x, 8.x, and 9.0

SUMMARY

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.

MORE INFORMATION

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;

main() {

     _setvideomode(_DEFAULTMODE); /* select std text mode */

     iregs.x.ax = 0;
     int86(0x33, &iregs, &oregs); /* initialize mouse */

     iregs.x.ax = 10; /* choose mouse function 10 */
     iregs.x.bx = 0;  /* select software text cursor */
     iregs.x.cx = 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 */

     iregs.x.ax = 1;
     int86(0x33, &iregs, &oregs); /* show mouse cursor */

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

}


KBCategory: kbhw
KBSubcategory:
Additional reference words: 7.00 7.03 7.04 7.05 8.00 8.10 8.20 9.00
1.00 2.00


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 16, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.