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 :
(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 :
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 :
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.