home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l200 / 6.ddi / LIB / CURCTRL.C < prev    next >
Encoding:
C/C++ Source or Header  |  1986-09-02  |  1.2 KB  |  64 lines

  1.  
  2. /* cur_control(cursor, start, stop) sets cursor size and visibility
  3.  
  4.     Copyright (c) 1985 by JMI Software Consultants, Inc.
  5.  
  6.  */
  7.  
  8. #include "acom.h"
  9. #include "host.h"
  10.  
  11. VOID cur_control(cursor, start, stop)
  12.     INT cursor, start, stop;
  13.     {
  14.     INTERN REGVAL cur_type = {0x0100, 0x0000, 0x0C0D, 0x0000};
  15.     INTERN REGVAL cga_type = {0x0100, 0x0000, 0x0607, 0x0000};
  16.     BITS cx;
  17.     REGVAL r;
  18.     LOCAL BOOL colordev = NO;
  19.     LOCAL BOOL firsttime = YES;
  20.  
  21.     if (firsttime)
  22.         {
  23.         firsttime = NO;
  24.         int86(0x11, &cga_type, &r);
  25.         if ((~r.ax) & 0x0030)
  26.             colordev = YES;
  27.         }
  28.     if (colordev)
  29.         cx = cga_type.cx;
  30.     else
  31.         cx = cur_type.cx;
  32.     if (start != -1)
  33.         {
  34.         if (start < 0 || start > 31)
  35.             xerror(1, "LOCATE");
  36.         else
  37.             cx = (cx & 0x00ff) | (start << 8);
  38.         if (stop == -1)
  39.             stop = start;
  40.         if (stop < 0 || stop > 31)
  41.             xerror(1, "LOCATE");
  42.         else
  43.             cx = (cx & 0xff00) | stop;
  44.         }
  45.     if (cursor != -1)
  46.         if (cursor == 0)
  47.             cx |= 0x2000;
  48.         else
  49.             if (cursor == 1)
  50.                 cx &= 0x1f1f;
  51.             else
  52.                 xerror(1, "LOCATE");
  53.     if (!colordev && cx != cur_type.cx)
  54.         {
  55.         cur_type.cx = cx;
  56.         int86(0x10, &cur_type, &r);
  57.         }
  58.     else if (cga_type.cx != cx)
  59.         {
  60.         cga_type.cx = cx;
  61.         int86(0x10, &cga_type, &r);
  62.         }
  63.     }
  64.