RET:
- This instruction transfers the program control from subroutine or subprogram to the main program.
- It pops the address of the instruction next to CALL instruction in the main program from the stack and loads program counter with this address.
- Then stack pointer is incremented by two.
- No flags are affected.
- It is a one byte instruction.
- Register indirect addressing mode is used because the return address is available in the memory location pointed by stack pointer.
Example:
If SP = 2000H
RET ; This instruction will load program counter with 3000H and will transfer program control to 3000H.
Rcond:
- When the condition is true, this instruction transfers the program control from subprogram or subroutine to the main program.
- It pops the address of the instruction next to CALL instruction from the stack and loads program counter with this address.
- Then stack pointer is incremented by two.
- When the condition is false, nothing happens.
- No flags are affected. They are only checked.
- It is a one byte instruction.
- Register indirect addressing mode is used because the return address is available in the memory location pointed by stack pointer.
Comments
Post a Comment