home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / snip9707.zip / CURSIZE.C < prev    next >
C/C++ Source or Header  |  1997-07-05  |  2KB  |  70 lines

  1. /* +++Date last modified: 05-Jul-1997 */
  2.  
  3. /*
  4. **  Program to set the size of the cursor
  5. **
  6. **  Public domain demonstration by Bob Jarvis
  7. */
  8.  
  9. #include <stdio.h>      /* puts()               */
  10. #include <dos.h>        /* int86(), union REGS  */
  11. #include <stdlib.h>     /* exit(), atoi()       */
  12.  
  13. char *help =  "CURSIZE - sets the cursor size.\n"
  14.               "Usage:\n"
  15.               "   CURSIZE <top-line> <bottom-line>\n"
  16.               "where\n"
  17.               "   top-line = top line of cursor within character cell\n"
  18.               "   bottom-line = bottom line\n"
  19.               "Example:\n"
  20.               "   CURSIZE 7 8     <set cursor to bottom 2 lines of VGA>\n"
  21.               "   CURSIZE 32 32   <turns cursor off>";
  22.  
  23. void cursor_size(int top_line, int bottom_line)
  24. {
  25.       union REGS regs;
  26.  
  27.       regs.h.ah = 1;
  28.       regs.h.ch = (unsigned char)top_line;
  29.       regs.h.cl = (unsigned char)bottom_line;
  30.  
  31.       int86(0x10,®s,®s);
  32. }
  33.  
  34. void get_cursor_size(int *top_line, int *bottom_line)
  35. {
  36.       union REGS regs;
  37.  
  38.       regs.h.ah = 3;
  39.       regs.h.bh = 0;
  40.       int86(0x10, ®s, ®s);
  41.  
  42.       *top_line = regs.h.ch;
  43.       *bottom_line = regs.h.cl;
  44.  
  45.       return;
  46. }
  47.  
  48. main(int argc, char *argv[])
  49. {
  50.       int top, bottom;
  51.  
  52.       if(argc < 3)
  53.       {
  54.             puts(help);
  55.             exit(1);
  56.       }
  57.  
  58.       top = atoi(argv[1]);
  59.       bottom = atoi(argv[2]);
  60.  
  61.       cursor_size(top,bottom);
  62.  
  63.       top = bottom = -1;
  64.  
  65.       get_cursor_size(&top, &bottom);
  66.  
  67.       printf("top = %d  bottom = %d\n", top, bottom);
  68.       return 0;
  69. }
  70.