INSB
Usage: INSB Modifies flags: None
Loads data from port to the 'dest' ES:(E)DI (even if a destination operand is supplied). (E)DI is adjusted by the size of the operand and increased if the DF flag is cleared and decreased if the DF flag is set.
Input String from I/O Port
INSB ; 6C [186]
INSW ; o16 6D [186]
INSD ; o32 6D [386]
INSB inputs a byte from the I/O port specified in DX and stores it at [ES:DI] or [ES:EDI]. It then increments or decrements (depending on the direction flag: increments if the flag is clear, decrements if it is set) DI or EDI.
The register used is DI if the address size is 16 bits, and EDI if it is 32 bits. If you need to use an address size not equal to the current BITS setting, you can use an explicit a16 or a32 prefix. For INSB, INSW, INSD no operands are allowed and the size is determined by the mnemonic, the port by DX. Segment override prefixes have no effect for this instruction: the use of ES for the load from [DI] or [EDI] cannot be overridden.
INSW and INSD work in the same way, but they input a word or a doubleword instead of a byte, and increment or decrement the addressing register by 2 or 4 instead of 1.
The REP prefix may be used to repeat the instruction CX (or ECX - again, the address size chooses which) times. See also OUTSB, OUTSW and OUTSD.
Example:
mov dx Port
insb