Assignment 5, due Sep 23

Part of the homework for 22C:60 (CS:2630), Fall 2011
by Douglas W. Jones
THE UNIVERSITY OF IOWA Department of Computer Science

On every assignment, write your name legibly as it appears on your University ID card! Homework is due on paper at the start of class on the day indicated (usually Friday). Exceptions will be made only by advance arrangement (excepting "acts of God"). Late work must be turned in to the TA's mailbox (ask the CS receptionist in 14 MLH for help). Never push homework under someone's door!

  1. Background: Assume, to begin with, that register 3 holds a pointer to an object of class month.

    Also assume that each month object is made up of three consecutive one-word fields, the length of the month in days during a normal year, the length of the month in days during a leap year, and a pointer to the name of the month.

    A problem: Write SMAL Hawk code (a fragment of a main program) to print out the name of the month (1.0 points).

  2. Background: Consider this bit of SMAL code for two interlaced infinite loops:
    L1:	BR	L3
    L2:	JUMP	L4
    L3:	BR	L1
    L4:	JUMP	L2
    

    a) Show the equivalent machine-language code as a sequence of 16-bit halfwords. (0.5 points)

    b) Why does the answer to the above question not depend on the assembly origin? (0.5 points)

  3. A question: Explain the relationship between the LEA, LEACC and ADDI instructions. (0.5 points)

  4. A Problem from the Notes: Do exercise e) from Chapter 6 in the notes. (0.5 points)