See also: DIV, SAR, AAD, CBW, CWD, INT 00h, EA, Flags
O | D | I | T | S | Z | A | P | C |
? | ? | ? | ? | ? | ? |
AL = AX / source ; Byte source AH ß remainderorAX = DX:AX / source ; Word source DX ß remainder
IDIV performs signed division. If source is a byte, IDIV divides the word value in AX by source, returning the quotient in AL and the remainder in AH. If source is a word, IDIV divides the double-word value in DX:AX by source, returning the quotient in AX and the remainder in DX.
Operands | Clocks | Transfers | Bytes | Example |
reg8 | 101-112 | - | 2 | IDIV CL |
reg16 | 165-184 | - | 2 | IDIV DX |
mem8 | (107-118)+EA | 1 | 2-4 | IDIV BYTE[SI] |
mem16 | (175-194)+EA | 1 | 2-4 | IDIV [BX],WORD_ARRAY |
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.
The 80286 and 80386 microprocessors are able to generate the
largest negative number (80h or 8000h) as a quotient for this
instruction, but the 8088/8086 will generate an Interrupt 0
(Divide by Zero) if this situation occurs.
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 IDIV instruction). On the 8088/8086, however, CS:IP
points to the instruction following the failed IDIV instruction.
O | D | I | T | S | Z | A | P | C |
* | ? | ? | ? | ? | * |
AX = AL * source ;if source is a byteorDX:AX = AX * source ;if source is a word
IMUL performs signed multiplication. If source is a byte, IMUL multiplies source by AL, returning the product in AX. If source is a word, IMUL multiplies source by AX, returning the product in DX:AX. The Carry Flag and Overflow Flag are set if the upper half of the result (AH for a byte source, DX for a word source) contains any significant digits of the product, otherwise they are cleared.
Operands | Clocks | Transfers | Bytes | Example |
reg8 | 80-98 | - | 2 | IMUL CL |
reg16 | 128-154 | - | 2 | IMUL BX |
mem8 | (86-104)+EA | 1 | 2-4 | IMUL BITE |
mem16 | (138-164)+EA | 1 | 2-4 | IMUL WORD[BP][DI] |
See Also: OUT
accumulator = (port)
IN transfers a byte or a word from a port to AL or AX. The port may be specified by an immediate byte value (for ports 0 through 255) or by the DX register (allowing access to all ports).
Operands | Clocks byte(word) |
Transfers | Bytes | Example |
accumulator, immed8 | 10(14) | 1 | 2 | IN AL,45h |
accumulator, DX | 8(12) | 1 | 1 | IN AX,DX |
Note: It is advised that hardware not use I/O ports F8h through FFh, since these are reserved for controlling the math coprocessor and future processor extensions.
See Also: ADD, ADC, AAA, DAA, DEC, EA, Flags
O | D | I | T | S | Z | A | P | C |
* | * | * | * | * |
destination = destination + 1
INC adds 1 to the destination. The destination, which may be either a byte or a word, is considered an unsigned binary number.
Operands | Clocks byte(word) |
Transfers | Bytes | Example |
reg16 | 2 | - | 1 | INC BX |
reg8 | 3 | - | 2 | INC BL |
memory | 15(23)+EA | 2 | 2-4 | INC THETA[BX] |
Note: This instruction does not set the carry flag.If you need to add 1 to a multi-word number, it is better to use the ADD and ADC instructions instead.
See also: IRET, INTO, PUSHF, CALL, INT 03h, Flags
O | D | I | T | S | Z | A | P | C |
0 | 0 |
PUSHF ;Push flags onto stack TF = 0 ;Clear Trap Flag IF = 0 ;Disable Interrupts CALL FAR (INT*4) ;Call the interrupt handler
INT pushes the flags register, clears the Trap and Interrupt-enable Flags, pushes CS and IP, then transfers control to the interrupt handler specified by the interrupt-num.If the interrupt handler returns using an IRET instruction, the original flags are restored.
Operands | Clocks byte(word) |
Transfers | Bytes | Example |
immed8 (type=3) | 52 | 5 | 1 | INT 3 |
immed8 (type<>3) | 51 | 5 | 2 | INT 21 |
Note: The flags are stored in the same format
as that used by the PUSHF instruction. The address of the
interrupt vector is determined by multiplying the interrupt-num
by 4. The first word at the resulting address is loaded into IP,
and the second word into CS.
All interrupt-nums except type 3 generate a two-byte opcode; type
3 generates a one-byte instruction called the Breakpoint
interrupt.
See Also: INT, IRET, JNO, JO, PUSHF, CALL, INT 04h, Flags
O | D | I | T | S | Z | A | P | C |
0 | 0 |
if (OF = 1) PUSHF ;Push flags onto stack TF = 0 ;Clear Trap FlagIF = 0 ;Disable Interrupts CALL FAR (10h) ;The INTO vector is at 0000:0010h
INTO activates interrupt type 4 if the Overflow Flag is set; otherwise it does nothing. This interrupt operates identically to an "INT 4" if the overflow flag is set, in which case INTO pushes the flags register, clears the Trap and Interrupt-enable Flags, pushes CS and IP, then transfers control to the interrupt-num 4 handler, which is pointed to by the vector at location 10h.If the interrupt handler returns using an IRET instruction, the original flags are restored.
Operands | Clocks byte(word) |
Transfers | Bytes | Example |
no operands | 53 or 4 | 5 | 1 | INTO |
Note: The flags are stored in the same format as that used by the PUSHF instruction. INTO can be used after an operation that may cause overflow, to call a recovery procedure.
See Also: INT, INTO, POP, POPF
O | D | I | T | S | Z | A | P | C |
r | r | r | r | r | r | r | r | r |
POP IP POP CS POPF ;Pop flags from stack
IRET returns control from an interrupt routine to the point where the interrupt occurred, by popping IP, CS, and the Flag registers.
Operands | Clocks | Transfers | Bytes | Example |
no operands | 32 | 3 | 1 | IRET |
Última actualização: 02 Maio 2005