home *** CD-ROM | disk | FTP | other *** search
- /*********************
- *
- * ms_test.c - mouse test program.
- *
- * Purpose: This file contains functions to test a mouse.
- *
- * Blackstar C Function Library
- * (c) Copyright 1985 Sterling Castle Software
- *
- *******/
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <dos.h>
- #include "blackstr.h"
- #include "gr_head.h"
- #include "sc_head.h"
- #include "ms_head.h"
-
- void main()
- {
- int i;
- struct SREGS segs;
-
- /******************************************************
- INITIALIZE SYSTEM AND SCREEN FOR PROPER ADAPTER TYPE
- *******************************************************/
- kb_init(NULL,NULL,NULL);
- sc_init(NUL,NUL,NUL); /* just get current parms */
- if(!ms_stat()) {
- sc_clr();
- sc_puts("\n\rSorry, no mouse driver detected.\n");
- exit(0);
- }
- switch (sc_adp_) {
- case MON_ADP:
- sc_clr();
- sy_beep();
- sc_puts("\n\rSorry, you need a color adapter to run this demo.\n");
- exit(0);
-
- case CGA_ADP:
- gr_init(GR320,WHITE,BLUE,gr_cgap1_);
- break;
-
- case EGA_ADP:
- gr_init(EGA_10,WHITE,BLUE,NULL);
- break;
-
- default:
- sc_puts("Screen adapter not recognized..\n\r");
- exit(0);
- }
-
- /**************************************************
- JUST MOVE ON SCREEN AND SHOW/HIDE CURSOR
- ***************************************************/
- sc_puts("Starting mouse tests\n\r");
- sc_puts(" Move mouse - move cursor on screen\n\r");
- sc_puts(" Left button - mouse cursor on\n\r");
- sc_puts(" Right button - mouse cursor off\n\r");
- sc_puts(" Both buttons - end test\n\r");
-
- ms_init(); /* set up mouse cursor */
- ms_cset(250,100); /* initial cursor position */
-
- while((mlbut_ | mrbut_)!= 0x03) {
- while(!ms_press()); /* wait for button down */
- for (i = 0; i < 2000; i++); /* wait for de-bounce */
- ms_press(); /* get updated value */
- if (mlbut_ != 0)
- ms_cson();
- if (mrbut_ != 0)
- ms_csof();
- }
- sc_init(MO_BW80,BLACK,WHITE);
- sc_clr();
- }
-