beautypg.com

Calr call relative – Zilog Z80380 User Manual

Page 66

background image

5-32

Z380

U

SER

'

S

M

ANUAL

DC-8297-03

Z

ILOG

CALR
CALL RELATIVE

CALR [cc,]dst

dst = RA

Operation:

if (cc is true) then begin

dst

SIGN EXTEND dst

if (XM) then begin

SP

SP - 4

(SP)

PC(7-0)

(SP+1)

PC(15-8)

(SP+2)

PC(23-16)

(SP+3)

PC(31-24)

PC(31-0)

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

end

else begin

SP

SP - 2

(SP)

PC(7-0)

(SP+1)

PC(15-8)

PC(15-0)

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

end

end

A conditional Call 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
call always transfers control to the destination address. The current contents of the Program
Counter (PC) are pushed onto the top of the stack; the PC value used is the address of the
first instruction byte following the Call instruction. The destination address is then loaded into
the PC and points to the first instruction of the called procedure. At the end of a procedure
a RETurn instruction is used to return to the original program. These instructions employ
either an 8-bit, 16-bit, or 24-bit signed, two’s complement displacement from the PC to
permit calls within the 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.

Each of the Zero, Carry, Sign, and Overflow flags can be individually tested and a call
performed conditionally on the setting of the flag.

Flags:

S:

Unaffected

Z:

Unaffected

H:

Unaffected

V:

Unaffected

N:

Unaffected

C:

Unaffected

Addressing

Execute

Mode

Syntax

Instruction Format

Time

Note

RA:

CALR CC,addr

11101101 11-cc100 —disp—

note

X

CALR addr

11101101 11001101 —disp—

4+w

X

CALR CC,addr

11011101 11-cc100 -d(low)- -d(high)

note

X

CALR addr

11011101 11001101 -d(low)- -d(high)

4+w

X

CALR CC,addr

11111101 11-cc100 -d(low)- -d(mid)- -d(high)

note

X

CALR addr

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

4+w

X

Field Encodings:

cc: 000 for NZ, 001 for Z, 010 for NC, 011 for C, 100 for PO or NV, 101 for PE or V,
110 for P or NS, 111 for M or S

Note:

2 if CC is false, 4+w if CC is true