
Instruction Set
4-71
INS *
INS B
INS W
Input S tring Component from Port
Input S tring Byte from Port
Input S tring Word from Port
INS
What It Does
INS copies a component from a port in I/O space to a string in memory.
S yntax
Desc ription
INS transfers data from the input port numbered by the DX register to the memory byte or
word at ES:DI. The memory operand must be addressable from the ES register; no segment
override is possible.
The INS instruction does not allow the specification of the port number as an immediate
value. You must address the port through the DX register value. Similarly, the destination
index register determines the destination address. Before executing the INS instruction,
you must preload the DX register value into the DX register and the correct index into the
destination index register.
After the transfer is made, the DI register advances automatically. If DF is 0 (a CLD
instruction was executed), the DI register increments; if DF is 1 (an STD instruction was
executed), the DI register decrements. The DI register increments or decrements by 1 if
the input is a byte, or by 2 if it is a word.
The INSB and INSW instructions are synonyms for the byte and word INS instructions,
respectively.
* – This instruction was not available on the original 8086/8088 systems.
Form
Opcode
Description
Clocks
Am186 Am188
INS m8DX
6C
Input byte from port in DX to ES:[DI]
14
14
INS m16DX
6D
Input word from port in DX to ES:[DI]
14
14
INSB
6C
Input byte from port in DX to ES:[DI]
14
14
INSW
6D
Input word from port in DX to ES:[DI]
14
14
To have the assembler type-check
your operands, use this form. The
assembler uses the definition of the
string component to determine its
size.
Regardless of the form of INS you
use, destination is always ES:[DI],
and port is always DX. Before using
any form of INS, make sure that: ES
contains the segment of the string, DI
contains the offset of the string, and
DX contains the number of the port.
To copy a byte from the I/O port
specified n DX o a byte within a string
located in the segment specified in
ES, use this form.
INS destination,port
INSB
INSW
To copy a word from the I/O port
specified in DX to a word within a
string located in the segment
specified in ES, use this form.