Assignment 6, due Oct 15

Part of the homework for 22C:50, Fall 2003
by Douglas W. Jones
THE UNIVERSITY OF IOWA Department of Computer Science

Public Notice

Accenture Corp. has told the career center that it is especially interested in interviewing CS students for entry-level positions during their upcoming campus visit on Oct. 20-21. Interested students should submit electronic resumes through the Career Center. Resumes must be submitted by October 16. From discussions with company reps, it appears that Accenture some unusually interesting opportunities for CS students.

Machine Problem III Due Oct. 22

The example EAL assembler does not produce any object code, aside from the contents of the listing file. Modify it so that object code is output to a new file, with a .o suffix, in the format defined in Figure 7.12 of the notes. Of course, our EAL assembler does not support relocation, so only tag types 0000, 0001 and 0011 are relevant to this assignment!

Pay attention: Nothing in the EAL assembler knows whether the target machine is a high-byter or a low-byter! In generating code for this object format, however, you need to know this! Assume it is a low-byter, so the least significant byte of each word goes in the first byte, and the most significant byte of each word goes in the second byte in memory.

Testing: You must write test data that completely and concisely tests your code. To facilitate this testing, the following program is provided to read your object file and convert it back to human readable form:

#include <stdio.h>
main() {
	for (;;) {
		int tag, tt, nn;
		int byte1 = 0;
		tag = getchar();
		if (tag == EOF) { puts("EOF"); exit(-1); }
		tt = (tag >> 4) & 0xF;
		nn = tag & 0xF;
		for (; nn > 0; nn--) {
			int dd = getchar();
			if (dd == EOF) { puts("unexpected EOF!"); exit(0); }
			if (tt == 1) printf( "B #%2X\n", dd );
			if (tt == 3) {
				if ((nn & 1) == 0) byte1 = dd;
				if ((nn & 1) == 1)
					printf( ".=#%4X\n", ((dd<<8)|byte1) );
			}
		}
	}
}

Turn in: Cleanly documented code, source listings of only the files you modified for this assignment, with the lines you changed clearly marked following the commenting conventions required for this course.

Also turn in an assembly listing of your test data produced by your modified EAL assembler and the listing produced by the above program when it reads your test data.

Homework Due Oct 15

  1. Do Chapter 8 Problem 3.

  2. Do Chapter 8 Problem 5.

  3. Do chapter 9 Problem 3.

  4. Do chapter 9 Problem 5.