SlideShare a Scribd company logo
1 of 21
Assembler Design Options
One and Multi-Pass Assembler
• So far, we have presented the design and
  implementation of a two-pass assembler.
• Here, we will present the design and
  implementation of
  – One-pass assembler
     • If avoiding a second pass over the source program is
       necessary or desirable.
  – Multi-pass assembler
     • Allow forward references during symbol definition.
One-Pass Assembler
• The main problem is about forward reference.
• Eliminating forward reference to data items can be
  easily done.
   – Simply ask the programmer to define variables before
     using them.
• However, eliminating forward reference to
  instruction cannot be easily done.
   – Sometimes your program needs a forward jump.
   – Asking your program to use only backward jumps is
     too restrictive.
Program Example
All variables are defined before they are used.
Two Types
• There are two types of one-pass assembler:
   – Produce object code directly in memory for immediate
     execution
      • No loader is needed
      • Load-and-go for program development and testing
      • Good for computing center where most students reassemble
        their programs each time.
      • Can save time for scanning the source code again
   – Produce the usual kind of object program for later
     execution
Internal Implementation
• The assembler generate object code instructions as
  it scans the source program.
• If an instruction operand is a symbol that has not
  yet been defined,the operand address is omitted
  when the instruction is assembled.
• The symbol used as an operand is entered into the
  symbol table.
• This entry is flagged to indicate that the symbol is
  undefined yet.
Internal Implementation (cont’d)
• The address of the operand field of the instruction
  that refers to the undefined symbol is added to a
  list of forward references associated with the
  symbol table entry.
• When the definition of the symbol is encountered,
  the forward reference list for that symbol is
  scanned, and the proper address is inserted into
  any instruction previously generated.
Processing Example




After scanning line 40
Processing Example (cont’d)




After scanning line 160
Processing Example (cont’d)
• Between scanning line 40 and 160:
   – On line 45, when the symbol ENDFIL is defined, the
     assembler places its value in the SYMTAB entry.
   – The assembler then inserts this value into the
     instruction operand field (at address 201C).
   – From this point on, any references to ENDFIL would
     not be forward references and would not be entered into
     a list.
• At the end of the processing of the program, any
  SYMTAB entries that are still marked with *
  indicate undefined symbols.
   – These should be flagged by the assembler as errors.
Multi-Pass Assembler
• If we use a two-pass assembler, the following
  symbol definition cannot be allowed.
            ALPHA      EQU      BETA
            BETA       EQU      DELTA
            DELTA RESW 1
• This is because ALPHA and BETA cannot be
  defined in pass 1. Actually, if we allow multi-pass
  processing, DELTA is defined in pass 1, BETA is
  defined in pass 2, and ALPHA is defined in pass
  3, and the above definitions can be allowed.
• This is the motivation for using a multi-pass
  assembler.
Multi-Pass Assembler(cont’d)
• It is unnecessary for a multi-pass assembler
  to make more than two passes over the
  entire program.
• Instead, only the parts of the program
  involving forward references need to be
  processed in multiple passes.
• The method presented here can be used to
  process any kind of forward references.
Multi-Pass Assembler
            Implementation
• Use a symbol table to store symbols that are not
  totally defined yet.
• For a undefined symbol, in its entry,
   – We store the names and the number of undefined
     symbols which contribute to the calculation of its value.
   – We also keep a list of symbols whose values depend on
      the defined value of this symbol.
• When a symbol becomes defined, we use its value
  to reevaluate the values of all of the symbols that
  are kept in this list.
• The above step is performed recursively.
Forward Reference Example
Forward Reference Processing

        But one symbol is unknown yet



        Defined




       Not defined yet
                                  After first line
After second line


But two symbols are unknown yet


   Now defined
After third line
After 4’th line




Start knowing values
Start knowing values




                       After 5’th line


                       All symbols are
                       defined and their
                       values are known
                       now.

More Related Content

What's hot

Assemblers: Ch03
Assemblers: Ch03Assemblers: Ch03
Assemblers: Ch03desta_gebre
 
Lexical Analysis - Compiler Design
Lexical Analysis - Compiler DesignLexical Analysis - Compiler Design
Lexical Analysis - Compiler DesignAkhil Kaushik
 
CLASSIFICATION OF DEBUGGERS
CLASSIFICATION OF DEBUGGERSCLASSIFICATION OF DEBUGGERS
CLASSIFICATION OF DEBUGGERSJAINAM KAPADIYA
 
Assembler design option
Assembler design optionAssembler design option
Assembler design optionMohd Arif
 
Introduction to systems programming
Introduction to systems programmingIntroduction to systems programming
Introduction to systems programmingMukesh Tekwani
 
Fundamentals of Language Processing
Fundamentals of Language ProcessingFundamentals of Language Processing
Fundamentals of Language ProcessingHemant Sharma
 
System software - macro expansion,nested macro calls
System software - macro expansion,nested macro callsSystem software - macro expansion,nested macro calls
System software - macro expansion,nested macro callsSARASWATHI S
 
Lecture 01 introduction to compiler
Lecture 01 introduction to compilerLecture 01 introduction to compiler
Lecture 01 introduction to compilerIffat Anjum
 
Software project management Software economics
Software project management Software economicsSoftware project management Software economics
Software project management Software economicsREHMAT ULLAH
 

What's hot (20)

Assemblers
AssemblersAssemblers
Assemblers
 
Unit 4 sp macro
Unit 4 sp macroUnit 4 sp macro
Unit 4 sp macro
 
Assemblers: Ch03
Assemblers: Ch03Assemblers: Ch03
Assemblers: Ch03
 
Lexical Analysis - Compiler Design
Lexical Analysis - Compiler DesignLexical Analysis - Compiler Design
Lexical Analysis - Compiler Design
 
System Programming Overview
System Programming OverviewSystem Programming Overview
System Programming Overview
 
CLASSIFICATION OF DEBUGGERS
CLASSIFICATION OF DEBUGGERSCLASSIFICATION OF DEBUGGERS
CLASSIFICATION OF DEBUGGERS
 
Compiler Chapter 1
Compiler Chapter 1Compiler Chapter 1
Compiler Chapter 1
 
Assembler design option
Assembler design optionAssembler design option
Assembler design option
 
Recognition-of-tokens
Recognition-of-tokensRecognition-of-tokens
Recognition-of-tokens
 
Types of Compilers
Types of CompilersTypes of Compilers
Types of Compilers
 
Introduction to Compiler design
Introduction to Compiler design Introduction to Compiler design
Introduction to Compiler design
 
Introduction to systems programming
Introduction to systems programmingIntroduction to systems programming
Introduction to systems programming
 
Code generation
Code generationCode generation
Code generation
 
Specification-of-tokens
Specification-of-tokensSpecification-of-tokens
Specification-of-tokens
 
Staffing level estimation
Staffing level estimation Staffing level estimation
Staffing level estimation
 
Fundamentals of Language Processing
Fundamentals of Language ProcessingFundamentals of Language Processing
Fundamentals of Language Processing
 
Phases of compiler
Phases of compilerPhases of compiler
Phases of compiler
 
System software - macro expansion,nested macro calls
System software - macro expansion,nested macro callsSystem software - macro expansion,nested macro calls
System software - macro expansion,nested macro calls
 
Lecture 01 introduction to compiler
Lecture 01 introduction to compilerLecture 01 introduction to compiler
Lecture 01 introduction to compiler
 
Software project management Software economics
Software project management Software economicsSoftware project management Software economics
Software project management Software economics
 

Viewers also liked

System Programming Unit III
System Programming Unit IIISystem Programming Unit III
System Programming Unit IIIManoj Patil
 
System Programming Unit IV
System Programming Unit IVSystem Programming Unit IV
System Programming Unit IVManoj Patil
 
System Programing Unit 1
System Programing Unit 1System Programing Unit 1
System Programing Unit 1Manoj Patil
 
System Programming Unit II
System Programming Unit IISystem Programming Unit II
System Programming Unit IIManoj Patil
 

Viewers also liked (6)

Smqa unit ii
Smqa unit   iiSmqa unit   ii
Smqa unit ii
 
System Programming Unit III
System Programming Unit IIISystem Programming Unit III
System Programming Unit III
 
System Programming Unit IV
System Programming Unit IVSystem Programming Unit IV
System Programming Unit IV
 
System Programing Unit 1
System Programing Unit 1System Programing Unit 1
System Programing Unit 1
 
Assembler
AssemblerAssembler
Assembler
 
System Programming Unit II
System Programming Unit IISystem Programming Unit II
System Programming Unit II
 

Similar to Assembler design options

Phases of Compiler.pptx
Phases of Compiler.pptxPhases of Compiler.pptx
Phases of Compiler.pptxssuser3b4934
 
Compiler Construction
Compiler ConstructionCompiler Construction
Compiler ConstructionSarmad Ali
 
Single pass assembler
Single pass assemblerSingle pass assembler
Single pass assemblerBansari Shah
 
classVII_Coding_Teacher_Presentation.pptx
classVII_Coding_Teacher_Presentation.pptxclassVII_Coding_Teacher_Presentation.pptx
classVII_Coding_Teacher_Presentation.pptxssusere336f4
 
Java developer trainee implementation and import
Java developer trainee implementation and importJava developer trainee implementation and import
Java developer trainee implementation and importiamluqman0403
 
Error Detection & Recovery
Error Detection & RecoveryError Detection & Recovery
Error Detection & RecoveryAkhil Kaushik
 
Part II: Assembly Fundamentals
Part II: Assembly FundamentalsPart II: Assembly Fundamentals
Part II: Assembly FundamentalsAhmed M. Abed
 
System software module 1 presentation file
System software module 1 presentation fileSystem software module 1 presentation file
System software module 1 presentation filejithujithin657
 
Basic syntax : Algorithm,Flow chart
Basic syntax : Algorithm,Flow chartBasic syntax : Algorithm,Flow chart
Basic syntax : Algorithm,Flow chartPrasanna R Kovath
 
Introduction to compiler
Introduction to compilerIntroduction to compiler
Introduction to compilerAbha Damani
 
Error Detection & Recovery.pptx
Error Detection & Recovery.pptxError Detection & Recovery.pptx
Error Detection & Recovery.pptxMohibKhan79
 
Concept of compiler in details
Concept of compiler in detailsConcept of compiler in details
Concept of compiler in detailskazi_aihtesham
 

Similar to Assembler design options (20)

Unit 1 psp
Unit 1 pspUnit 1 psp
Unit 1 psp
 
Assembler
AssemblerAssembler
Assembler
 
Sp2 4
Sp2 4Sp2 4
Sp2 4
 
Phases of Compiler.pptx
Phases of Compiler.pptxPhases of Compiler.pptx
Phases of Compiler.pptx
 
Compiler Construction
Compiler ConstructionCompiler Construction
Compiler Construction
 
Single pass assembler
Single pass assemblerSingle pass assembler
Single pass assembler
 
classVII_Coding_Teacher_Presentation.pptx
classVII_Coding_Teacher_Presentation.pptxclassVII_Coding_Teacher_Presentation.pptx
classVII_Coding_Teacher_Presentation.pptx
 
Java developer trainee implementation and import
Java developer trainee implementation and importJava developer trainee implementation and import
Java developer trainee implementation and import
 
Error Detection & Recovery
Error Detection & RecoveryError Detection & Recovery
Error Detection & Recovery
 
Chapter 1.pptx
Chapter 1.pptxChapter 1.pptx
Chapter 1.pptx
 
Part II: Assembly Fundamentals
Part II: Assembly FundamentalsPart II: Assembly Fundamentals
Part II: Assembly Fundamentals
 
CPP03 - Repetition
CPP03 - RepetitionCPP03 - Repetition
CPP03 - Repetition
 
System software module 1 presentation file
System software module 1 presentation fileSystem software module 1 presentation file
System software module 1 presentation file
 
Unit 1.pptx
Unit 1.pptxUnit 1.pptx
Unit 1.pptx
 
Basic syntax : Algorithm,Flow chart
Basic syntax : Algorithm,Flow chartBasic syntax : Algorithm,Flow chart
Basic syntax : Algorithm,Flow chart
 
C language
C languageC language
C language
 
Introduction to compiler
Introduction to compilerIntroduction to compiler
Introduction to compiler
 
Error Detection & Recovery.pptx
Error Detection & Recovery.pptxError Detection & Recovery.pptx
Error Detection & Recovery.pptx
 
algorithm
algorithmalgorithm
algorithm
 
Concept of compiler in details
Concept of compiler in detailsConcept of compiler in details
Concept of compiler in details
 

More from Mohd Arif

Bootp and dhcp
Bootp and dhcpBootp and dhcp
Bootp and dhcpMohd Arif
 
Arp and rarp
Arp and rarpArp and rarp
Arp and rarpMohd Arif
 
User datagram protocol
User datagram protocolUser datagram protocol
User datagram protocolMohd Arif
 
Project identification
Project identificationProject identification
Project identificationMohd Arif
 
Project evalaution techniques
Project evalaution techniquesProject evalaution techniques
Project evalaution techniquesMohd Arif
 
Presentation
PresentationPresentation
PresentationMohd Arif
 
Pointers in c
Pointers in cPointers in c
Pointers in cMohd Arif
 
Peer to-peer
Peer to-peerPeer to-peer
Peer to-peerMohd Arif
 
Overview of current communications systems
Overview of current communications systemsOverview of current communications systems
Overview of current communications systemsMohd Arif
 
Overall 23 11_2007_hdp
Overall 23 11_2007_hdpOverall 23 11_2007_hdp
Overall 23 11_2007_hdpMohd Arif
 
Objectives of budgeting
Objectives of budgetingObjectives of budgeting
Objectives of budgetingMohd Arif
 
Network management
Network managementNetwork management
Network managementMohd Arif
 
Networing basics
Networing basicsNetworing basics
Networing basicsMohd Arif
 
Iris ngx next generation ip based switching platform
Iris ngx next generation ip based switching platformIris ngx next generation ip based switching platform
Iris ngx next generation ip based switching platformMohd Arif
 
Ip sec and ssl
Ip sec and  sslIp sec and  ssl
Ip sec and sslMohd Arif
 
Ip security in i psec
Ip security in i psecIp security in i psec
Ip security in i psecMohd Arif
 
Intro to comp. hardware
Intro to comp. hardwareIntro to comp. hardware
Intro to comp. hardwareMohd Arif
 

More from Mohd Arif (20)

Bootp and dhcp
Bootp and dhcpBootp and dhcp
Bootp and dhcp
 
Arp and rarp
Arp and rarpArp and rarp
Arp and rarp
 
User datagram protocol
User datagram protocolUser datagram protocol
User datagram protocol
 
Project identification
Project identificationProject identification
Project identification
 
Project evalaution techniques
Project evalaution techniquesProject evalaution techniques
Project evalaution techniques
 
Presentation
PresentationPresentation
Presentation
 
Pointers in c
Pointers in cPointers in c
Pointers in c
 
Peer to-peer
Peer to-peerPeer to-peer
Peer to-peer
 
Overview of current communications systems
Overview of current communications systemsOverview of current communications systems
Overview of current communications systems
 
Overall 23 11_2007_hdp
Overall 23 11_2007_hdpOverall 23 11_2007_hdp
Overall 23 11_2007_hdp
 
Objectives of budgeting
Objectives of budgetingObjectives of budgeting
Objectives of budgeting
 
Network management
Network managementNetwork management
Network management
 
Networing basics
Networing basicsNetworing basics
Networing basics
 
Loaders
LoadersLoaders
Loaders
 
Lists
ListsLists
Lists
 
Iris ngx next generation ip based switching platform
Iris ngx next generation ip based switching platformIris ngx next generation ip based switching platform
Iris ngx next generation ip based switching platform
 
Ip sec and ssl
Ip sec and  sslIp sec and  ssl
Ip sec and ssl
 
Ip security in i psec
Ip security in i psecIp security in i psec
Ip security in i psec
 
Intro to comp. hardware
Intro to comp. hardwareIntro to comp. hardware
Intro to comp. hardware
 
Heap sort
Heap sortHeap sort
Heap sort
 

Recently uploaded

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusZilliz
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 

Recently uploaded (20)

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 

Assembler design options

  • 2. One and Multi-Pass Assembler • So far, we have presented the design and implementation of a two-pass assembler. • Here, we will present the design and implementation of – One-pass assembler • If avoiding a second pass over the source program is necessary or desirable. – Multi-pass assembler • Allow forward references during symbol definition.
  • 3. One-Pass Assembler • The main problem is about forward reference. • Eliminating forward reference to data items can be easily done. – Simply ask the programmer to define variables before using them. • However, eliminating forward reference to instruction cannot be easily done. – Sometimes your program needs a forward jump. – Asking your program to use only backward jumps is too restrictive.
  • 5.
  • 6. All variables are defined before they are used.
  • 7. Two Types • There are two types of one-pass assembler: – Produce object code directly in memory for immediate execution • No loader is needed • Load-and-go for program development and testing • Good for computing center where most students reassemble their programs each time. • Can save time for scanning the source code again – Produce the usual kind of object program for later execution
  • 8. Internal Implementation • The assembler generate object code instructions as it scans the source program. • If an instruction operand is a symbol that has not yet been defined,the operand address is omitted when the instruction is assembled. • The symbol used as an operand is entered into the symbol table. • This entry is flagged to indicate that the symbol is undefined yet.
  • 9. Internal Implementation (cont’d) • The address of the operand field of the instruction that refers to the undefined symbol is added to a list of forward references associated with the symbol table entry. • When the definition of the symbol is encountered, the forward reference list for that symbol is scanned, and the proper address is inserted into any instruction previously generated.
  • 12. Processing Example (cont’d) • Between scanning line 40 and 160: – On line 45, when the symbol ENDFIL is defined, the assembler places its value in the SYMTAB entry. – The assembler then inserts this value into the instruction operand field (at address 201C). – From this point on, any references to ENDFIL would not be forward references and would not be entered into a list. • At the end of the processing of the program, any SYMTAB entries that are still marked with * indicate undefined symbols. – These should be flagged by the assembler as errors.
  • 13. Multi-Pass Assembler • If we use a two-pass assembler, the following symbol definition cannot be allowed. ALPHA EQU BETA BETA EQU DELTA DELTA RESW 1 • This is because ALPHA and BETA cannot be defined in pass 1. Actually, if we allow multi-pass processing, DELTA is defined in pass 1, BETA is defined in pass 2, and ALPHA is defined in pass 3, and the above definitions can be allowed. • This is the motivation for using a multi-pass assembler.
  • 14. Multi-Pass Assembler(cont’d) • It is unnecessary for a multi-pass assembler to make more than two passes over the entire program. • Instead, only the parts of the program involving forward references need to be processed in multiple passes. • The method presented here can be used to process any kind of forward references.
  • 15. Multi-Pass Assembler Implementation • Use a symbol table to store symbols that are not totally defined yet. • For a undefined symbol, in its entry, – We store the names and the number of undefined symbols which contribute to the calculation of its value. – We also keep a list of symbols whose values depend on the defined value of this symbol. • When a symbol becomes defined, we use its value to reevaluate the values of all of the symbols that are kept in this list. • The above step is performed recursively.
  • 17. Forward Reference Processing But one symbol is unknown yet Defined Not defined yet After first line
  • 18. After second line But two symbols are unknown yet Now defined
  • 20. After 4’th line Start knowing values
  • 21. Start knowing values After 5’th line All symbols are defined and their values are known now.