Page 1 of 1
BIOS INT 0x13 and FAT12
Posted: Sun Dec 26, 2004 7:50 am
by XStream
Hi,
With the BIOS int 0x13, if I request the BIOS to read a range of sectors, say 8 sectors after the boot sector, the BIOS will most likely read all of those sectors in the one int 0x13 call, if any of those sectors are bad on the disk will the BIOS call fail and return the error code that means 'bad sector' or will it simply read all of the sectors missing the bad ones, and how can you determine which was the bad sector(s).
With FAT12, if any of the FAT sectors go bad, is this disk still usuable for the FAT12 file system, I know that the FAT12 fats are in a fixed location so how would a FAT12 driver handle a disk with bad sectors in this area.
Cheers.
Re:BIOS INT 0x13 and FAT12
Posted: Sun Dec 26, 2004 9:54 am
by ASHLEY4
I do not know the answer to your ?, but there are 2 copys of the fat, So maybe it users the other one ?.
\\\\||////
(@@)
ASHLEY4.
Batteries not included, Some assembly required.
Re:BIOS INT 0x13 and FAT12
Posted: Sun Dec 26, 2004 10:28 am
by XStream
That would certainly be the solution if the first FAT was corrupted, however I am thinking along the lines of some sectors in both FATs going bad.
Any files using that area of the FAT for their cluster chain would obviously be lost but the if the rest of the FAT is ok then any files using only the good parts would still be accessible, I guess my real question on the FAT12 subject is what does the specification say about this kind of problem, how should it be handled to remain within the standard, like what if a disk is inserted that had bad sectors in the critical areas, how should it be formatted, should it be formatted at all or simply rejected, etc..., I have the "official" docs from microsoft and have a few others but I do not have any that mention this kind of problem. I know it doesn't matter for my own OS because I could just write a driver that handles the situation, but what if a disk from my OS is accessed from another OS, will they still be compatible if they have these bad sectors.
I would like to be able to test it but unfortunately I do not know of any method that will allow me to damage a disk in certain areas only
Thanks.
Re:BIOS INT 0x13 and FAT12
Posted: Sun Dec 26, 2004 11:36 am
by ASHLEY4
I would not put too much effort in to this, as some times, its just blots your OS with check for errors that may or may not happen, and if both fats are corrupted then you can not recover, floppy's can easily be replaced.
I have just done a pmode floppy driver and if you follow the Intel manual you should be OK, it will work fine on a real pc, but getting it to work with a emulator (bochs etc) will be harder
.
\\\\||////
(@@)
ASHLEY4.
Batteries not included, Some assembly required.
Re:BIOS INT 0x13 and FAT12
Posted: Mon Dec 27, 2004 5:14 am
by XStream
ASHLEY4, How do you report errors if you do not know they have happened, surely a simple check for bad sectors wouldn't bloat the system to much. Also a recovery from bad sectors in the FATs might not be easy but if I had a disk with important info on it, then surely there would be cause to try and recover what you can.
And what of my other question, will the BIOS report bad sectors if you request a range of sectors to be read or written and one in the middle is bad? Or is it more reliable to actually read single sectors at a time. Has anyone had an opportunity to actually test this.
Cheers.
Re:BIOS INT 0x13 and FAT12
Posted: Mon Dec 27, 2004 9:32 am
by ASHLEY4
@XStream
1. Once the command has been completed, the status registers ST0-3 return information which can help you either confirm correct execution of the command, or determine the cause of an error.
2.You would get a error, you use the info from ST0-3 to find what coursed the error.
Also using a hex editor you should be able to simulate a bad sector error.
PS: when i said blot, i did not mean do not check for errors, i meant in the case where both fats are corrupted, its then a case of a 3 thd party data recover programs.
\\\\||////
(@@)
ASHLEY4.
Batteries not included, Some assembly required.
Re:BIOS INT 0x13 and FAT12
Posted: Tue Dec 28, 2004 6:39 am
by bubach
when the int is done the carry flag is set on a read error.
Code: Select all
;some code to set regs
int 0x13 ;read it
jc try_again ; failed, try it again..
Re:BIOS INT 0x13 and FAT12
Posted: Thu Dec 30, 2004 8:18 am
by XStream
bubach, if I tell the BIOS to read 10 sectors and it returns ah=bad sector status code then how do I know which sector was bad, should I just read one at a time after this until I find the sector that was bad?
Re:BIOS INT 0x13 and FAT12
Posted: Thu Dec 30, 2004 10:53 am
by bubach
you can have a loop that makes your function to always read one sector at a time.
or you can present the user with a blue screen of death and then reboot (on atleast three more read-tries).
/ Christoffer