> the kernel *should* work with sector sizes != 512 (as MSDOS
> reportedly does), but it simply doesn't. I Think PerditionC tried to
> make this work, and was successful for 256, 512, 1024 and 2048.
> unfortunately he didn't succeed for 4096 (I don't know the reason)
> so the FreeDOS kernel is stuck at 512 byte. no need to support
> anything else (in the context of freedos).

I would disagree about "no need to support", if for no other reason than MS-DOS 
does it (I've tested) and did it even in VERY early versions (not sure exactly 
which version it started -- it may have been there from the very beginning).

The way MS-DOS works is that there is one word in the List of Lists which is 
the maximum supported sector size for _any_ disk in the system.  The default 
value is set to 32 bytes, but this is changed while booting to match the 
largest sector size of any disk mounted (whether directly by the kernel or by a 
driver in CONFIG.SYS).  The MS-DOS kernel consistently uses the value stored in 
the LOL for calculations after booting, and never just assumes 512 bytes.  I'm 
not sure whether the MS-DOS utilities (like FORMAT and FDISK) can handle 
anything other than 512, but I know for sure the kernel can.

You can modify the LOL word in MSDOS.SYS to make a permanent change to the 
kernel, and a small "tutorial' on how to do that with DEBUG is included in the 
comments near the top of the source code for my USBDRIVE program.  You can also 
install a device driver for something that includes sectors larger than 512.  
What I usually do is install TurboDisk (TDsk.Exe) which is a RAM drive that 
supports sector sizes up to 2048 bytes.  I tell Turbo Disk to install a RAM 
drive with a 2K sector size and then I can use, for example, a DVD-RAM (which 
has 2K sectors) formatted with FAT32 as a sort of "giant floppy".  Of course, 
that only works with MS-DOS (and probably PC-DOS) since most other DOS's 
(including FreeDOS) don't work with sector sizes other than 512.

In terms of the FreeDOS kernel supporting sector sizes other than 512, there 
would probably need to be a LOT of changes.  One major thing I can think of are 
the BUFFERS, since the BUFFERS would either need to be compatible with 
different sector sizes (and not just assume 512) or the BUFFERS couldn't be 
used for disks that aren't 512.

> there *are* 4096 byte sector disk out in the wild:
> (a) 4kn  (4knative) disk export their 4k sector size to the OS and
> don't emulate 512 byte sectors.
>
> (b) some external USB disks export 4K sector size even when the
> internal disk has 512 byte sectors. I think they do this to be able
> to have 16 TB external disks, even with MBR partitioning.

I haven't seen a USB disk that does that, but don't doubt that they exist.

The specific example I can think of which has been around even longer than USB 
are DVD-RAM disks which have a 2k sector size.  DVD-RAM's have gone way out of 
fashion and the media is pretty scarce these days, but a lot of modern 
CD/DVD/BD players still support DVD-RAM.  You can format DVD-RAMs as either UDF 
or FAT32, and if they are formatted as FAT you can read them directly with an 
MS-DOS kernel.  One of the things I'm doing is modifying my USBDRIVE program to 
support CD/DVD/BD USB players.  If the disk inserted in the player is formatted 
as something other than FAT, the disk is presented as a "CD" and expects MSCDEX 
or SHSUCDX or something like that to handle the format interpretation.  If the 
media is formatted as FAT (usually FAT32) it is presented directly to the DOS 
kernel as a "removable hard drive" similar to how USBDRIVE presents a flash 
drive to DOS and lets the kernel do the format interpretation.

I'm not in a position to test right now, and I don't remember if Windows 
formats a FAT32 DVD-RAM as a hard drive (with an MBR and only one partition) or 
formats it as an un-partitioned "super-floppy".  A DVD-RAM is big enough that 
being able to divide it into multiple partitions seems like it would be a handy 
feature.

I'm also going to experiment with FAT formats on rewritable CD/DVD/BD media, 
but I'm not sure how well that will work.  I don't think FAT formats on 
rewritable CD/DVD/BD media (other than DVD-RAM) are supported by Windows (but 
they may be supported by Linux?), and rewritable media has a _much_ shorter 
lifespan than DVD-RAM.  With all the writing needed to the same area of the 
disk (the FAT) to store files "randomly", it's probably not going to be very 
reliable.  But I'm going to test and see.

> there is no point in this; CHS addresses the exact same sectors as
> LBA.

I think I agree.  CHS isn't going to give you any advantage over LBA.  I think 
I would make LBA the 'default" and only use CHS when there is no choice.

And, I think you should support sector sizes other than 512 right away even 
though you don't see a lot of practical use right now.  Having the capability 
already there certainly isn't going to hurt anything and will keep you (or 
someone else) from needing to come back in the future.  Sector sizes other than 
512 are not common, but they do exist and are probably going to be more 
prevalent in the future (especially since modern hard disks almost always use a 
native 4k sector size).


_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to