Assembler – Assembler Design Options. One-Pass Assemblers (1/2) Main problem  Forward references Data items Labels on instructions Solution  Data items:

Slides:



Advertisements
Similar presentations
The Assembly Language Level
Advertisements

Chapter 3 Loaders and Linkers
Linkage Editors Difference between a linkage editor and a linking loader: Linking loader performs all linking and relocation operations, including automatic.
Chapter 3 Loaders and Linkers
Macro Processor.
Machine Independent Assembler Features
Assembler Design Options
Chapter 6: Machine dependent Assembler Features
CPS4200 System Programming 2007 Spring 1 Systems Programming Chapter 2 Assembler I.
CS2422 Assembly Language and System Programming Linking Loader Department of Computer Science National Tsing Hua University.
Chih-Hung Wang Chapter 2: Assembler (Full) 參考書目 Leland L. Beck, System Software: An Introduction to Systems Programming (3rd), Addison-Wesley,
Chih-Hung Wang Chapter 2: Assembler (Part-1) 參考書目 Leland L. Beck, System Software: An Introduction to Systems Programming (3rd), Addison-Wesley, 1997.
System Software by Leland L. Beck Chapter 2
Loader- Machine Independent Loader Features
Chapter 2 Assemblers Assembler Linker Source Program Object Code
CS2422 Assembly Language & System Programming December 22, 2005.
Assemblers Dr. Monther Aldwairi 10/21/20071Dr. Monther Aldwairi.
1 Chapter 2 Assemblers Source Program Assembler Object Code Loader.
1 Chapter 3 Loaders and Linkers Source Program Assembler Object Code Loader Executable Code Linker.
Machine-Independent Assembler Features
Assembler (Basic Functions)
Assembler – Machine Independent Features. Literals Design idea  Let programmers to be able to write the value of a constant operand as a part of the.
CS2422 Assembly Language & System Programming December 14, 2006.
UNIT II ASSEMBLERS.
A Simple Two-Pass Assembler
Assemblers.
Chapter 4 System Programming and Operating Systems -DM Dhamdhere
Assembler Design Options
Assemblers.
Languages and the Machine Chapter 5 CS221. Topics The Compilation Process The Assembly Process Linking and Loading Macros We will skip –Case Study: Extensions.
CPS4200 System Programming 2007 Spring 1 Systems Programming Chapter 2 Assembler II.
One Pass with Fixup One-pass structure definition must occur before any uses (that is, uses can have only backward references to definitions) examples:
The LC-3 – Chapter 7 COMP 2620 Dr. James Money COMP
1 Assemblers System Software by Leland L. Beck Chapter 2.
5-1 Chapter 5 - Languages and the Machine Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles.
Ass. Prof. Dr Masri Ayob TK 6123 Lecture 13: Assembly Language Level (Level 4)
CS2422 Assembly Language and System Programming Assembler Design Options Department of Computer Science National Tsing Hua University.
1 Assemblers System Programming by Leland L. Beck Chapter 2.
Machine-Independent Assembler Features Literals, Symbol-Defining Statements, Expressions, Program Blocks, Control Sections and Program Linking.
2 : Assembler 1 Chapter II: Assembler Chapter goal: r Introduce the fundamental functions that any assembler must perform. m Assign machine address m Translate.
1 Assemblers System Software by Leland L. Beck Chapter 2.
Machine Independent Assembler Features
G.Umamaheswari Lect/IT R.M.D.EC system software
Loader and Linker.
Assembler Design Options One-Pass and Multi-Pass Assemblers.
Assemblers System Software.
Linking Loader untuk SIC/XE Machine. Lebih Lanjut mengenai Absolute Loader Shortcoming of an absolute loader –Programmer needs to specify the actual address.
CC410: System Programming Dr. Manal Helal – Fall 2014 – Lecture 4 - Assembler 1.
CS501 Advanced Computer Architecture Lecture 29 Dr.Noor Muhammad Sheikh.
One-pass structure definition must occur before any uses (that is, uses can have only backward references to definitions) examples: macro definition before.
CC410: System Programming Dr. Manal Helal – Fall 2014 – Lecture 9 - Assembler 4.
CC410: System Programming
Machine dependent Assembler Features
CC410: System Programming
Machine Independent Assembler Features
System Programming and administration
System Software by Leland L. Beck Chapter 2
Machine Independent Assembler Features
Chapter 9 : Assembler Design Options
Assembler Design Options
Assembler Design Options
Optional Assembler Features
Machine Independent Features
Assembler Design Options
A Simple Two-Pass Assembler
Optional Assembler Features 2
System Programming by Leland L. Beck Chapter 2
Machine Independent Assembler Features
Machine Independent Assembler Features
Location Counter (LC) = 0 while line of code <> END if ORG
Presentation transcript:

Assembler – Assembler Design Options

One-Pass Assemblers (1/2) Main problem  Forward references Data items Labels on instructions Solution  Data items: require all such areas be defined before they are referenced  Labels on instructions: no good solution

One-Pass Assemblers (2/2) Two types of one-pass assembler  Load-and-go Produces object code directly in memory for immediate execution  The other Produces usual kind of object code for later execution

Load-and-go Assembler (1/3) Characteristics  Useful for program development and testing  Avoids the overhead of writing the object program out and reading it back  Both one-pass and two-pass assemblers can be designed as load-and-go.

Load-and-go Assembler (2/3) Forward references handling 1. Omit the address translation 2. Insert the symbol into SYMTAB, and mark this symbol undefined 3. The address that refers to the undefined symbol is added to a list of forward references associated with the symbol table entry 4. When the definition for a symbol is encountered, the proper address for the symbol is then inserted into any instructions previous generated according to the forward reference list

Load-and-go Assembler (3/3) At the end of the program  Any SYMTAB entries that are still marked with * indicate undefined symbols  Search SYMTAB for the symbol named in the END statement and jump to this location to begin execution The actual starting address must be specified at assembly time Example  Figure 2.18, 2.19

Figure 2.18

Figure 2.19(a)

Figure 2.19(b)

Producing Object Code When definition of a symbol is encountered, the assembler must generate another Tex record with the correct operand address The loader is used to complete forward references that could not be handled by the assembler Example: Figure 2.20

Figure 2.20

Multi-Pass Assemblers Restriction on EQU and ORG  No forward reference, since symbols ’ value can ’ t be defined during the first pass Example  Use link list to keep track of whose value depend on an undefined symbol Figure 2.21

Figure 2.21 (1/5)

Figure 2.21 (2/5)

Figure 2.21 (3/5)

Figure 2.21 (4/5)

Figure 2.21 (5/5)