The DAA (Decimal Adjust after Addition) instruction allows addition of numbers represented
in 8-bit packed BCD code. It is used immediately after normal addition instruction operating
on BCD codes. This instruction assumes the AL register as the source and the destination,
and hence it requires no operand.
For example in the following program, that NUM1 and NUM2 are decimal numbers coded in BCD format, the result should be 61
For the processor there is no difference between a BCD and a
hexadecimal number, all numbers are seen as hexadecimal numbers.
Suppose that the result obtained after adding 27 to 35, is 5CH. To convert this to the value that we would expect after a decimal addition, the DAA instruction is used.
The DAS instruction works in a similar fashion after a SUB instruction.