home *** CD-ROM | disk | FTP | other *** search
- '╔═════════════════════════════════════════════════════════════════════════╗
- '║ ║
- '║ SYSCHECK.BAS ║
- '║ ║
- '║ ║
- '║ written with Microsoft QuickBASIC v4.00b ║
- '║ ║
- '╠═════════════════════════════════════════════════════════════════════════╣
- '║ ║
- '║ NOTE: ║
- '║ ║
- '║ THIS PROGRAM, ITS USE, OPERATION, AND SUPPORT IS PROVIDED "AS IS" ║
- '║ WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, ║
- '║ BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND ║
- '║ FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY ║
- '║ AND PERFORMANCE OF THIS PROGRAM IS WITH THE USER. IN NO EVENT SHALL ║
- '║ MICROSOFT BE LIABLE FOR DAMAGES INCLUDING, WITHOUT LIMITATION, ANY ║
- '║ LOST PROFITS, LOST SAVINGS, OR OTHER INCIDENTAL OR CONSEQUENTIAL ║
- '║ DAMAGES ARISING FROM THE USE OR INABILITY TO USE THIS PROGRAM, EVEN ║
- '║ IF MICROSOFT HAS BEEN ADVISED OF THE POSSIBILTY OF SUCH DAMAGES, OR ║
- '║ FOR ANY CLAIM BY ANY OTHER PARTY. ║
- '║ ║
- '╚═════════════════════════════════════════════════════════════════════════╝
- '
- ' SysCheck.BAS - System Equipment Check
- '
- ' Written by Kyle Sparks, Microsoft, 1988
- '
- '
-
- DEFINT A-Z
-
- TYPE Register
- ax AS INTEGER
- bx AS INTEGER
- cx AS INTEGER
- dx AS INTEGER
- bp AS INTEGER
- si AS INTEGER
- di AS INTEGER
- flags AS INTEGER
- ds AS INTEGER
- es AS INTEGER
- END TYPE
-
- '-------------------- Declare Procedures and Functions ----------------------
-
- '- - - - - - - - - - - Procedures in QB.QLB - - - - - - - - - - - - - - - - -
-
- DECLARE SUB Interrupt (intnum AS INTEGER, inreg AS Register, outreg AS Register)
- DECLARE SUB InterruptX (intnum AS INTEGER, inreg AS Register, outreg AS Register)
-
- '- - - - - - - - - - - Procedures contained internally - - - - - - - - - - -
-
- DECLARE FUNCTION BytesAvail& (Drive$)
- DECLARE FUNCTION ConvDate$ (d$)
- DECLARE FUNCTION Compaq$ (Default$)
- DECLARE FUNCTION GetDrive$ ()
- DECLARE FUNCTION GetPath$ (Drive$)
- DECLARE FUNCTION SetVideoSegment% ()
-
- DECLARE SUB CoPrint (f%, b%, m$)
- DECLARE SUB Initialize ()
- DECLARE SUB MakeBox (Left%, Top%, Right%, Bottom%, Border%)
- DECLARE SUB MoveToScreen (x1%, y1%, x2%, y2%, Buffer() AS INTEGER)
- DECLARE SUB MoveFromScreen (x1%, y1%, x2%, y2%, Buffer() AS INTEGER)
- DECLARE SUB PopUp ()
- DECLARE SUB ScrRstr (x$)
- DECLARE SUB ScrSave (x$)
- DECLARE SUB ShowComputerType ()
- DECLARE SUB ShowDisketteDrives ()
- DECLARE SUB ShowDriveMimic ()
- DECLARE SUB ShowInitVidMode ()
- DECLARE SUB ShowMathCoproc ()
- DECLARE SUB ShowPrinters ()
- DECLARE SUB ShowROMDate ()
- DECLARE SUB ShowSerialPorts ()
- DECLARE SUB ShowTotalRAM ()
-
- '------------------ Declare local and global variables ----------------------
-
- COMMON SHARED x1, y1, x2, y2
- COMMON SHARED Attrib1, Attrib2, Attrib3, Attrib6, Attrib4
- COMMON SHARED Attrib5, Attrib7
-
- '------------------------------ MAIN PROGRAM --------------------------------
-
- 'BEGIN
-
- Initialize
- PopUp
- END
-
- FUNCTION BytesAvail& (Drive$)
- '----------------------------------------------------------------------------
- ' function BytesAvail returns the number of bytes available on Drive$
- '----------------------------------------------------------------------------
-
- DIM regs AS Register
-
- regs.ax = &H3600
- regs.dx = ASC(Drive$) - 64
- Interrupt &H21, regs, regs
- Bytes& = regs.ax * regs.cx
- BytesAvail& = regs.bx * Bytes&
-
- END FUNCTION
-
- FUNCTION Compaq$ (Default$)
- '----------------------------------------------------------------------------
- ' function Compaq$ check to see if the current machine is a COMPAQ brand
- ' computer. If so, the value returned is "COMPAQ" else Default$ is returned
- '----------------------------------------------------------------------------
-
- a$ = "" ' Start with a blank string.
- DEF SEG = &HF000 ' ROM Bios area.
- FOR I = 0 TO 5
- a$ = a$ + CHR$(PEEK(&HFFEA + I))
- NEXT
- DEF SEG ' Back to BASIC.
-
- IF a$ = "COMPAQ" THEN
- Compaq$ = a$
- ELSE
- Compaq$ = Default$
- END IF
-
-
- END FUNCTION
-
- FUNCTION ConvDate$ (d$)
- '----------------------------------------------------------------------------
- ' function ConvDate$ converts the date into a MMMMMMMM DD, YYYY format.
- '----------------------------------------------------------------------------
-
- SELECT CASE LEFT$(d$, 2)
- CASE "01"
- r$ = r$ + "January "
- CASE "02"
- r$ = r$ + "February "
- CASE "03"
- r$ = r$ + "March "
- CASE "04"
- r$ = r$ + "April "
- CASE "05"
- r$ = r$ + "May "
- CASE "06"
- r$ = r$ + "June "
- CASE "07"
- r$ = r$ + "July "
- CASE "08"
- r$ = r$ + "August "
- CASE "09"
- r$ = r$ + "September "
- CASE "10"
- r$ = r$ + "October "
- CASE "11"
- r$ = r$ + "November "
- CASE "12"
- r$ = r$ + "December "
- CASE ELSE
- END SELECT
-
- ConvDate$ = r$ + MID$(d$, 4, 2) + ", 19" + RIGHT$(d$, 2)
-
- END FUNCTION
-
- SUB CoPrint (f, b, m$)
- '----------------------------------------------------------------------------
- ' procedure CoPrint prints m$ with forground color f and backround color b.
- '----------------------------------------------------------------------------
-
- COLOR f, b
- IF RIGHT$(m$, 1) = ";" THEN
- PRINT LEFT$(m$, LEN(m$) - 1);
- ELSE
- PRINT m$
- END IF
-
- END SUB
-
- FUNCTION GetDrive$
- '------------------------------------------------------------------------
- ' function GetDrive$ returns the current active DOS drive letter.
- '------------------------------------------------------------------------
-
- DIM regs AS Register
- regs.ax = &H1900
- Interrupt &H21, regs, regs
- GetDrive$ = CHR$(65 + regs.ax MOD 256)
-
- END FUNCTION
-
- FUNCTION GetPath$ (Drive$)
- '------------------------------------------------------------------------
- ' function GetPath$ returns the current active DOS path on the specified
- '------------------------------------------------------------------------
-
- DIM regs AS Register, sb AS STRING * 64
- regs.ax = &H4700
- regs.dx = ASC(Drive$) - 64
- regs.ds = VARSEG(sb)
- regs.si = VARPTR(sb)
- InterruptX &H21, regs, regs
- GetPath$ = LEFT$(sb, INSTR(sb, CHR$(0)) - 1)
-
- END FUNCTION
-
- SUB Initialize
- '----------------------------------------------------------------------------
- ' procedure Initialize sets up colors and global parameters for the program.
- '----------------------------------------------------------------------------
-
- DEF SEG = 0
-
- SELECT CASE PEEK(&H449)
-
- CASE 2, 7
- Attrib0 = 0 'Black
- Attrib1 = 9 'High Intensity Underline
- Attrib2 = 0 'Black
- Attrib3 = 7 'White
- Attrib4 = 7 'White
- Attrib5 = 0 'Black
- Attrib6 = 7 'White
- Attrib7 = 15 'High intensity white
- CASE 3
- Attrib0 = 0 'Black
- Attrib1 = 1 'Blue
- Attrib2 = 3 'Cyan
- Attrib3 = 4 'Red
- Attrib4 = 5 'Magenta
- Attrib5 = 7 'White
- Attrib6 = 0 'Black
- Attrib7 = 6 'Orange
-
- CASE ELSE
-
- END SELECT
-
- x1 = 10
- x2 = 70
- y1 = 4
- y2 = 21
-
- COLOR Attrib0, Attrib0
-
- LOCATE , , 0
-
- END SUB
-
- SUB MakeBox (Left, Top, Right, Bottom, Border)
- '----------------------------------------------------------------------------
- ' procedure MakeBox draws a box on the screen starting at Top, Left and
- ' ending at Bottom, Right using either no border, or a single or double
- ' line border based on the value of Border.
- '----------------------------------------------------------------------------
-
- SELECT CASE Border
- CASE 1
- VertLine$ = CHR$(179)
- HorizLine$ = CHR$(196)
- UpLeft$ = CHR$(218)
- UpRight$ = CHR$(191)
- LowLeft$ = CHR$(192)
- LowRight$ = CHR$(217)
-
- CASE 2
- VertLine$ = CHR$(186)
- HorizLine$ = CHR$(205)
- UpLeft$ = CHR$(201)
- UpRight$ = CHR$(187)
- LowLeft$ = CHR$(200)
- LowRight$ = CHR$(188)
-
- CASE ELSE
- VertLine$ = CHR$(32)
- HorizLine$ = CHR$(32)
- UpLeft$ = CHR$(32)
- UpRight$ = CHR$(32)
- LowLeft$ = CHR$(32)
- LowRight$ = CHR$(32)
-
- END SELECT
-
- LOCATE Top, Left
- PRINT UpLeft$; STRING$((Right - Left) - 1, HorizLine$); UpRight$;
- FOR Y = Top + 1 TO Bottom - 1
- LOCATE Y, Left
- PRINT VertLine$; SPACE$((Right - Left) - 1); VertLine$;
- NEXT Y
- LOCATE Bottom, Left
- PRINT LowLeft$; STRING$((Right - Left) - 1, HorizLine$); LowRight$;
-
- END SUB
-
- SUB PopUp
- '----------------------------------------------------------------------------
- ' procedure Popup is the main control procedure for the program. I makes
- ' the main window and performs the various functions of the program.
- '----------------------------------------------------------------------------
-
- OldY = CSRLIN
-
- DOSScreen$ = SPACE$(4000)
- ScrSave DOSScreen$
- COLOR Attrib3, Attrib5
-
- MakeBox x1, y1, x2, y2, 2
-
- LOCATE y1 + 2, x1 + 19
- CoPrint Attrib1, Attrib5, "Hardware System Check"
-
- LOCATE y1 + 4, x1 + 2
- ShowComputerType
- LOCATE y1 + 5, x1 + 2
- ShowROMDate
- LOCATE y1 + 7, x1 + 2
- ShowDriveMimic
- LOCATE y1 + 9, x1 + 14
- ShowPrinters
- LOCATE y1 + 10, x1 + 14
- ShowSerialPorts
- LOCATE y1 + 11, x1 + 14
- ShowDisketteDrives
- LOCATE y1 + 12, x1 + 11
- ShowInitVidMode
- LOCATE y1 + 13, x1 + 13
- ShowMathCoproc
- LOCATE y1 + 14, x1 + 11
- ShowTotalRAM
- LOCATE y1 + 16, x1 + 12
- COLOR Attrib7, Attrib5
- PRINT USING " ###,###,###"; BytesAvail&(GetDrive$); :
- COLOR Attrib6, Attrib5
- PRINT " Bytes Free on Drive ";
- CoPrint Attrib7, Attrib5, GetDrive$ + ": ;"
-
- WHILE INKEY$ = "": WEND
-
- ScrRstr DOSScreen$
-
- LOCATE OldY
-
- END SUB
-
- SUB ShowComputerType
- '----------------------------------------------------------------------------
- ' procedure ShowComputerType retrieves and displays the type of processor
- ' and, if applicable, the brand of the computer.
- '----------------------------------------------------------------------------
-
-
- DEF SEG = &HF000
- COLOR Attrib6, Attrib5
- PRINT "This is a";
-
- SELECT CASE PEEK(&HFFFE)
- CASE 45
- PRINT "n 8088 Compaq";
- CASE 154
- PRINT "n 8086 Compaq Plus";
- CASE 252
- PRINT "n 80286 based "; Compaq("AT (or compatible)");
- CASE 253
- PRINT " PCjr";
- CASE 254
- PRINT "n 8086 based "; Compaq("XT (or compatible) ");
- CASE 255
- PRINT "n 8088 based "; Compaq("PC (or compatible)");
- CASE ELSE
- PRINT "n unknown computer";
-
- END SELECT
-
- DEF SEG
-
- END SUB
-
- SUB ShowDisketteDrives
- '----------------------------------------------------------------------------
- ' procedure ShowDisketteDrives shows the number of diskette drives installed.
- '----------------------------------------------------------------------------
-
- DEF SEG = 0
-
- NumDrives = (PEEK(&H410) \ 64) + 1
- PRINT "Diskette Drives: ";
- CoPrint Attrib7, Attrib5, STR$(NumDrives) + " ;"
- COLOR Attrib4, Attrib5
-
- END SUB
-
- SUB ShowDriveMimic
- '----------------------------------------------------------------------------
- ' procedure ShowDriveMimic shows whether or not drive mimic is on (A: is
- ' acting as a logical drive B:).
- '----------------------------------------------------------------------------
-
- DEF SEG = 0
-
- IF PEEK(&H504) = 1 THEN
- PRINT "Drive Mimic is ";
- CoPrint Attrib7, Attrib5, "ON ;"
- CoPrint Attrib6, Attrib5, " (physical A: now acting as logical B:)"
- ELSE
- PRINT "Drive Mimic is ";
- CoPrint Attrib7, Attrib5, "OFF;"
- CoPrint Attrib6, Attrib5, " (physical A: not acting as logical B:)"
- END IF
-
- DEF SEG
-
- END SUB
-
- SUB ShowInitVidMode
- '----------------------------------------------------------------------------
- ' procedure ShowInitVidMode shows the primary video mode at boot time.
- '----------------------------------------------------------------------------
-
- DIM Message$(3)
- Message$(0) = " <Not Available> "
- Message$(1) = " 40-Column Color "
- Message$(2) = " 80-Column Color "
- Message$(3) = " 80-Column MONO "
-
- DEF SEG = &H40
-
- ModeNum = (PEEK(&H10) \ 2 ^ 4) AND 3
- PRINT "Initial Video Mode: ";
-
- IF ModeNum = 0 THEN
- CoPrint Attrib3 + 16, Attrib6, Message$(0) + ";"
- ELSE
- CoPrint Attrib7, Attrib5, Message$(ModeNum) + ";"
- END IF
-
- COLOR Attrib4, Attrib5
-
- DEF SEG
-
- END SUB
-
- SUB ShowMathCoproc
- '----------------------------------------------------------------------------
- ' procedure ShowMathCoproc checks to see if a math coprocessor is installed.
- '----------------------------------------------------------------------------
-
- DEF SEG = &H40
-
- MathCoproc = (PEEK(&H10) \ 2) AND 1
-
- PRINT "Math Coprocessor: ";
-
- IF MathCoproc = 0 THEN
- CoPrint Attrib3 + 16, Attrib5, " <Not Installed> ;"
- ELSE
- CoPrint Attrib7, Attrib5, " Installed ;"
- END IF
-
- COLOR Attrib4, Attrib5
-
- DEF SEG
-
- END SUB
-
- SUB ShowPrinters
- '----------------------------------------------------------------------------
- ' procedure ShowPrinters shows the number of printer ports installed.
- '----------------------------------------------------------------------------
-
- DEF SEG = &H40
-
- COLOR Attrib4, Attrib5
-
- Printers = PEEK(&H11) \ (2 ^ 6)
- PRINT "Printer Devices: ";
- CoPrint Attrib7, Attrib5, STR$(Printers) + " ;"
- COLOR Attrib4, Attrib5
-
- DEF SEG
-
- END SUB
-
- SUB ShowROMDate
- '----------------------------------------------------------------------------
- ' procedure ShowROMDate displays the date of the ROM programs in the
- ' machine.
- '----------------------------------------------------------------------------
-
- ROMDate$ = ""
-
- DEF SEG = &HF000
-
- FOR p = &HFFF5 TO &HFFFD
- ROMDate$ = ROMDate$ + CHR$(PEEK(p))
- NEXT p
-
- IF LEFT$(ROMDate$, 1) = CHR$(32) THEN
- ROMDate$ = RIGHT$(ROMDate$, LEN(ROMDate$) - 1)
- ELSE
- ROMDate$ = LEFT$(ROMDate$, LEN(ROMDate$) - 1)
- END IF
-
-
- DEF SEG
-
- PRINT "ROMs are dated "; ConvDate$(ROMDate$); "."
-
- END SUB
-
- SUB ShowSerialPorts
- '----------------------------------------------------------------------------
- ' procedure ShowSerialPorts shows the number of serial ports installed.
- '----------------------------------------------------------------------------
-
- DEF SEG = &H40
-
- NumSerial = (PEEK(&H11) \ 2) AND 7
-
- PRINT " Serial Devices: ";
- CoPrint Attrib7, Attrib5, STR$(NumSerial) + " ;"
- COLOR Attrib4, Attrib5
-
- DEF SEG
-
- END SUB
-
- SUB ShowTotalRAM
- '----------------------------------------------------------------------------
- ' procedure ShowTotalRAM displays the total amount of RAM installed.
- '----------------------------------------------------------------------------
-
- DEF SEG = &H40
-
- TotalRAM = PEEK(&H13) + (PEEK(&H14) * 256)
- PRINT "Total On-Board RAM: ";
- CoPrint Attrib7, Attrib5, STR$(TotalRAM) + "k ;"
- COLOR Attrib4, Attrib5
-
- DEF SEG
- END SUB
-
-