Problem Solutions Chapter 9
1
CHAPTER 9
9-1.
a) LD R1, A
LD R2, B
LD R3, C
b) MOV T1, A
ADD T1, B
SUB T1, C
c) LD A
ADD B
SUB C
9-2.*
a) LD R1, E
LD R2, F
b) MOV T1, A
ADD T1, B
c) LD E
MUL F
9-3.*
a)
    (A B) (A C) (B D) AB AC xBD x
b, c)
PUSH A
PUSH B
SUB
PUSH A
ADD
A
B
AB
A
A+C
Problem Solutions Chapter 9
9-4.
a)
   ((( ) ) ( ( ))A B C D E A F AB C D EAF Y
PUSH A
PUSH B
MUL
PUSH C
ADD
PUSH D
b, c)
A
B
A × B
C
(A × B) +C
D
E
A
DIV
POP Y
9-5.
a)
ZY
b)
Z M[Y]
c)
  Z Y W 2
d)
Z Y X
9-6.*
9-7.
a) X = 1000 144 1 = 855 b) X = 0000 0011 0101 0111
9-8.
a) Read Instruction
Read Address Field
b) Read Instruction
Read Address Field
Problem Solutions Chapter 9
9-9.
9-10.*
a) 3 Register Fields × 4 bits/Field = 12 bits. 32 bits 12 bits = 20 bits.
20
9-11.
LDI R6, TOSAD # Load R6 with address of the Top of Stack
Push and Pop can be implemented in one of two ways.
9-12.
PSHR and POPR work as follows:
PSHR: MSPR0 POPR: SPSP + 1
9-13.
9-14.*
a) ADD R0, R4 b) R07B + 4B, R0 = C6, C = 0
Problem Solutions Chapter 9
4
9-15.
a) AND: 0100 1000 OR: 1110 1111 XOR: 1010 0111
9-16.
9-17.*
Result
OP
Register
C
0110 1001
1
SHR
0011 0100
1
SHL
0110 1000
0
0011 0100
0
0110 1000
0
0011 0100
0110 1000
0011 0100
9-18.
9-19.*
Smallest Number = 0.5 × 2255
Problem Solutions Chapter 9
5
9-20.*
E
e
(e)2
+8
15
1111
+7
14
1110
+6
13
1101
7
0
0000
9-21.
a) The largest quantity is 0 1111 11111 = 27 × (0.111111)2 = (1111110)2 = 126. The
9-22.
a)
 
sign exponent 1023
( 1) 2 (1.fraction)
9-23.
If
xy
2 10
then:
+5
12
1100
+4
11
1011
+3
10
1010
+2
9
1001
+1
1000
0111
1
6
0110
0101
0100
4
3
0011
0010
0001
Problem Solutions Chapter 9
6
9-24.
9-25.*
TEST (0001)16, R (AND Immediate 1 with Register R)
BNZ ADRS (Branch to ADRS if Z = 0)
9-26.
Unsigned Signed
a) A = 1011 0110 182 74
9-27.*
a) A = 0101 1101 93
9-28.
a) A = 1101 1010 38
9-29.
a) A = 1010 0100 92
9-30.*
PC SP TOS
a) Initially 2000 4000 5000
Problem Solutions Chapter 9
9-31.
a) R7 PC PC points to the next instruction in sequence
9-32.
Branch Instruction: The processor jumps to a new location without the ability to return on its own.
9-33.*
External Interrupts:
1) Hard Drive
Internal Interrupts:
1) Overflow
9-34.
a) SP SP 1
MSPPC
b) PSR MSP
SP SP + 1
9-35.
a) LD R0, PARAMETER1
LD R1, PARAMETER2