Skip to main content

jmp/jcc

The jump and jump conditional instructions (conditionally) jump to the given location by setting the program counter accordingly.

In the following, PC\mathit{PC} denotes the address of the first byte after the current instruction, pc\mathit{pc} is the program counter register, and pi\mathit{pi} is the page-index register.

InstructionEncodingSemanticsCycles
jmp pi00 000 001pc←pi\mathit{pc} \gets \mathit{pi}1
jcc imm8s16100 ccc 11n imm8pc←PC+sext(imm8)\mathit{pc} \gets \mathit{PC} + \mathit{sext}(\mathit{imm8}) if the condition is met22/53/84
jmp imm1600 101 111 imm16pc←imm16\mathit{pc} \gets \mathit{imm16}3
  1. There is no jump with false condition (ccc = 101, n = 1). Instead, we have jmp imm16.
  2. 2 cycles for fall-through
  3. 5 cycles if the upper address byte remains unchanged
  4. 8 cycles if the upper address byte changes

Condition Codes​

For jcc, there are the following conditions (inspired by x86):

MnemoniccccnConditionDescription
jo0000OF=1\mathit{OF} = 1overflow
jb, jc, jnae0010CF=1\mathit{CF} = 1below / carry / not above or equal
je, jz0100ZF=1\mathit{ZF} = 1equal / zero
jbe, jna0110CF∣ZF=1\mathit{CF}\mid\mathit{ZF} = 1below or equal / not above
js1000SF=1\mathit{SF} = 1sign
jmp1010true\mathit{true}unconditional
jl, jnge1100SF ∧OF=1\mathit{SF}~^\wedge\mathit{OF} = 1less / not greater or equal
jle, jng1110(SF ∧OF)∣ZF=1(\mathit{SF}~^\wedge\mathit{OF})\mid\mathit{ZF} = 1less or equal / not greater
jno0001OF=0\mathit{OF} = 0not overflow
jnb, jnc, jae0011CF=0\mathit{CF} = 0not below / not carry / above or equal
jne, jnz0101ZF=0\mathit{ZF} = 0not equal / not zero
jnbe, ja0111CF∣ZF=0\mathit{CF}\mid\mathit{ZF} = 0not below or equal / above
jns1001SF=0\mathit{SF} = 0not sign
jnl, jge1101SF ∧OF=0\mathit{SF}~^\wedge\mathit{OF} = 0not less / greater or equal
jnle, jg1111(SF ∧OF)∣ZF=0(\mathit{SF}~^\wedge\mathit{OF})\mid\mathit{ZF} = 0not less or equal / greater