How to Suppress "Insert Diskette" on Single Floppy Systems (79027)
The information in this article applies to:
- Microsoft Basic Professional Development System for MS-DOS 7.0
- Microsoft Basic Professional Development System for MS-DOS 7.1
This article was previously published under Q79027 SUMMARY
When using the CURDIR$ or DIR$ function, or the CHDRIVE statement in
Basic Professional Development System (PDS) on a single floppy system,
the MS-DOS message
Insert Diskette for Drive B: and press any key when ready
Insert Diskette for Drive A: and press any key when ready
will appear if you attempt to access a single floppy drive as both
drives A and B in the same program. In many cases, this message is
inconvenient because it clutters the output screen. This is an MS-DOS
message that can be suppressed using the method below.
This information applies to Microsoft Basic PDS versions 7.0 and 7.1
for MS-DOS.
MORE INFORMATION
The above message will only appear when the program is running on a
single floppy system, because MS-DOS allows that one floppy to be
referenced as logical drive A or B. However, when you change the drive
reference (such as by typing "a:" then "b:", or by using any of the
Basic functions that change from drive A or B to the other drive),
MS-DOS prompts you with the message above. If a disk is already in the
drive, press a key to continue the operation.
If you are using a user-interface screen or menu, you may want to
suppress this message. To do so, you can call interrupt 11 hex to
detect whether the system has only one floppy drive. After the call,
bytes 6 and 7 of the ax register will contain a number that represents
the number of floppy drives on the system.
If it is determined that only one floppy drive is present, you can
call interrupt 21 with function 44 hex with subfunction 0F hex to set
the current drive specification for the floppy. Doing this will
suppress the MS-DOS message.
To run this program in the QBX.EXE environment, start with the
following line, which will load the QBX.QLB Quick library:
Code Example
'$INCLUDE: 'QBX.BI'
CONST TRUE = -1
CONST FALSE = 0
DIM InRegs AS RegType, OutRegs AS RegType
DIM SingleFloppy AS INTEGER 'Flag to check system config.
DIM Drive$
CALL INTERRUPT(&H11, InRegs, OutRegs)
IF (OutRegs.ax AND 192) THEN 'Check bits 6 and 7:
' 0->1 floppy, 1->2 floppies.
SingleFloppy = FALSE
ELSE
SingleFloppy = TRUE
END IF
'Normal Code there, probably setting Drive$
'Then, if the system only has one single floppy, before
'using any drive or directory functions or statements, use
'interrupt 21 to set the drive to the needed specification.
'This will suppress the MS-DOS message.
IF SingleFloppy THEN
Temp$ = UCASE$(LEFT$(Drive$, 2))
SELECT CASE Temp$
CASE "A:"
InRegs.ax = &H440F
InRegs.bx = 1 'Set A: as active drive
CALL INTERRUPT(&H21, InRegs, OutRegs)
CASE "B:"
InRegs.ax = &H440F
InRegs.bx = 2 'Set B: as active drive
CALL INTERRUPT(&H21, InRegs, OutRegs)
END SELECT
PRINT "The current directory on "; Temp$; " is ";
PRINT CURDIR$(Temp$)
END IF
Modification Type: | Minor | Last Reviewed: | 8/16/2005 |
---|
Keywords: | KB79027 |
---|
|