Featured

    Featured Posts

Explain directives used in assembly language program ?


Explain directives used in assembly language program ? 

       Assembler directories : Assembler directives are statements which give direction to the assembler to perform the task of assembly process. These are not translated into machine code.

        Commonly used assembler directive in 8086 assembly language programming are explained below :
(i) ASSUME : The assume directive is used to tell the assembler the name of the logical segment it should used for a specified segment. The statement ASSUME CS:CODE for example tells the assembler that the instructions for a program are in a logical segment named CODE. The statement ASSUME DS: DATA tells the assembler that for any program instruction which refers to the data segment, it should use the logical segment called DATA. If, for example, the assembler reads the statement MOV AX,[BX] after it reads this ASSUME, it will know that the memory location referred to by [BX] is in the logical segment DATA.

(ii) ALIGN : The align directive is used to align the next segment at an address divisible by specified number. The general syntax for this directive is a shown below :
ALIGN n
where n can be 2, 4, 8 or 16

(iii) CODE : The code directive is used to provide shortcut in definition of the code segment. General syntax for this directive is shown below : 
code [name]
The name is optional

(iv) DATA :  The data directive is used to provide shortcut in definition of the data segment.

(v) GROUPS : A program may contain several segments of the same type i.e code, data, or stack. The purpose of the GROUP is to collect them all under one hut, so that they reside within one segment, usually a data segment.
     Format : Name GROUP Seg -name,....., Seg-name.
(vi) LENGTH : It is an operator which tells the assembler to determine the number of elements in some named data item such as string or array.

(vii) MACRO and ENDM : The macros in the program can be defined by MACRO directive. ENDM directive is used along with the MACRO directive. ENDM defines the end of the macro.

(viii) NAME : The name directive is used at the start of a source program to give specific names, to each assembly module.

(ix) ORG : It is an assembler that uses a location counter to account for its relative position in a data or code segment.
     Format : ORG expression

(x) OFFSET : It is an operator which tells the assembler to determine the offset or displacement of a named data item ( variable) from the start of the segment which contains.

(xi) PAGE : The PAGE directive help to control the format of a listing of an assembled program. At the start of a program the PAGE directive specifies the maximum number of lines to list on a page and the maximum number of characters on a line.
     Format : PAGE [length], [width]

(xii) ENDP : ENDP directive is used along with PROC directive. ENDP defines the end of the procedure.

(xiii) TYPE : It is an operator which tells assembler to determine the type of specified variable. Assembler determines the type of specified variable in number of bytes. For byte type variable the assembler gives a value of 1. For word type variable the assembler gives a value of 2 and for double word type variable the assembler gives a value of 4.

Post a Comment

www.CodeNirvana.in

www.posthatke.com. Powered by Blogger.

Google+ Followers

Copyright © www.posthatke.com | Blogger Templates | Designed By posthatke.com