The JNE/JNZ instructions

Jump if not equal / not zero (Zero Flag = 0).

Format of the JNE/JNZ instructions

InstructionDescription
JNE rel8 / JNZ rel8Short jump if the ZF flag=0.
JNE rel16 / JNZ rel16Near jump if the ZF flag=0.

JNE (Jump if Not Equal) and JNZ (Jump if Not Zero) are synonyms denoting the same instruction. It performs a jump to the specified address if the zero flag (ZF) is cleared to 0. It is usually used after a CMP comparison instruction or after arithmetic/logical operations.

Usage example

title Author: Evgeny Sergeevich Dovgopolov

.model small
.stack 100h

code segment public        ; Start of the code segment
    assume cs:code

    main proc              ; Start of the main procedure
        mov     ax, 3      ; Copy the value 3 into the ax register

        cmp     ax, 5      ; Compare the value in ax with the number 5
        jne     Skip_1     ; If ZF=0, jump to the Skip_1 label

        mov     bx, 2      ; (These instructions will be skipped because ZF=0)
        imul    bx         ;

    Skip_1:
        mov     ax, 5      ; Copy the value 5 into the ax register

        cmp     ax, 5      ; Compare the value in ax with the number 5
        jne     Skip_2     ; If ZF=0, jump to the Skip_2 label (the jump will not occur)

        mov     bx, 2      ; (These instructions will be executed because ZF=1)
        imul    bx         ; Perform signed multiplication of ax by bx

    Skip_2:
        mov     ax, 4C00h  ; Copy the process termination function number into ah and the value into al
        int     21h        ; Call the interrupt
    main endp              ; End of the main procedure

code ends                  ; End of the code segment
end main                   ; End of file. The main procedure is the entry point

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

Processor status flags

CF
No
PF
No
AF
No
ZF
No
SF
No
TF
No
IF
No
DF
No
OF
No