- 2069 Bhadra · 4+4 marks
Compare CALL/RET with PUSH/POP
Short answer
CALL/RET transfer control by pushing/popping the return address to/from the stack; PUSH/POP only save/restore register pair data. CALL is 3 bytes/18 T-states, RET 1 byte/10 T-states; PUSH and POP are 1 byte, 12 and 10 T-states.
Compare CALL and RET instructions with PUSH and POP instructions for 8085. Illustrate their usages with appropriate examples.
Both pairs use the stack (LIFO area in RAM pointed to by SP), but CALL/RET transfer program control and save/restore the return address, while PUSH/POP only save/restore data.
| Point | CALL / RET | PUSH / POP |
|---|---|---|
| Purpose | Go to a subroutine and come back | Save and restore register pair contents |
| Data stored | Return address (PC) | Contents of BC, DE, HL or PSW (A + flags) |
| Effect on PC | CALL loads PC with the subroutine address; RET loads PC from the stack | PC only advances normally |
| Instruction length | CALL 3 bytes, RET 1 byte | 1 byte each |
| T-states | CALL 18 (conditional 18/9), RET 10 | PUSH 12, POP 10 |
| SP change | CALL: SP-2, RET: SP+2 | PUSH: SP-2, POP: SP+2 |
| Who does the saving | Done automatically by CPU | Done by programmer explicitly |
| Pairing | Every CALL needs a RET | Every PUSH needs a matching POP in reverse order |
Illustration
Delay subroutine that must keep the caller's BC:
LXI SP,27FFH ; initialise stack
MVI B,05H
CALL DELAY ; return address (next instruction) -> stack
MOV A,B ; B is still 05H
HLT
DELAY: PUSH B ; save BC
LXI B,0FFFFH
LP: DCX B
MOV A,B
ORA C
JNZ LP
POP B ; restore BC
RET ; PC <- return address from stack
CALL DELAY: PC (address ofMOV A,B) is pushed, SP = 27FDH, PC = address of DELAY.PUSH B: B and C go to the stack, SP = 27FBH.POP B: B and C come back, SP = 27FDH.RET: return address popped to PC, SP = 27FFH, execution continues atMOV A,B.
Note the order: the last item pushed must be the first popped, otherwise RET gets a wrong address.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- PC and SP in CALL, RET, PUSH, POP · Microprocessor, chapter 2
- Classification of 8085 instructions · Microprocessor, chapter 2
- RST instructions in 8085 · Microprocessor, chapter 2
- Push and pop on stack as linked list · Data Structure and Algorithm, chapter 4
- IRQ, ISR, IVT, PUSH, POP, latency · Embedded System, chapter 5