Assembly: conditional jmp statments (MASM/TASM)
How to use the conditional jmp, jumps (je, jg, jl, jne, etc)
a conditional jump, is just that, it jumps on a condition, if the condition is false, then if continues with the next line.
eg:
cmp 0,1
je one_equals_0
mov AX,0
if je returns true… which it won’t (this code shouldn’t work at all actually) then the mov statement is run, if it had returned true, then transfer of control would be moved to one_equals_0 label, where ever that is.
Arithmetic Jumps:
je – jump if equal, takes 2 parameters
jne – jump if not equal, takes 2 parameters
jl – jump if less than, if second parameter is less than the first
jg – jump if greater than, if second parameter is larger than the first
*NOTE there are many othe jmps available as well, some redundant, or uncommon.
Flag Jumps:
jz – jump if the last cmp or operation set the zero flag
jnz – jump if result is not zero
*Truthfully it is a flag or combination of flags that determines if the jump is taken or not in every case.
you can combine nearly any jump statemnt without it’s j prefix to a single j, and gain a new jmp statement, for instance:
jnle – jump if not less than or equal (the same as jg)
These conditional jumps allow for loops and if statements in assembly language.
Questions/Comments: william_a_wilson@hotmail.com
-William. § (marvin_gohan)










Metagen said on November 11, 2009
jl – jump if less than, if second parameter is less than the first
jg – jump if greater than, if second parameter is larger than the first
False