Homework 2

This assignment should be handed in before class on Tuesday March 10 2009. Handin is on the CADE lab machines using commands like this:

  handin regehr hw2 filename

Where "filename" is the name of a file to hand in. The exact names you should use are given below.

Your assignment is to relate this C code to this HCS12 assembly code. For each C function (func1 through func6) your job is to determine which of the 10 assembly functions is a correct implementation of that function.

Hand in a text file containing your answers. For example:

func1 matches 3, 5, 7
func2 matches nothing
...

Keep in mind:

  1. There may be zero, one, or more than one match for each C function.
  2. The compiler has to follow the rules for accessing volatile objects, as described in lecture.
  3. It is permissible to use the CodeWarrior compiler to help you answer these questions. However, it would be a mistake to rely too much on this shortcut, since your exam is likely to contain problems similar to this, and you will not have access to CodeWarrior while taking the exam.