Programming Assignment 2 -- CS429 Spring 2013

Due Date: 8 Feb 2013

The purpose of this assignment is mainly (a) to get you working with binary representations of information, and (b) to start the work of writing a simulator for Y86 by loading a Y86 binary into simulated memory.

Write a C program to read a Y86 object file into memory and then print, one byte per line, all non-zero bytes to standard output, in the format:

[Byte Address, in hex]: [Byte Value, in hex].

For example, an input file of

79620000000430F40001
would print
0000: 30
0001: F4
0003: 01

There are two types of errors that your program can report instead of the output given above.

  1. A file without the 0x7962 as the first two bytes should just report "The file is not a Y86 object file".
  2. If the file has the 0x7962 as the first two bytes, but does not match the expected format otherwise, just report "The Y86 object file is corrupted".

Due Date: 8 Feb 2013