Using USB devices on FreeDOS.
There is no real need to have access to a USB flash drive on a FreeDOS machine; if you have to transfer files (as for example in order to install new software), you can either use floppy diskettes or burn the files onto a CDROM (aka create a CD image). On the other hand, a flash drive may make things easier, and if you want to copy files, that are too large to fit on a diskette from your DOS machine to another computer, may be really useful.
There is a USB driver for DOS called DOSUSB, that features support for USB 3.0. Unfortunately, this driver is commercial. For details, please visit the dosusb.net website.
This tutorial is about installing USB 2.0 support on FreeDOS (I actually use FreeDOS 1.3 RC5). It works well on my VMware Workstation 16 virtual machine. Be sure to set USB compatibility to "USB 2.0" in the VM configuration!
Requirements:
- A USB 2.0 flash drive. These are still available at computer shops. If possible, use a drive with a maximum storage capacity of 32 GB. In fact, this is the maximum partition size supported by the FAT32 file system. If your flash drive has a bigger size (as in my case, 64 GB) things become rather tricky, and you'll have to partition the flash drive.
- A USB 2.0 driver for DOS. The Panasonic Communications Co. ASPI Manager for USB mass-storage (Universal Driver) Version 2.20 supports all major motherboard chipsets including Intel, ALi, SiS, VIA, and NVIDIA. It recognizes standard USB 1.1 (OHCI/UHCI) and high speed USB 2.0 (EHCI) controllers, and makes the connected USB device visible to the DOS operating system as an SCSI device in ASPI mode. The device can then be accessed by an ASPI driver; on FreeDOS this works well with the Novac ASPI Mass Storage Device Driver (aka the Motto Hairu USB Mass storage Driver).
It's possible that the two drivers are part of the FreeDOS installation files. Anyway, I downloaded USBASPI.SYS and DI1000DD.SYS from the DOS Days website, and copied them to my C:\FREEDOS\BIN directory.
The Panasonic driver does not support hot-plugging your device once the driver has loaded. Thus, you have to connect the flash drive before loading the driver. This is made easy, using the /w command line parameter during driver installation: It pauses execution (until you press ENTER) and thus gives you the time to connect the drive.
At first (we will see further down in the text that this might not work and that there is a better way to do), I added the following two lines to my FDCONFIG.SYS:
devicehigh=c:\freedos\bin\USBASPI.SYS /w /v
devicehigh=c:\freedos\bin\DI1000DD.SYS
The two screenshots below show a step by step start-up of my FreeDOS machine. On the left, you can see how the Panasonic driver is loaded, detects the USB controllers, and also my USB flash drive (a 64 GB USB 2 stick by Philips). On the right, you see the installation of the Motto Hairu driver. This results in read errors when trying to access the drive. Obvious, because the flash drive was formatted with the extended FAT file system, that is not supported by FreeDOS.
The screenshots below show the usage of memory when starting FreeDOS with the two drivers loaded. As you can see, both USBASPI.SYS and DI1000DD.SYS are entirely loaded into the UMB, thus conventional memory is not affected, and I had comfortable 624 KB of RAM left for program executions..
Partitioning a 64 GB flash drive for usage with FreeDOS.
If your flash drive is 32 GB or less (it is probably formatted with exFAT), you can simply reformat it using the FAT32 file system. This works for FreeDOS, but will not work for MS-DOS 6.22, that only supports FAT16. The partition size for this file system is limited to 4 GB, and I suppose that it would be rather difficult to find a 4 GB USB 2 flash drive in 2024...
What follows is rather messy. It describes how I did proceed, and this was essentially a "try something, and if it fails, try something else". This means that the way to proceed, described here, is neither the simplest, nor the best one. If you choose to do exactly how I did, it's nearly sure that you will succeed to let your FreeDOS access USB devices. If you prefer to try something else (easier, more logical), you might succeed, too, but you might also fail...
The problem actually is that USB flash drives are not supposed to be partitioned as are hard disks. But, that is what we'll have to do! I decided to delete the original file system on my USB flash drive on Windows, but noticed that this is not possible. Trying to delete the volume in Windows 10 Disk Manager, I got the error The request is not supported. I then used Minitool Partition Wizard to reformat the drive using FAT32. This idea was rather stupid, but at the beginning I did not consider the 32 GB limit of FAT32. Surprisingly, the operation was said to have succeeded in Minitool Partition Wizard. Displaying the disk layout in FreeDOS using fdisk showed 3 non-DOS partitions, that I deleted all three. I suppose, without being entirely sure, that the correct way to proceed would have been to do all on FreeDOS: connect the flash drive with its original file system, and use fdisk to delete whatever partitions are listed for the drive.
Anyway, the starting point is a flash drive with no partitions defined, i.e. consisting of an unallocated space area extending over the whole drive. Run fdisk; be sure to select the second disk as the one that you want to make modification to! Choose to create a DOS partition or a logical DOS drive (option 1), then to create an extended DOS partition (option 2). Use the maximum space available (this is also the filled-in default value) as size for the new partition.
Inside of the extended partition, create a logical drive. Remember that the size of this drive must be less than or equal to 32 GB. As you can see on the screenshot, I chose to create a partition of 20 GB.
The screenshot below shows the disks layout on my FreeDOS machine. As my harddisk actually contains 3 partitions, it's the drive letter F: that will be assigned to the new partition on the flash drive.
Delaying the installation of DI1000DD.SYS.
At the beginning of this tutorial, I showed how to add the directives to load the two drivers USBASPI.SYS and DI1000DD.SYS to FDCONFIG.SYS. I also said, that this will probably not work correctly. The reason for this is that modern computers are so fast, that somehow DI1000DD.SYS is loaded and executed so quickly, that if this occurs directly after USBASPI is loaded, it somehow fails to capture the latter's output. This is how Terry Stewart describes the issue on the Tezza's Projects and Articles website. The result of the issue is that the USB flash drive will not be usable.
The solution of the problem consists in delaying the installation of DI1000DD.SYS. Terry does it by loading USBASPI.SYS, then some other driver, and only then
DI1000DD.SYS. I opted for another way to do: Loading USBASPI.SYS in FDCONFIG.SYS and loading DI1000DD.SYS in FDAUTO.BAT. This requires that
DEVLOAD.COM is present on your computer, what on FreeDOS is the case by default, I think. Here are the correct directives/commands for the two drivers:
In FDCONFIG.SYS, add the directive:
devicehigh=c:\freedos\bin\USBASPI.SYS /w /v
In FDAUTO.BAT, add the command:
devload /H di1000dd.sys
The screenshot shows the execution of the final commands of my FDAUTO.BAT with the installation of the Motto Hairu USB Mass storage Driver and the assignment of the drive letter F: to the 20 GB FAT32 partition on my USB flash drive. Note, that the partition is said to be "not formatted", what actually is the case at this stage.
Formatting the USB drive partition.
Trying to format the partition on FreeDOS fails! Error message: Error reading from drive F: DOS area: Unknown media type. I chose to format the partition on Windows 98 (using the default FAT32 file system). Note, that you'll have to perform a complete format (Windows 98 says that quick format is not possible because the media is unformatted, its capacity is incorrect, or the device is empty). I suppose that it would have been simpler to format the partition on Windows 10; doing this using FAT32 should normally be no problem.
Note: On my Windows 10, I created a second partition on the flash drive, and formatted it using NTFS. This partition (and possibly the FAT32 partition, too) will on most operating systems not be accessible. Flash drives that are partitioned like harddisks are not correctly recognized by Windows releases prior to Windows 10. Modern Linux distributions seem to correctly recognize the two partitions (at least Linux Mint 20 does).
Accessing the USB drive partition.
The FAT32 partition should now be fully accessible using F: as drive letter (on my system; on yours, it will probably be D:). Access should work in read, as well as in write mode. The screenshot shows the directory listing of the empty drive, the copy of three files from a diskette, and another directory listing, showing the files that have been copied.
If you find this text helpful, please, support me and this website by signing my guestbook.