LOOPNZ
Operand:
label
Decrease CX, jump to label if CX not zero and ZF = 0.
Algorithm:
CX = CX - 1
if (CX <> 0) and (ZF = 0) then
jump
else
no jump, continue
Example:
; Loop until '7' is found,
; or 5 times.
include 'emu8086.inc'
#make_COM#
ORG 100h
MOV SI, 0
MOV CX, 5
label1:
PUTC '*'
MOV AL, v1[SI]
INC SI ; next byte (SI=SI+1).
CMP AL, 7
LOOPNZ label1
RET
v1 db 9, 8, 7, 6, 5
Flags:
C Z S O P A
unchanged