NASM 2.05 based x86 Instruction Reference[ch141]
A.5.121 INSB, INSW, INSD: 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. 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. The REP alias REPE, as well as the differently-encoded REPNE, are both allowed as well. They behave in the same way as REP. See also OUTSB, OUTSW and OUTSD (section A.5.195).