DAA—Decimal Adjust AL after AdditionInstruction Operand EncodingDescriptionAdjusts the sum of two packed BCD values to create a packed BCD result. The AL register is the implied source and destination operand. The DAA instruction is only useful when it follows an ADD instruction that adds (binary addi-tion) two 2-digit, packed BCD values and stores a byte result in the AL register. The DAA instruction then adjusts the contents of the AL register to contain the correct 2-digit, packed BCD result. If a decimal carry is detected, the CF and AF flags are set accordingly.This instruction executes as described above in compatibility mode and legacy mode. It is not valid in 64-bit mode.OperationIF 64-Bit ModeTHEN#UD;ELSEold_AL := AL;old_CF := CF;CF := 0;IF (((AL AND 0FH) > 9) or AF =1) THEN AL := AL + 6; CF := old_CF or (Carry from AL := AL + 6); AF := 1; ELSE AF := 0;FI;IF ((old_AL > 99H) or (old_CF = 1)) THEN AL := AL + 60H; CF := 1;ELSE CF := 0;FI;FI;ExampleADD AL, BL Before: AL=79H BL=35H EFLAGS(OSZAPC)=XXXXXXAfter: AL=AEH BL=35H EFLAGS(0SZAPC)=110000DAABefore: AL=AEH BL=35H EFLAGS(OSZAPC)=110000After: AL=14H BL=35H EFLAGS(0SZAPC)=X00111DAABefore: AL=2EH BL=35H EFLAGS(OSZAPC)=110000After: AL=34H BL=35H EFLAGS(0SZAPC)=X00101OpcodeInstructionOp/ En64-Bit ModeCompat/Leg ModeDescription27DAAZOInvalidValidDecimal adjust AL after addition.Op/EnOperand 1Operand 2Operand 3Operand 4ZONANANANA
This UNOFFICIAL reference was generated from the official Intel® 64 and IA-32 Architectures Software Developer’s Manual by a dumb script. There is no guarantee that some parts aren't mangled or broken and is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.