Assembler

8,288 views

Published on

Published in: Education, Technology
2 Comments
6 Likes
Statistics
Notes
No Downloads
Views
Total views
8,288
On SlideShare
0
From Embeds
0
Number of Embeds
43
Actions
Shares
0
Downloads
322
Comments
2
Likes
6
Embeds 0
No embeds

No notes for slide

Assembler

  1. 1. ASSEMBLER
  2. 2. WHAT IS ASSEMBLER? <ul><li>An assembler is a program that converts an assembly level language code (also called as mnemonic code) into machine language code and provides necessary information for the loader to load the programme. </li></ul>
  3. 3. Assembler languages-structure <ul><li>Label </li></ul><ul><ul><li>symbolic labeling of an assembler address (command address at Machine level) </li></ul></ul><ul><li>Mnemomic </li></ul><ul><ul><li>Symbolic description of an operation </li></ul></ul><ul><li>Operands </li></ul><ul><ul><li>Contains of variables or addresse if necessary </li></ul></ul><ul><li>Comments </li></ul><ul><ul><li>ignored by assembler </li></ul></ul><ul><ul><li>used by humans to document/understand programs </li></ul></ul><ul><ul><li>tips for useful comments: </li></ul></ul><ul><ul><ul><li>avoid restating the obvious, as “decrement R1” </li></ul></ul></ul><ul><ul><ul><li>provide additional insight, as in “accumulate product in R6” </li></ul></ul></ul><Mnemomic> <Operand> Comments <Label>
  4. 4. TYPES OF STATEMENT OF ASSEMBLER STATEMENTS IMPERATIVE STATEMENTS DECLARATIVE STATEMENT ASSEMBLER DIRECTIVE STATEMENTS
  5. 5. ASSEMBLER PROCESS ASSEMBLY LANGUAGE PROGRAM PASS1 PASS2 EXECUTABLE IMAGE SYMBOL TABLE <ul><li>First Pass: </li></ul><ul><ul><li>scan program file </li></ul></ul><ul><ul><li>find all labels and calculate the corresponding addresses; this is called the symbol table </li></ul></ul><ul><li>Second Pass: </li></ul><ul><ul><li>convert instructions to machine language, using information from symbol table </li></ul></ul>
  6. 6. OVERVIEW PASS1
  7. 7. PASS 2 Overview: Evaluate Fields and Generate Code.
  8. 8. Assembler’s functions <ul><li>Convert mnemonic operation codes to their machine language equivalents </li></ul><ul><li>Convert symbolic operands to their equivalent machine addresses . </li></ul><ul><li>Build the machine instructions in the proper format </li></ul><ul><li>Convert the data constants to internal machine representations </li></ul><ul><li>Write the object program and the assembly listing </li></ul>
  9. 9. Linking and Loading <ul><li>Loading is the process of copying an executable image into memory. </li></ul><ul><ul><li>more sophisticated loaders are able to relocate images to fit into available memory </li></ul></ul><ul><ul><li>must readjust branch targets, load/store addresses </li></ul></ul><ul><li>Linking is the process of resolving symbols between independent object files. </li></ul><ul><ul><li>suppose we define a symbol in one module, and want to use it in another </li></ul></ul><ul><ul><li>some notation, such as . EXTERNAL , is used to tell assembler that a symbol is defined in another module </li></ul></ul><ul><ul><li>linker will search symbol tables of other modules to resolve symbols and complete code generation before loading </li></ul></ul>
  10. 10. DATABASES USED BY PASS1 AND PASS2
  11. 11. ADVANTAGES <ul><li>It used mnemonics instead used bits. </li></ul><ul><li>Address are symbolic not absolute. </li></ul><ul><li>Reading / understand program easily. </li></ul><ul><li>Introduction to data is easier. </li></ul>
  12. 12. DISADVANTAGES <ul><li>Working with assembler takes a little more time, through not as much as people are wont to think. </li></ul><ul><li>Assembler offers more facilities for structuring, even though lacking craftsmanship will bring on maintenance problems more easily. </li></ul><ul><li>In assembler one has more possibilities for solving or preventing performance problems. </li></ul><ul><li>It takes some extra effort to find or train professionals. </li></ul>

×