Answers: Addition and Subtraction Instructions

1. Indicate whether or not each of the following instructions is valid.

  
a.
add ax,bx
V 
b.
add dx,bl
I
operand size mismatch
c.
add ecx,dx
I 
d.
sub si,di
V 
e.
add bx,90000
I 
source too large
f.
sub ds,1
I 
cannot use segment reg
g.
dec ip
I
cannot modify IP
h.
dec edx
V
i.
add edx,1000h
V
j.
sub ah,126h
I
source too large
k.
sub al,256
I
source too large
l.
inc ax,1
I
extraneous operand

 

2. What will be the value of the Carry flag after each of the following instruction sequences has executed?

(notate: CY = carry, NC = no carry)

  
a.
mov ax,0FFFFh
add ax,1
        
CY
b.
mov bh,2
sub bh,2
NC
c.
mov dx,0
dec dx
?? (Carry not affected by INC and DEC)
d.
mov al,0DFh
add al,32h
CY
e.
mov si,0B9F6h
sub si,9874h
NC
f.
mov cx,695Fh
sub cx,A218h
CY  

 

3. What will be the value of the Zero flag after each of the following instruction sequences has executed?

(notate: ZR = zero, NZ = not zero)

  
a.
mov ax,0FFFFh
add ax,1
    
ZR 
b.
mov bh,2
sub bh,2
ZR  
c.
mov dx,0
dec dx
NZ  
d.
mov al,0DFh
add al,32h
NZ  
e.
mov si,0B9F6h
sub si,9874h
NZ  
f.
mov cx,695Fh
add cx,96A1h
ZR  

 

4. What will be the value of the Sign flag after each of the following instruction sequences has executed?

(notate: PL = positive, NG = negative)

  
a.
mov ax,0FFFFh
sub ax,1
   
PL
b.
mov bh,2
sub bh,3
NG
c.
mov dx,0
dec dx
NG
d.
mov ax,7FFEh
add ax,22h
NG
e.
mov si,0B9F6h
sub si,9874h
PL
f.
mov cx,8000h
add cx,A69Fh
PL

 

5. What will be the values of the Carry, Sign, and Zero flags after the following instructions have executed?

(notate: CY/NC, PL/NG, ZR/NZ)

  
mov ax,620h
sub ah,0F6h
  
 CY,PL,NZ 

 

6. What will be the values of the Carry, Sign, and Zero flags after the following instructions have executed?

(notate: CY/NC, PL/NG, ZR/NZ)

  
mov ax,720h
sub ax,0E6h
  
 NC,PL,NZ 

 

7. What will be the values of the Carry, Sign, and Zero flags after the following instructions have executed?

(notate: CY/NC, PL/NG, ZR/NZ)

  
mov ax,0B6D4h
add al,0B3h
  
 CY,NG,NZ 

 

8. What will be the values of the Overflow, Sign, and Zero flags after the following instructions have executed?

(notate: OV/NV, PL/NG, ZR/NZ)

  
mov bl,-127
dec bl
  
 NV,NG,NZ 

 

9. What will be the values of the Carry, Overflow, Sign, and Zero flags after the following instructions have executed?

(notate: CY/NC, OV/NV, PL/NG, ZR/NZ)

  
mov cx,-4097
add cx,1001h
  
 CY,NV,PL,ZR 

 

10. What will be the values of the Carry, Overflow, Sign, and Zero flags after the following instructions have executed?

(notate: CY/NC, OV/NV, PL/NG, ZR/NZ)

  
mov ah,-56
add ah,-60
  
 CY,NV,NG,NZ