0% found this document useful (0 votes)
75 views

Today Task: Solving Question 1

a) NEG AL where AL contains 7Fh results in AL = 81h with CF = 1, SF = 1, ZF = 0, PF = 1, OF = 0. b) XCHG AX,BX where AX contains 1ABCh and BX contains 712Ah results in AX = 712Ah and BX = 1ABCh with no effect on flags. c) ADD AL,BL where AL contains 80h and BL contains FFh results in AL = 17Fh with CF = 1, SF = 0, ZF = 0, PF = 0, OF = 1.

Uploaded by

Syed Komail
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views

Today Task: Solving Question 1

a) NEG AL where AL contains 7Fh results in AL = 81h with CF = 1, SF = 1, ZF = 0, PF = 1, OF = 0. b) XCHG AX,BX where AX contains 1ABCh and BX contains 712Ah results in AX = 712Ah and BX = 1ABCh with no effect on flags. c) ADD AL,BL where AL contains 80h and BL contains FFh results in AL = 17Fh with CF = 1, SF = 0, ZF = 0, PF = 0, OF = 1.

Uploaded by

Syed Komail
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Today Task

For each of the following instructions, give the new destination contents and the new
settings of CF, SF, ZF, PF, AF, and OF. Suppose that the flags are initially O in each part
al this question.

a. NEG AL where AL contains 7Fh


b. XCHG AX,BX where AX contains 1ABCh and BX contains 712Ah
c. ADD AL,BL where AL contains 80h and BL contains FFh
d. SUB AX,BX where AX contains OOOOh and BX contains 8000h
e. NEG 'AX where AX contains 0001h

Suppose SUB AX, BX is executed. In each of the following parts, the first number is the
initial content of AX and the second number is the contents of BX. Give the resulting value
of AX and tell whether signed or unsigned overflow occurred.

a. 2143h
1986h

b. 80EEh
1986h

Solving question 1
a. NEG AL where AL contains 7Fh

7=0111,F=1111 binary
1’s complement =1000 0000

2’s complement = 10000000


+1
________
1000 000 1
AL = 81H
CF = 1
SF = 1
ZF = 0
FF = 1
OF = 0

b. XCHG AX,BX where AX contains 1ABCh and BX contains 712Ah


AX = 712AH
BX = 1ABCH
NO EFFECT AT ANY FLAG
c. ADD AL,BL where AL contains 80h and BL contains FFh

AL = 1000 0000
BL = 1111 1111

1000 0000
+1111 1111
__________
10111 1111

AL = 17FH
CF = 1
SF = 0
ZF = 0
PF = 0
OF =1

d. SUB AX,BX where AX contains OOOOh and BX contains 8000h

0000 0000 0000 0000


-1000 0000 0000 0000
--------------------------------
1000 0000 0000 0000

AX = 8000H
CF = 1
SF = 1
ZF = 0
PF = 1
OF = 1

e. NEG 'AX where AX contains 0001h

0000 0000 0000 0001


1’s complement = 1111 1111 1111 1110
2’s complement = 1111 1111 1111 1110
+1
------------------------------
1111 1111 1111 1111

Solving question 2
A. 2143h – 1986h
2143h = 0010 0001 0100 0011
1986h = 0001 1001 1000 1101

0010 0001 0100 0011


-0001 1001 1000 1101
-------------------------------
0000 0111 1011 1101

AX = 7BDH

CF = 0 unsigned overflow 0

No borrow in ,no borrow out signed overflow 0

B. 80EEh -1986h

80EE = 1000 0000 1110 1110


1986 = 0001 1001 1000 1101

1000 0000 1110 1110


-0001 1001 1000 1101
------------------------------
0110 0111 0110 0001

AX = 6768H

Borrow out but no borrow in so signed overflow 1

CF =0 so Unsigned overflow 0

You might also like