Here's the deal: you have some important data stored on a floppy disk but the darned thing is corrupted and now you can't get at it. You really can't face re-creating the data so you want to try and see how much of the file you can recover. You intend to do this by reading the entire disk into a file (binary, of course), and then trying to reconstruct your file.
The typical Floppy disk addressing works like this: [ you may or may not need this information]
|
Head#
|
Track#
|
Sector#
|
Logical Sector#
|
|
0
|
0
|
1
|
0
|
|
0
|
0
|
2
|
1
|
|
:
|
:
|
:
|
:
|
|
0
|
0
|
9
|
8
|
|
1
|
0
|
1
|
9
|
|
1
|
0
|
2
|
10
|
|
:
|
:
|
:
|
:
|
|
1
|
0
|
9
|
17
|
|
0
|
1
|
1
|
18
|
|
0
|
1
|
2
|
19
|
|
:
|
:
|
:
|
:
|
|
0
|
1
|
9
|
26
|
|
1
|
1
|
1
|
27
|
|
1
|
1
|
2
|
28
|
|
:
|
:
|
:
|
:
|
|
1
|
79
|
9
|
1439
|
Typical FAT looks like this:
|
Offset
|
Contents
|
|
0
|
8 byte file name
|
|
8
|
3 byte extension
|
|
11
|
attribute byte
|
|
|
bit 0 = read only bit
|
|
|
bit 1 = hidden file
|
|
|
bit 2 = system file
|
|
|
bit 3 = volume label entry (has no associated cluster)
|
|
|
bit 4 = subdirectory entry
|
|
|
bit 5 = archive (used by backup programs)
|
|
22
|
time (format: 5 bits for hour; 6 bits for minute; 5 bits for second)
|
|
24
|
date (format: 7 bits for year (year-1980); 4 bits for month; 6 bits for day)
|
|
26
|
starting cluster
|
|
28
|
2-word byte count
|
The File Info:
The file we are trying to recover is a Fixed Length Record file with the following format:
|
Field:
|
Contents
|
Size
|
Type
|
|
|
1
|
ID
|
4 bytes
|
integer
|
entry-sequenced so ID#s will be sequential in an uncorrupted file starting with #314 |
|
2
|
"name"
|
64
|
char
|
|
|
3
|
phone-number
|
5 bytes
|
10 digit BCD
|
|
|
4
|
"other info"
|
128
|
char
|
|
|
5
|
pad
|
3 bytes
|
zeros
|
- to get us to a word boundary |
|
total:
|
|
204 bytes
|
|
Records will NOT be split across sectors.
You may write this code [including shell scripts, perl, etc.] in any language your TA is willing to mark.
The program may require user input to complete its job, or it may work 'alone'.
These are the characteristics of the 'disks':
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Requirements:
| C- Version | Able to reconstruct file on test "disk" 1 | |
| B-Version | Able to reconstruct file on test "disks" 2-5 | |
| A-Version | Able to reconstruct file on test "disks" 6-7 | |
| BONUS | 1. [5-??? Points] print diagnostic information (like what went wrong? What is missing?) |
Copyright © 2002 Katrin Becker 1998-2002 Last Modified