diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2008-01-27 11:37:44 +0100 |
---|---|---|
committer | Tobias Klauser <tklauser@xenon.tklauser.home> | 2008-01-27 11:37:44 +0100 |
commit | 7e0f021a9aec35fd8e6725e87e3313b101d26f5e (patch) | |
tree | b1cacc4b24393f517aeb4610e9e1021f954307a8 /reference/C/CONTRIB/SNIP/cursor.c |
Initial import (2.0.2-6)2.0.2-6
Diffstat (limited to 'reference/C/CONTRIB/SNIP/cursor.c')
-rwxr-xr-x | reference/C/CONTRIB/SNIP/cursor.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/reference/C/CONTRIB/SNIP/cursor.c b/reference/C/CONTRIB/SNIP/cursor.c new file mode 100755 index 0000000..ce5b04e --- /dev/null +++ b/reference/C/CONTRIB/SNIP/cursor.c @@ -0,0 +1,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;
+ }
+}
|