define an appropriate data structure for a sector, using methods discussed during the lecture. Declare three sectors. Use 31 as
the track number and 1, 2 , 3 as the sector numbers; Access the sectors using a pointer.
- format the sectors, by initialising the various fields of the sectors with appropriate values as shown above, as well as calculating
the error code;
- reading appropriate amounts of data from the text file, writing it into the sector, and calculating and writing the error code;
- dumping the sector contents to the screen in a neat format. This shows that everthing was written properly
The algorithm for calculating the error check is as follows ('old' and 'new' are integers):
old = 0
for (all bytes in the data area) do
new = (old*23 + byte) mod 65536
old = new
The final result is a 16-bit variable whose value is highly dependent upon the sequence of bytes that was used.
Note that you have to put the following lines at the start of the
program:
#include
#include
Your program should make generous use of comments to make sure that everything is explained clearly. Include brief documentation outlining the stucture of the code, and testing results.
Your submission should consist of a single pdf file on Blackboard, in the format detailed at the end of your lecture notes handout.