DAA

DAA
Decimal Adjust Accumulator
Description
Does cool stuff with binary-coded decimal.
Uses
  • Probably useful for BCD arithmetic?
Results
Register/Flag 8-bit
S flag Set to the 7th bit of the result
Z flag Set if the result is 0; else reset
H flag Really complicated
P/V flag Set if the result has even parity; else reset
N flag Not affected
C flag Really complicated
Allowed Instructions
Instruction Opcode CC (ADL/non-ADL) CC (.S) CC (.L)
daa $27 1F X X
Notes
  • When using CP with signed integers, the flags are set as follows:
    • Z means M = N
    • NZ means MN
    • C means M < N
    • NC means MN
See Also
ADD, ADC, RLD, RRD, SBC, SUB