home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume34 / vesa_lib / part01 / main.cpp next >
Encoding:
C/C++ Source or Header  |  1993-01-10  |  1.8 KB  |  107 lines

  1. /*
  2.  
  3. Written by: Robert C. Pendleton
  4.  
  5. Placed in the public domain by the author.
  6.  
  7. */
  8.  
  9. #include <dos.h>
  10. #include <conio.h>
  11. #include <stdio.h>
  12. #include <memory.h>
  13. #include "ptypes.h"
  14. #include "vesa.h"
  15.  
  16. //---------------------------------------------------
  17.  
  18. static uint8 _huge *screen = (uint8 *) 0xA0000000L;
  19. vesaInfo info;
  20. vesaModeInfo modeInfo;
  21.  
  22. //---------------------------------------------------
  23.  
  24. void
  25. main()
  26. {
  27.     int16 oldMode;
  28.     uint8 _huge *scrnAddr;
  29.     int16 i;
  30.     int16 j;
  31.     uint32 pixel;
  32.     uint32 pixels[] =
  33.     {
  34.         0x00000000l,
  35.         0x01010101l,
  36.         0x02020202l,
  37.         0x03030303l,
  38.         0x04040404l,
  39.         0x05050505l,
  40.         0x06060606l,
  41.         0x07070707l,
  42.         0x08080808l
  43.     };
  44.  
  45.  
  46.     getVesaMode(&oldMode);
  47.  
  48.     setVesaMode(g320x200);
  49.     setVesaScanLineLength(1024);
  50.  
  51.     setVGAColor(0, 0xf0, 0xf0, 0xf0);
  52.     setVGAColor(1, 0x00, 0x00, 0xff);
  53.     setVGAColor(2, 0x00, 0xff, 0x00);
  54.     setVGAColor(3, 0x00, 0xff, 0xff);
  55.     setVGAColor(4, 0xff, 0x00, 0x00);
  56.     setVGAColor(5, 0xff, 0x00, 0xff);
  57.     setVGAColor(6, 0xff, 0xff, 0x00);
  58.     setVGAColor(7, 0xff, 0xff, 0xff);
  59.     setVGAColor(8, 0x3c, 0x3c, 0x3c);
  60.  
  61.  
  62. top:
  63.     for(i = 0; i < 16; i++)
  64.     {
  65.         setVesaWinAAddr(i);
  66.         memset(screen, i%8, 0x8000);
  67.         memset(screen + 0x8000l, i%8, 0x8000);
  68.     }
  69.  
  70.     for(i = 0; i < 640; i += 10)
  71.     {
  72.         setVesaDisplayStart(0, i);
  73.     }
  74.  
  75.     for(i = 0; i < 16; i++)
  76.     {
  77.         setVesaWinAAddr(i);
  78.         scrnAddr = screen;
  79.         for(j = 0; j < 64; j++)
  80.         {
  81.             *(scrnAddr +   0) = 8;
  82.             *(scrnAddr +  32) = 8;
  83.             *(scrnAddr +  64) = 8;
  84.             *(scrnAddr +  96) = 8;
  85.             *(scrnAddr + 128) = 8;
  86.             *(scrnAddr + 160) = 8;
  87.             *(scrnAddr + 192) = 8;
  88.             *(scrnAddr + 224) = 8;
  89.             *(scrnAddr + 256) = 8;
  90.             *(scrnAddr + 288) = 8;
  91.             *(scrnAddr + 320) = 8;
  92.  
  93.             scrnAddr += 1024;
  94.         }
  95.     }
  96.  
  97.     for(i = 0; i < 1024; i += 8)
  98.     {
  99.         setVesaDisplayStart(i, 0);
  100.     }
  101.  
  102.     setVesaDisplayStart(0, 0);
  103.     if(!_kbhit())goto top;
  104.     while(!_kbhit());_getch();
  105.     setVesaMode(oldMode);
  106. }
  107.