beautypg.com

Relative addressing – Zilog Z8F0130 User Manual

Page 58

background image

eZ8

CPU Core

User Manual

UM012820-0810

Addressing Modes

36

Relative Addressing

Figure 15

displays the Relative Addressing mode, symbol RA. The

instruction specifies a two’s complement signed displacement in the range
of –128 to +127. This instruction, added to the contents of the Program
Counter, obtains the address of the next instruction to be executed. Prior
to the addition operation, the Program Counter contains the address of the
instruction immediately following the current relative addressing instruc-
tion. The JR and DJNZ instructions are the only instructions that use this
mode.

Figure 15. Relative Addressing

8-bit Value

Program Memory

–128 to +127

One Operand

Instruction
(Example)

Op Code

Displacement

Next Op Code

Next Op Code

if Jump

16-bit Program

Memory address

is PC[15:0] + d[7:0]

if no Jump

+

PC[15:0]

d

If Jump taken,

PC[15:0] = PC[15:0] + d[7:0]

16-bit Program

Memory address

is PC[15:0]