X86-assembly/Instructions/jz

From aldeid
Jump to navigation Jump to search
You are here:
jz/je

Description

  • The jz instruction is a conditional jump that follows a test.
  • It jumps to the specified location if the Zero Flag (ZF) is set (1).
  • jz is commonly used to explicitly test for something being equal to zero whereas je is commonly found after a cmp instruction.

Syntax

jz location
je location

Examples

test eax, eax            ; test if eax=0
jz   short loc_402B13    ; if condition is met, jump to loc_402B13
dec  ecx
jz   counter_is_now_zero
cmp  edx, 42
je   short loc_402B13    ; if edx equals 42, jum to loc_402B13

Comments