A macro is a unit of specification of program generation through expansion. A macro consists of a name set of formal parameters and a body of code. A macro name is an abbreviation which stands for some related lines of code.

Macro is useful for the following purpose.

  • To simply and reduce the amour of repetitive coding.
  • To reduce errors caused by repetitive coding.
  • To make an assembly program more readable.

Macro Extension:-

The use of the macro name with a set of actual parameters is replaced by some code generated by program today.

A macro definition is enclosed between a macro header statement and a macro end statement. A macro definition is typically located at the start of a program.

A macro definition consist of:-

  • A macro prototype statement.
  • One or more model statement.
  • Microprocessor statement.


Micro call:-

A micro call is called by the macro name in the mnemonic field of an assemble statement. The macro call has the syntax.

<macro name>[<actual parameter spec>]

Where an actual parameter typically resembles an operand specification in on assembly language statement.


Macro Expansion:-

The use of a macro name with a set of actual parameters is replaced by some code generated from its body. This is called macro expansion.

There are two types of macro expansion.

  1. Lexical Expansion
  2. Semantic Expansion


1. Lexical Expansion:-

Lexical Expansion implies the replacement of a character string by another string during program generation lexical expansion is typically employed to replace accordance of formal parameters by corresponding actual parameters.

2. Semantic Expansion:-

Semantic expansion implies the generation of instruction tailored to the requirement of specific usage. For example generation of type and word operands. Semantic expansion is characterized by the fact that different uses of a macro can number, sequence and opcodes of instruction.


Nested Macro calls:-

A model statement in a macro may constitute a call on other macro such calls are known as nested micro calls. Calling macro is called outer macro and call macro is called the inner macro.

Expansion of nested macro calls. The last-in-first-out(LIFO) rule. Thus in a structure of nested macro call, Expansion of the latest macro call in the structured is completed first.


Nested macro:-

Definition:- A macro body may also contain further macro definition aren’t valid until the enclosing macro has been expanded that means, The inclosing macro must have been called before the nested macro can be called.

If you want to learn more on System Software the Follow given link.

System Software


Please enter your comment!
Please enter your name here