beautypg.com

Jr jump relative – Zilog Z80380 User Manual

Page 115

background image

5-81

Z380

U

SER

'

S

M

ANUAL

Z

ILOG

DC-8297-03

JR

JUMP RELATIVE

JR [cc,]dst

dst = RA

Operation:

if (cc is TRUE) then begin

dst

SIGN EXTEND dst

if (XM) then begin

PC(31-0)

PC(31-0) + dst(31-0)

end

else begin

PC(15-0)

PC(15-0) + dst(15-0)

end

end

A conditional Jump transfers program control to the destination address if the setting of a
selected flag satisfies the condition code “cc” specified in the instruction; an unconditional
Jump always transfers control to the destination address. Either the Zero or Carry flag can
be tested for the conditional Jump. If the jump is taken, the Program Counter (PC) is loaded
with the destination address; otherwise the instruction following the Jump Relative instruc-
tion is executed.

The destination address is calculated using relative addressing. The displacement in the
instruction is added to the PC value for the instruction following the JR instruction, not the
value of the PC for the JR instruction.

These instructions employ either an 8-bit, 16-bit, or 24-bit signed, two’s complement
displacement from the PC to permit jumps within a range of –126 to +129 bytes, –32,765 to
+32,770 bytes, or –8,388,604 to +8,388,611 bytes from the location of this instruction.

Flags:

S:

Unaffected

Z:

Unaffected

H:

Unaffected

V:

Unaffected

N:

Unaffected

C:

Unaffected

Addressing

Execute

Mode

Syntax

Instruction Format

Time

Note

RA:

JR CC,addr

001cc000 —disp—

2

X

JR addr

00011000 —disp—

2

X

JR CC,addr

11011101 001cc000 -d(low)- -d(high)

2

X

JR addr

11011101 00011000 -d(low)- -d(high)

2

X

JR CC,addr

11111101 001cc000 -d(low)- -d(mid)- -d(high)

2

X

JR addr

11111101 00011000 -d(low)- -d(mid)- -d(high)

2

X

Field Encodings:

cc: 00 for NZ, 01 for Z, 10 for NC, 11 for C