CHAPTER 9. INSTRUCTION SET

9.4.10 Subroutine Stack Control Instructions

CALLF !faddr

Function: (SP-1) PC7 to PC4 , (SP-2) PC3 to PC0 , (SP-3) 0, 0, 0, 0

(SP-4) 0, PC10 to PC8 , SP SP-4, PC A10 to A0 faddr = A10 to A0 : 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: PC10 to PC8 (SP), PC3 to PC0 (SP+2),

PC7 to PC4 (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: PC10 to PC8 (SP), PC3 to PC0 (SP+2)

PC7 to PC4 (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: PC10 to PC8 (SP), PC3 to PC0 (SP+2),

PC7 to PC4 (SP+3), PSWL (SP+4), PSWH (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.

172

Page 183
Image 183
NEC PD75402A, PD75P402 user manual Subroutine Stack Control Instructions, 172