The JNZ instruction

The JNZ instruction is used to transfer program control to the specified memory address if Z=0 in the flag register. In other words, it allows the program to choose a different execution path based on the result of a previous arithmetic or logical operation.

The JNZ instruction format

InstructionDescription
JNZ addr16 Performs a jump to an address or label if the Z flag is 0.

Usage example

; Author: Evgeny Sergeevich Dovgopolov

main:
    xra     a         ; Clear the accumulator.
    mvi     c, 0Ah    ; Load the hexadecimal value 0Ah into register C

MainLoop:
    inr     a         ; Increment the value in register A by 1
    dcr     c         ; Decrement the value in register C by 1
    jnz     MainLoop  ; Jump to the label MainLoop while register C is not equal to 0

    hlt               ; Stop program execution

Example taken from the textbook "HANDYFAR - MASM (Evgeny Sergeevich Dovgopolov)".

Processor status flags

S
No
Z
No
AC
No
P
No
CY
No