The JE/JZ instructions

Jump if equal (Zero Flag = 1).

Format of the JE/JZ instructions

InstructionDescription
JE rel8 / JZ rel8Short jump if the ZF flag=1.
JE rel16 / JZ rel16Near jump if the ZF flag=1.

JE (Jump if Equal) and JZ (Jump if Zero) are synonyms denoting the same instruction. It performs a jump to the specified address if the zero flag (ZF) is set to 1. It is usually used after a CMP comparison instruction or after arithmetic/logical operations that affect the ZF flag.

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, 5     ; Copy the value 5 into the ax register

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

        mov     bx, 2     ; (These instructions will be skipped if ZF=1)
        imul    bx        ;

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

        cmp     ax, 5     ; Compare the value in ax with the number 5
        je      Skip_2    ; If ZF=1, jump to the Skip_2 label

        mov     bx, 2     ; (These instructions will be executed because ZF=0)
        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