Practice over 1000+ GATE-level questions from this topic!
Designed to match the latest GATE pattern with topic-wise precision, difficulty tagging, and detailed solutions.
A portion of the main program to call a subroutine SUB in an 8085 environment is given below.
:
:
LXI D, DISP
LP. CALL SUB
:
:
It is desired that control be returned to LP + DISP + 3 when the RET instruction is executed in thee subroutine. The set of instructions that precede the RET instruction in the subroutine are




When CALL instruction is executed the address of LP is pushed to the top of stack and then the PC is fed with new address. To return the execution to LP + DISP + 3.
The address of LP must be extracted in HL register pair by means of POP instruction and then DISP is added to it by the use of DAD instruction so that HL = LP +DISP
Then HL register pair is incremented thrice to obtain HL = LP +DISP + 3
Then this is pushed back to the top of stack to be fed to Program Counter upon execution of RET instruction.