Eddie Anderson wrote:
> "Jan van Wijk" ecomstat...@dfsee.com wrote:
>>Message: 1
>>I have seen this problems numerous times over the last 10 years,
>>starting with the 1.0 kernel, then the 1.1, and I now just verified that
>>it still happens with the kernel that is in the 1.2 RC1 release.
>>Description of the problem symptoms:
>>On booting FreeDOS, AFTER processing config.sys and at least
>>after a part of the stuff in AUTOEXEC.BAT, it may happen that
>>error messages scroll by, relatively fast, and for a long time:
>>         Run chkdsk: Bad FAT I/O: 0x00000001
>>The message is repeated at least a dozen times, then the sector/block number
>>is incremented and another bunch or errors is repeated.
> Thanks for your detailed description of this problem, its cause, and 
> some circumventions. I have stored it for future reference.
> I don't remember if I have encountered this particular problem; but 
> I have had to patch boot sectors after using mkdosfs (due to missing 
> boot code) or incompatible BPBs when repairing or constructing image 
> files.
> Sorry for my delayed response.  Because of the way sourceforge 
> handles digests, I didn't receive the digest containing your post 
> until more than two weeks after you sent it.
> --
> Eddie


I did previously did some search about some similar problem (format error in 
FAT32 kernel, I think it is bug 115). I found it seems due to some unitialised 
variable, I put the mail I sent to kernel list at the time I look at that (it 
was 2,5 years ago, so perhaps line numbers are no more correct).

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
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).

I have an additional remark about the check for 0x0207 or 0x0408 difference.
In my version of RBIL, it is set that the checks is performed only when using 
function for device less than 32M. But this is never the case in format code: 
uses either INT 25/CX=FFFF (so > 32M call) or INT 21/AX=7305 (FAT 32) 
So perhaps could this part of code be removed. I think it could be safer 
trying to format hard-drive in case formatting floppy fails is quite 

Jan, something you can try (if you can easily perform this), you can change the 
kernel to use a not FAT32 one, as this check only exists in FAT32 specific 
You will see if it works or not (it is perhaps not suitable for you need, but 
that could help knowing if it is the same problem or another one).



Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Freedos-user mailing list

Reply via email to