JE
and JZ
are just different names for exactly the same thing: a conditional jump when ZF
(the “zero” flag) is equal to 1.
(Similarly, JNE
and JNZ
are just different names for a conditional jump when ZF
is equal to 0.)
You could use them interchangeably, but you should use them depending on what you are doing:
JZ
/JNZ
are more appropriate when you are explicitly testing for something being equal to zero:dec ecx jz counter_is_now_zero
JE
andJNE
are more appropriate after aCMP
instruction:cmp edx, 42 je the_answer_is_42
(ACMP
instruction performs a subtraction, and throws the value of the result away, while keeping the flags; which is why you getZF=1
when the operands are equal andZF=0
when they’re not.)