Problems 1 and 2 - Emory University



1. (One point for each of the three answers.) Name:

9916 = 100110012

= 15310 (interpreting binary as unsigned)

= -10310 (interpreting binary as two's complement)

2. (One point for each of the three answers.)

AA16 = 101010102

= 17010 (interpreting binary as unsigned)

= -8610 (interpreting binary as two's complement)

Problems 3-5. (One point each.) Replace each JMP command with a BRA command that has the same effect.

3. 11 – 02 = 0F

Address Old contents New contents

0000 7E 20

0001 00 0F

0002 11 01

4. 0B – 08 = 03, two's complement = FD

Address Old contents New contents

0009 7E 20

000A 00 FD

000B 08 01

5. F201 – F1FE = 03, two's complement = FD

Address Old contents New contents

F1FF 7E 20

F200 F1 FD

F201 FE 01

Problems 6-8. (One point each.) Replace each BRA command (and the preceding NOP command) with a JMP command that has the same effect.

6. FD = -03, 7EA2 – 03 = 7E9F

Address Old contents New contents

7E9F 01 7E

7EA0 20 7E

7EA1 FD 9F

7. A001 + 7F = A080

Address Old contents New contents

9FFE 01 7E

9FFF 20 A0

A000 7F 80

8. 8016 (two's complement)= -8016, A001 - 80 = 9F81

Address Old contents New contents

9FFE 01 7E

9FFF 20 9F

A000 80 81

Problems 9-19 are based on the following program (all numbers are hexadecimal):

LDAA 20

CMPA# 03

BMI 02

LDAA# 03

INC 0020

DECA

BPL FA

WAI

9. (One point for each command.) If you wanted to load the program into memory, starting at address 0000, what would you load?

Address Contents Address Contents

0000 96 0008 7C

0001 20 0009 00

0002 81 000A 20

0003 03 000B 4A

0004 2B 000C 2A

0005 02 000D FA

0006 86 000E 3E

0007 03

Recall: The condition code register stores 11HINZVC.

Suppose that some value x is initially stored in address 0020. The program loads ACCA with x. If x ( 3, ACCA is loaded with 03. Next, the value in 0020 is incremented and the value in ACCA in decremented. This process is repeated until the value in ACCA is reduced to FF, so ACCA always stores FF when the program is complete. If x < 3, the process is repeated x + 1 times (because the value in ACCA must be reduced from x to x – (x + 1), so the final value in 0020 is x + x + 1 = 2x + 1. If x ( 3, the process is repeated 4 times (since ACCA was loaded with 03 and must be reduced below 00), so the final value in 0020 is x + 4.

10. (One point.) If the condition code register contains 11000000 when BMI 02 is executed, what command is executed next?

N = 0, so a branch does not occur, so the next command is LDAA# 03.

11. (One point.) If the condition code register contains 11001001 when BMI 02 is executed, what command is executed next?

N = 1, so a branch occurs, so the next command is INC 0020.

12. (One point.) If the condition code register contains 11000100 when BMI 02 is executed, what command is executed next?

N = 0, so a branch does not occur, so the next command is LDAA# 03.

13. (One point.) If the condition code register contains 11000000 when BPL FA is executed, what command is executed next?

N = 0, so a branch occurs, so the next command is INC 0020.

14. (One point.) If the condition code register contains 11001000 when BPL FA is executed, what command is executed next?

N = 0, so a branch does not occur, so the next command is WAI.

15. (One point.) If the condition code register contains 11000100 when BPL FA is executed, what command is executed next?

N = 0, so a branch occurs, so the next command is INC 0020.

16. (One point.) If address 0020 contains 0116 before the program runs, what does this address contain after the program runs?

03 (because the INC 0020, DECA sequence is executed twice to reduce the value stored in ACCA to FF)

17. (One point.) If address 0020 contains 0116 before the program runs, what is stored in Accumulator A after the program runs?

FF

18. (One point.) If address 0020 contains 0416 before the program runs, what does this address contain after the program runs?

08 (because ACCA is loaded with 03, and then the INC 0020, DECA sequence is executed four times to reduce the value stored in ACCA to FF)

19. (One point.) If address 0020 contains 0416 before the program runs, what is stored in Accumulator A after the program runs?

FF

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download