SHARE
SPREAD
HELP

The Tradition of Sharing

Help your friends and juniors by posting answers to the questions that you know. Also post questions that are not available.


To start with, Sr2Jr’s first step is to reduce the expenses related to education. To achieve this goal Sr2Jr organized the textbook’s question and answers. Sr2Jr is community based and need your support to fill the question and answers. The question and answers posted will be available free of cost to all.

 

#
Authors:
Linda Null ,julia Lobur
Chapter:
Marie An Introduction To A Simple Computer
Exercise:
Review Of Essential Terms And Concepts
Question:34 | ISBN:9780763704445 | Edition: 3

Question

34. Explain how an assembler works, including how it generates the symbol table, what it does with source and object code, and how it handles labels.

TextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbook

Answer

The Assembler is a Software that converts an assembly language code to machine code

  • It takes basic Computer commands and converts them into Binary Code that Computer's Processor can use to perform its Basic Operations. These instructions are assembler language or assembly language.
  • We can also name an assembler as the compiler of assembly language. This is because a compiler converts the high-level language to machine language. On the other hand, an assembler is doing the same task but, for assembly language, the name compiler of assembly language.
  • Types of Assembler

    Assemblers generate instruction. On the basis of a number of phases used to convert to machine code, assemblers have two types:

    1. One-Pass Assembler

    These assemblers perform the whole conversion of assembly code to machine code in one go.

    2. Multi-Pass/Two-Pass Assembler

    These assemblers first process the assembly code and store values in the opcode table and symbol table. And then in the second step, they generate the machine code using these tables.

  • Object code is nothing but ,machine code.

a) Pass 1

  • Symbol table and opcode tables are defined.
  • keep the record of the location counter.

b) Pass 2

  • Finally, converts the opcode into the corresponding numeric opcode.
  • Generates machine code according to values of literals and symbols.
  •  
  • Also, processes the pseudo instructions.

 The asssembler records the reference to the label name in a table and emits a jump with a dummy address. Later, when the label definition is encountered and the instruction pointer is therefore known, the assembler goes through the table of references to this label and patches in the - now known - address.

1 0

Discussions

Post the discussion to improve the above solution.