A subroutine cannot always be used to replace a macro in an assembly language program.
View worked solution
Answer: 1
The given statement is True (represented by 1).
A subroutine cannot always be used to replace a macro in an assembly language program due to the following fundamental differences:
- Assembly-Time Directives: Macros are expanded during the assembly phase (pre-processing) and can contain assembler directives (such as
DB,DW,EQU, or storage reservation commands). These directives instruct the assembler on how to allocate memory or define constants. A subroutine, being a runtime entity consisting only of executable machine instructions, cannot perform these assembly-time operations. - Textual Parameter Substitution: Macros use literal textual substitution. This allows them to accept non-value parameters such as register names (e.g.,
AX,BX), condition codes, or instruction opcodes. Subroutines can only pass data values or memory addresses via registers or the stack at runtime. - Code Fragments and Control Flow: A macro can represent an incomplete fragment of code (for example, starting a loop or a conditional block without closing it inside the macro). A subroutine must be a complete, self-contained block of executable code with a well-defined entry point and a return instruction (e.g.,
RET).
Free practice · Your answers on this page are not saved.
