Condition: jumps if ZF = 1. JE and JZ are two names for one instruction; choose the one that says what you mean. After CMP a, b the flags describe a − b, and ZF = 1 means the difference was zero, that is a = b: write JE. After arithmetic or logic, ZF = 1 means the result itself was zero: write JZ.
Equality does not depend on how you read the bits, so JE serves both the signed and the unsigned family. ZF is set by CMP, TEST, ADD, SUB, INC, DEC, NEG, AND, OR, XOR and the string compares. MOV, XCHG, LEA, PUSH, POP and the jumps leave it alone, so the jump may come a few instructions after the compare as long as nothing in between changes the flags.
MOV AX, 1234hCMP AX, 1234h ; equal: ZF = 1MOV DL, "Y" ; MOV leaves the flags aloneJE SHOW1 ; taken: DL stays "Y"MOV DL, "N"SHOW1:MOV AH, 02h ; DOS: print the character in DLINT 21h
Idioms
TEST AX, AX then JZ ZERO1 checks a register for zero without changing it. TEST AL, 4 then JZ CLEAR1 checks one bit. After REPE CMPSB, JE means the two blocks matched all the way.
Range
On the 8086 JE exists only in the SHORT form: two bytes, opcode 74h and a signed 8-bit displacement counted from the end of the instruction. The target must lie within −128..+127 bytes of that point. To go farther, invert the test and hop over an unconditional JMP, which can reach the whole segment. MASM 6 makes this rewrite itself when it finds the target out of range (its default OPTION LJMP), so the listing may show two instructions where you wrote one.
JNE SKIP1 ; the opposite test, a short hopJMP FARAWAY ; any distance in the segmentSKIP1:
Later CPUs
The 80386 added a near form of every conditional jump, 0Fh 84h followed by a 16-bit displacement (32-bit in 32-bit code), so from the 386 on JE can reach anywhere in the segment. Code for the 8086 must stay with the short form.