home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Big Blue Disk 29
/
bbd29.zip
/
VIDCHK.TXT
< prev
next >
Wrap
Text File
|
1989-01-04
|
7KB
|
161 lines
|A╔══════════════╗════════════════════════════════════════════════╔══════════════╗
|A║ |6Happy Hacker |A║══════════════════ ^1Video Check |A═════════════════║ |6Happy Hacker |A║
|A╚══════════════╝════════════════════════════════════════════════╚══════════════╝
^Cby
^CWolfgang Stiller
VIDCHK is a program which will analyze the video hardware installed on an
unknown PC. If you're not sure what display adapter you have (something you
often need to know in order to know whether various pieces of software are
compatible), you can run VIDCHK to find out. Also, if you're writing batch
files to run a program, you can make them do things differently when they're run
on differently-equipped machines using VIDCHK's errorlevel capability. VIDCHK
will report the following information:
1) Type of active video adapter and monitor
2) Type of inactive video adapter
3) Amount of memory installed if an EGA card is present
4) It returns a DOS "ERRORLEVEL" to indicate the type of active
adapter installed. This allows use in DOS BATCH files.
Companion utility EGAMEM will report the amount of memory on an EGA video
adapter, and also report the amount of memory in the DOS "ERRORLEVEL."
How to use:
Simply type VIDCHK and you will get a report on type of video
configuration and also the amount of EGA memory present. This is
valuable for quickly checking out unknown equipment.
To use in a batch file:
These programs are valuable for automating installation of programs,
or for producing varying displays depending upon type of video
hardware installed. For instance if you wish to use 16 colors
on the 640-by-350 graphics display with an EGA or VGA adapter,
you could execute VIDCHK and check the DOS ERRORLEVEL to determine
that a VGA or EGA is installed. If only an EGA is installed, you would
need to determine that the EGA has more than 64K or memory. To do this
execute EGAMEM and check that its ERRORLEVEL is greater than zero.
VIDCHK will return an ERRORLEVEL code for the ACTIVE video adapter as
follows:
0 = MDA adapter
1 = CGA
2 = EGA Color - IRGB (old style RGB monitor with 16 color display)
3 = EGA Color - with enhanced display (rgbRGB display - 64 colors)
4 = EGA monochrome
5 = PGA - Professional graphics adapter as reported by function 1Ah
6 = VGA monochrome
7 = VGA color display
10= MCGA monochrome
11= MCGA color
20= Hercules (mono graphics - plain vanilla)
21= Hercules Plus
22= Hercules INCOLOR
99= unknown type adapter
EGAMEM ERRORLEVEL returned is as follows:
0 - Indicates no EGA card present
1 - indicates 64K of memory installed on EGA card
2 - indicates 128K of memory installed on EGA card
n - indicates n*64k of memory installed on EGA card
Example of use in a batch file:
: Error level demo file
VIDCHK
IF ERRORLEVEL 99 GOTO END
.
.
.
IF ERRORLEVEL 4 GOTO ER4
IF ERRORLEVEL 3 GOTO ER3
IF ERRORLEVEL 2 GOTO ER2
IF ERRORLEVEL 1 GOTO ER1
ECHO error level returned was 0
REM MDA dependent code appears here
GOTO END
:ER1
ECHO error level returned was 1
REM CGA dependent code appears here
GOTO END
:ER2
ECHO error level returned was 2
REM EGA color IRGB monitor detected
GOTO EGAMEM
:ER3
ECHO error level returned was 3
REM EGA color with enhanced monitor detected
GOTO EGAMEM
:ER4
ECHO error level returned was 4
REM EGA color with monochrome monitor detected
GOTO EGAMEM
.
.
. and so forth
:EGAMEM
EGAMEM
IF ERRORLEVEL 2 GOTO EGABIG
ECHO EGA 64K or less detected
REM Limited ega code appears here
GOTO END
:EGABIG
ECHO EGA with more than 64k detected
REM EGA with more than 64k code appears here
:END
Technical overview of VIDCHK:
1) VIDCHK checks for a VGA type board first. This invokes BIOS interrupt
10h function 1Ah. The PS/2 style adapters such as the VGA and the MCGA
will respond to this function. Both the active (primary) and the
secondary (inactive) adapters will be reported. A DOS ERRORLEVEL will be
returned for the active video adapter detected. If the BIOS 1Ah function
does not respond, then BIOS function 12H of interrupt 10h is used to
check for the presence of an EGA type adapter.
2) The EGA check then begins (Interupt 10h). This function returns the
video mode in effect (color or monochrome: 0 or 1) in register BH. The
amount of memory is returned in register BL (0=64K,1=128K etc). CL
returns the type of monitor attached to the EGA board. If the EGA board
is present, the EGA status byte at 040:087 is checked. Bit three
determines whether the EGA board is the active adapter. This is
reported. If the EGA is not the active adapter, then a flag is
incremented (non zero) to indicate that fact. This is used later to
report not the presence of the EGA in the ERRORLEVEL but whatever other
adapter is present and active. Next the type of display attached to the
EGA is reported. (Monochrome, RGBI, or RGBrgb). A separate check is
made to see if a monochrome (MDA) or Hercules type adapter is present in
addition to the EGA. These checks are made in routine Mono_board_check
which in turn calls Hercules_check. These checks are done by programming
the board's registers directly rather than checking the DOS video status
byte (40:10h), since the presence of the EGA adapter will alter these
bits. Since some EGA boards will simulate other style adapters such as
the MDA or Hercules, it is possible that these boards may not actually
be present as a physically separate board when an EGA is reported to be
present on the system.
3) If the EGA is not present, then the DOS video status byte at 040:010h is
checked. Bits 4 and 5 are masked out and checked for either a CGA or
monochrome (MDA) display adapter. If a CGA adapter is present, an
additional check is made by calling a subroutine to check for the presence
of additional MDA or Hercules adapters. These checks are made by
programming the 6845 status register at port 3b4h to check for a
monochrome style card such as the MDA or Hercules. A separate series of
checks is for the presence of a Hercules adapter by reading the Hercules
status port at 3bAh, 32767 times and waiting for the sync bit to change.
4) If a monochrome (MDA) type adapter is determined to be present, then an
additional check is made for the presence of a Hercules type adapter as
described above.
DISK FILES THIS PROGRAM USES:
VIDCHK.COM the video checkout program in executable form
EGAMEM.COM EGA memory reporting program in executable form
BAT.BAT Sample batch file to exploit these programs.