Always remember that the size of the file that holds the image of the floppy disk’s data must be exact 1,474,560 bytes because the floppy has 80 tracks (0 to 79), 2 sides or heads (head 0 and head 1), each track has 18 sectors on it and each sector holds the 512 bytes of data, thus
Total bytes = (Number of tracks) * (Number of Heads) *
(Number of Sectors per Track) * 512
= 80*2*18*512
= 1,474,560 Bytes
Thus, if there is any error in reading at any sector of the floppy disk, it will change the size of the file from 1,474,560 Bytes, which will make the entire information completely or partially of no use for the destination disk on which we are going to write the disk image sector by sector from this file.
This is so because the Computer reads the information of any file on the surface of the media of the floppy disk within the sector range as it has been allocated in its allocation unit. Now if the sectors of the data of the files are changed, the complete file information is changed.
Thinking for the solution of sector(s) reading error
It is possible with the bad or unreadable floppy that it may have such bad area on its surface that we may not be able to read the information from the surface of the disk.
In this condition the information of this sector(s) will we skipped and the image of the floppy will be distorted even for the other sectors as the size of the image file in this case differs from 1,474,560 Bytes.
To maintain the size of the image file and to paste the rest of the information on the exact sector locations on the destination disk, we write some other information on behalf of the original data of 512 bytes and in this way, we’ll be capable to save the rest of the information however the recovery in such case may be the partial recovery.
If your system also fails to read the first sector of the source floppy, after pasting the image to the destination floppy you should run the program described before, to rewrite the DOS Boot Record of the floppy.
Let us see how we can do it by programming:
#include <bios.h>
#include <stdio.h>
void main(void)
{
int head,track;
union REGS regs;
int result,i,sector;
char filename[80];
struct diskinfo_t dinfo;
static char dbuf[512];
|