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 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
/*
** Program to set the size of the cursor
**
** Public domain demonstration by Bob Jarvis
*/
#include <stdio.h> /* puts() */
#include <dos.h> /* int86(), union REGS */
#include <stdlib.h> /* exit(), atoi() */
char *help = "CURSIZE - sets the cursor size.\n"
"Usage:\n"
" CURSIZE <top-line> <bottom-line>\n"
"where\n"
" top-line = top line of cursor within character cell\n"
" bottom-line = bottom line\n"
"Example:\n"
" CURSIZE 7 8 <set cursor to bottom 2 lines of VGA>\n"
" CURSIZE 32 32 <turns cursor off>";
void cursor_size(int top_line, int bottom_line)
{
union REGS regs;
regs.h.ah = 1;
regs.h.ch = (unsigned char)top_line;
regs.h.cl = (unsigned char)bottom_line;
int86(0x10,®s,®s);
}
void get_cursor_size(int *top_line, int *bottom_line)
{
union REGS regs;
regs.h.ah = 3;
regs.h.bh = 0;
int86(0x10, ®s, ®s);
*top_line = regs.h.ch;
*bottom_line = regs.h.cl;
return;
}
void main(int argc, char *argv[])
{
int top, bottom;
if(argc < 3)
{
puts(help);
exit(1);
}
top = atoi(argv[1]);
bottom = atoi(argv[2]);
cursor_size(top,bottom);
top = bottom = -1;
get_cursor_size(&top, &bottom);
printf("top = %d bottom = %d\n", top, bottom);
}
|