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