"Adjusts 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 addition) 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."
[2]
"IF (((AL AND 0FH) > 9) or AF = 1)"
"THEN"
"AL ¼ AL + 6;"
"CF ¼ CF OR CarryFromLastAddition; (* CF OR carry from AL ¼ AL + 6 *)"
"AF ¼ 1;"
"ELSE"
"AF ¼ 0;"
"FI;"
"IF ((AL AND F0H) > 90H) or CF = 1)"
"THEN"
"AL ¼ AL + 60H;"
"CF ¼ 1;"
"ELSE"
"CF ¼ 0;"
"FI;"
""
"Example"
""
"ADD AL, BL"
"Before: AL=79H BL=35H EFLAGS(OSZAPC)=XXXXXX"
"After: AL=AEH BL=35H EFLAGS(0SZAPC)=110000"
""
"DAA"
"Before: AL=AEH BL=35H EFLAGS(OSZAPC)=110000"
"After: AL=14H BL=35H EFLAGS(0SZAPC)=X00111"
[3]
"The CF and AF flags are set if the adjustment of the value results in a decimal carry in either digit of the result. The SF, ZF, and PF flags are set according to the result. The OF flag is undefined."
[4]
"(All Operating Modes)"
"None."
[5]
"27 DAA Decimal adjust AL after addition"
[6]
</DAA>
<DAS>
[1]
"DAS: Decimal Adjust AL after Subtraction"
""
"Adjusts 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."
[2]
"IF (AL AND 0FH) > 9 OR AF = 1"
"THEN"
"AL ¼ AL - 6;"
"CF ¼ CF OR BorrowFromLastSubtraction; (* CF OR borrow from AL ¼ AL - 6 *)"
"AF ¼ 1;"
"ELSE AF ¼ 0;"
"FI;"
"IF ((AL > 9FH) or CF = 1)"
"THEN"
"AL ¼ AL - 60H;"
"CF ¼ 1;"
"ELSE CF ¼ 0;"
"FI;"
""
"Example"
""
"SUB AL, BL"
"Before: AL=35H BL=47H EFLAGS(OSZAPC)=XXXXXX"
"After: AL=EEH BL=47H EFLAGS(0SZAPC)=010111"
""
"DAS"
"Before: AL=EEH BL=47H EFLAGS(OSZAPC)=010111"
"After: AL=88H BL=47H EFLAGS(0SZAPC)=X10111"
[3]
"The CF and AF flags are set if the adjustment of the value results in a decimal borrow in either digit of the result. The SF, ZF, and PF flags are set according to the result. The OF flag is undefined."
[4]
"(All Operating Modes)"
"None."
[5]
"2F DAS Decimal adjust AL after subtraction"
[6]
</DAS>
<DEC>
[1]
"DEC: Decrement by 1"
""
"Subtracts 1 from the destination operand, while preserving the state of the CF flag. The destination operand can be a register or a memory location. This instruction allows a loop counter to be updated without disturbing the CF flag. To perform a decrement operation that updates the CF flag, use a SUB instruction with an immediate operand of 1.)"
[2]
"DEST ¼ DEST û 1;"
[3]
"The CF flag is not affected. The OF, SF, ZF, AF, and PF flags are set according to the result."
[4]
"Protected Mode Exceptions"
""
"#GP(0) If the destination operand is located in a nonwritable segment. If a memory operand effective address is outside the CS, DS, ES, FS, or GS segment limit. If the DS, ES, FS, or GS register contains a null segment selector."
"#SS(0) If a memory operand effective address is outside the SS segment limit."
"#PF(fault-code) If a page fault occurs."
"#AC(0) If alignment checking is enabled and an unaligned memory reference is made while the current privilege level is 3."
""
"Real-Address Mode Exceptions"
""
"#GP If a memory operand effective address is outside the CS, DS, ES, FS, or GS segment limit."
"#SS If a memory operand effective address is outside the SS segment limit."
""
"Virtual-8086 Mode Exceptions"
""
"#GP(0) If a memory operand effective address is outside the CS, DS, ES, FS, or GS segment limit."
"#SS(0) If a memory operand effective address is outside the SS segment limit."
"#PF(fault-code) If a page fault occurs."
"#AC(0) If alignment checking is enabled and an unaligned memory reference is made."
[5]
"FE /1 DEC r/m8 Decrement r/m8 by 1"
"FF /1 DEC r/m16 Decrement r/m16 by 1"
"FF /1 DEC r/m32 Decrement r/m32 by 1"
"48+rw DEC r16 Decrement r16 by 1"
"48+rd DEC r32 Decrement r32 by 1"
[6]
</DEC>
<DIV>
[1]
"DIV: Unsigned Divide"
""
"Divides (unsigned) the value in the AX register, DX:AX register pair, or EDX:EAX register pair (dividend) by the source operand (divisor) and stores the result in the AX (AH:AL), DX:AX, or EDX:EAX registers. The source operand can be a general-purpose register or a memory location."
"The action of this instruction depends on the operand size, as shown in the following table:"
"Non-integral results are truncated (chopped) towards 0. The remainder is always less than the divisor in magnitude. Overflow is indicated with the #DE (divide error) exception rather than with the CF flag."
"The CF, OF, SF, ZF, AF, and PF flags are undefined."
[4]
"Protected Mode Exceptions"
""
"#DE If the source operand (divisor) is 0. If the quotient is too large for the designated register."
"#GP(0) If a memory operand effective address is outside the CS, DS, ES, FS, or GS segment limit. If the DS, ES, FS, or GS register contains a null segment selector."
"#SS(0) If a memory operand effective address is outside the SS segment limit."
"#PF(fault-code) If a page fault occurs."
"#AC(0) If alignment checking is enabled and an unaligned memory reference is made while the current privilege level is 3."
""
"Real-Address Mode Exceptions"
""
"#DE If the source operand (divisor) is 0. If the quotient is too large for the designated register."
"#GP If a memory operand effective address is outside the CS, DS, ES, FS, or GS segment limit. If the DS, ES, FS, or GS register contains a null segment selector."
"#SS(0) If a memory operand effective address is outside the SS segment limit."
""
"Virtual-8086 Mode Exceptions"
""
"#DE If the source operand (divisor) is 0. If the quotient is too large for the designated register."
"#GP(0) If a memory operand effective address is outside the CS, DS, ES, FS, or GS segment limit."
"#SS If a memory operand effective address is outside the SS segment limit."
"#PF(fault-code) If a page fault occurs."
"#AC(0) If alignment checking is enabled and an unaligned memory reference is made."
[5]
"F6 /6 DIV r/m8 Unsigned divide AX by r/m8; AL ¼ Quotient, AH ¼ Remainder"
"F7 /6 DIV r/m16 Unsigned divide DX:AX by r/m16; AX ¼ Quotient, DX ¼ Remainder"
"F7 /6 DIV r/m32 Unsigned divide EDX:EAX by r/m32 doubleword; EAX ¼ Quotient, EDX ¼ Remainder"
[6]
</DIV>
<DS:>
[1]
"Internal disassembler's symbol which indicates that the next command is used with the DS: segment."