home *** CD-ROM | disk | FTP | other *** search
/ Shareware 1 2 the Maxx / sw_1.zip / sw_1 / PROGRAM / VIDEO.ZIP / VIDIDTST.C < prev   
C/C++ Source or Header  |  1992-06-29  |  3KB  |  94 lines

  1. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  2.  *                                     .                                     *
  3.  *                                   Video                                   *
  4.  *                                                                           *
  5.  *                    (c) Copyright 1988 Michael K. Heney                    *
  6.  *                                                                           *
  7.  * File:      VidIdTst.C                                                     *
  8.  * Purpose:   Test driver for the VideoID package.                           *
  9.  *                                                                           *
  10.  * Routines:  main                                                           *
  11.  *                                                                           *
  12.  * Written:   16 Jul 88 - 16 Jul 88 MKH                                      *
  13.  *                                                                           *
  14.  * Notes:     Adapted from the VideoID program written in assembler in       *
  15.  *            "Programmer's Guide to PC & PS/2 Video Systems" by             *
  16.  *            Richard Wilton (Microsoft Press).  Listing C-2, pp. 521-522.   *
  17.  *                                                                           *
  18.  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  19.  
  20. #include <stdio.h>
  21. #include "videoid.h"
  22.  
  23.  
  24. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  25.  *  Some arrays of strings to make printing the results easier.              *
  26.  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  27.  
  28. char *Devices[] =
  29. {
  30.     "None",
  31.     "MDA",
  32.     "CGA",
  33.     "EGA",
  34.     "MCGA",
  35.     "VGA"
  36. } ;
  37.  
  38. char *Hercs[] =
  39. {
  40.     "HGC",
  41.     "HGCPlus",
  42.     "InColor"
  43. } ;
  44.  
  45. char *Displays[] =
  46. {
  47.     "NoDisplay",
  48.     "MDADisplay",
  49.     "CGADisplay",
  50.     "EGAColorDisplay",
  51.     "PS2MonoDisplay",
  52.     "PS2ColorDisplay"
  53. } ;
  54.  
  55.  
  56. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  57.  *  main is a driver                                                         *
  58.  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  59.  
  60. main()
  61. {
  62.     long IDval ;
  63.     int dev0, disp0, dev1, disp1 ;
  64.  
  65.     IDval = VideoID() ;
  66.  
  67.     disp1 = IDval & 0x00ff ;
  68.     dev1  = (IDval >>  8) & 0x00ff ;
  69.     disp0 = (IDval >> 16) & 0x00ff ;
  70.     dev0  = (IDval >> 24) & 0x00ff ;
  71.  
  72.  
  73.     printf("\n\n") ;
  74.     printf("  Active Device: ") ;
  75.  
  76.     if (dev0 & 0x80)
  77.         printf("%-20s", Hercs[dev0 & 0x007f]) ;
  78.     else
  79.         printf("%-20s", Devices[dev0]) ;
  80.  
  81.     printf("%-20s", Displays[disp0] ) ;
  82.  
  83.     printf("\n") ;
  84.     printf("   Other Device: ") ;
  85.  
  86.     if (dev1 & 0x80)
  87.         printf("%-20s", Hercs[dev1 & 0x007f]) ;
  88.     else
  89.         printf("%-20s", Devices[dev1]) ;
  90.  
  91.     printf("%-20s\n\n", Displays[disp1] ) ;
  92.  
  93. }
  94.