Assembler pass structure system software




    1. Assembler:

Elements of Assembly Language Programming

Simple Assembly Scheme

Pass structure of Assemblers



Introduction to Assembly Language: -

    1. Assembly language also known as low level because of it directly works with the internal structure of CPU.

    2. To write a program in assembly language a programmer must have the knowledge of all the registers in CPU.

    3. Assembly language is introduced a symbols for the machine level code instruction and this symbol is known as mnemonics.

    4. In assembly language program, program is consisting of mnemonic that is translated into machine code and program that is used for this conversion is known as assembler.

Advantages of using assembly languages are as follows:-

a. Languages required less memory and less execution time.

b. This language is suitable for time-critical jobs.

c. Assembly language allows hardware specific complex jobs in easier way.

An assembly program sum of two numbers using Clanguage: -

1.   #include<stdio.h>  

2.   void main() {  

3.      int a = 10, b = 20, c;  


5.      asm {  

6.         mov ax,a  

7.         mov bx,b  

8.         add ax,bx  

9.         mov c,ax  

10.    }  


12.    printf("c= %d",c);  

13.    }  


Output: - 30

Steps for creating, assembling and running an assembly level language are as follows (Click on Fig for clear view): -




Editors like MS Dos program that comes with all Microsoft operating system can be used for creating or edit a language program.

Assembler Program: -

Assembler is used for converting the Assembly language instruction into machine code and it is produced the .obj file (object file) and .lst file (list file).

Linker Program: -

Linker is a program used for generating one or more object files and producers and object file with an extension .abs.

OH Program: -

OH program faces the abs file and feed it to program called OH (it creates a file with an extension hex that is ready for burn in to the ROM).


Elements of Assembly language programming: -

Compared to Machine Language of a computer system it provides three basic features which simplify programming: -

    1. DATA Section

    2. BSS Section

    3. TEXT section

DATA Section: -

    a. For declaration and initialization of data are constants we use data section and the data does not change at runtime.

    b. In this section we can declare constants, file names or size of the buffer etc.

    c.     Syntax : -



BSS Section: -

    a. For declaring variables we use BSS section and it stands for Block Started by Symbol.

    b. BSS section leads to very important practical advantage during program modification.

    c.     Syntax: -


TEXT Section: -

    a. For keeping the actual code text section is used and it must begin with declaration Global main.

    b. We use mnemonic operation codes which are also known as mnemonics opcodes.

    c. Global main tails the kernel where the program execution begins.

    d. Syntax


global main



   Syntax of Assembly Language Statements: -

    [label] mnemonic [operands]   [;comment]

The hello word program: -


    global main


mov edx, len

moc ecx, msg

mov ebx,1

move eax,4

int 0x80

move eax,1

int 0x80


msg db HELLO WORLD!!

len equ $ - msg




A simple Assembly Scheme: -

    In a simply assembly scheme each statement has two operands: -

a. First Operand is always a register which can be any one of AREG, BREG, CREG, & DREG.

b. Second Operand refers to memory word using a symbolic name and operation displacement.

 (Click on Fig for clear view)

Pass Structure of Assembler: -

1. The work of assembler is in a program to convert instruction written in low level assembly code into relocatable machine code and generating information for the loader.

2. Assembler generates instruction of symbols or mnemonics in Operation field and find the values of symbol to produce machine code.

3. If assembler does this work in one scan or in a single scan then it is called single pass assembler.

4. If assembly takes multiple scans then called multiple pass assemblers


Single Pass Assembler: -

   1. Single pass assembler defines symbols and literals and separates the symbol, mnemonic opcode & operand fields.

    2. Single pass assembler will perform analysis.

    3.  It builds the symbol table and literal table to remember them respectively.

    4. Keep track of location counter (LC) and perform processing.

    5. Process pseudo-operations and construct intermediate representation.


Two Pass Assembler: -

    1. Two pass assembler forwards references easily and uses symbol table, IR (Instruction Register) and gives TP (Target Program).

   2. Two pass assembler generates object code by converting symbolic opcode into respective numeric opcode.

    3. It generates data for literals and look for values of symbol.

    4. We can say that synthesis is performed by second pass assembler.


 (Click on Fig for clear view)




No comments:

Post a Comment

Please do not enter any spam link in the comment box and use English and Hindi language for comment.

Latest Update

Key Components of XML

Popular Posts