This assignment makes use of four files contained in this zip file. This assignment has two parts. This assignment is due Friday, April 20. Part IFor this part of the assignment you are to write a program that accesses the sectors of a floppy disk at a fairly low level. (The second part will look at the "file allocation table" (i.e., FAT) that is on the floppy disk.)
You are to write implementations for the following three functions, which are described in comments in the file HANDLE physicalDisk(char driveLetter); void sectorRead(HANDLE theDisk, unsigned int logicalSectorNumber, unsigned char* buffer); void sectorDump(HANDLE theDisk, unsigned int logicalSectorNumber);Your definitions of the three functions must work with the driver program floppy.c which is also in the above zip file (you do not need to make any changes in the file floppy.c ). Make sure that you error check all of the Win32 function calls that you make. For example, your program should produce meaningful error messages if there is no floppy disk in the drive, or if the floppy disk is not formatted.
When you have this program done, experiment with it. Take a blank floppy disk and look at a bunch of its sectors. Are they empty? Format the floppy and look at the sectors again. Add a small text file to the newly formatted disk. Find the sectors that the file's data are written to (the data sectors will be after sector 10). Now delete the file. Is the data still there in the sectors? If you have access to a "boot floppy", look at its sector 0 and compare it to sector 0 of a non boot disk. Here are links to three of the Win32 API functions that you will need to use in this part of this assignment.
One of the things that you need to do in this part of the assignment is implement a hex dump of sectors from a floppy disk. It helps to have something that can verify for you that your hex dump is correct. You can do this using Microsoft Windows built in DOS C:\>debug -l 100 0 0 1 -d 100 1ffThese commands will dump the first half of sector zero from a floppy disk in drive A (only half a sector will fit in a command prompt window). You dump the second half of the sector using -d 200 2ffYou can dump any sector from the floppy by using a "load" command of the following form. -l 100 0 <sector-number> 1where the sector number is a hexadecimal number. In the zip file there is a screen shot of what these commands look like.
Here are links to information about the DOS Part II
For this part of the assignment you are to write a program that "unpacks" and displays the File Allocation Table (FAT) on a floppy disk so that the FAT can be more easily understood and manipulated. One of the points of this assignment is to emphasize why you want the operating system to provide "device abstractions" (because accessing a floppy disk at this low a level is not all that easy) and to also give you an idea of how an operating system can maintain a file system on a disk. This part of the assignment will use your
You are to write implementations for the following three functions, which are described in comments in the file BOOL fatRead(HANDLE theDisk, unsigned char *buffer); void unpackFAT(unsigned char *buffer, int* unpackedFAT); int countObjects(int* unpackedFAT);Your definitions of the three functions must work with the driver program floppyFAT.c which is also in the above zip file (you do not need to make any changes in the file floppyFAT.c ). Make sure that you error check all of the Win32 function calls that you make.
Notice that the third function in
When you have this program done, experiment with it. Format a floppy and then look at its FAT. Compare the display of the FAT given by In this part of the assignment you will need to make use of the following C operators.
Turn in a zip file containing your versions of the |