SlideShare a Scribd company logo
1 of 19
BIRLA INSTITUTE OF TECHNOLOGY, MESRA
JAIPUR CAMPUS
TOPIC : MACRO ASSEMBLER
BY:
MEGHAJ KUMAR MALLICK
(MCA/25017/18)
2ND YEAR, 4TH SEMESTER
Design issues of Macro preocessor
• Flexible data structures and databases
• Attributes of macro arguments/parameter
name
• Default arguments/ formal parameter value at
macro definition time
• Numeric values of arguments/ actual
parameter value at macro call
• Comments in macros
Features of macro processor
• Associating macro parameters with their
arguments
• Delimiting macro parameters
• Directives related to arguments
• Automatic label generation
• Machine independent features
Design of Macro Preprocessor
Functions of Macro preprocessor
• Macro processor will perform the following
tasks-
– Identifies macro definitions and calls in the
program.
– Determines formal parameters and their values.
– Keeps track of the values of expansion time
variables and sequencing symbols declared in a
macro.
– Handles expansion time control flow and performs
expansion of model statements.
Two pass Macro Processor
• General Design Steps
• Step 1: Specification of Problem:-
• Step 2 Specification of databases:-
• Step 3 Specification of database
formats
• Step 4 : Algorithm
Specify the problem
• In Pass-I the macro definitions are searched
and stored in the macro definition table and
the entry is made in macro name table
• In Pass-II the macro calls are identified and the
arguments are placed in the appropriate place
and the macro calls are replaced by macro
definitions.
Specification of databases:-
Pass 1:-
• The input macro source program.
• The output macro source program to be used by Pass2.
• Macro-Definition Table (MDT), to store the body of macro
defns.
• Macro-Definition Table Counter (MDTC), to mark next
available entry MDT.
• Macro- Name Table (MNT), used to store names of macros.
• Macro Name Table counter (MNTC), used to indicate the
next available entry in MNT.
• Argument List Array (ALA), used to substitute index markers
for dummy arguments before storing a macro-defns.
Specification of databases:-
• Pass 2:-
• The copy of the input from Pass1.
• The output expanded source to be given to assembler.
• MDT, created by Pass1.
• MNT, created by Pass1.
• Macro-Definition Table Pointer (MDTP), used to
indicate the next line of text to be used during macro-
expansion.
• Argument List Array (ALA), used to substitute macro-
call arguments for the index markers in the stored
macro-defns
Specification of Database format
Specification of Database format
Argument List Array (ALA):
• ALA is used during both Pass1 & Pas2 but for some what
reverse functions.
• During Pass1, in order to simplify later argument
replacement during macro expansion, dummy arguments
are replaced with positional indicators when defn is stored.
Ex. # 1, # 2, # 3 etc.
• The ith dummy argument on the macro-name is
represented in the body by #i.
• These symbols are used in conjunction with ALA prepared
before expansion of a macro-call.
• Symbolic dummy argument are retained on macro-name to
enable the macro processor to handle argument
replacement byname rather by position.
Algorithm
• Pass1 of macro processor makes a line-by-line scan
over its input.
• Set MDTC = 1 as well as MNTC = 1.
• Read next line from input program.
• If it is a MACRO pseudo-op, the entire macro definition
except this (MACRO) line is stored in MDT.
• The name is entered into Macro Name Table along with
a pointer to the first location of MDT entry of the
definition.
• When the END pseudo-op is encountered all the
macro-defns have been processed, so control is
transferred to pass2
MDTC1
MNTC1
MDTC MDTC+1
MDTC MDTC+1
Enter Macro Name andCurrent
value of MDTC in MNT
Algorithm for Pass – 2
•
• This algorithm reads one line of i/p prog. at a time.
• for each Line it checks if op-code of that line matches any of the MNT
• entry.
• When match is found (i.e. when call is pointer called MDTF to
corresponding macro defns stored inMDT.
• The initial value of MDTP is obtained from MDT index field of MNT
entry.
• The macro expander prepares the ALA consisting of a table of dummy
• argument indices & corresponding arguments to the call.
• Reading proceeds from the MDT, as each successive line is read, The
values form the argument list one substituted for dummy arguments
indices in the macro defn.
• Reading MEND line in MDT terminates expansion of macro & scanning
• continues from the input file.
• When END pseudo-op encountered , the expanded source program is
given to the assembler
MDTP  MDTP + 1
Pass structure of Macro assembler
Macro assembler flow chart
THANK
YOU

More Related Content

What's hot

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
 

What's hot (20)

loaders and linkers
 loaders and linkers loaders and linkers
loaders and linkers
 
Basic Computer Organization and Design
Basic  Computer  Organization  and  DesignBasic  Computer  Organization  and  Design
Basic Computer Organization and Design
 
Assemblers
AssemblersAssemblers
Assemblers
 
Unit 3 sp assembler
Unit 3 sp assemblerUnit 3 sp assembler
Unit 3 sp assembler
 
System Programming- Unit I
System Programming- Unit ISystem Programming- Unit I
System Programming- Unit I
 
Token, Pattern and Lexeme
Token, Pattern and LexemeToken, Pattern and Lexeme
Token, Pattern and Lexeme
 
Single Pass Assembler
Single Pass AssemblerSingle Pass Assembler
Single Pass Assembler
 
DMA operation
DMA operationDMA operation
DMA operation
 
Life cycle of a computer program
Life cycle of a computer programLife cycle of a computer program
Life cycle of a computer program
 
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
 
Language processing activity
Language processing activityLanguage processing activity
Language processing activity
 
Intermediate code generation (Compiler Design)
Intermediate code generation (Compiler Design)   Intermediate code generation (Compiler Design)
Intermediate code generation (Compiler Design)
 
Two pass Assembler
Two pass AssemblerTwo pass Assembler
Two pass Assembler
 
Programming the basic computer
Programming the basic computerProgramming the basic computer
Programming the basic computer
 
Lexical Analysis - Compiler Design
Lexical Analysis - Compiler DesignLexical Analysis - Compiler Design
Lexical Analysis - Compiler Design
 
Microprogrammed Control Unit
Microprogrammed Control UnitMicroprogrammed Control Unit
Microprogrammed Control Unit
 
Control Memory
Control MemoryControl Memory
Control Memory
 
Linking in MS-Dos System
Linking in MS-Dos SystemLinking in MS-Dos System
Linking in MS-Dos System
 
MASM -UNIT-III
MASM -UNIT-IIIMASM -UNIT-III
MASM -UNIT-III
 
Memory Reference Instructions
Memory Reference InstructionsMemory Reference Instructions
Memory Reference Instructions
 

Similar to Macro assembler

Unit ii-111206004636-phpapp01
Unit ii-111206004636-phpapp01Unit ii-111206004636-phpapp01
Unit ii-111206004636-phpapp01
riddhi viradiya
 
33443223 system-software-unit-iv
33443223 system-software-unit-iv33443223 system-software-unit-iv
33443223 system-software-unit-iv
Shaniya Fathimuthu
 

Similar to Macro assembler (20)

Unit ii-111206004636-phpapp01
Unit ii-111206004636-phpapp01Unit ii-111206004636-phpapp01
Unit ii-111206004636-phpapp01
 
Module 5.pdf
Module 5.pdfModule 5.pdf
Module 5.pdf
 
Macro-processor
Macro-processorMacro-processor
Macro-processor
 
33443223 system-software-unit-iv
33443223 system-software-unit-iv33443223 system-software-unit-iv
33443223 system-software-unit-iv
 
MACRO ASSEBLER
MACRO ASSEBLERMACRO ASSEBLER
MACRO ASSEBLER
 
Ss4
Ss4Ss4
Ss4
 
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
 
What's a macro?: Learning by Examples
What's a macro?: Learning by ExamplesWhat's a macro?: Learning by Examples
What's a macro?: Learning by Examples
 
Macro Processor
Macro ProcessorMacro Processor
Macro Processor
 
Writing command macro in stratus cobol
Writing command macro in stratus cobolWriting command macro in stratus cobol
Writing command macro in stratus cobol
 
What's a macro?: Learning by Examples / Scalaのマクロに実用例から触れてみよう!
What's a macro?: Learning by Examples / Scalaのマクロに実用例から触れてみよう!What's a macro?: Learning by Examples / Scalaのマクロに実用例から触れてみよう!
What's a macro?: Learning by Examples / Scalaのマクロに実用例から触れてみよう!
 
SAS Macro
SAS MacroSAS Macro
SAS Macro
 
Simulation with Python and MATLAB® in Capella
Simulation with Python and MATLAB® in CapellaSimulation with Python and MATLAB® in Capella
Simulation with Python and MATLAB® in Capella
 
Unit 2
Unit 2Unit 2
Unit 2
 
Compilers
CompilersCompilers
Compilers
 
Performance security tradeoff in Robotic Mobile Wireless Ad hoc Networks
Performance security tradeoff in Robotic Mobile Wireless Ad hoc Networks Performance security tradeoff in Robotic Mobile Wireless Ad hoc Networks
Performance security tradeoff in Robotic Mobile Wireless Ad hoc Networks
 
CS304PC:Computer Organization and Architecture Session 10 design of control ...
CS304PC:Computer Organization and Architecture  Session 10 design of control ...CS304PC:Computer Organization and Architecture  Session 10 design of control ...
CS304PC:Computer Organization and Architecture Session 10 design of control ...
 
assembler-ppt.pdf
assembler-ppt.pdfassembler-ppt.pdf
assembler-ppt.pdf
 
A NOVEL APPROACH FOR LOWER POWER DESIGN IN TURBO CODING SYSTEM
A NOVEL APPROACH FOR LOWER POWER DESIGN IN TURBO CODING SYSTEMA NOVEL APPROACH FOR LOWER POWER DESIGN IN TURBO CODING SYSTEM
A NOVEL APPROACH FOR LOWER POWER DESIGN IN TURBO CODING SYSTEM
 

More from Meghaj Mallick

More from Meghaj Mallick (20)

24 partial-orderings
24 partial-orderings24 partial-orderings
24 partial-orderings
 
PORTFOLIO BY USING HTML & CSS
PORTFOLIO BY USING HTML & CSSPORTFOLIO BY USING HTML & CSS
PORTFOLIO BY USING HTML & CSS
 
Introduction to Software Testing
Introduction to Software TestingIntroduction to Software Testing
Introduction to Software Testing
 
Introduction to System Programming
Introduction to System ProgrammingIntroduction to System Programming
Introduction to System Programming
 
Icons, Image & Multimedia
Icons, Image & MultimediaIcons, Image & Multimedia
Icons, Image & Multimedia
 
Project Tracking & SPC
Project Tracking & SPCProject Tracking & SPC
Project Tracking & SPC
 
Peephole Optimization
Peephole OptimizationPeephole Optimization
Peephole Optimization
 
Routing in MANET
Routing in MANETRouting in MANET
Routing in MANET
 
Architecture and security in Vanet PPT
Architecture and security in Vanet PPTArchitecture and security in Vanet PPT
Architecture and security in Vanet PPT
 
Design Model & User Interface Design in Software Engineering
Design Model & User Interface Design in Software EngineeringDesign Model & User Interface Design in Software Engineering
Design Model & User Interface Design in Software Engineering
 
Text Mining of Twitter in Data Mining
Text Mining of Twitter in Data MiningText Mining of Twitter in Data Mining
Text Mining of Twitter in Data Mining
 
DFS & BFS in Computer Algorithm
DFS & BFS in Computer AlgorithmDFS & BFS in Computer Algorithm
DFS & BFS in Computer Algorithm
 
Software Development Method
Software Development MethodSoftware Development Method
Software Development Method
 
Secant method in Numerical & Statistical Method
Secant method in Numerical & Statistical MethodSecant method in Numerical & Statistical Method
Secant method in Numerical & Statistical Method
 
Motivation in Organization
Motivation in OrganizationMotivation in Organization
Motivation in Organization
 
Communication Skill
Communication SkillCommunication Skill
Communication Skill
 
Partial-Orderings in Discrete Mathematics
 Partial-Orderings in Discrete Mathematics Partial-Orderings in Discrete Mathematics
Partial-Orderings in Discrete Mathematics
 
Hashing In Data Structure
Hashing In Data Structure Hashing In Data Structure
Hashing In Data Structure
 
Complexity Analysis of Recursive Function
Complexity Analysis of Recursive FunctionComplexity Analysis of Recursive Function
Complexity Analysis of Recursive Function
 
Array implementation & Construction of Heap
Array implementation & Construction of HeapArray implementation & Construction of Heap
Array implementation & Construction of Heap
 

Recently uploaded

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Recently uploaded (20)

UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 

Macro assembler

  • 1. BIRLA INSTITUTE OF TECHNOLOGY, MESRA JAIPUR CAMPUS TOPIC : MACRO ASSEMBLER BY: MEGHAJ KUMAR MALLICK (MCA/25017/18) 2ND YEAR, 4TH SEMESTER
  • 2. Design issues of Macro preocessor • Flexible data structures and databases • Attributes of macro arguments/parameter name • Default arguments/ formal parameter value at macro definition time • Numeric values of arguments/ actual parameter value at macro call • Comments in macros
  • 3. Features of macro processor • Associating macro parameters with their arguments • Delimiting macro parameters • Directives related to arguments • Automatic label generation • Machine independent features
  • 4. Design of Macro Preprocessor
  • 5. Functions of Macro preprocessor • Macro processor will perform the following tasks- – Identifies macro definitions and calls in the program. – Determines formal parameters and their values. – Keeps track of the values of expansion time variables and sequencing symbols declared in a macro. – Handles expansion time control flow and performs expansion of model statements.
  • 6. Two pass Macro Processor • General Design Steps • Step 1: Specification of Problem:- • Step 2 Specification of databases:- • Step 3 Specification of database formats • Step 4 : Algorithm
  • 7. Specify the problem • In Pass-I the macro definitions are searched and stored in the macro definition table and the entry is made in macro name table • In Pass-II the macro calls are identified and the arguments are placed in the appropriate place and the macro calls are replaced by macro definitions.
  • 8. Specification of databases:- Pass 1:- • The input macro source program. • The output macro source program to be used by Pass2. • Macro-Definition Table (MDT), to store the body of macro defns. • Macro-Definition Table Counter (MDTC), to mark next available entry MDT. • Macro- Name Table (MNT), used to store names of macros. • Macro Name Table counter (MNTC), used to indicate the next available entry in MNT. • Argument List Array (ALA), used to substitute index markers for dummy arguments before storing a macro-defns.
  • 9. Specification of databases:- • Pass 2:- • The copy of the input from Pass1. • The output expanded source to be given to assembler. • MDT, created by Pass1. • MNT, created by Pass1. • Macro-Definition Table Pointer (MDTP), used to indicate the next line of text to be used during macro- expansion. • Argument List Array (ALA), used to substitute macro- call arguments for the index markers in the stored macro-defns
  • 12. Argument List Array (ALA): • ALA is used during both Pass1 & Pas2 but for some what reverse functions. • During Pass1, in order to simplify later argument replacement during macro expansion, dummy arguments are replaced with positional indicators when defn is stored. Ex. # 1, # 2, # 3 etc. • The ith dummy argument on the macro-name is represented in the body by #i. • These symbols are used in conjunction with ALA prepared before expansion of a macro-call. • Symbolic dummy argument are retained on macro-name to enable the macro processor to handle argument replacement byname rather by position.
  • 13. Algorithm • Pass1 of macro processor makes a line-by-line scan over its input. • Set MDTC = 1 as well as MNTC = 1. • Read next line from input program. • If it is a MACRO pseudo-op, the entire macro definition except this (MACRO) line is stored in MDT. • The name is entered into Macro Name Table along with a pointer to the first location of MDT entry of the definition. • When the END pseudo-op is encountered all the macro-defns have been processed, so control is transferred to pass2
  • 14. MDTC1 MNTC1 MDTC MDTC+1 MDTC MDTC+1 Enter Macro Name andCurrent value of MDTC in MNT
  • 15. Algorithm for Pass – 2 • • This algorithm reads one line of i/p prog. at a time. • for each Line it checks if op-code of that line matches any of the MNT • entry. • When match is found (i.e. when call is pointer called MDTF to corresponding macro defns stored inMDT. • The initial value of MDTP is obtained from MDT index field of MNT entry. • The macro expander prepares the ALA consisting of a table of dummy • argument indices & corresponding arguments to the call. • Reading proceeds from the MDT, as each successive line is read, The values form the argument list one substituted for dummy arguments indices in the macro defn. • Reading MEND line in MDT terminates expansion of macro & scanning • continues from the input file. • When END pseudo-op encountered , the expanded source program is given to the assembler
  • 17. Pass structure of Macro assembler