See Also: DAS, AAA, AAS, AAM, AAD, Flags
| O | D | I | T | S | Z | A | P | C |
| ? | * | * | * | * | * |
If (AL & 0Fh) > 9 or (AF = 1) then AL = AL + 6 AF = 1 else AF = 0 If (AL > 9Fh) or (CF = 1) then AL = AL + 60h CF = 1 else CF = 0
DAA corrects the result of a previous addition of two valid packed decimal operands (note that this result must be in AL). This instruction changes the content of AL so that it will contain a pair of valid packed decimal digits.
| Operands | Clocks | Transfers | Bytes | Example |
| no operands | 4 | - | 1 | DAA |
Note: Packed BCD stores one digit per nibble (4 bits); the least significant digit is in the lower nibble. It is not possible to apply an adjustment after division or multiplication of packed BCD numbers. If you need to use multiplication or division, it is better to use unpacked BCD numbers.See, for example, the description of AAM (ASCII Adjust after Multiply).
See Also: AAS, DAA, SUB, SBB, DEC, NEG, Flags
| O | D | I | T | S | Z | A | P | C |
| ? | * | * | * | * | * |
If(AL & 0Fh) > 9 or (AF = 1) then AL = AL - 6 AF = 1 else AF = 0If (AL > 9Fh) or (CF = 1) then AL = AL - 60h CF = 1 else CF = 0
DAS corrects the result of a previous subtraction of two valid packed decimal operands (note that this result must be in AL). This instruction changes the content of AL so that it will contain a pair of valid packed decimal digits.
| Operands | Clocks | Transfers | Bytes | Example |
| no operands | 4 | - | 1 | DAS |
Note: Packed BCD stores one digit per nibble
(4 bits); the least significant digit is in the lower nibble.
It is not possible to apply an adjustment after division or
multiplication of packed BCD numbers. If you need to use
multiplication and division, it is better to use unpacked BCD
numbers. See, for example, the description of AAM (ASCII Adjust
after Multiply).
See Also: SUB, SBB, AAS, DAS, EA, Flags
| O | D | I | T | S | Z | A | P | C |
| * | * | * | * | * |
destination = destination - 1
This instruction decrements the destination by one. The destination operand, which may be either a word or a byte, is treated as an unsigned binary number.
| Operands | Clocks | Transfers | Bytes | Example |
| reg16 | 2 | - | 1 | DEC BX |
| reg8 | 3 | - | 2 | DEC BL |
| memory | 15(23)+EA | 2 | 2-4 | DEC MATRIX[SI] |
Note: This instruction does not set the carry, so if you need to decrement a multi-word number, it is better to use the SUB and SBB instructions.
See Also: IDIV, SHR, AAD, CBW, CWD, INT 00h, EA, Flags
| O | D | I | T | S | Z | A | P | C |
| ? | ? | ? | ? | ? | ? |
AL = AX / source ;Source is byte AH = remainderorAX = DX:AX / source ;Source is word DX = remainder
This instruction performs unsigned division. If the source is a byte, DIV divides the word value in AX by source, returning the quotient in AL and the remainder in AH. If the source is a word, DIV divides the double-word value in DX:AX by the source, returning the quotient in AX and the remainder in DX.
| Operands | Clocks | Transfers | Bytes | Example |
| reg8 | 0-90 | - | 2 | DIV BL |
| reg16 | 4-162 | - | 2 | DIV BX |
| mem8 | (86-96)+EA | 1 | 2-4 | DIV VYUP |
| mem16 | (154-172)+EA | 1 | 2-4 | DIV NCONQUER[SI] |
Note: If the result is too large to fit in
the destination (AL or AX), an INT 0 (Divide by Zero) is
generated, and the quotient and remainder are undefined.
When an Interrupt 0 (Divide by Zero) is generated, the saved
CS:IP value on the 80286 and 80386 points to the instruction that
failed (the DIV instruction).On the 8088/8086, however, CS:IP
points to the instruction following the failed DIV instruction.
Última actualização: 02 Maio 2005