A Macro instruction is the notational convenience for the programmer. For every occurrence of macro the whole macro body or macro block of statements gets expanded in the main source code. Thus Macro instructions makes writing code more convenient.
Silent features of Macro Processor:
- Macro represents a group of commonly used statements in the source programming language.
- Macro Processor replace each macro instruction with the corresponding group of source language statements. This is known as expansion of macros.
- Using Macro instructions programmer can leave the mechanical details to be handled by the macro processor.
- Macro Processor designs are not directly related to the computer architecture on which it runs.
- Macro Processor involves definition, invocation and expansion.
Macro Definition and Expansion:
Line Label Opcode Operand 5 COPY START 0 10 RDBUFF MACRO &INDEV, &BUFADR 15 . . 90 95 MEND
- Line 10:
RDBUFF (Read Buffer) in the Label part is the name of the Macro or definition of the Macro. &INDEV and &BUFADR are the parameters present in the Operand part. Each parameter begins with the character &.
- Line 15 – Line 90:
From Line 15 to Line 90 Macro Body is present. Macro directives are the statements that make up the body of the macro definition.
- Line 95:
MEND is the assembler directive that means the end of the macro definition.
Line Label Opcode Operand 180 FIRST STL RETADR 190 CLOOP RDBUFF F1, BUFFER 15 . . 255 END FIRST
RDBUFF is the Macro invocation or Macro Call that gives the name of the macro instruction being invoked and F1, BUFFER are the arguments to be used in expanding the macro. The statement that form the expansion of a macro are generated each time the macro is invoked.
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
- Difference between Normal Processor and AI Processor
- Difference between Macro and Procedure
- Introduction of Input-Output Processor
- Difference between RISC and CISC processor | Set 2
- Vector processor classification
- Operation of SIMD Array Processor
- Types of Array Processor
- Advantages and Disadvantages of ARM processor
- ARM processor and its Features
- Difference between Dual Core processors and Core 2 DUO processors
- Conditional Branch Instructions in AVR Microcontroller
- Logical Instructions in AVR Microcontroller
- Data Transfer instructions in AVR microcontroller
- Arithmetic instructions in AVR microcontroller