loopz

8086 and later

Loop with Counter

loopz imm8 {near|short} | loopz imm8 {near|short}, cx | loopz imm8 {near|short}, ecx | loopz imm8 {near|short}, rcx

LOOP decrements its counter register (either CX or ECX - if one is not specified explicitly, the BITS setting dictates which is used) 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 and the zero flag is set. Similarly, LOOPNE (and LOOPNZ) jumps only if the counter is nonzero and the zero flag is clear.

Loading...

Forms

Every form of loopz the assembler accepts, from NASM's own instruction table. The second column is the processor that introduced the form; a badge marks a form that needs an extension, that is lockable, or that long mode dropped.

FormSinceNotes
loopz imm8 {near|short}8086
loopz imm8 {near|short}, cx8086nolong
loopz imm8 {near|short}, ecx386
loopz imm8 {near|short}, rcxx86-64long