I decided to do a little testing and of the computers I have and tried on, here are the requirements to get the same formatted USB thumb drive to boot on all machines:
- Must have four partition entries at offset 0x1BE within the first sector.
- All Boot_ID fields (first field in each entry) must be either 00h or 80h. (only one can be non-zero (80h))
- The Sys_ID field must be non-zero for at least one entry.
- The last two bytes in the first sector (512 byte sectors) must be 0xAA55 (55 AA).
All other fields are ignored. For example, it doesn't matter if none of the entries are marked active. It also doesn't matter what the starting and ending CHS values are, nor what the Starting LBA and Sector Count fields are.
I have a valid DOS 5.0 1.44Meg Floppy BPB with 2 heads, 18 SPT, 2880 sectors, etc., and it still did not matter.
All machines emulated the USB thumb drive as a hard drive. I removed the partition entries and replaced with NOP's and all but one machine would no longer recognize the thumb drive as bootable. That one machine would still boot it, though it still emulated it as a hard drive, even with a floppy BPB.
Therefore, for all the machines I tried, as long as there is a Partition Table with four valid entries, three of them may be NULL's, but one must be a valid entry, all machines booted my code just fine.
There are a few things you must remember though. You must use BIOS service 08h (DL < 80h) or service 48h (DL >= 80h and verified this service is available) to get the parameters, *or* you must check to see that the BIOS emulates the Extended Read Service and use LBA addressing only, period. If you do this, it doesn't matter if the emulation is floppy or hard drive, as long as you do one of two things:
- if DL < 80h, call service 08h, then use the CHS read service (02h)
- if DL >= 80h, use service 42h and LBA addressing (making sure to check for the availability of service 42h).
If you follow those two rules, it won't matter if the emulation is floppy or hard drive emulation.
Anyway, these are my findings.
Ben
-
http://www.fysnet.net/the_universal_serial_bus.htmP.S. A little more digging and it looks like some of the machines I have use the Head count and Sectors per Track count from the BPB, if it exists, and then tries to calculate a cylinder count from that and the total sectors of the USB drive. However, it never uses a value larger than 0x400 (1024) cylinders. If the BPB does not exist, it uses a Head count of 0xFF and a SPT count of 0x3F. If I give it a BPB for a 1.44Meg floppy, it uses a head count of 2 and a SPT count of 18. However, DL is always 80h and the BIOS Disk Extension services are always supported, even with a 1.44Meg floppy BPB and a head count of 2 and a SPT count of 18. :-)