JP
The JP or "jump" instruction is used to jumpt to a specific address. This can be done unconditionally or a condition can be used.
Note that JP provides a similar operation in that it changes the flow of execution, except jp does not use a return address while CALL will include this on the stack.
| Instruction | Condition Met When | Opcode |
|---|---|---|
| JP (HL) | Jump to address held in HL registers | E9 |
| JP (IX) | Jump to address held in IX registers | DDE9 |
| JP (IY) | Jump to address held in IY registers | FD E9 |
| JP {address} | Jump to address | C3 {????} |
| JP Z, {address} | Jump if Zero flag (Z) is set | CA {????} |
| JP NZ, {address} | Jump if Zero flag (Z) is not set | C2 {????} |
| JP C, {address} | Jump if Carry flag (C) is set | DA {????} |
| JP NC, {address} | Jump if Carry flag (C) is not set | D2 {????} |
| JP M, {address} | Jump if minus flag (S) is set (minus sign) | F2 {????} |
| JP P, {address} | Jump if Plus flag (S) is not set (plus sign) | FA {????} |
| JP PO, {address} | Jump if parity odd or has overflow flag (P) is set | EA {????} |
| JP PE, {address} | Jump if parity even or had no overflow flag (P) is not set | E2 {????} |
Example
It is worth noting that the jump is unable to perform the logic of a comparison and a register-indirect jump. It would need to always be a immediate address when used with a jp comparion.