[comp.sys.ibm.pc.programmer] how do you detect a hard drive?

TOMIII@MTUS5.BITNET (Thomas Dwyer III) (06/26/90)

Hi there.  I've been programming the PCs for years, and this may be a
silly question, but what is the best method to determine if a hard
drive exists on a machine (PC through PS/2 models)?  Examples in ASM
or C would be appreciated.


Thomas Dwyer III                     TOMIII @ MTUS5.BITNET
Network Programmer
Michigan Technological University

mouse@vaxb.acs.unt.edu (Dhanapong Saengrussamee, University of North Texas) (06/28/90)

In article <90177.114030TOMIII@MTUS5.BITNET>,
TOMIII@MTUS5.BITNET (Thomas Dwyer III) writes:
> Hi there.  I've been programming the PCs for years, and this may be a
> silly question, but what is the best method to determine if a hard
> drive exists on a machine (PC through PS/2 models)?  Examples in ASM
> or C would be appreciated.
> 
> Thomas Dwyer III
-- 

Have you try Intr $21 function $1C yet?  Call with AH = $1C and DL is the drive
number in question (0=default, 1=A, 2=B, ...).  Look at the first byte of the
return at DS:BX, if it is $0F8 then it is harddisk.  It's worked for me... 
Something like:

	MOV	AH,1CH
	MOV	DL,03H		;drive code, 0 default, 1=A, 2=B, ...
	INT	21H
	CMP	BYTE PTR DS:[BX],0F8H
	JE	FIXED
	JMP	FLOPPY
FIXED:	.....

FLOPPY:	.....

should work, methink ;-}.

__Mouse.o()~
-----------------------------------+------------------------------------------
Dhanapong "Mouse" Saengrussamee    | AppleLink : U1364 | BITNET : mouse@untvax
Technical Support, CECS Dept.,     | BIX : d.mouse.s | CompuServe : 71301,1516
University of North Texas,         | GENie : d.saengrussa | IP : 129.120.1.4
PO Box 5155, Denton, TX 76203-5155 | Internet : mouse@vaxb.acs.unt.edu
voice (817) 565-4379               | SPAN : utspan::utandx::untvax::mouse
fax   (817) 565-4425               | THENet : untvax::mouse
------------------- UUCP : {...!uunet!convex!iex}!ntvax!vaxb.acs.unt.edu!mouse
This is not the end.                  <-- This is a quote from a movie not a
This is not the beginning of the end. <   disclaimer.  I am, just a graduate
This is the end of the beginning.     <   student, not allowed to disclaim
                    - R. Sherman      <   anything.