News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

INT 13h AH=08

Started by Artoo, March 11, 2007, 08:30:13 AM

Previous topic - Next topic

Artoo

Hi all, again I ask you wise people a questions about DOS interupts.

In my bootcode I have the following code the  "GET DRIVE PARAMETERS":


PUSH    DI
MOV    EAX,    0800h
MOV    EDX,    FS:[DI.S_DriveStats.dwDiskNum]
INT    13h
POP    DI
JC    GetDriveStats_RET            ; on carry jump to error/end of proc
;Success continue doing my stuff


This piece of code loops with  FS:[DI.S_DriveStats.dwDiskNum] (hard drive disk number) starting at 80h incrementent each time.

All works ok in Bochs and VMWare, it even works on my PC.   But when I try it on my wifes PC that has only one hard drive, when dwDiskNum is 81h (the second hard drive) the Carry is not set (success)! In summary, disk 80h is recognised (as it should), disk 81h is also recognised as a present disk. A phantom Disk!

Also:
1  After the int 13h has returned DL is meant to contain the number of drives.  On my wifes PC, DL is 2.
2  Mem location, 0040:0075h I have read is meant to contain the number of hard drives.  Its too has the value of 2.
3. Ralph Brown suggest using INT 13h AH = 15, But it too recognises it as a valid drive.

My wifes PC is "fairly" recent. less than 2 years old.

So, how does one accurately predict the number of drives attached to the PC?

Thanks to any one that help!



Artoo

How stupid am I!

A USB drive was connected.  I removed it, and all is well.

So now my question is how does one detect "real" hard drives??

Thanks again.

<Why is it only after I post questions on this forum that I realise my stoopid mistake!?!  Granted it was a very tiny usb drive! :) >

PBrennick

A USB drive for all intents and purposes IS a real Hard Drive and it is being reported as such. This includes Memory Sticks.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

Artoo

Should I be able to read/write sectors to the USB drive as I would any other drive?


Its just that my existing code that detects the current CHS (cylinder heads and sectors) and if it has extended support doesnt work on that usb drive.  All others I have tested on work fine.

japheth

> Should I be able to read/write sectors to the USB drive as I would any other drive?

Usually yes. I have a USB memory stick attached and a fully functional Int 13h interface is installed for it. With a HD disk editor I can read/write the sectors as with "normal" HDs.


MichaelW

QuoteSo now my question is how does one detect "real" hard drives?

One possible method would be to determine if a device is present, and then ask it what it is :toothy

The attachment contains the MASM source and EXE for a mostly unfinished, and barely tested, DOS application that scans the standard ATA interface channels for devices that support the ATA or ATAPI Identify Device command, and reports what it finds. It should run under Windows, but for most versions it will not be able to detect any devices. I also included the source for the main module of an old QuickBASIC app that returns much more information, along with the compiled EXE. Before you try to run either of the apps under Windows, you should read the warnings in the QuickBASIC source.


[attachment deleted by admin]
eschew obfuscation