'===========================================================================
' Subject: DETECT DISK SIZE                   Date: 01/93 (00:00)          
'  Author: Dick Dennison                      Code: QB, PDS                
'  Origin: DETECT,DISK,SIZE                 Packet: DISK.ABC
'===========================================================================
 'No checking for open drive doors on this:

'$INCLUDE: 'qb.bi'

DEFINT A-Z    'Dick Dennison 1/93 1:272/34 PD
DIM regs AS regtypex    'Does not test for open floppy door

regs.ax = &H1C00                       'ah=1c al=00
regs.dx = 0                            '0=default, 1=a:,2=b:,etc
CALL interruptx(&H21, regs, regs)      'use dos
DEF SEG = regs.ds                      'change to returned segment
MediaByte = PEEK(regs.bx)              'Get the byte
DEF SEG                                'get back to basic's segment

IF (regs.ax AND 255) <> &HFF THEN

    SELECT CASE HEX$(MediaByte)
		CASE "F0"
			MediaType$ = "3.5 inch DS, 18 sectors or other"
		CASE "F8"
			MediaType$ = "Fixed Disk"
		CASE "F9"
			MediaType$ = "5.25 in DS, 15 sects or 3.5 in DS, 9 sects"
		CASE "FC"
			MediaType$ = "5.25 inch SS, 9 sectors"
		CASE "FD"
			MediaType$ = "5.25 inch DS, 9 sectors"
		CASE "FE"
			MediaType$ = "5.25 inch SS, 8 sectors"
		CASE "FF"
			MediaType$ = "5.25 inch DS, 8 sectors"
		CASE ELSE
			MediaType$ = "Unknown Type"
	END SELECT
	PRINT "Media ID Byte : "; HEX$(MediaByte); " = "; MediaType$
ELSE
	PRINT "Error encountered (invalid drive or critical error)"
END IF
END
