50% found this document useful (2 votes)
2K views6 pages

8086 Instruction Set: Decimal Adjust After Addition

The DAA instruction is used to adjust the result of decimal addition to produce the correct binary coded decimal (BCD) value. It is used after an addition instruction to correct the sum if the result of the addition produced a value greater than 9 in either the low or high nibble. The example demonstrates adding the decimal values 38 and 45 using the ADD and DAA instructions. Without DAA, the incorrect binary result of 83 is produced, but with DAA, the correct BCD result of 83 is obtained.

Uploaded by

vikas chawla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
50% found this document useful (2 votes)
2K views6 pages

8086 Instruction Set: Decimal Adjust After Addition

The DAA instruction is used to adjust the result of decimal addition to produce the correct binary coded decimal (BCD) value. It is used after an addition instruction to correct the sum if the result of the addition produced a value greater than 9 in either the low or high nibble. The example demonstrates adding the decimal values 38 and 45 using the ADD and DAA instructions. Without DAA, the incorrect binary result of 83 is produced, but with DAA, the correct BCD result of 83 is obtained.

Uploaded by

vikas chawla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Prepared by

Dr Manjusha

8086 Instruction Set


DAA
Decimal Adjust after Addition
Arithmetic Group
Dr Manjusha Deshmukh
PhD ( Elect. & Tele. Comm. )
MBA ( Finance & Marketing)
Dr Manjusha
Prepared by
Dr Manjusha

•DAA instruction should be used after addition instruction.


•It is used for decimal addition

MOV AL, 38
ADD AL, 45
DAA
HLT
Prepared by
Operand Dr Manjusha
Example Explanation
Add 8 bit data (45 H) to data in
ADD Rd, 8 bit data
AL, 45 register AL(38) and store result in
ADD AL,45 45 H
AL
AH AL 38
MOV AL, 38
BH BL
ADD AL, 45 CH CL
HLT DH DL

ALU 38 ---> 0011 1000


+ 45 ---> 0100 0101
& ---- ---------
83 0111 1101
---- ----
7D 7 D
Operand Prepared by
Example Explanation Dr Manjusha
The contents of the destination
DAA register are changed from a binary
NONE
DAA value to two 4-bit BCD digits.
Decimal Adjust Accumulator

Let us consider we want to add two decimal numbers 38 and 45.


If the value of the low-order If the value of the high-order
38 ---> 0011 1000 4-bits in the register is 4-bits in the register is greater
+ 45 ---> 0100 0101 greater than 9 or if AC flag than 9 or if the Carry flag is
---- --------- is set, the instruction adds set, the instruction adds 6 to
83 0111 1101 6 to the low-order four bits. the high-order four bits.
---- ----
Decimal addition 7 D
result should 0111 1101
be 83 We got result 7 D + 0110
This answer is ---- -----
incorrect 1000 0011
8 3
Here, in such situations, we can use DAA to have the We got correct
BCD sum as outcome. BCD result
Prepared by
Operand Dr Manjusha
Example Explanation
Add 8 bit data (45 H) to data in
ADD Rd, 8 bit data
AL, 45 register AL(38) and store result in
ADD AL,45 H
AL

MOV AL, 38 AH AL 83
38

ADD AL, 45 BH BL
DAA CH CL
HLT DH DL

ALU 38 ---> 0011 1000 0111 1101


+ 45 ---> 0100 0101 + 0110
38 & 45 ---- --------- ---- -----
83 0111 1101 1000 0011
---- ---- 8 3
7D 7 D
Prepared by
Dr Manjusha

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy