NASM 2.05 based x86 Instruction Reference[ch311]
A.5.286.1 Pseudo-code examples a16 SCASB and with Direction Flag clear (UP) is equal to CMP AL, BYTE [ES:DI] LEA DI, [DI + 1] a16 REPE SCASW and with Direction Flag clear (UP) is equal to JCXZ @FF @@: CMP AX, WORD [ES:DI] LEA DI, [DI + 2] a16 LOOPE @B @@: a32 SCASD with Direction Flag set (DN) is equal to CMP EAX, DWORD [ES:EDI] LEA EDI, [EDI - 4]