CS 2734
Computer Organization II
Laboratory 7
Laboratory 7 will meet in the Sun laboratory.
Prior to the laboratory you must write the following program.
- Create a separate directory and download the following
programs:
- Perform a
make to be sure that you have downloaded
the programs correctly.
- Modify
checkopcodes.c to do the following:
- If the number of command line arguments is incorrect,
output a Usage message and exit.
- Use the command line argument as a filename. Open the file
for reading.
- Read the file one line at a time until
end-of-file using
fgets.
- Echo the line to standard output and then process the line as follows:
- Use
strtok to peel off the tokens one at a time.
- Output each token on a separate line along with whether or not it
is an opcode. Your program should determine this by calling
get_opcode with the appropriate arguments.
If it is an opcode, output the op field
in HEX.
- Modify
opcodes.c so that it performs
as indicated in the documentation.
During laboratory checkoff a file will be made available for
you to run your program. You must hand in copies of all source,
your makefile, and your lint output. There should be no lint
errors.
You can test your program on the following
sample program.