CS611
Fall 2002
Programming Assignment 2
Due Sunday September 29


Write a disassembler for IAS object files.

The structure of an IAS object file is defined in this description of the IAS assembler.

The encoding of IAS instructions is discussed in this description of the IAS computer.

Your program should duplicate the behavior of my dumpobj program, which may be run on any CIS Linux machine via:
~cs611/bin/dumpobj

Like dumpobj, your program should read a program from stdin and dump its contents to stdout.

The format of your dump should be identical to the dump produced by dumpobj. This includes spacing, blank lines, etc. In fact, you may want to use the diff (file difference) tool to compare the output of dumpobj with the output of your program. For more information, see
man diff

Use dumpobj on some examples to get a better idea. Basically, however, every word of the object file gets dumped to a single line of the output.

Instruction words are displayed by first printing the word's address in hex, then printing the word in hex, then disassembling the instruction at bits 20-39, then disassembling the instruction at bits 0-19. Address fields are displayed in hex.

Data words are displayed by first printing the word's address in hex and then printing the word in hex.

Remember that the input file is not human-readable. You can examine input files using the od (octal dump) tool. For example, the following will display the file one byte at a time using hexadecimal:
od -tx1 file.obj

Be aware, however, that the first thing that od displays on a line is the octal offset of the first byte on the line. For more information, see
man od

Look in ~cs611/public/prog2 for some assembly language test files. These files should be converted to object files by using the IAS assembler. You may need to create other test files as well.

Grading will be based upon completed, correct functionality:

Your program will be graded primarily by testing it for correct functionality. However, you may lose points if your program is not properly structured or adequately documented. See the mandatory guidelines given in the course overview webpage.

You must write your program in C.

Put all your code in a file called dis.c.

Your assignment should be submitted for grading from a CIS Linux machine (e.g. turing.unh.edu). To turn in this assignment, type:
~cs611/bin/submit prog2 dis.c

Do not turn in any other files!

Submissions can be checked from a CIS Linux machine by typing:
~cs611/bin/scheck prog2

To receive full credit for the assignment, you must turn in your files prior to 8am on Monday September 30. Late submissions will be accepted at the penalty of 5 points per day up to one week late.

Your programs will be graded using a CIS Linux machine (e.g. turing.unh.edu) so be sure to test in that environment.

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!

If you developed your code on a DOS/Windows system, be sure to appropriately transfer your files to a CIS Linux system before submitting them. You need to convert the DOS ASCII file format to UNIX format. If you need help with this, please see me.


Last modified on September 17, 2002.

Comments and questions should be directed to hatcher@unh.edu