Assignment 5, due Sept 28

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

Always, on every assignment, please write your name legibly as it appears on your University ID and on the class list! All assignments will be due at the start of class on the day indicated (usually a Friday). The only exceptions to this rule will be by advance arrangement unless there is what insurance companies call "an act of God" - something outside your control. Homework must be turned in on paper and in class! Late work may be turned in to the teaching assistant's mailbox, but see the late work policy. Never push late work under someone's door!

  1. Homework

  2. A Problem: Give the shortest Hawk instruction or instruction sequence, in SMAL assembly language, for loading each of the following values into register 3. (0.2 points each)

    a) 25
    b) -250
    c) FFFFF66616
    d) 800000
    e) FADF00D16

  3. A Problem: Suppose memory location 1100016 holds the variable p. As it turns out, p is a pointer to a structure -- that is to say, the handle on an object. The object has the following fields: next, x, y, width, height, one word each, in sequence in memory.

    a) Write a SMAL Hawk code fragment (one or more instructions) to load R3 with the pointer p. (0.2 points each)

    b) Write a SMAL Hawk code fragment (one or more instructions) to load R3 with p.next. That is, with the value of the first field of the object pointed to by p. (0.3 points each)

    c) Write a SMAL Hawk code fragment (one or more instructions) to load R3 with p.x. That is, with the value of the second field of the object pointed to by p. (0.5 points each) (1 point)

  4. Excercises from Chapter 5 of the notes: Do exercises j) (0.2 points), o) (0.3 points) and p) (0.5 points).