## Machine Organization and Assembly Language programming Problem Set #1 Due: Wednesday April 7th

1. By the due date, you should have read Chapter 1, Chapter 3 (Sections 3.1 to 3.3) and Chapter 2 (Sections 2.1 to 2.6)

2. Please do the "Assignment #0 -- Getting Familiar with Spim". The text of the assignment is on the Web. You DON'T have to turn it in.

3. Convert 255 into a 16-bit two's complement binary number. Give the answer in hexadecimal.

4. Convert -512 into a 16-bit two's complement binary number. Give the answer in hexadecimal.

5. What decimal number does this two's complement binary number represent
1111 1111 1111 1111 1111 1111 1001 1011 ?

6. What binary number does this 32-bit two's complement hexadecimal number represent: 0fff ffff?
What decimal number does it represent? (you can use an expression of the form 2**x + y for the decimal number if you find it convenient)?

7. What binary number does this 32-bit two's complement hexadecimal number represent: 8000 0000 ?
What decimal number does it represent? (you can use an expression of the form 2**x + y for the decimal number if you find it convenient)?

8. Assume an 8-bit register and a 2's complement representation of integers.

·        What are the largest positive number and the smallest negative number that you can represent (give representations in 2's complement and their values in decimal).

·        Give examples of adding two positive numbers with and without overflow and of subtracting a negative number from a positive number with and without overflow. Show the 2's complement representation of the operands and the result in a manner similar to what is done in the book pp 161.

·        How do you test if a number is not negative? How do you test if a number is not positive?

·        How do you test for overflow?