Macro Definition and call, Nested Macro Calls,

Video Tutorial


MACRO PROCESSOR

Q.        Explain the terms : MACRO DEFINITION, MACRO CALL. NESTED macro call,  (6 m)

MACRO Definition :- Macro is a unit of specification of program generation through expansion. It is single line abbreviation for group of instructions Typically MACRO is defined at start of program or at end of program.

Macro Definition Syntax :-

1) Macro header :- It contains keyword ‘MACRO’.

2) Macro prototype statement syntax :-

< Macro Name > [ & < Formal Parameters > ]

3) Model Statements :- It contains 1 or more simple assembly statements, which will replace MACRO CALL while macro expansion.

4) MACRO END MARKER :- It contains keyword ‘MEND’.

MACRO CALL :-

            < MACRO NAME > [<ACTUAL Parameters > ]

If we are passing actual parameters, the formal parameters are replaced by actual parameters. In macro expansion we only have actual parameters

Example of MACRO :-

            Start of definition  - MACRO

Macro name   ( Prototype ) – My MACRO

Macro body    (Model Statements ) – ADD AREG, X

                                                            ADD BREG, X

End of Macro Definition        -           MEND.

Source program

Another example of MACRO :

e.g Following macro will perform memory increment operation i.e will take contents from memory perform increment operation and will store contents again into memory location.

MACRO Definition                                        Statement Type

MACRO                                                         Macro Header

INCR & MEM, & VAL, & R                          Macro prototype

MOVER & R, & MEM                                  Model statements or

ADD & R, & VAL                                          macro body

MOVEM & R, & MEM

MEND                                                         Macro End.

START  300

           INCR A, B, BREAG                           Macro call.

STOP

A         DS       1

B          DS       1

            END

NESTED MACRO CALLS :-

NESTED MACRO CALLS

References

1.Prof Dipak Pawar, Team WikiNote, Pune


Last modified: Friday, 20 September 2019, 12:15 AM