16 bit Assembly
Here is a summary of the tasks required. I will add more detail and code about each of these processes as the code is developed.
A floppy disk formatted as 1.44Mb has the following layout. 80 cylinders from 0 to 79, 18 sectors 1 10 18, 2 heads 0 to 1.
CHS is Short for Cylinder Head and Sector.
When calculating the sector position on the disk you must use the following method to get the head, cylinder and sector numbers. This example assumes the cluster address is 54.
If you need to work is backwards from a CHS to an Allocation Cluster do this. For example using the previous convertion.
The FAT contains a 3 byte addressing system. Each set of 3 bytes points to 2 blocks in the Disk Data Area.
The FAT starts counting from block zero, The first 3 bytes will usually be F0 FF FF, these represent blocks 0 and 1.
F0 FF indicates if the disk needs scanning etc.., Block 1 is where the disk label would be if it had a data area.
To find the correct data block number you need to manipulate the bytes as shown in the image below, using the address from the above FAT example, we get Allocation Clusers 2 and 3 which are byte values 03 40 00.
>The code sample following shows a method of achieving this in assembly code.
The code sample following is an alternate method of achieving this by returning both cluster values.
The code sample following converts the clusters back into a FAT12 allocation block.
The code sample following calculates to location of a cluster / allocation block within the FAT.
The code sample following converts a cluster number to its
CHS (Cylinder, Head, Sector) on the Disk.
The code sample following calculates the Cluster number from the CHS (Cylinder, Head, Sector).