home *** CD-ROM | disk | FTP | other *** search
- /* TITLE vcursor.c
- * AUTHOR Tim Spencer - Compuserve [73657,1400]
- * DATE March 13, 1987
- */
-
-
-
- #include "dos.h"
- #include "video.h"
-
- void vid_set_cur(row,col) /* set cursor position */
- int row ; /* new row number */
- int col ; /* new column number */
- {
- union REGS inregs , outregs ;
-
- inregs.h.dh = (char)row ;
- inregs.h.dl = (char)col ;
- inregs.x.bx = 0 ;
- inregs.h.ah = V_SET_CUR;
- int86(VID_INT,&inregs,&outregs) ;
- }
-
- void vid_get_cur(prow,pcol) /* get current cursor position */
- int *prow ; /* store row number here */
- int *pcol ; /* store column number here */
- {
- union REGS inregs , outregs ;
-
- inregs.x.bx = 0 ;
- inregs.h.ah = V_GET_CUR;
- int86(VID_INT,&inregs,&outregs) ;
- *prow = outregs.h.dh ;
- *pcol = outregs.h.dl ;
- }
-
- void vid_cur_rt(num) /* move cursor right num positions */
- int num;
- {
- int row, col;
-
- vid_get_cur(&row,&col);
- vid_set_cur(row,col+num);
- }
-
- /*
- * vid_cur_switch - turns the blinking cursor on/off. Can also be used
- * to change cursor shape by changing the top and bottom values before
- * sending the interrupt.
- */
-
- void vid_cur_switch(flag) /* turns cursor on/off */
- int flag; /* flag=0 is off, flag>0 is on */
- {
-
- union REGS inregs, outregs; /* defined in dos.h */
- int top; /* top of cursor */
- int bottom; /* bottom of cursor */
- int cols; /* columns on display */
-
- if (vid_state(&cols) == MONO_MODE) { /* is display mono? */
- top = 12; /* yes - mono cursor shape */
- bottom = 13;
- }
- else {
- top = 6; /* no - color cursor shape */
- bottom = 7;
- }
-
- inregs.h.ch = (char)top; /* put top into ch register */
- inregs.h.cl = (char)bottom; /* put bottom into cl register */
- inregs.h.ah = V_CUR_TYPE; /* set cursor size signal */
-
- if (!flag) /* clear cursor if flag = 0 */
- inregs.x.cx = 0x2000;
-
- int86(VID_INT, &inregs, &outregs); /* send interrupt */
-
- }
-