home *** CD-ROM | disk | FTP | other *** search
/ Big Blue Disk 29 / bbd29.zip / VIDCHK.TXT < prev    next >
Text File  |  1989-01-04  |  7KB  |  161 lines

  1. |A╔══════════════╗════════════════════════════════════════════════╔══════════════╗
  2. |A║ |6Happy Hacker |A║══════════════════ ^1Video Check |A═════════════════║ |6Happy Hacker |A║
  3. |A╚══════════════╝════════════════════════════════════════════════╚══════════════╝
  4. ^Cby
  5. ^CWolfgang Stiller
  6.  
  7.  
  8.    VIDCHK is a program which will analyze the video hardware installed on an 
  9. unknown PC.  If you're not sure what display adapter you have (something you 
  10. often need to know in order to know whether various pieces of software are 
  11. compatible), you can run VIDCHK to find out.  Also, if you're writing batch 
  12. files to run a program, you can make them do things differently when they're run 
  13. on differently-equipped machines using VIDCHK's errorlevel capability.  VIDCHK 
  14. will report the following information: 
  15.  
  16.  1) Type of active video adapter and monitor
  17.  
  18.  2) Type of inactive video adapter
  19.  
  20.  3) Amount of memory installed if an EGA card is present
  21.  
  22.  4) It returns a DOS "ERRORLEVEL" to indicate the type of active
  23.     adapter installed. This allows use in DOS BATCH files.
  24.  
  25.    Companion utility EGAMEM will report the amount of memory on an EGA video 
  26. adapter, and also report the amount of memory in the DOS "ERRORLEVEL." 
  27.  
  28. How to use:
  29.     Simply type VIDCHK and you will get a report on type of video
  30.     configuration and also the amount of EGA memory present. This is
  31.     valuable for quickly checking out unknown equipment.
  32.  
  33. To use in a batch file:
  34.     These programs are valuable for automating installation of programs,
  35.     or for producing varying displays depending upon type of video
  36.     hardware installed. For instance if you wish to use 16 colors
  37.     on the 640-by-350 graphics display with an EGA or VGA adapter,
  38.     you could execute VIDCHK and check the DOS ERRORLEVEL to determine
  39.     that a VGA or EGA is installed. If only an EGA is installed, you would
  40.     need to determine that the EGA has more than 64K or memory. To do this
  41.     execute EGAMEM and check that its ERRORLEVEL is greater than zero.
  42.  
  43.    VIDCHK will return an ERRORLEVEL code for the ACTIVE video adapter as 
  44. follows:
  45.    0 = MDA adapter
  46.    1 = CGA
  47.    2 = EGA Color - IRGB (old style RGB monitor with 16 color display)
  48.    3 = EGA Color - with enhanced display (rgbRGB display - 64 colors)
  49.    4 = EGA monochrome
  50.    5 = PGA - Professional graphics adapter as reported by function 1Ah
  51.    6 = VGA monochrome
  52.    7 = VGA color display
  53.    10= MCGA monochrome
  54.    11= MCGA color
  55.    20= Hercules (mono graphics - plain vanilla)
  56.    21= Hercules Plus
  57.    22= Hercules INCOLOR
  58.    99= unknown type adapter
  59.  
  60.    EGAMEM ERRORLEVEL returned is as follows:
  61.     0   - Indicates no EGA card present
  62.     1   - indicates 64K of memory installed on EGA card
  63.     2   - indicates 128K of memory installed on EGA card
  64.     n   - indicates n*64k of memory installed on EGA card
  65.  
  66.    Example of use in a batch file:
  67.  
  68. : Error level demo file
  69. VIDCHK
  70. IF ERRORLEVEL 99 GOTO END
  71. .
  72. .
  73. .
  74. IF ERRORLEVEL 4 GOTO ER4
  75. IF ERRORLEVEL 3 GOTO ER3
  76. IF ERRORLEVEL 2 GOTO ER2
  77. IF ERRORLEVEL 1 GOTO ER1
  78. ECHO error level returned was 0
  79. REM  MDA dependent code appears here
  80. GOTO END
  81. :ER1
  82. ECHO error level returned was 1
  83. REM  CGA dependent code appears here
  84. GOTO END
  85. :ER2
  86. ECHO error level returned was 2
  87. REM  EGA color IRGB monitor detected
  88. GOTO EGAMEM
  89. :ER3
  90. ECHO error level returned was 3
  91. REM  EGA color with enhanced monitor detected
  92. GOTO EGAMEM
  93. :ER4
  94. ECHO error level returned was 4
  95. REM  EGA color with monochrome monitor detected
  96. GOTO EGAMEM
  97. .
  98. .
  99. . and so forth
  100. :EGAMEM
  101. EGAMEM
  102. IF ERRORLEVEL 2 GOTO EGABIG
  103. ECHO EGA 64K or less detected
  104. REM  Limited ega code appears here
  105. GOTO END
  106. :EGABIG
  107. ECHO EGA with more than 64k detected
  108. REM  EGA with more than 64k code appears here
  109. :END
  110.  
  111. Technical overview of VIDCHK:
  112.  
  113.   1) VIDCHK checks for a VGA type board first.  This invokes BIOS interrupt
  114.      10h function 1Ah.  The PS/2 style adapters such as the VGA and the MCGA 
  115.      will respond to this function.  Both the active (primary) and the 
  116.      secondary (inactive) adapters will be reported.  A DOS ERRORLEVEL will be 
  117.      returned for the active video adapter detected.  If the BIOS 1Ah function 
  118.      does not respond, then BIOS function 12H of interrupt 10h is used to 
  119.      check for the presence of an EGA type adapter.
  120.  
  121.   2) The EGA check then begins (Interupt 10h).  This function returns the 
  122.      video mode in effect (color or monochrome: 0 or 1) in register BH.  The 
  123.      amount of memory is returned in register BL (0=64K,1=128K etc).  CL
  124.      returns the type of monitor attached to the EGA board.  If the EGA board 
  125.      is present, the EGA status byte at 040:087 is checked.  Bit three 
  126.      determines whether the EGA board is the active adapter.  This is 
  127.      reported. If the EGA is not the active adapter, then a flag is 
  128.      incremented (non zero) to indicate that fact.  This is used later to
  129.      report not the presence of the EGA in the ERRORLEVEL but whatever other 
  130.      adapter is present and active.  Next the type of display attached to the 
  131.      EGA is reported.  (Monochrome, RGBI, or RGBrgb).  A separate check is 
  132.      made to see if a monochrome (MDA) or Hercules type adapter is present in 
  133.      addition to the EGA.  These checks are made in routine Mono_board_check
  134.      which in turn calls Hercules_check.  These checks are done by programming
  135.      the board's registers directly rather than checking the DOS video status 
  136.      byte (40:10h), since the presence of the EGA adapter will alter these 
  137.      bits.  Since some EGA boards will simulate other style adapters such as 
  138.      the MDA or Hercules, it is possible that these boards may not actually 
  139.      be present as a physically separate board when an EGA is reported to be 
  140.      present on the system.
  141.  
  142.   3) If the EGA is not present, then the DOS video status byte at 040:010h is 
  143.      checked.  Bits 4 and 5 are masked out and checked for either a CGA or 
  144.      monochrome (MDA) display adapter.  If a CGA adapter is present, an 
  145.      additional check is made by calling a subroutine to check for the presence 
  146.      of additional MDA or Hercules adapters.  These checks are made by
  147.      programming the 6845 status register at port 3b4h to check for a 
  148.      monochrome style card such as the MDA or Hercules.  A separate series of 
  149.      checks is for the presence of a Hercules adapter by reading the Hercules
  150.      status port at 3bAh, 32767 times and waiting for the sync bit to change. 
  151.  
  152.   4) If a monochrome (MDA) type adapter is determined to be present, then an 
  153.      additional check is made for the presence of a Hercules type adapter as 
  154.      described above.
  155.  
  156.  
  157. DISK FILES THIS PROGRAM USES:
  158.          VIDCHK.COM     the video checkout program in executable form
  159.          EGAMEM.COM     EGA memory reporting program in executable form
  160.          BAT.BAT        Sample batch file to exploit these programs.
  161.