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

  1. /* vputm.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_putm (const char *p, int len)
  11. {
  12.   if (len > 0)
  13.     {
  14.       if (_osmode == OS2_MODE)
  15.         {
  16.           BYTE attr;
  17.  
  18.           attr = (BYTE)_v_attr;
  19.           VioWrtCharStrAtt (p, len, _v_y, _v_x, &attr, 0);
  20.         }
  21.       else if (_v_mem != NULL)
  22.         {
  23.           char *dst;
  24.  
  25.           dst = _v_mem + (_v_y * _v_width + _v_x) * 2;
  26.           while (len > 0)
  27.             {
  28.               dst[0] = *p++;
  29.               dst[1] = (char)_v_attr;
  30.               --len; dst += 2;
  31.             }
  32.         }
  33.       else
  34.         {
  35.           int i;
  36.           union REGS r;
  37.  
  38.           for (i = 0; i < len; ++i)
  39.             {
  40.               r.h.ah = 0x02;
  41.               r.h.bh = 0x00;
  42.               r.h.dl = (unsigned char)_v_x + i;
  43.               r.h.dh = (unsigned char)_v_y;
  44.               _int86 (0x10, &r, &r);
  45.               r.h.ah = 0x09;
  46.               r.h.bh = 0;
  47.               r.h.bl = (unsigned char)_v_attr;
  48.               r.h.al = p[i];
  49.               r.x.cx = 1;
  50.               _int86 (0x10, &r, &r);
  51.             }
  52.           r.h.ah = 0x02;
  53.           r.h.bh = 0x00;
  54.           r.h.dl = (unsigned char)_v_x;
  55.           r.h.dh = (unsigned char)_v_y;
  56.           _int86 (0x10, &r, &r);
  57.         }
  58.     }
  59. }
  60.