home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / EMXLIB8F.ZIP / EMX / LIB / GRAPH / GVGAPAL.C < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-02  |  712 b   |  30 lines

  1. /* gvgapal.c (emx+gcc) -- Copyright (c) 1987-1993 by Eberhard Mattes */
  2.  
  3. #include <stdlib.h>
  4. #include <graph.h>
  5. #define INCL_VIO
  6. #include <os2emx.h>
  7. #include "graph2.h"
  8. #include <sys/hw.h>
  9.  
  10. static int port_flag = 0;
  11.  
  12. void g_vgapal (const char *pal, int first, int n, int wait_flag)
  13. {
  14.   if (port_flag == 0)
  15.     if (_portaccess (0x3c8, 0x3c9) == 0 && _portaccess (0x3da, 0x3da) == 0)
  16.       port_flag = 1;
  17.     else
  18.       port_flag = -1;
  19.   if (port_flag == 1 && n >= 1 && first >= 0 && first <= 255
  20.       && first + n <= 256)
  21.     {
  22.       GLOCK;
  23.       if (wait_flag)
  24.         _wait01 (0x3da, 0x08);
  25.       _outp8 (0x3c8, first);
  26.       _outps8dac (0x3c9, pal, 3 * n);
  27.       GUNLOCK;
  28.     }
  29. }
  30.