File: cursor.c

package info (click to toggle)
c-cpp-reference 2.0.2-6
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny
  • size: 8,012 kB
  • ctags: 4,612
  • sloc: ansic: 26,960; sh: 11,014; perl: 1,854; cpp: 1,324; asm: 1,239; python: 258; makefile: 115; java: 77; awk: 34; csh: 9
file content (52 lines) | stat: -rwxr-xr-x 2,400 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*****************************************************************/
/**   CURSOR()                                                  **/
/**   ARGUMENTS: A char variable identifiny what to do with     **/
/**              the cursor.                                    **/
/**   RETURN: none                                              **/
/**                                                             **/
/**   DESCRIPTION:  This function receives a character which    **/
/**                 tells it to do one of several things.       **/
/**                 Turn the cursor on or off, or save the      **/
/**                 cursor positon, or restore the position.    **/
/**                                                             **/
/**   BY Bill Wilkie, 1988                                      **/
/*****************************************************************/
 
#include <dos.h>
 
static int position;            /* global to hold cursor postion */
 
void cursor(char tmp)
{
   union REGS inregs,outregs;                   /* cpu registers */
    
   switch(tmp)
   {
      case 'h' :                                  /* CURSOR OFF */
               inregs.h.ah = 1;              /* set cursor size */
               inregs.h.ch = 0x20;  /* set bit turns cursor off */
               int86(0x10,&inregs,&outregs);
               break;
 
      case 's' :                      /* SAVE CURSOR POSITION */
               inregs.h.ah = 3; /* read cursor positon and size */
               inregs.h.bh = 0;              /* from page zero */
               int86(0x10,&inregs,&outregs);
               position = outregs.x.dx;       /* store positon */
               break;
 
      case 'r' :                     /* RESTORE CURSOR POSITON */
               inregs.h.ah = 2;         /* set cursor positon */
               inregs.h.bh = 0;              /* on page zero */
               inregs.x.dx = position; /* at this old position */
               int86(0x10,&inregs,&outregs);
               break;
 
      case 'o' :                                   /* CURSOR ON */
               inregs.h.ah = 1;     /* set cursor size */     
               inregs.h.ch = 6;     /* cursor start line */
               inregs.h.cl = 7;     /* cursor end line */
               int86(0x10,&inregs,&outregs);
               break;
    }
}