8051 subroutine control flow — does the statement 'LCALL READ' transfer execution to the line labelled READ? Judge whether LCALL followed by a label calls that subroutine and saves the return address.
-
ATrue
-
BFalse
-
COnly if READ is in external code memory
-
DOnly if EA = 1
-
EOnly if DPTR points to READ
Answer
Correct Answer: True
Explanation
Introduction / Context:Calls and returns form the basis of structured programs on the 8051. LCALL performs a long call to a 16-bit destination address, enabling subroutines anywhere in the 64 KB code space.
Given Data / Assumptions:
- Instruction under review: LCALL READ
- Assembler resolves READ to a 16-bit code address
- Standard 8051 stack behavior on calls/returns
Concept / Approach:LCALL pushes the return address (address of the next instruction) onto the stack and then loads the Program Counter with the target address of label READ. Execution continues at READ until a RET is encountered, which pops the saved return address and resumes the caller.
Step-by-Step Solution:
Assemble LCALL READ ⇒ target = addr(READ)Push PC_next on stack; SP increments accordinglyPC ← addr(READ); fetch next opcode from label READVerification / Alternative check:LCALL is location-independent regarding internal vs external code; the code fetch mechanism (internal/external) is governed by EA and address, not the instruction form.
Why Other Options Are Wrong:
- False: contradicts the semantics of LCALL.
- Dependence on external code memory or EA: LCALL works regardless; the memory system resolves the fetch.
- DPTR requirement: DPTR is unused for calls; it is for data addressing.
Common Pitfalls:
- Confusing LCALL (16-bit) with ACALL (11-bit within 2 KB page).
Final Answer:True