9 Using the following initial register values for each case
9. Using the following initial register values for each case: AX = 0B517H, BX = 0C7A2H, CL = 4 and CF = 0, specify the result after each instruction is executed.
a. shl ax,3
b. shl al,cl
c. sal al,cl
d. shr bh,1
e. sar bl,2
10. Using the following initial register values for each case: AX = 0B517H, BX = 0C7 A2H, CL = 4 and CF = 0, specify the result after each instruction is executed.
a) rol ax,3
b) rcl ax,3
c) ror bh,cl
d) rcr bl,7
e) rcr ah,cl
Solution
9).AX=0B517H ,BX=0C7A2H , CL=4 and CF=0
a. shl ax,3 1011 0101 0001 0111
after three left shifts Ax= 1010 1000 1011 1000 = A8B8H
b.shl al,cl al = 17H = 0001 0111 CL=4
after 4 left shifts al= 0111 0000 =70H so AX= B570H
c.sal al,cl shift arthimetic left is similer to shift left so al= 70H AX=B570H
d.shr bh,1 BH = C7H = 1100 0111 after 1 right shift BH= 0110 0011 =63H
BX = 63A2H
e. sar bl,2 bl= A2H =1010 0010 after 2 arthimetic right shifts bl =1110 1000=E8H
Bx=63E8H
10 Ax=0B517H BX=0C7A2H CL=4, CF=0
a. rol ax,3 Ax=1011 0101 0001 0111 after three left rotations AX =1010 1000 1011 1101 =A8BDH
b.rcl ax,3 Ax=1011 0101 0001 0111 after three rotate left with carry operations AX =1010 1000 1011 1100 =A8BCH
c.ror bh,cl BH =1100 0111 after 4 right rotations BH =0111 1100 =7CH
d.rcr bl,7 BL=1010 0010 after 7 roatate right with carry operations BL=1000 1001 =89H
e. rcr ah ,cl AH =1011 0101 after 4 rotate right with carry operations AH = 1010 1011= ABH
