Opcode Instruction Clocks Description 6C INS r/m8,DX 15,pm=9*/29** Input byte from port DX into ES:(E)DI 6D INS r/m16,DX 15,pm=9*/29** Input word from port DX into ES:(E)DI 6D INS r/m32,DX 15,pm=9*/29** Input dword from port DX into ES:(E)DI 6C INSB 15,pm=9*/29** Input byte from port DX into ES:(E)DI 6D INSW 15,pm=9*/29** Input word from port DX into ES:(E)DI 6D INSD 15,pm=9*/29** Input dword from port DX into ES:(E)DI
*If CPL <= IOPL **If CPL > IOPL or if in virtual 8086 mode
IF AddressSize = 16 THEN use DI for dest-index; ELSE (* AddressSize = 32 *) use EDI for dest-index; FI; IF (PE = 1) AND ((VM = 1) OR (CPL > IOPL)) THEN (* Virtual 8086 mode, or protected mode with CPL > IOPL *) IF NOT I-O-Permission (SRC, width(SRC)) THEN #GP(0); FI; FI; IF byte type of instruction THEN ES:[dest-index] := [DX]; (* Reads byte at DX from I/O address space *) IF DF = 0 THEN IncDec := 1 ELSE IncDec := -1; FI; FI; IF OperandSize = 16 THEN ES:[dest-index] := [DX]; (* Reads word at DX from I/O address space *) IF DF = 0 THEN IncDec := 2 ELSE IncDec := -2; FI; FI; IF OperandSize = 32 THEN ES:[dest-index] := [DX]; (* Reads dword at DX from I/O address space *) IF DF = 0 THEN IncDec := 4 ELSE IncDec := -4; FI; FI; dest-index := dest-index + IncDec;
INS does not allow the specification of the port number as an immediate value. The port must be addressed through the DX register value. Load the correct value into DX before executing the INS instruction.
The destination address is determined by the contents of the destination index register. Load the correct index into the destination index register before executing INS.
After the transfer is made, DI or EDI advances automatically. If the direction flag is 0 (CLD was executed), DI or EDI increments; if the direction flag is 1 (STD was executed), DI or EDI decrements. DI increments or decrements by 1 if a byte is input, by 2 if a word is input, or by 4 if a doubleword is input.
INSB, INSW and INSD are synonyms of the byte, word, and doubleword INS instructions. INS can be preceded by the REP prefix for block input of CX bytes or words. Refer to the REP instruction for details of this operation.
up:
Chapter 17 -- 80386 Instruction Set
prev: INC Increment by 1
next: INT/INTO Call to Interrupt Procedure