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:
The executables for my implementation of as520 and dis520 are available on agate as ~cs520/bin/as520 and ~cs520/bin/dis520. The goal of this assignment is to match the output of my implementation of as520. (Of course, if you think you find bugs in my implementation, please let me know.)
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.
The goal for the lab on Friday March 3 is to complete the first 60 points of this assignment. 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. Concentrate on correct programs and determine the addresses for all labels. (As described above, print the labels and their addresses to stdout.)
Your programs will be graded using agate.cs.unh.edu so be sure to test in that environment.
You will only submit assemble.c and symtab.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 prog3 assemble.c symtab.c
Submissions can be checked by typing:
~cs520/bin/scheck prog3
This assignment is due Wednesday March 8. The standard late policy concerning late submissions will be in effect. See the course overview webpage.
Remember: as always you are expected to do your own work on this assignment. Copying code from another student or from sites on the internet is explicitly forbidden!
Comments and questions should be directed to pjh@cs.unh.edu