Assignment 2, due Feb 4

Part of the homework for 22C:60, Spring 2005
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, and unless there is what insurance companies call "an act of God" - something outside your control; the only exceptions to this rule will be by advance arrangement.

  1. In order to prepare to start using the SMAL assembler, you will need to do the following things on your account in the departmental Linux cluster (linux.cs.uiowa.edu):

    Add the following text, verbatim, to the end of the file .cshrc in your home directory:

    	alias smal ~dwjones/smalstuff/smal32.intel -U ~dwjones/hawk
    	alias link ~dwjones/hawk/link
    	alias hawk ~dwjones/hawk/hawk.intel
    

    And then, log out and then back in in order to make sure the command language interpreter actually executes these lines.

    Do this, and then prove that you have done so by doing exercise h) from Chapter 3 of the text, but make sure the title is "Your Name" instead of "A Meaningless Example."

    Assemble this, and get a listing of your solution. Assuming that you created your solution in a file called hw2.a, the assembly listing will be in the file hw2.l and the best way to print this in Room 301 MacLean Hall is with the command:

            lp -o landscape hw2.l
    
  2. Consider the data structure representing an object, where each instance of that object contains: A person's name, exactly 16 characters, with zeros filling unused space after the end of the text, Their age in years, an 8-bit integer, their weight in kilograms, an 8-bit integer, their height in centimeters, an 8-bit integer, and their year of college graduation, a 16-bit integer.

    Here is the data for 3 people:

    John Henry          28  98  187  2003
    Francis Smith       31  62  178  1996
    Ted Stevens         25  81  181  2004
    

    a) Write assembly code to place this data in memory, with no regard to alignment constraints. (Turn in your assembly listing)

    b) Align this data so each byte, word or halfword is aligned on an appropriate boundary. (Turn in your assembly listing, it may follow in the same source file as part a. The comments should identify which problem and which part of the assignment you are doing.)