flat assembler
Message board for the users of flat assembler.

Index > OS Construction > How to enumerate drives using interrupt?

Author
Thread Post new topic Reply to topic
irvan_herz



Joined: 16 Jun 2015
Posts: 2
irvan_herz 16 Jun 2015, 10:38
Currently, I'm writing bootloader.
I need to get list of drives in my computer.
I think i can check drives from 0 to 255. But it seem ineffective..
Could you tell me better way to do?
Post 16 Jun 2015, 10:38
View user's profile Send private message Visit poster's website Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 557
smiddy 16 Jun 2015, 11:33
There a lot of solutions to this. If you think about it, from a BIOS perspective, not all of the 0 thru 255 will be used. So what is the most practical? Check 0 thru 3 (use CMOS) for floppy drives, then start at 80h until you get no more drives for HDD, then start at each of 90h, A0h, B0h, C0h, D0h, E0h, and F0h for CD/BDs. That cuts it down quite a bit.
Post 16 Jun 2015, 11:33
View user's profile Send private message Reply with quote
irvan_herz



Joined: 16 Jun 2015
Posts: 2
irvan_herz 16 Jun 2015, 12:50
smiddy wrote:
There a lot of solutions to this. If you think about it, from a BIOS perspective, not all of the 0 thru 255 will be used. So what is the most practical? Check 0 thru 3 (use CMOS) for floppy drives, then start at 80h until you get no more drives for HDD, then start at each of 90h, A0h, B0h, C0h, D0h, E0h, and F0h for CD/BDs. That cuts it down quite a bit.

Okey, now I am wondering. where I can find reference about BIOS drive number like that?
I have searched in RBIL and google and found incomplete explanation.. Rolling Eyes
Post 16 Jun 2015, 12:50
View user's profile Send private message Visit poster's website Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 557
smiddy 16 Jun 2015, 18:47
There are several references, not one specific to enumerating drives. Start with the boot process, where once the PC boots, it places the boot drive number in the DL. Then look up CMOS and drive numbers, you will find some references to floppies and hard drives. The most obscure and ambiguous is/are compact disc/bluray discs. In my own personal experience, the CD/BDs will most likely start at E0h or F0h, but there are times I've seem them at A0h too, which is why I mentioned the ones in between. Oh, and 90h can sometimes be a hard drive (see DOSBox's interfaces; but if yuo don't use DOSBox, don't sweat that one).

So, to be clear, there are many references, all over the place, not one specific one. Your enumeration method/requirement would require you to seek out many different sources to determine how they all work together. They were all developed in different times, and patched together since the 1970's-ish.

BIOS, itself, doesn't care about the drive number, per se. What I provided is a convention, not really a standard.
Post 16 Jun 2015, 18:47
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.