Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Irvine K.R.Assembly language workbook.2002.pdf
Скачиваний:
50
Добавлен:
23.08.2013
Размер:
244.02 Кб
Скачать

Answers: Addition and Subtraction Instructions

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

Ioperand size mismatch

c.add ecx,dx

I

d.sub si,di

V

e.add bx,90000

Isource too large

f.sub ds,1

Icannot use segment reg

g. dec ip

Icannot modify IP

h. dec edx

V

i.add edx,1000hV

j.sub ah,126h Isource too large

k.sub al,256 Isource too large

l.inc ax,1 Iextraneous 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 CY add ax,1

http://www.nuvisionmiami.com/books/asm/workbook/addsub_ans.htm (1 of 4) [1/15/2003 4:43:56 PM]

Answers: Addition and Subtraction Instructions

b.mov bh,2 sub bh,2

c.mov dx,0 dec dx

d.mov al,0DFh add al,32h

e.mov si,0B9F6h sub si,9874h

f.mov cx,695Fh sub cx,A218h

NC

?? (Carry not affected by INC and DEC)

CY

NC

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 ZR add ax,1

b.mov

bh,2

ZR

sub

bh,2

 

c.mov

dx,0

NZ

dec

dx

 

d.mov

al,0DFh

NZ

add

al,32h

 

e.mov si,0B9F6h NZ sub si,9874h

f.mov cx,695Fh

ZR

add cx,96A1h

 

http://www.nuvisionmiami.com/books/asm/workbook/addsub_ans.htm (2 of 4) [1/15/2003 4:43:56 PM]

Answers: Addition and Subtraction Instructions

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 PL sub ax,1

b.mov

bh,2

NG

sub

bh,3

 

c.mov

dx,0

NG

dec

dx

 

d.mov

ax,7FFEh

NG

add

ax,22h

 

e.mov si,0B9F6h PL sub si,9874h

f.mov cx,8000h

PL

add cx,A69Fh

 

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

http://www.nuvisionmiami.com/books/asm/workbook/addsub_ans.htm (3 of 4) [1/15/2003 4:43:56 PM]

Answers: Addition and Subtraction Instructions

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

NV,NG,NZ

dec

bl

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

http://www.nuvisionmiami.com/books/asm/workbook/addsub_ans.htm (4 of 4) [1/15/2003 4:43:56 PM]

Соседние файлы в предмете Электротехника