Mnemonics

JP

Jump Group
Expansion:
JumP
Usage:
jp [f,]{address}

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.

Z80.CPU instructions
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

; Example ld hl, $FFFA ; load hl with $FFFA ld de, 1 ; load de register with 1 there: add hl, de ; increment hl register from de which has a value of 1 jp here ; jump to label "here" here: ; each pass we add one until we go beyond the 16-bit number range ; at which point the carry flag will be engaged. jp nc, there ; jump to label "there" if there is no carry ret

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.

See also