INDEX
1 Assembler
2 Feature of an assembly language
3 Element of an assembly language program
4 Pass structure of assembler
5 Comparison between Single pass & Multi pass assembler
ASSEMBLER
Assembler is a translator which translates an assembler language program into machine language .
Assembly language program low level language programs which are machine dependents but easier as compare to machine language.
FEATURES OF AN ASSEMBLY LANGUAGE
FEATURES OF AN ASSEMBLY LANGUAGE
• We can use mnemonic rather than numeric operation code and it also supports an indication of coding error.
• In this language symbolic operand specification is possible means operand can be represented in the form of symbolic references rather than machine address of data.
• Data can be declared by using decimal
notation.
The format of an assembly language
statement is as follow :-
[label] Mnemonic operand ,
[operand 1 , operand 2 , _ _ _ _ _ ]
The field label is optional.
ELEMENTS OF AN ASSEMBLY LANGUAGE PROGRAM
ELEMENTS OF AN ASSEMBLY LANGUAGE PROGRAM
An assembly program contain three types of
statement :-
1. Imperative statements
2. Declarative statements
3. Assembler Directive statements
PASS STRUCTURE OF PASS STRUCTURE OF ASSEMBLERS
The pass of a language processor is defined as one complete scan of the source program
or it’s equivalent representation .
There are two type of assembler :-
1. Single pass assembler
2. Multi pass assembler
1. SINGLE PASS ASSEMBLER
An assembler pass is one complete scan of source program input to the assembler or equivalent representation and a translation on a statement by statement basis would be termed as single pass translation or one pass assembler.
Analysis Synthesis
Assembly language statement
Equivalent target text
PROGRAM OF SINGLE PASS PROGRAM OF SINGLE PASS ASSEMBLER
START 100
A DS 1
B DS I
FIRST READ A
READ B
LOAD A
SUB B
TRIM LARGE B
PRINT A
STOP
LARGE B PRINT B
STOP
END FIRST
ANALYSIS PHASE
Analysis Phase
1. It isolates label, mnemonics and operand
field of a statement.
2. It enter symbol found in label field if any and address of text available machine word into symbol table.
3. It validates the mnemonic by looking it up in to the mnemonic code table.
SYNTHESIS PHASE
Synthesis Phase
1. It obtained machine op code corresponding mnemonic op code by searching mnemonic table.
2. It obtained the machine address of operand symbol table.
3. It makes synthesis of the machine instruction the machine form of constant.
MULTI PASS ASSEMBLER
• In multi pass assembler, an assembler goes through assembly language program several times and generates object code
Machine knowledgeMachine knowledgedatabase
Error routineError routine
Pass 1 Pass 2 Pass 3 Pass NIC 3IC 3IC 2IC 2IC 1IC 1
Symbol literal table Symbol literal table manage
Source code
Object code
• First pass second pass and third pass are
called as pass1, pass2, pass3 respectively.
• last passed is called as synthesis phase.
• This assembler requires several form of
intermediate codes, which are generate
by each pass.
COMPARISION BETWEEN SINGLE PASS & MULTI PASS ASSEMBLER
COMPARISION BETWEEN SINGLE PASS & MULTI PASS ASSEMBLER
• Each statement of source program is scanned by single pass assembler only one times.
• Single pass assembler is faster than multi pass.
• There is no need to construct intermediate code.
• In single pass assembler there is need to the construct TII.
• There is no probability of occuring duplication action.
• In multi pass assembler each statement is scanned more than one times.
• Multi pass assembler is slower than single pass.
• There is need to construct intermediate code.
• There is no need to the construct TII.
• There is a certain amount of duplication in the action performed by each pass.
Multi pass assemblerSingle pass assembler
THANK YOU