CSC 277 Program 6 (40 points)
DUE: Wednesday 04/11/01
In this assignment, you are to write a utility program that performs certain low-level disk operations on the 1.44 MB floppy drive. Your program’s interface should be similar to that of program 5 in the sense that it will present at least three separate regions of the screen, one for user input, one for user-requested output, and one for help. Your program should have the following capabilities:
1. The user can select and display any logical sector on the disk.
2. The user can save a given sector to a file on another disk.
3. Display a listing of the files in the root directory in a directory format, including the actual sectors allocated to them. I will not test this function on files that have “many” clusters allocated (i.e., really large files), but your program should allow the user to page through this output. (That is, make sure that you don’t generate so much output that the output obliterates all that hard work you’ve done setting up screen regions.)
The directory format display should show the following information: the filename, the date, time, file size, and the file’s attributes. The attributes of files should include single-character codes for hidden, read-only, system files, and directories. Volume label and archive bits can be ignored. Do not use function 43H at int 21h. Below each directory listing line, display the actual sectors (not the clusters) allocated to the file.
The choice of how you handle input from the keyboard is up to you, but there should be some sort of region of the screen that shows the choices (display a help area that shows all valid commands). Make your program ignore invalid input. A suggestion (which some of you have already done in previous programs) is to simply use a single-character input function and to not respond if the input is not in the set of valid inputs. Input from the disk may not use DOS service functions described in chapter 12. Instead, use those functions (such as INT 25h) described in Chapter 11 (specific requirements are described in the next paragraph).
For item 1: use the INT 25H function to read sectors. Display the output so that control characters are not interpreted. For item 2: you can use DOS service functions (i.e., the file functions at INT 21h) to create and write the output files. You must obtain the output filename (and/or path) from the user so that the program knows where to write its output. Do not allow the user to overwrite pre-existing files. For item 3: the information is to be obtained using techniques described in Chapter 11 to read a sector that happens to be the root directory. Extract the information into a data structure as described by the directory structure entry (table 5 in the book). You will then need to do some formatting of this data structure to display it (for example, perform some computations on the time and date fields and extract information from the attribute byte).
Hints:
Much of the functionality in this assignment has already been written and presented to you. Your job is mainly to take those separate programs and combine them together into one, adding some screen processing and other functionality (such as time displays) that you must figure out.
Deliverables:
· A copy of prog06.asm on disk
· A printed listing of the program file, unless you prefer an emailed grade.
Grading:
· Correct execution: 30 points
· Program readability 10 points
Extra Credit:
I’ll give up to 10 points extra credit if this program can handle a larger disk (i.e., one with a 16-bit FAT). Specifically, this larger disk might be a Zip drive. This would also require the program to allow the user to select the current drive. Do not worry about functionality on drive C.
Cautions:
Don’t break your computer. Don’t break my computer.