home *** CD-ROM | disk | FTP | other *** search
- #include <dos.h>
- #include <stdlib.h>
- #include <stdio.h>
-
- #define MOUSE 0x33
- #define VIDEO 0x10
-
- void GMODE ();
- void TMODE ();
-
- main ()
-
- {
- union REGS inregs, outregs;
- struct SREGS segregs;
- char far *lpMem;
- char cVideoMode;
-
- /* Do whatever is necessary to setup display hardware */
- lpMem = (char far *)0x00000449; /* Video BIOS mode add. */
- cVideoMode = *lpMem; /* Get old Video mode */
- GMODE ();
- /* Set Video BIOS mode byte to 6 for single step cursor increment */
- *lpMem = 6; /* HGC Video Page 0 */
-
- /* Reset Driver to recognize single step mode and set defaults */
- inregs.x.ax = 0;
- int86 (MOUSE, &inregs, &outregs);
-
- inregs.x.ax = 1;
- int86 (MOUSE, &inregs, &outregs);
-
- /* Loop to display cursor position when left button is clicked */
- do {
- /* Check button status */
- inregs.x.ax = 3;
- int86 (MOUSE, &inregs, &outregs);
-
- /* If left button clicked, display position */
- if (outregs.x.bx & 1) {
- printf ("%d %d\n", outregs.x.cx, outregs.x.dx);
- /* Wait for left button release before continuing */
- do {
- int86 (MOUSE, &inregs, &outregs);
- } while (outregs.x.bx & 1);
- }
-
- } while (!(outregs.x.bx & 2)); /* Loop 'til right pressed */
-
- /* Hide Mouse cursor */
- inregs.x.ax = 2;
- int86 (MOUSE, &inregs, &outregs);
-
- /* Clear screen and restore video mode */
- TMODE ();
- *lpMem = cVideoMode;
- }