jmp/jcc
The jump and jump conditional instructions (conditionally) jump to the given location by setting the program counter accordingly.
In the following, denotes the address of the first byte after the current instruction, is the program counter register, and is the page-index register.
Instruction | Encoding | Semantics | Cycles |
---|---|---|---|
jmp pi | 00 000 001 | 1 | |
jcc imm8s16 1 | 00 ccc 11n imm8 | if the condition is met | 22/53/84 |
jmp imm16 | 00 101 111 imm16 | 3 |
- There is no jump with false condition (
ccc
=101
,n
= 1). Instead, we havejmp imm16
. - 2 cycles for fall-through
- 5 cycles if the upper address byte remains unchanged
- 8 cycles if the upper address byte changes
Condition Codes
For jcc
, there are the following conditions (inspired by x86):
Mnemonic | ccc | n | Condition | Description |
---|---|---|---|---|
jo | 000 | 0 | overflow | |
jb , jc , jnae | 001 | 0 | below / carry / not above or equal | |
je , jz | 010 | 0 | equal / zero | |
jbe , jna | 011 | 0 | below or equal / not above | |
js | 100 | 0 | sign | |
jmp | 101 | 0 | unconditional | |
jl , jnge | 110 | 0 | less / not greater or equal | |
jle , jng | 111 | 0 | less or equal / not greater | |
jno | 000 | 1 | not overflow | |
jnb , jnc , jae | 001 | 1 | not below / not carry / above or equal | |
jne , jnz | 010 | 1 | not equal / not zero | |
jnbe , ja | 011 | 1 | not below or equal / above | |
jns | 100 | 1 | not sign | |
jnl , jge | 110 | 1 | not less / greater or equal | |
jnle , jg | 111 | 1 | not less or equal / greater |