<< Previous | Next >>

> LRET Long Return Rabbit 2000/3000/4000 Instruction

> Opcode | Instruction | Clocks | Operation
> ED 45 | LRET | 13 (2,2,1,2,2,2,2) | PClow = (SP) PChigh = (SP + 1) XPC = (SP + 2) SP = SP + 3

> Flags | ALTD | IOI/IOE
> S | Z | L/V | C | F | R | SP | S | D
> - | - | - | - |  |  |  |  |

> #### Description

> The `LRET` instruction is used to return from an `LCALL` operation. It transfers execution from a subroutine to the calling program by popping PC and the XPC from the stack.

> First, the low-order byte of PC is loaded with the data whose address is SP. Next, the high-order byte of PC is loaded with the data whose address is SP+1. Then, XPC is loaded with the data whose address is SP+2. Finally the value in SP is incremented by 3.

<< Previous | Next >>