LOOPNZ
and LOOPNE
Instructions
LOOPNZ
(loop if not zero) and LOOPNE
(loop if not equal) instructions are the counterpart of LOOPZ
or LOOPE
.
The loop destination must be within –128 to +127 bytes of the current location counter.
LOOPNZ/LOOPNE — LOOP If Not Equal (Zero) |
||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
The loop continues while the unsigned value of ECX is greater than zero and zero flag is clear. The following code is the execution logic of them:
ECX = ECX - 1 if (ECX > 0 and ZF = 0) jump to destinationThe code on the right shows an array whose integer elements are sorted ascendingly. It scans each number in an array until a nonnegative number is found. It then applies addition to the remaining nonnegative numbers. |
|