0% found this document useful (0 votes)
267 views12 pages

Elements of Assembly Language Programming

SS and OS elements of assembly language

Uploaded by

Simal Jaan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
267 views12 pages

Elements of Assembly Language Programming

SS and OS elements of assembly language

Uploaded by

Simal Jaan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

ELEMENTS OF ASSEMBLY

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.

Assembly language Machine language


program
Assembler program
Elements of The Assembly Language Programming
An Assembly language is a machine dependent,low level programming
Language specific to a certain computer system.Three feature when
Compare with machine language are,

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.

[Label] <opcode> <operand spec>[<operand spec>..]

❖ <opcode> is the mnemonic opcode.


❖ Where the notation[…]indicates that the enclosed specification is optional
❖ <operand spec> has the following syntax:

<symbolic> [+<displacement>] [(<index register>)]

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).

The DC (Declare constant) statement constructs memory words containing constants .


Eg:- ONE DC ‘1’
associate name ONE with a memory word containing value ‘1’.
Use of constants

The DC statement does not really implement constants it just initializes


memory word to given values.The values are not protected by the
assembler and can be changed by moving a new values.The values are
not protected by the assembler and be changed by moving a new value
into the memory word.in the above example ,the value of ONE
Can be changed by excuting an instruction MOVEM BREG,ONE.

an Assembly program can use constants,in two ways.


a) As immediate operands,
b) As literals
a) Immediate operands:
it can be used in an assembly statement only if the architecture
Of the target machine includes the necessary features .
Eg:- ADD AREG,5

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

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy