LOOPE
Usage: LOOPE label Modifies flags: None
Decrements ECX by 1 (without modifying the flags) and transfers control to 'label' if ECX is not zero and the Zero Flag is set. The 'label' operand must be within -128 or 127 bytes of the instruction following the loop instruction.
Loop with Counter
LOOP imm ; E2 rb [8086]
LOOP imm,CX ; a16 E2 rb [8086]
LOOP imm,ECX ; a32 E2 rb [386]
LOOPE imm ; E1 rb [8086]
LOOPE imm,CX ; a16 E1 rb [8086]
LOOPE imm,ECX ; a32 E1 rb [386]
LOOPZ imm ; E1 rb [8086]
LOOPZ imm,CX ; a16 E1 rb [8086]
LOOPZ imm,ECX ; a32 E1 rb [386]
LOOPNE imm ; E0 rb [8086]
LOOPNE imm,CX ; a16 E0 rb [8086]
LOOPNE imm,ECX ; a32 E0 rb [386]
LOOPNZ imm ; E0 rb [8086]
LOOPNZ imm,CX ; a16 E0 rb [8086]
LOOPNZ imm,ECX ; a32 E0 rb [386]
LOOP decrements its counter register (ECX) by one, and if the counter does not become zero as a result of this operation, it jumps to the given label. The jump has a range of 128 bytes.
LOOPE (or its synonym LOOPZ) adds the additional condition that it only jumps if the counter is nonzero the zero flag is set. Similarly, LOOPNE (and LOOPNZ) jumps only if the counter is nonzero and the zero flag is clear.
EXAMPLE:
mov ecx 10
mov edi MyString
mov al '0'
L0: stosb | inc al | loope L0<