Professional Documents
Culture Documents
Assembler Directives of 8085
Assembler Directives of 8085
What is an Assembler?
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:
DB: Define Byte
This directive is used for the purpose of allocating and initializing single or multiple data
bytes.
Memory name AREA has three consecutive locations where 30H, 52H and 35H are to be
stored.
DW: Define Word
It is used for initialising single or multiple data words (16-bit).
These two 16-bit data 1020H and 4216H are stored at 4 consecutive locations in the memory
MARK.
END: End of program
This directive is used at the time of program termination.
EQU: Equate
It is used to assign any numerical value or constant to the variable.
MACRO: Represents beginning
Shows the beginning of macro along with defining name and parameters.
ENDM: End of macro
ENDM indicates the termination of macro.
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.
This directive specifies that the instruction of the source program is stored in logical segment
_DONE.
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.
So this permits the storing of these data in memory and creating 8 identical sets in the
memory identified as Book.
DWORD: Double word
This directive is used to indicate that the operand is of double word size.
PROC: Procedure
It defines the starting of a procedure/subroutine.
FAR: This directive is a type specifier that is used by the assembler to declare intersegment
call (i.e., call from different segment).
Procedure is used outside the code segment
NEAR: This is used for intrasegment call i.e., a call within the same segment.
Procedure is used inside the code segment
ENDP: End of procedure
This directive shows the termination of a procedure.
ENDS: End of 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
This directive shows information regarding the size of the operand.
This shows legal near jump to BX.
PUBLIC: This directive is used to provide a declaration to variables that are common for
different program modules.
STACK: This directive shows the presence of a stack segment.
0B97:0000 01 02 03 04 05
Program to check whether a number is Even or Odd using Macro > Assembly
Language
Microprocessor
ASSUME CS:CODE,DS:DATA
DATA SEGMENT
MSG DB 10,13,'ENTER A NUMBER = $'
MSG1 DB 10,13,'NUMBER IS EVEN $'
MSG2 DB 10,13,'NUMBER IS ODD $'
DATA ENDS
CODE SEGMENT
START:
MOV BX,DATA
MOV DS,BX
PRINT MSG
MOV AH,01H
INT 21H
SAR AL,01
JC ODD
PRINT MSG1
JMP TERMINATE
ODD:
PRINT MSG2
TERMINATE:
MOV AH,4CH
INT 21H
CODE ENDS
END START
/*
OUTPUT-------------
C:\Users\student>CD C:\Tasm 1.4\Tasm
C:\TASM1~1.4\Tasm>TLINK ODDEVE
Turbo Link Version 2.0 Copyright (c) 1987, 1988 Borland International
Warning: no stack
C:\TASM1~1.4\Tasm>ODDEVE
ENTER A NUMBER = 2
NUMBER IS EVEN
C:\TASM1~1.4\Tasm>ODDEVE
ENTER A NUMBER = 1
NUMBER IS ODD
C:\TASM1~1.4\Tasm>
*/