DAS—Decimal Adjust AL after SubtractionInstruction Operand EncodingDescriptionAdjusts the result of the subtraction of two packed BCD values to create a packed BCD result. The AL register is the implied source and destination operand. The DAS instruction is only useful when it follows a SUB instruction that subtracts (binary subtraction) one 2-digit, packed BCD value from another and stores a byte result in the AL register. The DAS instruction then adjusts the contents of the AL register to contain the correct 2-digit, packed BCD result. If a decimal borrow 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 (Borrow from AL := AL − 6);AF := 1;ELSEAF := 0;FI;IF ((old_AL > 99H) or (old_CF = 1)) THENAL := AL −60H;CF := 1;FI;FI;ExampleSUB AL, BL Before: AL = 35H, BL = 47H, EFLAGS(OSZAPC) = XXXXXXAfter: AL = EEH, BL = 47H, EFLAGS(0SZAPC) = 010111DAABefore: AL = EEH, BL = 47H, EFLAGS(OSZAPC) = 010111After: AL = 88H, BL = 47H, EFLAGS(0SZAPC) = X10111Flags AffectedThe CF and AF flags are set if the adjustment of the value results in a decimal borrow in either digit of the result (see the “Operation” section above). The SF, ZF, and PF flags are set according to the result. The OF flag is unde-fined.OpcodeInstructionOp/ En64-Bit ModeCompat/Leg ModeDescription2FDASZOInvalidValidDecimal adjust AL after subtraction.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.