z80:Opcodes:DAA

From Learn @ Cemetech
Revision as of 22:22, 5 February 2016 by Maintenance script (talk | contribs) (Initial automated import)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

When this instruction is executed, the A register is BCD corrected using the contents of the flags. The exact process is the following: if the least significant four bits of A contain a non-BCD digit (i. e. it is greater than 9) or the H flag is set, then $06 is added to the register. Then the four most significant bits are checked. If this more significant digit also happens to be greater than 9 or the C flag is set, then $60 is added.

Syntax

   daa

Effects

If the second addition was needed, the C flag is set after execution, otherwise it is reset. The N flag is preserved, P/V is parity and the others are altered by definition.

Uses

T-States

4 t-states

See Also

ADC,ADD,DEC,INC,SBC,SUB