B.4.57. `DAA', `DAS': Decimal Adjustments
-----------------------------------------
DAA ; 27 [8086]
DAS ; 2F [8086]
These instructions are used in conjunction with the add and subtract
instructions to perform binary-coded decimal arithmetic in _packed_
(one BCD digit per nibble) form. For the unpacked equivalents, see
*Note Section B.4.1::.
`DAA' should be used after a one-byte `ADD' instruction whose
destination was the `AL' register: by means of examining the value in
the `AL' and also the auxiliary carry flag `AF', it determines whether
either digit of the addition has overflowed, and adjusts it (and sets
the carry and auxiliary-carry flags) if so. You can add long BCD
strings together by doing `ADD'/`DAA' on the low two digits, then doing
`ADC'/`DAA' on each subsequent pair of digits.
`DAS' works similarly to `DAA', but is for use after `SUB'
instructions rather than `ADD'.