usbdrive; dos-number of drives in 0040h:0075h

The intent of this forum is to discuss my DOS TSR programs (available at http://bretjohnson.us), how they work and don't work, new/missing features, status of updates, and anything else related to them that may need to be discussed.

usbdrive; dos-number of drives in 0040h:0075h

Postby admin » Wed Aug 12, 2009 2:33 am

ADMIN Note: This is an e-mail I received from a user, but it's such an excellent question that I am posting it here on the forum for others to view.

Hi,

Thanks for your prompt answer yesterday. I’m sorry overlooking the “DisableOther”-parameter in your description.

Now I noticed another problem:
Our self-made measuring-program is reading the number of drives from DOS at memory 0040h:0075h. With your USB-solution this parameter seems to be wrong now.

The situation:
Computer: FUJITSU-SIEMENS Scenic L, i845G, D1387, Phoenix-BIOS4.06 with build-in
PCI-6xUSB: see the pdf-enclosure if necessary.
MS-DOS 6.22
“LASTDRIVE = O”
HDDs:
1st (80h, with Extension) = C:, E:, F: and G:
2nd (81h) = D:
CD-ROM (by MSCDEX) = O:

So the letters H:, I:, J:, K:, L:, M: and N: are free. I chose the 3rd Controller for USBUHCI (Index 2) for the 2 Front-USB-plugs and told your USBDRIVE to look from H: onwards.

The memory at 0040h:0075h shows the number of 10 to me regardless of a memory-stick has been plugged in or not. From my DOS-knowledge this number should be 2 without the
memory-stick and 3 with it plugged in. When I tried the Panasonic-solution this was as expected for DOS. Why is it not so with your program? Is it a fault?

EDIT:

Perhaps I made a mistake. Possibly this address is owned by the BIOS and not DOS. I do not remember well.
admin
Site Admin
 
Posts: 10
Joined: Thu Jul 10, 2008 1:34 pm

Re: usbdrive; dos-number of drives in 0040h:0075h

Postby Bret » Wed Aug 12, 2009 3:52 am

No, this is not a fault. This is exactly as it should be.

Everything in the 0040h segment is related to the BIOS, and has nothing at all to do with the Operating System (in this case, DOS). It is completely independent of the OS.

The value stored at 0040h:0075h is the number of fixed disks in the computer, which are assigned INT 13h disk numbers starting at 80h (80h is the first fixed disk, 81h is the second, etc.). On most "standard" computers, there is usually only one fixed disk (usually IDE, SCSI, or SATA, assigned number 80h). The disk can have many partitions on it, which may or may not get assigned drive letters by DOS.

To further complicate things, there are devices called "removable hard drives" or "fixed disks with removable media". These are sort of a cross between a floppy and a fixed disk. They are similar to a floppy because the media is removable, but a floppy doesn't have multiple partitions. In the BIOS, removable hard drives they look like fixed disks (INT 13h disk numbers starting at 80h), but they need to respond to certain kinds of requests like floppies do. USB disks are, by nature, removable, and therefore are set up by USBDRIVE to look like removable hard drives.

The main difference between Panasonic solution and USBDRIVE is that Panasonic does not support "plug-and-play". Panasonic sets the USB disk up as a true fixed disk rather than a removable hard drive. When the Panasonic drive is installed into memory, the USB disk(s) must ALREADY be plugged in or Panasonic will never find them. If you ever unplug the disk while the Panasonic driver is loaded and then try to plug it in again, or heaven forbid try to plug a DIFFERENT disk into the same slot, the results could be catastrophic. The Panasonic driver is designed to be loaded via CONFIG.SYS, so the number of fixed disks stored at 0040:0075h is assigned during the boot process.

USBDRIVE does not work that way. When USBDRIVE is installed into memory, it simply "reserves" some INT 13h disk numbers (the number of these is controlled by the /Disks:# option) and some DOS drive letters (the number of these is controlled by the /Drives:# option). It adjusts the number of fixed disks stored at 0040:0075h according to the value of the /Disks:# option. This is what happens with all removable hard drives (and floppies) -- it's actually the disk "carrier" or "slot" that is assigned the INT 13h disk number, not the media. This is true no matter what the Operating System is, since this is BIOS-level configuration, not OS-level.

When USBDRIVE is first installed into memory, the ONLY thing it does is RESERVE the disk numbers and drive letters. It doesn't care yet whether there are actually any USB disks inserted or not. After it has been installed, it searches for disk/media insertions and removals in the background. As disks are inserted and removed, they are assigned to the INT 13h disk numbers that were reserved when USBDRIVE was installed. After USBDRIVE assigns an INT 13h disk number, it then reads and interprets the partition information from the disk and assigns the appropriate FAT partitions to the DOS drive letters that were reserved when it was installed. Even if the disk doesn't have any valid FAT partitions, the INT 13h disk number is still assigned so that you can use BIOS-level programs like FDISK or the Ranish Partition Manager or NTFSDOS.

Because USBDRIVE does all of the disk number and drive letter assignments in the background, even if a USB disk is inserted when it is installed into memory, it may take a short time (usually a couple of seconds) before everything configures and the DOS drive letter(s) are actually usable. This can take even a little bit longer if the USB disk itself is something like a multimedia card reader that has several physical slots on it. Each physical slot (into which can be inserted a different type of media) gets assigned a different INT 13h disk number.

The value at 0040:0075h is the total number of fixed disks AND removable hard drives. Removable hard drives are just not something people are used to seeing any more, even though they first appeared on PC's in the early 1980's.
Bret
 
Posts: 478
Joined: Fri Oct 10, 2008 3:43 am
Location: Rio Rancho, NM


Return to Programs

Who is online

Users browsing this forum: No registered users and 1 guest

cron