Page 1 of 1

Test for boot drive

Posted: Wed Jan 26, 2005 7:46 pm
by ASHLEY4
Does any one know how to test for boot drive, let me explane, i do not mean if you boot from a floppy disk etc, i know how to do that, but say i am booting from a CD, that emulats the floppy.
I need a way to know that its the CD and not the floppy.

So i can put D:\> at the prompt and not A:\>.

Thanks in advance.

\\\\||////
(@@)
ASHLEY4.

Batteries not included, Some assembly required.

Re:Test for boot drive

Posted: Wed Jan 26, 2005 9:24 pm
by AR
http://www.phoenix.com/NR/rdonlyres/56E ... bbs101.pdf
According to this, the BIOS Drive Number will be passed in in DL. But as far as I can tell, it's Phoenix specific which is probably why the FAT BIOS Block has the drive number placed in by the format utility

Re:Test for boot drive

Posted: Thu Jan 27, 2005 12:15 am
by Brendan
Hi,
ASHLEY4 wrote: Does any one know how to test for boot drive, let me explane, i do not mean if you boot from a floppy disk etc, i know how to do that, but say i am booting from a CD, that emulats the floppy.
I need a way to know that its the CD and not the floppy.

So i can put D:\> at the prompt and not A:\>.
How about INT 0x13, AX = 0x4B01 (http://www.ctyme.com/intr/rb-0719.htm)?

After that you could try INT 0x13, AX = 0x4B00 (http://www.ctyme.com/intr/rb-0718.htm) to disable the emulated floppy, restoring the system back to normal so that the real floppy is no longer B:.

I'd load the entire OS into memory, use the first BIOS function to detect the emulated floppy from the CD and then the second to disable the emulated floppy, and then boot the OS. That way all device letters will be the same regardless of how you boot.

In any case D: should refer to the real CD rather than the emulated floppy from the CD.


Cheers,

Brendan

Re:Test for boot drive

Posted: Thu Jan 27, 2005 12:51 pm
by ASHLEY4
Thank you both for your help.
In any case D: should refer to the real CD rather than the emulated floppy from the CD.
The probem is people boot from a CD, it loads my OS, but once it enter pmode emulation stops, all of the files on the CD can be run from the built in CD driver, but before they can do a dir command they need to change from the A:\ to the D:\ .
I know and you know it emulats a floppy, but to them they are booting for a CD.

But all test for boot drive, show 00 for the first floppy drive.
What do you think about testing for a b: drive as not many PC have them these days ??.

\\\\||////
(@@)
ASHLEY4.

Batteries not included, Some assembly required.

Re:Test for boot drive

Posted: Thu Jan 27, 2005 8:16 pm
by Brendan
Hi,
ASHLEY4 wrote:
In any case D: should refer to the real CD rather than the emulated floppy from the CD.
The probem is people boot from a CD, it loads my OS, but once it enter pmode emulation stops, all of the files on the CD can be run from the built in CD driver, but before they can do a dir command they need to change from the A:\ to the D:\ .


The traditional way of solving this is with a "PATH = D:" environment variable (which could be preset by the OS). You'll need something like this when the OS is installed on the hard drive anyway. In general the user should be able to type something like:

A:
dir
D:
dir
format c: /u /s
mkdir c:\os
cp d:\os\* c:\os
set path=c:\os
dir
ASHLEY4 wrote: But all test for boot drive, show 00 for the first floppy drive.
If you detect if the CD is emulating a floppy (see my previous message) you'll know if "device 0x00" is the emulated floppy or a real floppy. This method also works for emulated hard disks too (where "device 0x80" is actually a fake hard drive from the boot CD).
ASHLEY4 wrote: What do you think about testing for a b: drive as not many PC have them these days ??.
What do you think of restricting your OS to one floppy drive only? What if the user has got 4 floppy drives (let's see, A:, B:, um, err)? I guess they can still use Unix (/dev/fd0 to /dev/fd3).


Cheers,

Brendan

Re:Test for boot drive

Posted: Thu Jan 27, 2005 9:01 pm
by ASHLEY4
Thanks Brendan, I will give your ideas a try.

\\\\||////
(@@)
ASHLEY4.

Batteries not included, Some assembly required.

Re:Test for boot drive

Posted: Fri Jan 28, 2005 9:41 am
by dh
I suppose that you could look for (on a Hard Drive) for the bootable flag and on other devices look for the 0xAA00 (or is it something else???) flag somewhere near the beginning of the filesystem. Hope this can [somehow] help ;P


Cheers, DH.

Re:Test for boot drive

Posted: Fri Jan 28, 2005 12:05 pm
by ASHLEY4
Thanks DH,
I will give all methods a try tonight and see which work, or which works best.

\\\\||////
(@@)
ASHLEY4.

Batteries not included, Some assembly required.

Re:Test for boot drive

Posted: Fri Jan 28, 2005 12:56 pm
by dh
@Ashley4: I'm here to learn and help others ;D

Re:Test for boot drive

Posted: Sat Jan 29, 2005 4:09 pm
by ASHLEY4
Update: Just in case any one else, may need this info.
http://www.ctyme.com/intr/rb-0719.htm
Works in finding wether the drive is emulatored or no.
This int works on all my test PC, other than a old p100, which gives a error, eg: set the CF to 1.

\\\\||////
(@@)
ASHLEY4.

Batteries not included, Some assembly required.