Assignment 2, due Jan 27

Part of the homework for 22C:60 (CS:2630), Spring 2012
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!

A note about calculators. There is no way to control your use of calculators on homework problems like this, but beware, most students who try to use calculators to solve these kinds of problems end up with wrong answers -- Calculators are very good at doing exactly what you tell them to do, but they only deliver the right result if you tell them to do the right thing. Learning to solve these kinds of problems without a caluculator is valuable because it focuses on understanding what is actually involved.

  1. Background: Consider the hexadecimal numbers EE9CA0 and 053977.

    a) Convert each of these numbers to a 24-bit binary number. (0.5 points)

    b) Convert each of these numbers to an 8-digit octal number. (0.5 points)

  2. Background: Consider the following 2 10-bit binary numbers: 1110110101 0011011000

    a) Give the one's complement of each of these numbers. (0.2 points)

    b) Give the two's complement of each of these numbers. (0.2 points)

    c) Assuming that each of these numbers is an unsigned binary number, give the decimal equivalent. (0.2 points)

    d) Assuming that each of these numbers is in the one's complement number system, give the signed decimal equivalent. (0.2 points)

    e) Assuming that each of these numbers is in the two's complement number system, give the signed decimal equivalent. (0.2 points)

  3. Background: Consider this sequence of hexadecimal values:
         48 65 6C 6C 6F 20 57 6F 72 6C 64
    

    A Problem What sequence of ASCII characters does this represent? (1 point)

Machine Problem 1

Due Feb. 6

Assemble and run the following SMAL Hawk program, with the title changed so that "as distributed" is changed to your full name as it appears on your ID card:

        TITLE   "MP1 as distributed"
        USE     "hawk.h"
        USE     "monitor.h"
ARSIZE  =       4
        INT     MAIN
MAIN:                        ; entry point
        STORES  R1,R2
	ADDI    R2,R2,ARSIZE

;  --- begin aplication code ---
        LIL     R3,MESSAGE
        LIL     R1,PUTS
        JSRS    R1,R1        ; puts(message)
;  --- end aplication code ---

        ADDI    R2,R2,-ARSIZE
        LOADS   R1,R2
        JUMPS   R1           ; return

; --- begin aplication constants ---
	ALIGN	4
MESSAGE:
	B	'M'
	B	#65
	B	8#163,'s'
        H       #6761
        H       #2065
        W       #6D6F7266
	ASCII   " MP1",0
        END

Submission Instructions

Your source file must be named mp1.a all lower case. This file must exist on the departmental linux cluster. Use the division of math-sciences coursework submission tools to submit this file. For instructions, see:

-- http://www.divms.uiowa.edu/help/msstart/submit.html

In short, you will type the shell command submit, with no arguments, and when it prompts for a file name, you will type mp1.a, and then an extra carriage return to indicate that there is only one file in your submission. When it prompts for a course, type c_060 and finally, when it prompts for an assignment directory, enter mp1.

Grading

This is almost a pass-fail assignment. Successful submission of working code is worth 1/2 credit. The other half of the credit is for the change you were required to make to the title. No other changes to the code are required.