SlideShare uma empresa Scribd logo
1 de 35
MACROS
11/15/2016jaya
1
MACRO
 Macro instructions are single-line abbreviations for group of
instructions.
 Macro is an abbreviation for a sequence of operations .
 Syntax/structure
start of definition MACRO
macro name {
Sequence to be abbreviated }
End of definition MEND
11/15/2016jaya
2
MACRO
 Example
:
:
A 1, DATA
A 2, DATA
:
A 1, DATA
A 2, DATA
:
DATA DC F’5’ 11/15/2016jaya
3
MACRO
 Example(Macro definition)
Syntax example
MACRO MACRO
MACRO NAME INCR
INSTRUCTION 1 A 1, DATA
INSTRUCTION 2 A 2, DATA
.
.
.
MEND MEND
11/15/2016jaya
4
MACRO Example(Macro call)
Macro call(SYNTAX) macro call(example)
MACRO MACRO
MACRO NAME INCR
INSTRUCTION 1 A 1, DATA
INSTRUCTION 2 A 2, DATA
:
:
MEND MEND
:
INSTRUCTION A 3, DATA
:
MACRO NAME INCR
: DATA DC F’5
11/15/2016jaya
5
MACRO
 Example(Macro definition)
Syntax example
MACRO MACRO
MACRO NAME INCR
INSTRUCTION 1 A 1, DATA
INSTRUCTION 2 A 2, DATA
.
.
.
11/15/2016jaya
6
CONDITIONAL MACRO EXPANSION
 Two pseudo-ops are used
 AIF:- It is conditional branch pseudo-op that performs an
arithmetic test and branches to specified macro-label only if test is
true.
 AGO:- It is unconditional branch pseudo-op. It is equivalent to go-
to statement.
 .FINI:- Labels starting with a period(.), such as .FINI, are macro
label do not appear in the output of the macro processor.
11/15/2016jaya
7
MACRO
: macro definition :
LOOP1 A 1,DATA1 MACRO
A 2,DATA2 ARG0 VARY &COUNT,&ARG1,&ARG2,&ARG3
A 3,DATA3 &ARG0 A 1,&ARG1
: AIF (&COUNT EQ 1).FINI
LOOP2 A 1,DATA3 A 2,&ARG2
A 2,DATA2 AIF (&COUNT EQ 2).FINI
: A 3,&ARG3
LOOP3 A 1,DATA1 .FINI MEND
: macro call :
DATA1 DC F’5’ LOOP1 VARY 3,DATA1,DATA2,DATA3
DATA2 DC F’10’ :
DATA3 DC F’15’ LOOP2 VARY 2,DATA3,DATA2
: :
LOOP3 VARY 1,DATA1
:
DATA1 DC F’5’
DATA2 DC F’10’
DATA3 DC F’15’
Pgm with macro definition
(macro call)
example
11/15/2016jaya
8
MACRO
: :
MACRO MACRO
&ARG0 VARY &COUNT,&ARG1,&ARG2,&ARG3 &ARGO VARY &COUNT,&ARG1,&ARG2,&ARG3
&ARG0 A 1,&ARG1 &ARG0 A 1,&ARG1
AIF (&COUNT EQ 1).FINI AIF (&COUNT EQ 1).FINI
A 2,&ARG2 A 2,&ARG2
AIF (&COUNT EQ 2).FINI AIF (&COUNT EQ 2).FINI
A 3,&ARG3 A 3.&ARG3
.FINI MEND .FINI MEND 3,&ARG3
: :
LOOP1 VARY 3,DATA1,DATA2,DATA3 LOOP1 A 1,DATA1
: A 2,DATA2
LOOP2 VARY 2,DATA3,DATA2 A 3,DATA3
: :
LOOP3 VARY 1,DATA1 LOOP2 A 1,DATA3
: A 2,DATA2
DATA1DC F’5’ :
DATA2DC F’10’ LOOP3 A 1,DATA1
DATA3DC F’15’ :
Macro call
Macro expansion
11/15/2016jaya
9
MACRO CALLS WITHIN MACROS
:
L 1,DATA1
A 1,=F’1’
ST 1,DATA1
L 1,DATA2
A 1,=F’1’
ST 1,DATA2
L 1,DATA3
A 1,=F’1’
ST 1,DATA3
:
:
DATA1 DC F’5’
DATA2 DC F’10’
DATA3 DC F’15’
:
11/15/2016jaya
10
MACRO CALLS WITHIN MACROS
MACRO
ADD1 &ARG
L 1,&ARG
A 1,=F’1’
ST 1,&ARG
MEND
MACRO
ADDS &ARG1,&ARG2,&ARG3
ADD1 &ARG1
ADD1 &ARG2
ADD1 &ARG3
MEND
Macro call
11/15/2016jaya
11
MACRO EXPANSION
SOURCE
:
MACRO
ADD1 &ARG
L 1,&ARG
A 1,=F’1’
ST 1,&ARG
MEND
MACRO
ADDS &ARG1,&ARG2,
&ARG3
ADD1 &ARG1 : :
ADD1 &ARG2
ADD1 &ARG3 L 1,DATA1
: ADD1 DATA1 A 1,=F’1’
: ST 1,DATA1
: L 1,DATA2
: ADD1 DATA2 A 1,=F’1’
ADDS DATA1,DATA2, ST 1,DATA2
DATA3 ADD1 DATA3 L 1,DATA3
A 1,=F’1’
: ST 1,DATA3
:
:
: :
: :
DATA1 DC F’5’ DATA1 DC F’5’
DATA2 DC F’10’ DATA2 DC F’10’
DATA3 DC F’15’ DATA3 DC F’15’
Expanded
source of
ADDS
Expanded
source of
ADD1
11/15/2016jaya
12
MACRO DEFINITION WITHIN MACRO DEFINITION
MACRO
DEFINE &SUB
MACRO
&SUB &Y
CNOP 0,4
BAL 1,*+8
DC A(&Y)
L 15,=V(&SUB)
BALR 14,15
MEND
MEND
D
e
f
i
n
i
t
i
o
n
o
f
m
a
c
r
o
&
s
u
b
D
E
F
I
N
I
T
I
O
N
O
F
Ma
C
R
O
d
E
F
I
N
e
11/15/2016jaya
13
MACRO DEFINITION WITHIN MACRO
DEFINITION
 Inner macro will not be defined until outer macro is called.
 Macro call sequence
 DEFINE COS
 The statement expands into a new macro definition
 COS AR
 The macro processor will generate the calling sequence:
BAL 1,*+8
DC A(AR)
L 15,=V(COS)
BALR 14,15
11/15/2016jaya
14
IMPLEMENTATION
STATEMENT OF PROBLEM
SPECIFICATION OF DATA BASES
SPECIFICATION OF DATA BASE FORMAT
ALGORITHM
11/15/2016jaya
15
STATEMENT OF PROBLEM
 Macro processor is a system program which accepts an assembly
language program with macro definition and macro calls and produce
an equivalent assembly language program in which all macro calls are
expanded.
 Four basic tasks of macro instruction processor
 Recognize macro definitions
 Save the definition
 Recognize calls
 Expand calls and substitute arguments
11/15/2016jaya
16
STATEMENT OF PROBLEM
 Macro processor performs expansion using 2 passes
 Pass I
 It examines every operation code
 Save all macro definitions in a macro definition table
and macro name table
 Save a copy of the input text , minus macro definition
 Pass II
 Identify macro calls
 Replace each macro name with the appropriate text
from macro definition(expand macro call)
11/15/2016jaya
17
SPECIFICATION OF DATA BASE
 PASS I
 The input macro source deck
 Output macro source deck copy for use by pass2
 Macro Definition Table(MDT)
 Macro Name Table(MNT)
 Macro Definition Table Counter(MDNTC)
 Macro Name Table Counter(MNTC)
 Argument List Array(ALA)
11/15/2016jaya
18
SPECIFICATION OF DATA BASE
 PASS II
 The copy input macro source deck
 Output expanded source deck copy for use by
assembler
 Macro Definition Table(MDT) created by pass1
 Macro Name Table(MNT) created by pass1
 Macro Definition Table Pointer(MDNTP)
 Argument List Array(ALA)
11/15/2016jaya
19
PASS 1- PROCESSING MACRO
DEFINITIONS
11/15/2016jaya
20
EXAMPLE
MACRO
&LAB INCR &ARG1,&ARG2,&ARG3
&LAB A 1,&ARG1
A 2,&ARG2
A 3,&ARG3
MEND
|
|
INCR
Index Contents(80 bytes per entry)
5 &LAB INCR &ARG1,&ARG2,&ARG3
6 #0 A 2,#1
7 A 3,#2
8 A 2,#3
9 MEND
10
INDEX NAME(8
bytes)
0 #0(&LAB)
1 #1(&ARG1)
2 #2(&ARG2)
3 #3(&ARG3)
INDEX NAME( 8
bytes
MDT
POSITION(
4 bytes)
1 INCR 5
2
3
Macro Definition Table
Argument List Array
Macro Name Table
11/15/2016jaya
21
PASS 2 – PROCESSING MACRO CALLS AND EXPANSION
11/15/2016jaya
22
EXAMPLE
MACRO
&LAB INCR &ARG1,&ARG2,&ARG3
&LAB A 1,&ARG1
A 2,&ARG2
A 3,&ARG3
MEND
|
|
LOOP1 INCR DATA1,DATA2,DATA3
Index Contents ( 80 bytes per entry)
5 &LAB INCR &ARG1,&ARG2,&ARG3
6 #0 A 2,#1
7 A 3,#2
8 A 2,#3
9 MEND
10
INDEX NAME (
8 bytes)
0 “LOOP1bbb”
1 “DATA1bbb”
2 “DATA2bbb”
3 “DATA3bbb”
INDEX NAME ( 8 bytes) MDT
POSITION
( 4 byte)
1 “INCRbbb” 5
2
3
Macro Definition Table
Argument List Array
Macro Name Table
11/15/2016jaya
23
MACRO
&LAB INCR &ARG1,&ARG2,&ARG3
&LAB A 1,&ARG1
A 2,&ARG2
A 3,&ARG3
MEND
|
|
LOOP1 INCR DATA1,DATA2,DATA3
LOOP1 A 1,DATA1
A 2, DATA2
A 3,DATA3
11/15/2016jaya
24
IMPLEMENTATION OF MACRO
CALL WITHIN MACRO
 Basic problem in implementing macro calls within
macros is “recursion”
 Need to expand both macro
 Each call might be expanded by another macro
 More macros vs single macro
11/15/2016jaya
25
 Example with 2 macros ADDS and ADD1
MACRO
ADD1 &ARG
L 1,&ARG
A 1,=F’1’
ST 1,&ARG
MEND
MACRO
ADDS &ARG1,&ARG2,&ARG3
ADD1 &ARG1
ADD2 &ARG2
ADD3 &ARG3
MEND
11/15/2016jaya
26
 MDT(Macro Definition Table)
Index Contents
1 ADD1 &ARG
2 L 1,#1
3 A 1,=F’1’
4 ST 1,#1
5 MEND
6 ADDS &ARG1,&ARG2,&ARG3
7 ADD1 #1
8 ADD2 #2
9 ADD3 #3
10 MEND
11/15/2016jaya
27
IMPLEMENTATION WITHIN AN
ASSEMBLER
 Macro processor can be added as a pre-processor to
an assembler
 Combining similar functions
 Ex- MNT+MOT/POT
11/15/2016jaya
28
MACRO PROCESSOR COMBINED WITH
ASSEMBLER PASS 1
PASS 1!
Search Pseudo-Op Table
(POT)!
Search Macro Name Table
(MNT)!!
GO TO PASS2!
Search Machine -Op Table
(MOT)!
Process machine instruction
Type?
Process macro definition
Set up macro stack frame ,
etc.
Process pseudo-ops
READ *R
R
R
R R
END pseudo-op
Found
others
Not macro call
Not pseudo op
Found macro call
Macro pseudo op
11/15/2016jaya
29
ADVANTAGES & DISADVANTAGES
OF INCORPORATING MACRO INTO
PASS1
 Advantages
 functions do not have to implemented twice
 Less overhead during processing
 More flexible for programmer
 Disadvantages
 Large program
 More complex
11/15/2016jaya
30
SINGLE PASS ALGORITHM
 Problem of macro definition with macros
 Combine pass1 and pass2
 Two additional variables
 MDI(Macro Definition Input) indicator
 MDLC(Macro Definition Level Counter)
11/15/2016jaya
31
One-pass macro processor
MDTC  1
MNTC  1
MDI  “OFF”
MDLC  0
Search MNT for match with
operation code
MDTP  MDT index from MNT
entry
READ
Macr
o
name
found
MDI  “ON”
Set up macro call argument list array
Macr
o
pseu
do-op
?
READ*
Enter macro name & current value of
MDTC in MNT entry number MNTC
MNTC  MNTC+1
Prepare macro definition argument list
array
Enter macro name card into MDT
MDTC MDTC+1
MDLC MDLC+1
READ*
MDTC MDTC+1
Substitute index notation for argument
in definition
Enter line into MDT
Macro
pseudo
-op ?
MEN
D
pseud
o-op ?
MDLC MDLC+1
MDLC MDLC-1
MDLC
 0 ?
MNTC  MNTC+1
END
Pseudo
-op?
Supply expanded source file to
processing
a
a
a
no
Yes macro call
no
no
yes
yes
no
yes
no
yes
no
Yes macro definition
READ *
subroutine
MDI =
“OFF”
?
Read next source card from
input file
Return to main processing
Increment MDT pointer to
next entry MDTP 
MDTP + 1
MDI  “OFF”
Get next card from MDT
Substitute arguments from
macro call
Process AIF or AGO set new value
to MDTP
MDLC
= 0 ?
MEND
pseudo-
op ?
AIF
or
AGO
?
yes
yes
yes
yes
No within
macro call
no
no
no
Detail of read function used
for macro expansion
11/15/2016jaya
33
One-pass macro processor
MDTC  1
MNTC  1
MDI  “OFF”
MDLC  0
Search MNT for match with
operation code
SP  SP+N+2
READ
Macr
o
name
found
S(SP+N+2) SP
Set up macro call argument list
array in S(SP+2)---- S(SP+N+1)
where N = total number of
arguments
Macr
o
pseu
do-
op ?
READ*
Enter macro name & current value of
MDTC in MNT entry number MNTC
Prepare macro definition argument list
array
Enter macro name card into MDT
MDLC MDLC+1
READ*
Substitute index notation for
argument in definition
Enter line into MDT
Macro
pseudo
-op ?
MEN
D
pseud
o-op ?
MDLC MDLC+1
MDLC MDLC-1
MDLC
 0 ?
MNTC  MNTC+1
END
Pseudo
-op?
Supply expanded source file to
processing
a
a
a
no
Yes macro call
no
no
yes
yes
no
yes
no
yes
no
Yes macro definition
S(SP+1) MDT index from MNT
entry
b
b
b
One pass macro processor capable
of handling macro calls within macro
definitions
11/15/2016jaya
34
READ *
subroutine
SP = -
1
Read next source card from
input file
Return to main processing
Increment MDT pointer to
next entry S(SP+1)+1
Get next card from MDT ;
pointer is S(SP+1)
Substitute arguments from macro
call S(SP+2)…S(SP+N+1)
N  SP – S(SP)-2
AIF or
AGO ? MEND
pseudo-
op ?
MDL
C = 0
?
yes
yes
yes
No within
macro call
no
no
yes
Process AIF or AGO set new value
to MDTP
SP  S(SP)
yes
no
b
b
Detail of read
function for
recursive
macro
expansion
11/15/2016jaya
35

Mais conteúdo relacionado

Mais procurados

32 dynamic linking nd overlays
32 dynamic linking nd overlays32 dynamic linking nd overlays
32 dynamic linking nd overlays
myrajendra
 
Direct linking loader
Direct linking loaderDirect linking loader
Direct linking loader
babyparul
 
Types of Addressing modes- COA
Types of Addressing modes- COATypes of Addressing modes- COA
Types of Addressing modes- COA
Ruchi Maurya
 
Control Units : Microprogrammed and Hardwired:control unit
Control Units : Microprogrammed and Hardwired:control unitControl Units : Microprogrammed and Hardwired:control unit
Control Units : Microprogrammed and Hardwired:control unit
abdosaidgkv
 

Mais procurados (20)

Linker and Loader
Linker and Loader Linker and Loader
Linker and Loader
 
32 dynamic linking nd overlays
32 dynamic linking nd overlays32 dynamic linking nd overlays
32 dynamic linking nd overlays
 
Assemblers
AssemblersAssemblers
Assemblers
 
Linking in MS-Dos System
Linking in MS-Dos SystemLinking in MS-Dos System
Linking in MS-Dos System
 
Unit 3 sp assembler
Unit 3 sp assemblerUnit 3 sp assembler
Unit 3 sp assembler
 
Macro-processor
Macro-processorMacro-processor
Macro-processor
 
Direct linking loader
Direct linking loaderDirect linking loader
Direct linking loader
 
Macros...presentation
Macros...presentationMacros...presentation
Macros...presentation
 
Data Structure and Algorithms
Data Structure and AlgorithmsData Structure and Algorithms
Data Structure and Algorithms
 
loaders and linkers
 loaders and linkers loaders and linkers
loaders and linkers
 
Pass 1 flowchart
Pass 1 flowchartPass 1 flowchart
Pass 1 flowchart
 
Assemblers: Ch03
Assemblers: Ch03Assemblers: Ch03
Assemblers: Ch03
 
Assembler
AssemblerAssembler
Assembler
 
Types of Addressing modes- COA
Types of Addressing modes- COATypes of Addressing modes- COA
Types of Addressing modes- COA
 
Single Pass Assembler
Single Pass AssemblerSingle Pass Assembler
Single Pass Assembler
 
The role of the parser and Error recovery strategies ppt in compiler design
The role of the parser and Error recovery strategies ppt in compiler designThe role of the parser and Error recovery strategies ppt in compiler design
The role of the parser and Error recovery strategies ppt in compiler design
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
 
Direct linking loaders
Direct linking loadersDirect linking loaders
Direct linking loaders
 
Control Units : Microprogrammed and Hardwired:control unit
Control Units : Microprogrammed and Hardwired:control unitControl Units : Microprogrammed and Hardwired:control unit
Control Units : Microprogrammed and Hardwired:control unit
 
Array in c++
Array in c++Array in c++
Array in c++
 

Destaque

Cp0675 03 may-2012-rm04
Cp0675 03 may-2012-rm04Cp0675 03 may-2012-rm04
Cp0675 03 may-2012-rm04
Parth Mudgal
 
Lecture 4 assembly language
Lecture 4   assembly languageLecture 4   assembly language
Lecture 4 assembly language
Pradeep Kumar TS
 
System Programing Unit 1
System Programing Unit 1System Programing Unit 1
System Programing Unit 1
Manoj Patil
 

Destaque (19)

System programming
System programmingSystem programming
System programming
 
Compilers
CompilersCompilers
Compilers
 
Pre processor directives in c
Pre processor directives in cPre processor directives in c
Pre processor directives in c
 
Assembler1
Assembler1Assembler1
Assembler1
 
Cp0675 03 may-2012-rm04
Cp0675 03 may-2012-rm04Cp0675 03 may-2012-rm04
Cp0675 03 may-2012-rm04
 
Loader
LoaderLoader
Loader
 
Lecture 4 assembly language
Lecture 4   assembly languageLecture 4   assembly language
Lecture 4 assembly language
 
OMD chapter 2 Class modelling
 OMD  chapter 2 Class modelling OMD  chapter 2 Class modelling
OMD chapter 2 Class modelling
 
Parsing
ParsingParsing
Parsing
 
SAS Macros
SAS MacrosSAS Macros
SAS Macros
 
Ss4
Ss4Ss4
Ss4
 
Assembly Language Lecture 2
Assembly Language Lecture 2Assembly Language Lecture 2
Assembly Language Lecture 2
 
Introduction to systems programming
Introduction to systems programmingIntroduction to systems programming
Introduction to systems programming
 
System Programing Unit 1
System Programing Unit 1System Programing Unit 1
System Programing Unit 1
 
Assembly language programming_fundamentals 8086
Assembly language programming_fundamentals 8086Assembly language programming_fundamentals 8086
Assembly language programming_fundamentals 8086
 
Advanced behavioral modeling chapter 4 of omd
Advanced behavioral modeling chapter 4 of omdAdvanced behavioral modeling chapter 4 of omd
Advanced behavioral modeling chapter 4 of omd
 
Architectural modeling chapter 5 of omd
Architectural modeling chapter 5 of omdArchitectural modeling chapter 5 of omd
Architectural modeling chapter 5 of omd
 
Assembly Language Lecture 3
Assembly Language Lecture 3Assembly Language Lecture 3
Assembly Language Lecture 3
 
Two pass Assembler
Two pass AssemblerTwo pass Assembler
Two pass Assembler
 

Semelhante a Macro

Unit ii-111206004636-phpapp01
Unit ii-111206004636-phpapp01Unit ii-111206004636-phpapp01
Unit ii-111206004636-phpapp01
riddhi viradiya
 
Sas macros part 4.1
Sas macros part 4.1Sas macros part 4.1
Sas macros part 4.1
venkatam
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early results
ESUG
 
33443223 system-software-unit-iv
33443223 system-software-unit-iv33443223 system-software-unit-iv
33443223 system-software-unit-iv
Shaniya Fathimuthu
 
Emergency Service Provide by Mobile
Emergency Service Provide by MobileEmergency Service Provide by Mobile
Emergency Service Provide by Mobile
Samiul Hoque
 
Report for lab 8
Report for lab 8Report for lab 8
Report for lab 8
trayyoo
 
Report for lab 8(1)
Report for lab 8(1)Report for lab 8(1)
Report for lab 8(1)
trayyoo
 
Power of call symput data
Power of call symput dataPower of call symput data
Power of call symput data
Yash Sharma
 
Unit-2-Stack_basic_Input_Output-4-12-2022-8am.ppt
Unit-2-Stack_basic_Input_Output-4-12-2022-8am.pptUnit-2-Stack_basic_Input_Output-4-12-2022-8am.ppt
Unit-2-Stack_basic_Input_Output-4-12-2022-8am.ppt
IronMan665214
 

Semelhante a Macro (20)

Unit ii-111206004636-phpapp01
Unit ii-111206004636-phpapp01Unit ii-111206004636-phpapp01
Unit ii-111206004636-phpapp01
 
Presentation on macros and macro processor
Presentation on macros and macro processorPresentation on macros and macro processor
Presentation on macros and macro processor
 
handout6.pdf
handout6.pdfhandout6.pdf
handout6.pdf
 
Module 5.pdf
Module 5.pdfModule 5.pdf
Module 5.pdf
 
MLflow with R
MLflow with RMLflow with R
MLflow with R
 
Sas macros part 4.1
Sas macros part 4.1Sas macros part 4.1
Sas macros part 4.1
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early results
 
Mdb dn 2016_09_34_features
Mdb dn 2016_09_34_featuresMdb dn 2016_09_34_features
Mdb dn 2016_09_34_features
 
33443223 system-software-unit-iv
33443223 system-software-unit-iv33443223 system-software-unit-iv
33443223 system-software-unit-iv
 
NoSQL Containers get Rich
NoSQL Containers get RichNoSQL Containers get Rich
NoSQL Containers get Rich
 
Fast and Reliable Apache Spark SQL Engine
Fast and Reliable Apache Spark SQL EngineFast and Reliable Apache Spark SQL Engine
Fast and Reliable Apache Spark SQL Engine
 
Emergency Service Provide by Mobile
Emergency Service Provide by MobileEmergency Service Provide by Mobile
Emergency Service Provide by Mobile
 
Distributed Computing for Everyone
Distributed Computing for EveryoneDistributed Computing for Everyone
Distributed Computing for Everyone
 
Report for lab 8
Report for lab 8Report for lab 8
Report for lab 8
 
Report for lab 8(1)
Report for lab 8(1)Report for lab 8(1)
Report for lab 8(1)
 
Power of call symput data
Power of call symput dataPower of call symput data
Power of call symput data
 
Pragmatic Optimization in Modern Programming - Demystifying the Compiler
Pragmatic Optimization in Modern Programming - Demystifying the CompilerPragmatic Optimization in Modern Programming - Demystifying the Compiler
Pragmatic Optimization in Modern Programming - Demystifying the Compiler
 
Unit 2
Unit 2Unit 2
Unit 2
 
Big Data Day LA 2016/ Hadoop/ Spark/ Kafka track - Data Provenance Support in...
Big Data Day LA 2016/ Hadoop/ Spark/ Kafka track - Data Provenance Support in...Big Data Day LA 2016/ Hadoop/ Spark/ Kafka track - Data Provenance Support in...
Big Data Day LA 2016/ Hadoop/ Spark/ Kafka track - Data Provenance Support in...
 
Unit-2-Stack_basic_Input_Output-4-12-2022-8am.ppt
Unit-2-Stack_basic_Input_Output-4-12-2022-8am.pptUnit-2-Stack_basic_Input_Output-4-12-2022-8am.ppt
Unit-2-Stack_basic_Input_Output-4-12-2022-8am.ppt
 

Último

AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
ankushspencer015
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
MsecMca
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Último (20)

Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdf
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 

Macro

  • 2. MACRO  Macro instructions are single-line abbreviations for group of instructions.  Macro is an abbreviation for a sequence of operations .  Syntax/structure start of definition MACRO macro name { Sequence to be abbreviated } End of definition MEND 11/15/2016jaya 2
  • 3. MACRO  Example : : A 1, DATA A 2, DATA : A 1, DATA A 2, DATA : DATA DC F’5’ 11/15/2016jaya 3
  • 4. MACRO  Example(Macro definition) Syntax example MACRO MACRO MACRO NAME INCR INSTRUCTION 1 A 1, DATA INSTRUCTION 2 A 2, DATA . . . MEND MEND 11/15/2016jaya 4
  • 5. MACRO Example(Macro call) Macro call(SYNTAX) macro call(example) MACRO MACRO MACRO NAME INCR INSTRUCTION 1 A 1, DATA INSTRUCTION 2 A 2, DATA : : MEND MEND : INSTRUCTION A 3, DATA : MACRO NAME INCR : DATA DC F’5 11/15/2016jaya 5
  • 6. MACRO  Example(Macro definition) Syntax example MACRO MACRO MACRO NAME INCR INSTRUCTION 1 A 1, DATA INSTRUCTION 2 A 2, DATA . . . 11/15/2016jaya 6
  • 7. CONDITIONAL MACRO EXPANSION  Two pseudo-ops are used  AIF:- It is conditional branch pseudo-op that performs an arithmetic test and branches to specified macro-label only if test is true.  AGO:- It is unconditional branch pseudo-op. It is equivalent to go- to statement.  .FINI:- Labels starting with a period(.), such as .FINI, are macro label do not appear in the output of the macro processor. 11/15/2016jaya 7
  • 8. MACRO : macro definition : LOOP1 A 1,DATA1 MACRO A 2,DATA2 ARG0 VARY &COUNT,&ARG1,&ARG2,&ARG3 A 3,DATA3 &ARG0 A 1,&ARG1 : AIF (&COUNT EQ 1).FINI LOOP2 A 1,DATA3 A 2,&ARG2 A 2,DATA2 AIF (&COUNT EQ 2).FINI : A 3,&ARG3 LOOP3 A 1,DATA1 .FINI MEND : macro call : DATA1 DC F’5’ LOOP1 VARY 3,DATA1,DATA2,DATA3 DATA2 DC F’10’ : DATA3 DC F’15’ LOOP2 VARY 2,DATA3,DATA2 : : LOOP3 VARY 1,DATA1 : DATA1 DC F’5’ DATA2 DC F’10’ DATA3 DC F’15’ Pgm with macro definition (macro call) example 11/15/2016jaya 8
  • 9. MACRO : : MACRO MACRO &ARG0 VARY &COUNT,&ARG1,&ARG2,&ARG3 &ARGO VARY &COUNT,&ARG1,&ARG2,&ARG3 &ARG0 A 1,&ARG1 &ARG0 A 1,&ARG1 AIF (&COUNT EQ 1).FINI AIF (&COUNT EQ 1).FINI A 2,&ARG2 A 2,&ARG2 AIF (&COUNT EQ 2).FINI AIF (&COUNT EQ 2).FINI A 3,&ARG3 A 3.&ARG3 .FINI MEND .FINI MEND 3,&ARG3 : : LOOP1 VARY 3,DATA1,DATA2,DATA3 LOOP1 A 1,DATA1 : A 2,DATA2 LOOP2 VARY 2,DATA3,DATA2 A 3,DATA3 : : LOOP3 VARY 1,DATA1 LOOP2 A 1,DATA3 : A 2,DATA2 DATA1DC F’5’ : DATA2DC F’10’ LOOP3 A 1,DATA1 DATA3DC F’15’ : Macro call Macro expansion 11/15/2016jaya 9
  • 10. MACRO CALLS WITHIN MACROS : L 1,DATA1 A 1,=F’1’ ST 1,DATA1 L 1,DATA2 A 1,=F’1’ ST 1,DATA2 L 1,DATA3 A 1,=F’1’ ST 1,DATA3 : : DATA1 DC F’5’ DATA2 DC F’10’ DATA3 DC F’15’ : 11/15/2016jaya 10
  • 11. MACRO CALLS WITHIN MACROS MACRO ADD1 &ARG L 1,&ARG A 1,=F’1’ ST 1,&ARG MEND MACRO ADDS &ARG1,&ARG2,&ARG3 ADD1 &ARG1 ADD1 &ARG2 ADD1 &ARG3 MEND Macro call 11/15/2016jaya 11
  • 12. MACRO EXPANSION SOURCE : MACRO ADD1 &ARG L 1,&ARG A 1,=F’1’ ST 1,&ARG MEND MACRO ADDS &ARG1,&ARG2, &ARG3 ADD1 &ARG1 : : ADD1 &ARG2 ADD1 &ARG3 L 1,DATA1 : ADD1 DATA1 A 1,=F’1’ : ST 1,DATA1 : L 1,DATA2 : ADD1 DATA2 A 1,=F’1’ ADDS DATA1,DATA2, ST 1,DATA2 DATA3 ADD1 DATA3 L 1,DATA3 A 1,=F’1’ : ST 1,DATA3 : : : : : : DATA1 DC F’5’ DATA1 DC F’5’ DATA2 DC F’10’ DATA2 DC F’10’ DATA3 DC F’15’ DATA3 DC F’15’ Expanded source of ADDS Expanded source of ADD1 11/15/2016jaya 12
  • 13. MACRO DEFINITION WITHIN MACRO DEFINITION MACRO DEFINE &SUB MACRO &SUB &Y CNOP 0,4 BAL 1,*+8 DC A(&Y) L 15,=V(&SUB) BALR 14,15 MEND MEND D e f i n i t i o n o f m a c r o & s u b D E F I N I T I O N O F Ma C R O d E F I N e 11/15/2016jaya 13
  • 14. MACRO DEFINITION WITHIN MACRO DEFINITION  Inner macro will not be defined until outer macro is called.  Macro call sequence  DEFINE COS  The statement expands into a new macro definition  COS AR  The macro processor will generate the calling sequence: BAL 1,*+8 DC A(AR) L 15,=V(COS) BALR 14,15 11/15/2016jaya 14
  • 15. IMPLEMENTATION STATEMENT OF PROBLEM SPECIFICATION OF DATA BASES SPECIFICATION OF DATA BASE FORMAT ALGORITHM 11/15/2016jaya 15
  • 16. STATEMENT OF PROBLEM  Macro processor is a system program which accepts an assembly language program with macro definition and macro calls and produce an equivalent assembly language program in which all macro calls are expanded.  Four basic tasks of macro instruction processor  Recognize macro definitions  Save the definition  Recognize calls  Expand calls and substitute arguments 11/15/2016jaya 16
  • 17. STATEMENT OF PROBLEM  Macro processor performs expansion using 2 passes  Pass I  It examines every operation code  Save all macro definitions in a macro definition table and macro name table  Save a copy of the input text , minus macro definition  Pass II  Identify macro calls  Replace each macro name with the appropriate text from macro definition(expand macro call) 11/15/2016jaya 17
  • 18. SPECIFICATION OF DATA BASE  PASS I  The input macro source deck  Output macro source deck copy for use by pass2  Macro Definition Table(MDT)  Macro Name Table(MNT)  Macro Definition Table Counter(MDNTC)  Macro Name Table Counter(MNTC)  Argument List Array(ALA) 11/15/2016jaya 18
  • 19. SPECIFICATION OF DATA BASE  PASS II  The copy input macro source deck  Output expanded source deck copy for use by assembler  Macro Definition Table(MDT) created by pass1  Macro Name Table(MNT) created by pass1  Macro Definition Table Pointer(MDNTP)  Argument List Array(ALA) 11/15/2016jaya 19
  • 20. PASS 1- PROCESSING MACRO DEFINITIONS 11/15/2016jaya 20
  • 21. EXAMPLE MACRO &LAB INCR &ARG1,&ARG2,&ARG3 &LAB A 1,&ARG1 A 2,&ARG2 A 3,&ARG3 MEND | | INCR Index Contents(80 bytes per entry) 5 &LAB INCR &ARG1,&ARG2,&ARG3 6 #0 A 2,#1 7 A 3,#2 8 A 2,#3 9 MEND 10 INDEX NAME(8 bytes) 0 #0(&LAB) 1 #1(&ARG1) 2 #2(&ARG2) 3 #3(&ARG3) INDEX NAME( 8 bytes MDT POSITION( 4 bytes) 1 INCR 5 2 3 Macro Definition Table Argument List Array Macro Name Table 11/15/2016jaya 21
  • 22. PASS 2 – PROCESSING MACRO CALLS AND EXPANSION 11/15/2016jaya 22
  • 23. EXAMPLE MACRO &LAB INCR &ARG1,&ARG2,&ARG3 &LAB A 1,&ARG1 A 2,&ARG2 A 3,&ARG3 MEND | | LOOP1 INCR DATA1,DATA2,DATA3 Index Contents ( 80 bytes per entry) 5 &LAB INCR &ARG1,&ARG2,&ARG3 6 #0 A 2,#1 7 A 3,#2 8 A 2,#3 9 MEND 10 INDEX NAME ( 8 bytes) 0 “LOOP1bbb” 1 “DATA1bbb” 2 “DATA2bbb” 3 “DATA3bbb” INDEX NAME ( 8 bytes) MDT POSITION ( 4 byte) 1 “INCRbbb” 5 2 3 Macro Definition Table Argument List Array Macro Name Table 11/15/2016jaya 23
  • 24. MACRO &LAB INCR &ARG1,&ARG2,&ARG3 &LAB A 1,&ARG1 A 2,&ARG2 A 3,&ARG3 MEND | | LOOP1 INCR DATA1,DATA2,DATA3 LOOP1 A 1,DATA1 A 2, DATA2 A 3,DATA3 11/15/2016jaya 24
  • 25. IMPLEMENTATION OF MACRO CALL WITHIN MACRO  Basic problem in implementing macro calls within macros is “recursion”  Need to expand both macro  Each call might be expanded by another macro  More macros vs single macro 11/15/2016jaya 25
  • 26.  Example with 2 macros ADDS and ADD1 MACRO ADD1 &ARG L 1,&ARG A 1,=F’1’ ST 1,&ARG MEND MACRO ADDS &ARG1,&ARG2,&ARG3 ADD1 &ARG1 ADD2 &ARG2 ADD3 &ARG3 MEND 11/15/2016jaya 26
  • 27.  MDT(Macro Definition Table) Index Contents 1 ADD1 &ARG 2 L 1,#1 3 A 1,=F’1’ 4 ST 1,#1 5 MEND 6 ADDS &ARG1,&ARG2,&ARG3 7 ADD1 #1 8 ADD2 #2 9 ADD3 #3 10 MEND 11/15/2016jaya 27
  • 28. IMPLEMENTATION WITHIN AN ASSEMBLER  Macro processor can be added as a pre-processor to an assembler  Combining similar functions  Ex- MNT+MOT/POT 11/15/2016jaya 28
  • 29. MACRO PROCESSOR COMBINED WITH ASSEMBLER PASS 1 PASS 1! Search Pseudo-Op Table (POT)! Search Macro Name Table (MNT)!! GO TO PASS2! Search Machine -Op Table (MOT)! Process machine instruction Type? Process macro definition Set up macro stack frame , etc. Process pseudo-ops READ *R R R R R END pseudo-op Found others Not macro call Not pseudo op Found macro call Macro pseudo op 11/15/2016jaya 29
  • 30. ADVANTAGES & DISADVANTAGES OF INCORPORATING MACRO INTO PASS1  Advantages  functions do not have to implemented twice  Less overhead during processing  More flexible for programmer  Disadvantages  Large program  More complex 11/15/2016jaya 30
  • 31. SINGLE PASS ALGORITHM  Problem of macro definition with macros  Combine pass1 and pass2  Two additional variables  MDI(Macro Definition Input) indicator  MDLC(Macro Definition Level Counter) 11/15/2016jaya 31
  • 32. One-pass macro processor MDTC  1 MNTC  1 MDI  “OFF” MDLC  0 Search MNT for match with operation code MDTP  MDT index from MNT entry READ Macr o name found MDI  “ON” Set up macro call argument list array Macr o pseu do-op ? READ* Enter macro name & current value of MDTC in MNT entry number MNTC MNTC  MNTC+1 Prepare macro definition argument list array Enter macro name card into MDT MDTC MDTC+1 MDLC MDLC+1 READ* MDTC MDTC+1 Substitute index notation for argument in definition Enter line into MDT Macro pseudo -op ? MEN D pseud o-op ? MDLC MDLC+1 MDLC MDLC-1 MDLC  0 ? MNTC  MNTC+1 END Pseudo -op? Supply expanded source file to processing a a a no Yes macro call no no yes yes no yes no yes no Yes macro definition
  • 33. READ * subroutine MDI = “OFF” ? Read next source card from input file Return to main processing Increment MDT pointer to next entry MDTP  MDTP + 1 MDI  “OFF” Get next card from MDT Substitute arguments from macro call Process AIF or AGO set new value to MDTP MDLC = 0 ? MEND pseudo- op ? AIF or AGO ? yes yes yes yes No within macro call no no no Detail of read function used for macro expansion 11/15/2016jaya 33
  • 34. One-pass macro processor MDTC  1 MNTC  1 MDI  “OFF” MDLC  0 Search MNT for match with operation code SP  SP+N+2 READ Macr o name found S(SP+N+2) SP Set up macro call argument list array in S(SP+2)---- S(SP+N+1) where N = total number of arguments Macr o pseu do- op ? READ* Enter macro name & current value of MDTC in MNT entry number MNTC Prepare macro definition argument list array Enter macro name card into MDT MDLC MDLC+1 READ* Substitute index notation for argument in definition Enter line into MDT Macro pseudo -op ? MEN D pseud o-op ? MDLC MDLC+1 MDLC MDLC-1 MDLC  0 ? MNTC  MNTC+1 END Pseudo -op? Supply expanded source file to processing a a a no Yes macro call no no yes yes no yes no yes no Yes macro definition S(SP+1) MDT index from MNT entry b b b One pass macro processor capable of handling macro calls within macro definitions 11/15/2016jaya 34
  • 35. READ * subroutine SP = - 1 Read next source card from input file Return to main processing Increment MDT pointer to next entry S(SP+1)+1 Get next card from MDT ; pointer is S(SP+1) Substitute arguments from macro call S(SP+2)…S(SP+N+1) N  SP – S(SP)-2 AIF or AGO ? MEND pseudo- op ? MDL C = 0 ? yes yes yes No within macro call no no yes Process AIF or AGO set new value to MDTP SP  S(SP) yes no b b Detail of read function for recursive macro expansion 11/15/2016jaya 35