## EE 308

Homework Assignment 2
Due Jan. 28, 1999

1. Consider the following hexadecimal 8-bit numbers as unsigned. Find their decimal equivalents:
1. 0xA2
2. 0xCA
3. 0x15
4. 0x80

2. Repeat Problem 1, considering the numbers as signed.

3. Consider the hexadecimal 8-bit numbers below. Do the indicated additions, and find the 8-bit result. Determine if a carry resulted. Determine if an overflow resulted. Convert the operands and results to decimal numbers, and indicate if the results are correct. (Do the last part twice, first assuming the numbers are unsigned, then assuming the numbers are signed.)
1. 0x23 + 0x3C
2. 0x3A + 0x61
3. 0x92 + 0x83
4. 0xD2 + 0x61

4. Subtract the following 8-bit numbers. Was a carry generated? Was an overflow generated? Convert the operands and results to decimal numbers, and indicate if the results are correct. (Do the last part twice, first assuming the numbers are unsigned, then assuming the numbers are signed.)
1. 0x4B - 0x17
2. 0x41 - 0x7A
3. 0x81 - 0x20
4. 0x55 - 0xB2

5. Write an instruction sequence to add the 8-bit numbers at address 0x1000 and 0x1001, and store the result into address 0x1002.

6. Write an instruction sequence to swap the contents of accumulators A and B. Hint: Use a memory location as a swap buffer.

Bill Rison, <rison@ee.nmt.edu >