home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / EMXLIB8F.ZIP / EMX / LIB / VIDEO / VGETLINE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-02  |  1.1 KB  |  49 lines

  1. /* vgetline.c (emx+gcc) -- Copyright (c) 1987-1993 by Eberhard Mattes */
  2.  
  3. #include <stdlib.h>
  4. #include <dos.h>
  5. #define INCL_VIO
  6. #include <os2emx.h>
  7. #include <sys/video.h>
  8. #include "video2.h"
  9.  
  10. void v_getline (char *dst, int x, int y, int count)
  11. {
  12.   if (count > 0)
  13.     {
  14.       if (_v_mem != NULL)
  15.         memcpy (dst, _v_mem + (y * _v_width + x) * 2, count * 2);
  16.       else if (_osmode == OS2_MODE)
  17.         {
  18.           USHORT len;
  19.  
  20.           len = count * 2;
  21.           VioReadCellStr (dst, &len, y, x, 0);
  22.         }
  23.       else
  24.         {
  25.           union REGS r;
  26.           int i;
  27.  
  28.           for (i = 0; i < count; ++i)
  29.             {
  30.               r.h.ah = 0x02;
  31.               r.h.bh = 0;
  32.               r.h.dl = x + i;
  33.               r.h.dh = y;
  34.               _int86 (0x10, &r, &r);
  35.               r.h.ah = 0x08;
  36.               _int86 (0x10, &r, &r);
  37.               dst[0] = r.h.al;
  38.               dst[1] = r.h.ah;
  39.               dst += 2;
  40.             }
  41.           r.h.ah = 0x02;
  42.           r.h.bh = 0x00;
  43.           r.h.dl = (unsigned char)_v_x;
  44.           r.h.dh = (unsigned char)_v_y;
  45.           _int86 (0x10, &r, &r);
  46.         }
  47.     }
  48. }
  49.