home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / VGOVBE20.ZIP / TEST.C < prev    next >
C/C++ Source or Header  |  1997-03-25  |  4KB  |  163 lines

  1. //▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  2. // File        : TEST.H
  3. // Description : Vesa Bios Extention 2.0 test file
  4. // Notes       : Brought to you by Vertigo. If you use this, or have
  5. //               learned from this, send us an email and/or Greet us
  6. //               In your demo =).
  7. //
  8. //▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  9.  
  10. #include "STDIO.H"
  11. #include "VGOVBE20.H"
  12.  
  13. char *memModel[]=
  14. {
  15.   "TEXT",
  16.   "CGA",
  17.   "HERCULES",
  18.   "PLANAR",
  19.   "PACKED",
  20.   "MODEX",
  21.   "RGB",
  22.   "YUV"
  23. };
  24.  
  25. void printModes(VBEINFO *vbeInfo);
  26.  
  27. //░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  28. // Main entry point
  29. //░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  30. void main(void)
  31. {
  32.   VBEINFO *vbeInfo;
  33.  
  34.   // Detect the VBE bios
  35.  
  36.   if( (vbeInfo = vbeDetect()) == NULL )
  37.   {
  38.     printf("Can't find VESA bios extentions\n");
  39.     exit(0);
  40.   }
  41.  
  42.   // Print basic VBE info
  43.  
  44.   printf("\nVBE Version      : %d.%d\n"
  45.      "Oem              : %s\n"
  46.      "Total memory     : %gK\n",
  47.       vbeInfo->VbeVersion>>8,
  48.       vbeInfo->VbeVersion&0xFF,
  49.       vbeInfo->OemStringPtr,
  50.       ((float)vbeInfo->TotalMemory*64000.0f)/1024.0f);
  51.  
  52.  
  53.   // Print extended VBE 2.0 info, if available
  54.  
  55.   if( vbeInfo->VbeVersion >= 0x200 )
  56.   {
  57.  
  58.     printf("Oem software rev : %d.%d\n"
  59.        "Oem vendor name  : %s\n"
  60.        "Oem product name : %s\n"
  61.        "Oem product rev  : %s\n",
  62.         vbeInfo->OemSoftwareRev>>8,
  63.         vbeInfo->OemSoftwareRev&0xFF,
  64.         vbeInfo->OemVendorNamePtr,
  65.         vbeInfo->OemProductNamePtr,
  66.         vbeInfo->OemProductRevPtr);
  67.   }
  68.  
  69.   // Check capabilities
  70.  
  71.   if( vbeInfo->Capabilities & VBE_CAPS_8BITDAC )
  72.     printf("DAC can be 8bit\n");
  73.  
  74.   if( vbeInfo->Capabilities & VBE_CAPS_NONVGA )
  75.     printf("Non-VGA compatible controller\n");
  76.  
  77.   if( vbeInfo->Capabilities & VBE_CAPS_BLANKRAMDAC )
  78.     printf("Programmed DAC width blank bit\n");
  79.  
  80.  
  81.   printf("\nPress any key for mode list\n");
  82.   getch();
  83.  
  84.   printModes(vbeInfo);
  85.  
  86. }
  87.  
  88. //░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  89. // Print mode list
  90. //
  91. // In:
  92. //   vbeInfo -> VBEINFO structure
  93. //
  94. // Out:
  95. //   NONE
  96. //
  97. //░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  98. void printModes(VBEINFO *vbeInfo)
  99. {
  100.   VBEMODEINFO vbeModeInfo;
  101.   unsigned short *vbeMode;
  102.  
  103.   vbeMode      = vbeInfo->VideoModePtr;
  104.  
  105.   while( *vbeMode != 0xFFFF )
  106.   {
  107.     if( vbeGetModeInfo(*vbeMode,&vbeModeInfo) )
  108.     {
  109.       printf("%xh : %4d x %-4d %2dbpp  ",
  110.          *vbeMode,
  111.          vbeModeInfo.XResolution,
  112.          vbeModeInfo.YResolution,
  113.          vbeModeInfo.BitsPerPixel);
  114.     }
  115.  
  116.     // We only check overall mode attributes, and
  117.     // ignore window A and B, since we're aiming
  118.     // for LFB modes.
  119.  
  120.     if( vbeModeInfo.ModeAttributes & VBEMODE_CAPS_AVAILABLE )
  121.       printf("AVL ");
  122.     else
  123.       printf("--- ");
  124.  
  125.     if( vbeModeInfo.ModeAttributes & VBEMODE_CAPS_TTYOUTPUT )
  126.       printf("TTY ");
  127.     else
  128.       printf("--- ");
  129.  
  130.     if( vbeModeInfo.ModeAttributes & VBEMODE_CAPS_COLORMODE )
  131.       printf("CLR ");
  132.     else
  133.       printf("--- ");
  134.  
  135.     if( vbeModeInfo.ModeAttributes & VBEMODE_CAPS_GRAPHMODE )
  136.       printf("GRPH ");
  137.     else
  138.       printf("---- ");
  139.  
  140.     if( vbeModeInfo.ModeAttributes & VBEMODE_CAPS_NONVGA )
  141.       printf("NONVGA ");
  142.     else
  143.       printf("VGA    ");
  144.  
  145.     if( vbeModeInfo.ModeAttributes & VBEMODE_CAPS_NONBANKED )
  146.       printf("NONBANKED ");
  147.     else
  148.       printf("BANKED    ");
  149.  
  150.     if( vbeModeInfo.ModeAttributes & VBEMODE_CAPS_LINEAR )
  151.       printf("LFB   ");
  152.     else
  153.       printf("NOLFB ");
  154.  
  155.     // Print memory model
  156.  
  157.     printf("(%s)\n",memModel[vbeModeInfo.MemoryModel]);
  158.  
  159.     vbeMode++;
  160.   }
  161.  
  162. }
  163.