Page 1 of 1

Bios get valid hard disks?

Posted: Tue Jul 02, 2013 9:19 am
by computertrick
I am trying to make a drive system for my OS but when I check how many drives are ready it says 8 I am using the following code

Code: Select all

...
mov ah, 10h
mov dl, cl
int 13h
cmp ah, 0
je .found
...
Note: the code above is on a loop and CL gets incremented until it reaches 255

I did some testing and found that AH = 0 when a drive is ready is this incorrect? if so does anybody know how I can find out if a drive is in the system or not. And I am emulating with qemu

My reference: http://www.ctyme.com/intr/rb-0631.htm

Re: Bios get valid hard disks?

Posted: Tue Jul 02, 2013 12:08 pm
by AbstractYouShudNow
If all you want is to know what BIOS drive numbers have an actual corresponding drive, you can:
  • Try to read its first sector and check for errors
  • Try to read its geometry
  • Attempt to verify some of its sectors
I don't remember what exactly, but I think GRUB has a similar way to do this. A valuable reference is http://en.wikipedia.org/wiki/Int_13H