beautypg.com

Ret return – Zilog Z80380 User Manual

Page 174

background image

5-140

Z380

U

SER

'

S

M

ANUAL

DC-8297-03

Z

ILOG

RET
RETURN

RET [cc]

Operation:

if (cc is TRUE) then begin

if (XM) then begin

PC(7-0)

(SP)

PC(15-8)

(SP+1)

PC(23-16)

(SP+2)

PC(31-24)

(SP+3)

SP

SP + 4

end

else begin

PC(7-0)

(SP)

PC(15-8)

(SP+1)

SP

SP + 2

end

end

This instruction is used to return to a previously executing procedure at the end of a
procedure entered by a Call instruction. For a conditional return, one of the Zero, Carry, Sign,
or Parity/Overflow flags is checked to see if its setting matches the condition code “cc”
encoded in the instruction; if the condition is not satisfied, the instruction following the Return
instruction is executed, otherwise a value is popped from the stack and loaded into the
Program Counter (PC), thereby specifying the location of the next instruction to be executed.
For an unconditional return, the return is always taken and a condition code is not specified.

This instruction is also used to return to a previously executing procedure at the end of a
procedure entered by an interrupt in the assigned vectors mode, if Z80 family peripherals
are used external to the Z380 MPU.

Flags:

S:

Unaffected

Z:

Unaffected

H:

Unaffected

V:

Unaffected

N:

Unaffected

C:

Unaffected

Addressing

Execute

Mode

Syntax

Instruction Format

Time

Note

RET CC

11-cc000

note

X

RET

11001001

2+r

X

Field Encodings:

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

Note:

2 if CC is false, 2+r if CC is true