Assignment 3, due Sep 12

Part of the homework for CS:2630, Fall 2019
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 in discussion section on Thursday. Some parts of assignments may be submitted on-line and completed in discussion section. 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. Framework: Consider this SMAL code
    STRING1:ASCII   "this is an example string",0
    ENDMARK:
    LENGTH: H       ENDMARK-STRING
    STRING2:ASCII	"this is another example string",0
    POINT1: W       STRING1
    POINT2: W       STRING2
    

    Rewrite the above code with ALIGN directives insterted where they should be to assure that all halfwords and words are properly aligned. (1 point, 0.2 point penalty for each missing or extra align)

  2. Framework: Consider this sequence of words, given in hex, in consecutive memory locations on a Hawk computer:
    113201D1
    C213F2F3
    000662F4
    000010E5
    

    a) Disassemble these words into a sequence of hawk instructions, and give those instructions in SMAL Hawk notation. (1.0 points, 0.1 points penalty per error in opcode, register or field.)

    Hint: All the instructions are found in Chapter 4, Appendix B of the Hawk Manual is the primary resource for this kind of problem, in general, the Hawk emulator can solve this problem for you, but you will be expected to be able to disassemble code by hand using Appendix B on exams.

    b) What registers does the above code change, and what values does it leave in those registers, when it is done. (0.5 points, 0.1 point penalty per missing or extra register or incorrect value)

    Hint: Again, you will be expected to be able to solve this with pencil, paper and the Hawk manual, but you can check your work using the Hawk emulator.

  3. Background: Many older machines had an absolute-load instruction that looked something like the following:
            LOADA   rd,address
    

    Here, rd is the destination register, address is a 32-bit literal memory address, and the instruction loads the word from that memory address into the destination register.

    A problem: Write a SMAL Hawk macro that implements this. (0.5 points, 0.1 point penalty per missing, corrupt or extra element)