You are here : assembly8086LOOPNZ

LOOPNZ - 8086

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


Syntax

LOOPNE Label


Example

; Loop until '7' is found,
; or 5 times.
 include 'emu8086.inc'
 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 


Output / Return Value


Limitations


Alternatives / See Also


Reference