I took a look at this problem, and I think it comes from check done at
inthndlr.c:1657: if (dpbp != NULL && ISFAT32(dpbp)))
As the dpbp content has still its default initialisation value (filled with 0
during kernel initialisation), dbp_fatsize is 0, leading to error 0x0207.
In that case format retries with 0x80 added to drive letter leading to wrong
drive letter error 0x0201. About this retry, I noticed that in format code, the
comment about it (driveio.c:227), is wrong with my version of RBIL (my version
agrees with original check of 0x0408 that was commented :-).
When the drive is read before through dir, the dpbp is initialised and thus pass
the check. It shall be noticed that it still could fails in case byte
corresponding to dbp_fatsize is 0. An easy check with quemu is to fill the file
corresponding to floppy drive with 0 and the same error happens even with
performing dir before (in that case dir itself outputs errors).
Using FreeDOS format with a MS-DOS kernel works fine.
There can be several solutions to this problem:
- perform a media_check before the test, but could this be done on any kind of
drive without problem ? This is only a partial soluation as this will still be
wrong when writing boot sector.
- ignore this check for floppy as they hardly can be FAT32 (unless having some
ZIP or similar floppy).
- not perform the check in case of write: RBIL speaks of 0x0207 error for FAT32
access only in read case, not in write one. And that seems not dummy as doing
such a check when writing the boot sector is nonesense.
It shall be noticed that for the boot sector writing, format already workaround
this by using BIOS access in that case (but I did not find any documentation
about writing boot sector through INT 26 to be disallowed).