beautypg.com

6 program counter relative mode (ra) (continued) – Zilog Z80380 User Manual

Page 31

background image

4-6

Z380

U

SER

'

S

M

ANUAL

DC-8297-03

Z

ILOG

4.2.6 Program Counter Relative Mode (RA)

(Continued)

PCz

PC

Before instruction execution

0000

1000

After instruction execution

0000

0FFE

Address calculation: In Native mode, –2 is encoded as
0FEH in the instruction, and it is sign extended to a 16-bit
value before added to the Program Counter. Calculation is
done in modulo 2

16

and does not affect the Extended

portion of the Program Counter.

1000

+

FFFE
FFFE

Address calculation: Since this is a 4-byte instruction, the
PC value after fetch but before jump taking place is:

19590807

+

00000004
1959080B

The displacement portion, –5000H, is sign extended to a
32-bit value before being added to the Program Counter.
Calculation is done in modulo 2

32

and affects the Extended

portion of the Program Counter.

1959080B

+

FFFFB000
1958B80B

2. Jump relative in Extended mode, 16-bit displacement

SETC

XM

;Put it in Extended mode of operation

JR

$-5000H

;Jumps to the location
;(Current PC value) – 5000H
;$ stands for current PC value
;This instruction jumps to itself.

PCz

PC

Before instruction execution

1959

0807

After instruction execution

1958

B80B