Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Assignment

Course Title
Microprocessor & Assembly Language Laboratory
Course Code: CSE 316.2

Submitted To: Sohrab Hossain


Assistant Professor
School of Science, Engineering and Technology

East Delta University, Chittagong

Submitted By:
M.K. Ataul Karim
ID: 163001112
Submission Date: 28th July, 2021.
1. Suppose ADD AX, BX is executed. In each of the following parts, the first number being
added is the contents 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. 512Ch + 4185h
b. FE12h + 1ACBh
c. EIE4h + DAB3h
d. 7132h + 7000h
e. 6389h + 1176h

Answer:

a) 512Ch + 4185h
0101 0001 0010 1100
+ 0100 0001 1000 0101
1001 0010 1011 0001
AX=92B1
Flow Set/clear Reason
Signed 1 Carry in but no carry out
Unsigned 0 CF=0

b) FE12h + 1ACBh
1111 1110 0001 0010
+ 0001 1010 1100 1011
1 0001 1000 1101 1101
AX= 118DDh
Flow Set/clear Reason
Signed 0 carry in and carry out
Unsigned 1 CF=1

Page | 1
c) E1E4h + DAB3h
1110 0001 1110 0100
+ 1101 1010 1011 0011
1 1011 1100 1001 0111
AX= BC97h; 1 will be in CF
Flow Set/clear Reason
Signed 0 carry in and borrow out
Unsigned 1 CF=1

d) 7132h + 7000h
0111 0001 0011 0010
+ 0111 0000 0000 0000
1110 0001 0011 0010
AX= E132h
Flow Set/clear Reason
Signed 1 Carry in but no carry out
Unsigned 0 CF=0

e) 6389h + 1176h
0110 0011 1000 1001
+ 0001 0001 0111 0110
0111 0100 1111 1111
AX= 74FFh
Flow Set/clear Reason
Signed 0 No carry in, no carry out
Unsigned 0 CF=0

Page | 2
2. Suppose SUB AX, BX is executed. In each of the following parts, the first number is the
initial contents 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. 81FEh - 1986h
c. 19BCh - 81FfEh
d. 0002h – FE0Fh
e. 8BCDh - 71Abh
Answer:
a) 2143h - 1986h
0010 0001 0100 0011
- 0001 1001 1000 1101
0000 0111 1011 1101
AX= 7BDh
Flow Set/clear Reason
Signed 0 No borrow in, no borrow out
Unsigned 0 CF=0

b) 81FEh-1986h
1000 0001 1111 1110
- 0001 1001 1000 0110
0110 1000 0111 1000
AX= 6878h
Flow Set/clear Reason
Signed 0 Borrow out but no borrow in
Unsigned 0 CF=0

Page | 3
c) 19BCh-81Feh
0001 1001 1011 110
- 1000 0001 1111 1110
1001 0111 1011 1110
AX= 97Beh
Flow Set/clear Reason
Signed 1 Borrow in but no borrow out
Unsigned 1 CF=1

d) 0002h-FE0Fh
0000 0000 0000 0010
- 1111 1110 0000 1111
0000 0001 1111 0011
AX= 01F3h
Flow Set/clear Reason
Signed 0 Borrow in and borrow out
Unsigned 1 CF=1

d) 8BCDh-71Abh
1000 1011 1100 1101
- 0111 0001 1010 1011
0001 1010 0010 0010
AX= 1A22h
Flow Set/clear Reason
Signed 1 Borrow out but no borrow in
Unsigned 0 CF=0

Page | 4

You might also like