NASM 2.05 based x86 Instruction Reference[ch329]
A.5.303.1 Pseudo-code examples a16 STOSB and with Direction Flag clear (UP) is equal to MOV BYTE [ES:DI], AL LEA DI, [DI + 1] a16 REP STOSW and with Direction Flag clear (UP) is equal to JCXZ @FF @@: MOV WORD [ES:DI], AX LEA DI, [DI + 2] a16 LOOP @B @@: a32 STOSD with Direction Flag set (DN) is equal to MOV DWORD [ES:EDI], EAX LEA EDI, [EDI - 4]