Elements of Assembly Language Programming
Elements of Assembly Language Programming
LANGUAGE PROGRAMMING
P RE SE N T E D B Y AM I N N O U R I N K . A
ASSEMBLER
Use of symbols in programming is to improve readability.Giving symbols names for
each instruction(eg: symbolic names ADD is used to represent addition),these names
are called mnemonics and a program written using these symbols are called as
Assembly language Program.
An assembler is a program which translates source code written in
assembly language to equivalent object code in machine language.
Basic feature of
assembly language
Mnemonics operation
Symbolic Operand Data Declaration
code
➢ Mnemonic Operation Code:
The mnemonic operation codes for machine instructions (also called mnemonic opcodes)
are easier to remember and use than numeric Operation codes.
eg:-ADD,SUB,MOVE etc.
➢ Symbolic Operands:
A programmer can associate symbolic names with data or instructions and use these
symbolic names as operands in assembly statements.
eg:-ADD R1,R2,R3
➢ Data Declaration:
Data can be declared in a variety of notations including the Decimal notation.
eg:-NUM1 03 OR
NUM1 0011H
Statement Format
An assembly language statement has the following format.
eg:-AREA,AREA+5,AREA(4),AREA+5(4)
The first specification refer to the memory word with which the name AREA is associated.The
second specification refers to the memory word 5 words away from the word with the name
AREA.Here 5 is the Displacement or offset from AREA.The third specification implies indexing with
Index register 4-ie,the operand address is obtained by adding the content of Index register 4 to the
address of AREA.the last specification is a combination of the previous two combinations.
Some mnemonic opcodes for machine instruction
Assembly Language Statements
An assembly program contains three kinds of statements:
• Imperative statements
• Declaration statements
• Assembler Directives
❑ Imperative Statements:
They indicate an action to be performed during the execution of an Assembled program .Each
imperative statement is translated into One machine instruction.
Eg:ADD,SUBB,DIV,PRINT etc.
❑Declaration statements:
syntax of declaration statements is as follows:
[Label] DS <constant>
[label] DC ‘<Value>’
The DS(declare storage) statement reserves areas of mamory and associates names
With them.
Eg:- A DS 1
Reserve a memory area of 1 word, associating the name A to it.
Eg:- G DS 200
Reserve a block of 200 words and the name G is associated with the first word of
the block.Other words of the block.Other words in the block can be accessed through of
fsets from G(G+5 is the6th word of memory block etc).
This is transilated into an instruction from two operands AREG and the value’5’ as
an immediate operand.
b) Literal(constant):
It is an operand with the syntax=‘<value>’.it differ from a constant
Because its location cannot Be specificed in the assembly program.its value does not
Change during the execution of the program.
Eg:- ADD AREG,=‘5’.
❑ Assembler directives
Assembler directives instruct the assembler to perform certain
Action during the assembly of a program.some assembler directive
Are described in the following.
1)START
Syntax: START<CONSTANT>
This directive indicates that the first word of the target Program generated by the assembler should
be placed in the memory Word having address.
2)END
Syntax: END [<operand spec>]
This directive indicates the end of the source program.the optional
Indicates the address of the instruction where the execution of the program begin.
THANK YOU