Bios get valid hard disks?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
computertrick
Member
Member
Posts: 71
Joined: Wed May 29, 2013 1:07 pm

Bios get valid hard disks?

Post 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
1100110100010011
AbstractYouShudNow
Member
Member
Posts: 92
Joined: Tue Aug 14, 2012 8:51 am

Re: Bios get valid hard disks?

Post 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
Post Reply