|
The int86x(0x13, &i, &o, &s) function invokes the interrupt 13H with segment register Values. The getdrivegeometry function returns the total number on drive.
- In the main() function, (char)peekb(0x0040, 0x0075); (the function peekb is Defined in DOS.H) returns the number of hard disks attached to the system.
The number of hard disks connected to the system is represented by the byte stored at memory location 0040H:0075H (Segment 0040H: Offset 0075H). If the number of hard disks connected to the system is less then two program shows the error message and exits.
Sectors_in_HDD1 = getdrivegeometry (0x80); gets the parameters of first hard disk (0x80) and returns the total number of sectors on first hard disk.
Similarly Sectors_in_HDD2 = getdrivegeometry (0x81); gets the parameters of second hard disk (0x81) and returns the total number of sectors on second hard disk.
After confirmation by the user to continue with imaging, first check the condition that the size of source hard disk should not be greater then the size of the destination hard disk. If the destination is smaller, Display the error message and exit.
If everything is going right, copy the sectors of the source disk to the destination disk. Here we are reading and writing 61440 Bytes (120 sectors with each of 512 Bytes) at a time to make the imaging process faster.
If you want to use more sectors at a time, even beyond the limit of 64K, you can do it by using “huge Pointer” in large memory model. The Example of Specification is as follows:
char huge array[100000L];
- The Function, readabsolutesectors ( 0x80, loop, 120, buffer ); reads the 120 sectors of first hard disk (0x80), starting from the sector number specified by unsigned long integer loop and store the data in data buffer.
- The Function, writeabsolutesectors ( 0x81, loop, 120, buffer ); writes the data of data buffer to 120 sectors of second hard disk(0x81), starting from the sector number specified by unsigned long integer loop.
|
|