Programming Assignment 3 -- CS429 Spring 2013

Due Date: 22 Feb 2013

The purpose of this assignment is mainly to (a) show how the same information can be interpreted in different ways and (b) to get you decoding instructions for the y86 instruction set.

Write a C program to read a Y86 object file into memory (same as Programming Assignment 2). As you do this, remember the minimum and maximum address that you load data into.

For each load address, from the minimum to the maximum, print (on one line, separated by one space):

  1. The load address, as a 4-digit hexidecimal number (%04X).

  2. That byte as a 2-digit hexidecimal number (%02X).

  3. The 4 bytes that start at the address, assembled least significant byte first (little-endian), as an 8-digit hexidecimal number (%08X).

  4. The 4 bytes that start at the address, assembled least significant byte first (little-endian), as a signed decimal number (%10d).

  5. Decode the y86 instruction starting at the load address, and print the mnemonic corresponding to the instruction (%s). If the byte is not a valid opcode, print "invalid".

The y86 instruction set is given on page 338 of the text book Computer Systems: A Programmer's Perspective (2nd Edition), Randal E. Bryant, David R. O'Hallaron, 2010. Figures 4.2 and 4.3 which I have scanned as this page . Also available here

As an example, if the yb file was:

7962 0000 0006 3063A001007E
the output would look like:
0000 30 01A06330    27288368 irmovl
0001 63 0001A063      106595 xorl
0002 A0 7E0001A0  2113929632 pushl
0003 01 007E0001     8257537 invalid
0004 00 00007E00       32256 halt
0005 7E 0000007E         126 invalid

Due Date: 22 Feb 2013