beautypg.com

Subroutine stack control instructions, Callf !faddr, Rets – NEC PD75402A User Manual

Page 183: Reti

background image

172

CHAPTER 9. INSTRUCTION SET

9.4.10 Subroutine Stack Control Instructions

CALLF !faddr

Function: (SP-1)

PC

7

to PC

4

, (SP-2)

PC

3

to PC

0

,

(SP-3)

0, 0, 0, 0

(SP-4)

0, PC

10

to PC

8

,

SP

SP-4, PC

A

10

to A

0

faddr = A

10

to A

0

: 000H to 77FH

Saves the contents of the program counter (PC; return address) to the data memory (stack) addressed by

the stack pointer (SP) and decrements the SP, then branches to the address addressed by 11-bit immediate

data faddr.

The range that can be called is limited to addresses 000H to 77FH (0 to 1919).

RET

Function: PC

10

to PC

8

(SP), PC

3

to PC

0

(SP+2),

PC

7

to PC

4

(SP+3), SP

SP+4

Restores the contents of the data memory (stack) addressed by the stack pointer (SP) to the program counter

(PC), then increments the contents of the SP.

RETS

Function: PC

10

to PC

8

(SP), PC

3

to PC

0

(SP+2)

PC

7

to PC

4

(SP+3), SP

SP+4, Then skip unconditionally

Restores the contents of the data memory (stack) addressed by the stack pointer (SP) to the program counter

(PC) and increments the contents of the SP, then skips unconditionally.

RETI

Function: PC

10

to PC

8

(SP), PC

3

to PC

0

(SP+2),

PC

7

to PC

4

(SP+3), PSW

L

(SP+4), PSW

H

(SP+5), SP

SP+6

Restores the contents of the data memory (stack) addressed by the stack pointer (SP) to the program counter

(PC) and program status word (PSW), then increments the SP.

This instruction is used to return from an interrupt handling routine.

This manual is related to the following products: