You are on page 1of 3

EXPERIMENT NO.

: - 01

Title: Two Pass Assembler

Aim: - Design and implementation of pass1 of two-pass assembler for general machine.

System Software/ Instruments/ Equipment’s Requirements: - gedit, gcc

Theory/ Working Principle:


If the source program is in assembly language of the machine, the object code is in the machine
language of same machine and translation is executing on the same machine. Assembler
generates two files. One is object file with .obj extension and the other is list file with .lst
extension. The object file contains the binary code for instruction and information about
object instruction. The list file contains assembly language statements, binary code for
each instruction and offset for each instruction
There are two phases of assembler design :
 Analysis phase

2. Synthesis phase
These phases performs following tasks :
1. Analysis phase :
1.a.a) Isolate label, mnemonic opcode, operands and comment of statement.
1.a.b) Check validity of mnemonic opcode by consulting MOT.
1.a.c) Check the no. of operands required for an instruction by consulting MOT.
1.a.d) Process the labels or symbols appropriately and fill ST(Symbol Table).
1.a.e) Update LC appropriately by consulting MOT for the length of instruction.
1.a.f) Ignore comments.
1.a.g) Take proper actions for pseudo opcodes by consulting POT.
2. Synthesis phase :
1.a) Obtain machine opcode consulting to MOT corresponding to mnemonic.
1.b) Filll in address of symbols or labels by consulting ST.
1.c) Write the above information in output object file.
// Draw flowchart for PASS1

Program:

Output:
Conclusion: - Successfully designed pass 1 in Two pass assembler.

You might also like