
<
2
.75
7UGT U/CPWCN
#FFTGUU5RCEG
=L/2*
7/<:
DA
Decimal Adjust
Example: A subtraction is performed on BCD values to subtract 17 from 25, the result should be 8. The result
is incorrect when standard binary subtraction is performed on the binary representations of the BCD numbers.
Register 45H contains the value 5FH. The result of the subtraction is stored in 5FH. The following statements
adjust the result so the correct BCD representation is obtained.
DA @45H
Op Code: 40 45
Register
5FH
now contains the value
08H
. The
C
,
Z
, and
S
flags are set to 0.
0010 0101 = 25H
+
0001 0111 = 17H
0000 1110 = 0EH
0000 1110 = 0EH
+
1111 1010 = FAH
0000 1000 = 08H