0% found this document useful (0 votes)
90 views

Macro Assignment

This document discusses macro processors and provides examples of macro definitions and calls. It covers topics like parameter passing, nested macros, recursive macros, and the data structures needed to implement a macro processor like the macro definition table, macro name table, and argument list array. Examples show macros with parameters, nested macro calls, and conditional macro processing.

Uploaded by

jagdish750
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
90 views

Macro Assignment

This document discusses macro processors and provides examples of macro definitions and calls. It covers topics like parameter passing, nested macros, recursive macros, and the data structures needed to implement a macro processor like the macro definition table, macro name table, and argument list array. Examples show macros with parameters, nested macro calls, and conditional macro processing.

Uploaded by

jagdish750
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Title: Macro Processor

Problem Statement:

Study assignment for macro processor. (consider all aspects of macro processor)

Objective:
To study basic functioning of Macro Processor.
To study working of nested macro.

Theory:
What is Macro Processor :
Minimum 5 Lines. (structure of macro definition , call with example)

Parameter passing methods in Macro processor

what is pass structure of Macro Processor


Minimum 5 Lines.

Data structure needed for Macro Processor:


(in detail with description)

ADVANCED MACRO FACILITIES

What is nested Macro Call


Definition within Definition
Calll within definition with example
Recursive Macrol
Need of stack frame

Show the contents of various MACRO definition table and Macro Name table
and Argument list array , stack frame wherever needed, Expanded Source file.

Example 1
1. READ A
2. READ B
3. MACRO
4. ADD2 X,Y,Z
5. LOAD X
6. ADD Y
7. STORE Z
8. MEND
9. MACRO
10. MULT L,X,Y,Z
11. LOAD @0
12. STORE Z
13. L ADD2 X,Z,Z
14. LOAD Y
15. SUB @1
16. STORE Y
17. JPOSE L
18. MEND
19. MULT L1,A,B,C
20. ENDP
21. A DEFW
22. B DEFW
23. C DEFW
24. END

Example 2
START
SR 2,2
L 1,DATA1
MACRO
ADD_M &ARG1
L 1, &ARG1
A 1, =F’10’
SR 3,3
ST 1, &ARG1
MEND
AR 2,2
MACRO
ADD_S &A1, &A2,&A3
ADD_M &A1
ADD_M &A2
ADD_M &A3
MEND

ADD_M DATA1
ADD_S X1, X2, X3
ADD_S X2, X1, X3
DATA1 DC F’20’
X1 DC F’25’
X2 DC F’30’
X3 DC F’35’
END
Example 3
MACRO
MAC1
MOVER AREG, M
ADD BREG, M
MOVEM CREG, M
MEND
MACRO
EVAL &X,&Y,&Z
MOVER AREG, &X
SUB AREG, &Y
ADD AREG, &Z
MOVER AREG, &Z
MEND
MACRO
CALC &X,&Y,&OP=MULT,&LAB=
&LAB MOVER AREG, &X
&OP AREG, &Y
MOVEM AREG, &X
MEND
START
MOVEM AREG, B
EVAL A, B, C
ADD AREG, N
MOVEM AREG, N
CALC P, Q, LAB=LOOP:
MOVEM AREG, N
MAC1
CALC P,Q,OP=DIV, LAB=NEXT
M DS 1
A DS 5
B DS 1 C DS 1 N DS 1
P DS 1 Q DS 1
END

You might also like