The goal of this assignment is to write a two-pass assembler for the assembly language for the vm520 virtual machine.
The details of the vm520 virtual machine, including its registers, instructions, instruction encodings and object-file format are available here.
The vm520 assembler, as520, is described here.
The vm520 disassembler, dis520, is described here.
Your work must be done in the context of my assembler "front-end" and conform to the interfaces I have defined for your code and my code to utilize to interact. The code base you are to work within is available in ~cs520/public/as520.
You must implement the following three functions:
Understand that a vm520 object file is not an ASCII file. You will want to use od to examine output files to be sure they are correct. I recommend using the flag -tx4 to show the file in hex as a sequence of 32-bit words, since an object file is a sequence of 32-bit words.
Points will be awarded for this assignment in the following manner:
Your program will be graded primarily by testing it for correct functionality. In addition, however, you may lose points if your program is not properly structured and documented. Decompose sub-problems appropriately into functions and do incremental testing. Leave your debugging output in your code, but disabled, when you do your final assignment submission.
By the end of the lab on Friday November 12, you should have completed the first pass of the assembler. This will require that you begin working on this prior to coming to lab. In lab we will work on any issues that you are having trouble with. First, concentrate on correct programs and determine the addresses for all labels. (As described above, print the labels and their addresses to stdout.) Second, work to add the necessary error detection.
By the end of the lab on Friday November 19, you should have completed the second pass of the assembler. In lab we will work on any issues that you are having trouble with.
Your programs will be graded using agate.cs.unh.edu so be sure to test in that environment.
You should only submit assemble.c. This, of course, means you should not edit any of the other distributed files.
Your programs should be submitted for grading from
agate.cs.unh.edu.
To turn in this assignment, type:
~cs520/bin/submit prog6 assemble.c
Please submit only this one file. Do not turn in any other files!
Submissions can be checked by typing:
~cs520/bin/scheck prog6
To receive full credit for the assignment, you must turn in your files prior to 8am on Monday November 22. Programming assignments may be handed in late at a penalty of 2 points for one day late, 5 points for two days late, 10 points for three days late, 20 points for four days late, and 40 points for five days late. No program may be turned in more than 5 days late.
Remember: as always you are expected to do your own work on this assignment.
Comments and questions should be directed to hatcher@unh.edu