home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 17 / CD_ASCQ_17_101194.iso / vrac / raycst.zip / VIDEO.CPP < prev    next >
C/C++ Source or Header  |  1994-05-13  |  877b  |  57 lines

  1. #include <stdio.h>
  2. #include <dos.h>
  3. #include "video.h"
  4.  
  5. struct RGB
  6. {
  7.   byte Red;
  8.   byte Green;
  9.   byte Blue;
  10. };
  11.  
  12. RGB palPalette[256];
  13.  
  14. void palLoad (char *Name)
  15. {
  16.   FILE* Palette=fopen (Name,"rb");
  17.   fread (palPalette,1,768,Palette);
  18.   fclose (Palette);
  19. };
  20.  
  21. void palSet(void)
  22. {
  23.   palSetDAC ((char *)palPalette);
  24. };
  25.  
  26. void palSetDAC(char *Palette)
  27. {
  28.   union REGS r;
  29.   struct SREGS s;
  30.  
  31.   s.es = FP_SEG(Palette);       //dac_block is a pointer to DAC structure
  32.   r.x.dx = FP_OFF(Palette);
  33.  
  34.   r.x.ax = 0x1012;      //Function 1012 is set block of DAC registers
  35.   r.x.bx = 0;   //BX holds number to begin with (0 to 255)
  36.   r.x.cx = 255; //CX holds how many to set
  37.   int86x(0x10, &r, &r, &s);
  38.  
  39.   return;
  40. };
  41.  
  42. void VidOn (void)
  43. {
  44.   asm{
  45.      mov ax,0x13
  46.      int 0x10
  47.   };
  48. };
  49.  
  50. void VidOff (void)
  51. {
  52.   asm{
  53.      mov ax,0x3
  54.      int 0x10
  55.   };
  56. };
  57.