0% found this document useful (0 votes)
21 views

Directives Lecture

The document discusses various assembler directives used in assembly language programming including DB, DW, DD, DQ, DT, SEGMENT, ENDS, END, EQU, LENGTH, OFFSET, PROC, ENDP, LABEL, PUBLIC and TYPE. The directives provide instructions and information to the assembler to perform tasks during the assembly process like defining variables, reserving memory, indicating segments and procedures.

Uploaded by

KONARK TANWAR
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Directives Lecture

The document discusses various assembler directives used in assembly language programming including DB, DW, DD, DQ, DT, SEGMENT, ENDS, END, EQU, LENGTH, OFFSET, PROC, ENDP, LABEL, PUBLIC and TYPE. The directives provide instructions and information to the assembler to perform tasks during the assembly process like defining variables, reserving memory, indicating segments and procedures.

Uploaded by

KONARK TANWAR
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 17

Directives

of
8086
Definition
• Assembler directives are instructions that direct
the assembler to do something.

• An assembler directive is a statement to give


direction to the assembler to perform task of the
assembly process. It control the organization if the
program and provide necessary information to
the assembler to understand the assembly
language programs to generate necessary machine
codes.
Assembly Language Statements

• Assembly language programs consist of three


types of statements −

• Executable instructions or instructions

• Assembler directives or pseudo-ops, and

• Macros
ASSUME

• This directive tells the assembler the name of the


logical segment use for a specified predefined
physical segment.
For example

  -> ASSUME CS:CODE

-> ASSUME DS:DATA


DB (DEFINE BYTE)
• The DB directive is used to declare a byte type
variable, or to set one or more storage locations
of type byte in memory.
• For example

PRICE DB 49h, 98h, 29h

NAME DB ABCDEF
DW: DEFINE WORD
• It is used to define a variable of type word i.e.
assembler reserves the no. of memory words
16-bits.
• EXAMPLE:

MULTIPLIER DW 437Ah

EXP1 DW 1234h, 3456h, 5678h


DD: DEFINE DOUBLEWORD
reserve 2 words of storage in memory
Example, TEMP DD 25629261h DQ :

DQ:DEFINE QUADWORD ;
reserve 4 words of storage in memory

DT : Define Ten Bytes


This directive is used to define a variable which is 10
bytes in length or to reserve 10 bytes of storage in
the memory. 
SEGMENT
• SEGMENT : Indicate start of a logical segment

CODE SEGMENT
• ENDS : Indicate end of a logical segment

CODE SEGMENT WORD

CODE SEGMENT PUBLIC


END (END PROCEDURE)
• The END directive is put after the last
statement of a program
EQU (EQUATE)
• EQU (EQUATE) EQU is used to give a name to
some value or symbol.
• Example:

FACTOR EQU 03H


LENGTH
• LENGTH is an directive, which tells the
assembler to determine the number of
elements in some named data item, such as a
string or an array.
• Example:
LENGTH Name of string or an array

MOV CX, LENGTH


OFFSET
• OFFSET is an operator, which tells the
assembler to determine the offset or
displacement of a named data item.

MOV BX, OFFSET PRICES


PROC (PROCEDURE)
• The PROC directive is used to identify the start
of a procedure.
• Example:
DIVIDE PROC FAR
ENDP (END PROCEDURE)
• ENDP directive is used along with the name of
the procedure to indicate the end of a procedure
to the assembler.
LABEL
• LABEL as an assembler uses a location counter
to be keep track of how many bytes it is from
the start of a segment at any time.
PUBLIC
• The PUBLIC directive is used to tell the
assembler that a specified name or label will
be accessed from other modules.
TYPE
• The TYPE operator tells the assembler to
determine the type of a specified variable.

• For a byte-type variable, the assembler will


give a value of 1,
• For a word-type variable, give a value of 2,
• For a double word-type variable, give a value
of 4.

You might also like