Advanced Macro Facilities

Updated on 2019/03/21 07:22

Advanced Macro Facilities

.


Advanced macro facilities are aimed at supporting semantic expansion. These facilities can be grouped into :

a) Facilities for alteration of flow of control during expansion

b) Expansion Time Variables

c) Attributes of parameters.

d) Facilities for alteration of flow of control during expansion.

a) Facilities for alteration of flow of control during expansion

Expansion with statements AIF, AGO and ANOP.

A sequencing symbol (SS) has the syntax

            < ordinary String >

As SS is defined by putting it in the field ‘ LABEL’ of a statement in the macro body. This LABEL field will act as target address on which control is transferred for conditional as well as unconditional way. It never appear in the expanded form of a model statement.

Syntax of AIF :-          conditional jump

            AIF      ( < expression > ) < LABEL sequential symbol >

Where < expression > is formal parameters and their attributes like T, L,S ( Type , Length and size ). If expression is true, control is transferred to LABEL or sequential symbol

           Syntax of AGO                       Unconditional  jump

                        AGO < sequential symbol >

Without checking condition control is transferred to LABEL.

An ANOT statement is written as

            < Sequential symbol >                        ANOP.

Which will simply act as LABEL.

Example of altering flow of control during expansion :-

            MACRO                                

            EVAL & X, & Y                     

AIF ( & Y EQ & X ) AGAIN             

            AGO NEXT                           

AGAI N : ANOP                              

               MOVER AREG, BREG       

NEXT : ANOP                                              

            MEND           

  1.   AIF ( & Y EQ & X ) AGAIN   If  value of X = Y then it     will jump on label  again  i.e conditional jump.  
  2.   AGO NEXT     Unconditionally   it will go on NEXT
  3.   Every label is having first   statement as ANOP.

b) Expansion Time Variables :-

EV are used during expansion of macros A local EV is created for use inside a particular MACRO. A global EV exists across all macro calls. Syntax for local and global EV’s

            LCL     < EV    specification >

            GBL     < EV    specification >

Where < EV specification > has the syntax  & < EV Name >

Where < EV Name > is an ordinary string.

            Values of EV’s can be manipulated by SET statement . A SET statement is written as

            < EV Specification > SET  < SET – expression >

Here < EV specification > appears in the label field and SET in mnemonic field . A SET statement assigns the value of < SET- expression > to the < EV specification.

e.g.                  MACRO

                        CALC

                        LAL                 & A, & B

            & A     SET                  1

            & B      SET                  5

                        MEND

A call on macro CALC is expanded by creating two local EV A & B . The first SET statement assigns value ‘1’ to A and second SET statement assigns value ‘s’ to B.

c) Attributes of formal parameters:-

An attribute is written using the syntax

            < attribute name >’ < formal parameter > and represents information about the value of the formal parameter. These attributes are type, length and size have the names T, L and S

e.g                   MACRO

                        CALC & B

                        AIF ( L’ & A EQ 1 )    NEXT

            NEXT :            

                           MEND

Here expression control is transferred to NEXT only if Length of A. is equal to 1.

Tags:
Created by Vishal E on 2019/03/21 07:22
    
Happy WikiNoting!