You are on page 1of 9

Assembler

• The assembler is a software utility that takes an assembly program as


input and produces object code as output. The object code is a binary
file. The assembler views this file as a block of memory starting at
relative location 0.
Assembler

Assembly
Language Assembler Machine Code
Program

Single Pass TwoPass


2 Pass Assembler
• Pass 1
Takes an assembly language program as input and generates an
Intermediate code.
Looks for Labels, symbols and literals and make a table of that.
Pass 2
Assembly language program into machine code.
We use different data structures for creating the intermediate code.
High Level Programming Language Lowe level Assembly Programming Language
Python/ C++ Device Drivers/ Embedded/ Real Time systems
“Hello World” STR 5

Interpreter/ Compiler Assembler

Executable Machine Code/ Able to be processed by the CPU


0011010100001110
Types of Assemblers
• There are two general approaches to assemblers: the two-pass
assembler and the one-pass assembler.
1. One Pass Assembler
2. Two Pass Assembler
2 Pass Assembler
• We look first at the two-pass assembler, which is more common and
somewhat easier  to understand. The assembler makes two passes
through the source code (Figure B.4):
2 Pass Assembler
Symbol
Table
Variables/Labels

Literal
Table
Constants

Assembly Pass 1 Pass 2 Object


Analysis Synthesis Linker Executable
Code Analysis Synthesis
Code

Opcode
Executable Loader
Opcode - Binary

You might also like