You are here : assembly8086LOOPZ

LOOPZ - 8086

Decrease CX, jump to label if CX not zero and ZF = 1.

Algorithm:

  • CX = CX - 1
  • if (CX <> 0) and (ZF = 1) then
    • jump
  • else
    • no jump, continue


Syntax

LOOPZ Label


Example

; Loop until result fits into AL alone,
; or 5 times. The result will be over 255
; on third loop (100+100+100),
; so loop will exit.
 include 'emu8086.inc'
 ORG 100h
 MOV AX, 0
 MOV CX, 5
label1:
 PUTC '*'
 ADD AX, 100
 CMP AH, 0
 LOOPZ label1
 RET


Output / Return Value


Limitations


Alternatives / See Also


Reference