Write a C or C++ function that disassembles Alpha machine language.
The function should be capable of disassembling any of the instructions listed in the distributed document "alpha.ops". If while disassembling you encounter an instruction not on this list, simply place "unknown" (and the hex value of the instruction) in the output buffer.
The output format should be identical to the format used in the "Example" column in the "alpha.ops" document. Registers should be displayed with `$num' notation where `num' is decimal. Displacements and immediate constants should be in decimal. The opcode should be placed in the buffer first (with no preceding spaces). The operands should be separated from the opcode by one space. Operands should be separated by commas (with no spaces). IT IS IMPORTANT TO FOLLOW THESE FORMATTING RULES SINCE WE WILL BE USING THE diff PROGRAM WHEN WE DO THE GRADING.
The directory ~cs611/public/progs/prog5 contains a stub for the function in disassemble.c. The directory also contains the "alpha.ops" document, a main program, four test files. and a Makefile for building and testing your program. One test file contains only Memory format instructions, one contains only Operate format instructions, one contains only Branch format instructions, and one contains only jsr and ret instructions. Each test file will be worth 25 points. (The directory also contains a program, create-data, for creating test data from Alpha assembler input. The create-data program must be run on a Alpha processor.)
You may lose points if your program is not properly structured or adequately documented. The same general guidelines given on program 2 are still in effect.
Your programs will be graded using an Alpha machine (e.g. hopper and christa) so be sure to test in that environment.
Your programs should be submitted for grading from either hopper or christa. To turn in this assignment, type:
~cs611/bin/submit prog5 Makefile disassemble.c main.c
or
~cs611/bin/submit prog5 Makefile disassemble.C main.C
Turn in Makefile and main.c even if you did not change them. (If you do the assignment in C++, you will need to modify the Makefile and possibly rename the source files.)
Notes:
Submissions can be checked by typing:
~cs611/bin/scheck prog5
To receive full credit for the assignment, you must turn in your files prior to 8am on Monday April 14. Late submissions will be accepted at the penalty of 5% per day up to one week late.
Remember: as always you are expected to do your own work on this assignment.
Comments and questions should be directed to pjh@cs.unh.edu