Jcc
Usage: Jcc target Modifies flags: None
Checks the flags in the EFLAGS register (CF, OF, PF, SF, and ZF) and, if the flags are in the specified state (condition), performs a jump to the target instruction.
Conditional Branch
Jcc imm ; 70+cc rb [8086]
Jcc NEAR imm ; 0F 80+cc rw/rd [386]
The jump instructions execute a near (same segment) jump if and only if their conditions are satisfied. For example, JNZ jumps only if the zero flag is not set.
The ordinary form of the instructions has only a 128-byte range; the Short form is a 386 extension to the instruction set, and can span the full size of a segment.
RosAsm will not override your choice of jump instruction: if you want Jcc Long, you have to use full talking Labels (MyLabelName) and if you want the Short form, you have to make use of Local meaningless labels with short Markers (jz L2>). For having the Long form with Local Labels, you must state the the Long Form Direction marker (jz L2>>).
The SHORT upward Marker is provided for clarity, but is not necessary.
Details of the condition codes:
Flags: O S Z P C
Simple Flags tests Instructions:
je / jz . . 1 . .
jne / jnz . . 0 . .
jno 0 . . . .
jnp / jpo . . . 0 .
jnz . 0 . . .
jo 1 . . . .
jp / jpe . . . 1 .
je . 1 . . .
Unsigned Math Instructions:
jb / jnae / jc . . . . 1
jbe / jna . . 1 . 1 (both ZF and CF set on)
jnb / jae / jn . . . . 0
jnbe / ja . . 0 . 0 (both ZF and CF set off)
Signed Math Instructions:
jl / jnge A B . . . (NOT (A=B))
jle / jng A B 1 . . (NOT (A=B)) OR ZF
jnl / jge A B . . . (A=B)
jnle / jg A B 0 . .
Read j as 'jump', e as 'equal', z as 'Zeroed', n as 'not', o as 'overflow, p as 'parity', a as 'above', c as 'carry', b as 'below', g as 'greater', l as 'lower'
JE/JZ Jump if equal/Jump if zero
JNE/JNZ Jump if not equal/Jump if not zero
JAE/JNB Jump if above or equal/Jump if not below
JB/JNAE Jump if below/Jump if not above or equal
JBE/JNA Jump if below or equal/Jump if not above
JG/JNLE Jump if greater/Jump if not less or equal
JGE/JNL Jump if greater or equal/Jump if not less
JL/JNGE Jump if less/Jump if not greater or equal
JLE/JNG Jump if less or equal/Jump if not greater
JC Jump if carry
JNC Jump if not carry
JO Jump if overflow
JNO Jump if not overflow
JS Jump if sign (negative)
JNS Jump if not sign (non-negative)
JPO/JNP Jump if parity odd/Jump if not parity
JPE/JP Jump if parity even/Jump if parity
Examples:
If B$WriteCheckerWanted = &TRUE
cmp eax 32 | jnae L1>
cmp eax CR | je L1>
cmp eax ',' | jae L1>
cmp eax 8 | jbe L1>
cmp eax Tab | jne L0>
L1: call Label