Assembler Directives
Assembler Directives
Definition: Assembler directives are the instructions used by the assembler at the time of
assembling a source program. More specifically, we can say, assembler directives are the
commands or instructions that control the operation of the assembler.
Assembler directives are the instructions provided to the assembler, not the processor as the
processor has nothing to do with these instructions. These instructions are also known as pseudo-
instructions or pseudo-opcode.
define the start and end of different segments, procedures or macros etc. of a program.
We know that assembly language is a less complex and programmer-friendly language used to
program the processors. In assembly language programming, the instructions are specified in the
form of mnemonics rather in the form of machine code i.e., 0 and 1. But the microprocessor or
microcontrollers are specifically designed in a way that they can only understand machine
language.
Thus assembler is used to convert assembly language into machine code so that it can be
understood and executed by the processor. Therefore, to control the generation of machine codes
from the assembly language, assembler directives are used. However, machine codes are only
generated for the program that must be provided to the processor and not for assembler directives
because they do not belong to the actual program.
The assembler directives given below are used by 8085 and 8086 assemblers:
This directive is used for the purpose of allocating and initializing single or multiple data bytes.
assemblewr directive - DB
Memory name AREA has three consecutive locations where 30H, 52H and 35H are to be stored.
representation of DB
These two 16-bit data 1020H and 4216H are stored at 4 consecutive locations in the memory
MARK.
representation of DW
EQU: Equate
Shows the beginning of macro along with defining name and parameters.
ORG: Origin
This directive is used at the time of assigning starting address for a module or segment.
By this instruction, the assembler gets to know that the statements following this instruction,
must be stored in the memory location beginning with address 1050H.
It provides information to the assembler regarding the name of the program or data segment for
that particular segment.
assembler directive - ASSUME
This directive specifies that the instruction of the source program is stored in logical segment
_DONE.
This directive allows the initialization of single or multiple data in the form of double words (i.e.,
4 bytes). The is used to inform the assembler that the stored data in memory is a double word.
assembler directive - DD
representation of DD
It is used to initialise quad words (8-bytes) either one or more than one. Thereby informing the
assembler that the data stored in memory is quad-word.
DUP: Duplicate
DUP allows initialization of multiple locations and assigning of values to them. This allows
storing of repeated characters or variables in different locations.
assembler directive - DUP
So this permits the storing of these data in memory and creating 8 identical sets in the memory
identified as Book.
representation of DUP
This directive is used to indicate that the operand is of double word size.
PROC: Procedure
FAR: This directive is a type specifier that is used by the assembler to declare intersegment call
(i.e., call from different segment).
NEAR: This is used for intrasegment call i.e., a call within the same segment.
This directive defines the termination of a particular memory segment as it is specified by its
name
The statements within the segment are nothing but the program code.
EVEN: It is used to inform the assembler to align the data beginning from an even address.
As data specified with an odd starting address requires 2 byte accessing. Thus using this
directive, data can be aligned with an even starting address.
PTR: Pointer
PUBLIC: This directive is used to provide a declaration to variables that are common for
different program modules.
SHORT: This is used in reference to jump instruction in order to assign a displacement of one
byte.
THIS: It is used along with EQU directive for setting the label to either, byte, word or double-
word.
So, these assembler directives are used by the processors for controlling the generation of
machine code and organization of the program.