NASM 2.05 based x86 Instruction Reference[ch142]
A.5.121.1 Pseudo-code examples a16 INSB and with Direction Flag clear (UP) is equal to IN BYTE [ES:DI], DX LEA DI, [DI + 1] a16 REP INSW and with Direction Flag clear (UP) is equal to JCXZ @FF @@: IN WORD [ES:DI], DX LEA DI, [DI + 2] a16 LOOP @B @@: a32 INSD with Direction Flag set (DN) is equal to IN DWORD [ES:EDI], DX LEA EDI, [EDI - 4]