0% found this document useful (0 votes)
9 views21 pages

Unit-2 Mic

The document outlines various assembly language directives including RECORD, EQU, ORG, ALIGN, EVEN, LABEL, DUP, and program organization directives like ASSUME, SEGMENT, and ENDS. It also details value returning attributes such as LENGTH, SIZE, OFFSET, SEG, and TYPE, as well as procedure definition directives PROC and ENDP. Each directive is explained with its general form and examples to illustrate its usage in assembly programming.

Uploaded by

shaikhabaaz75
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views21 pages

Unit-2 Mic

The document outlines various assembly language directives including RECORD, EQU, ORG, ALIGN, EVEN, LABEL, DUP, and program organization directives like ASSUME, SEGMENT, and ENDS. It also details value returning attributes such as LENGTH, SIZE, OFFSET, SEG, and TYPE, as well as procedure definition directives PROC and ENDP. Each directive is explained with its general form and examples to illustrate its usage in assembly programming.

Uploaded by

shaikhabaaz75
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 21

RECORD:

• The directive RECORD is used to define a bit pattern within a byte or a


word.
• It is similar to the bit-wise access in C language.
• The RECORD definition helps in encoding or decoding of bit for which
some meaning is assigned.
• General form:
Record_name RECORDField_Specification_1.... Field_Specificationn_N
EQU: Equate to
• The EQU directive is used to declare the I symbols to which some constant
value is assigned.
• Such symbols are called as macro symbols, So macro assembler will replace
every occurrences of the symbol in a program by its value.
• General Form
Symbol name EQU Expression

ORG-Originate:
• The directives ORG assigns the location counter with the value specified in the
directive. The ORG statement changes the starting offset address of the data.
• General Form
ORG [$+] Numeric _value
ALIGN: Alignment of memory addresses
• The directive ALIGN is used to force the assembler to align the next data
item or instruction according to given value.
• General Form:
ALIGN Numeric_value
EVEN: Align as even memory location
The directive EVEN is used to inform the assemble to increment the
location counter to the next even memory address. If it is location counter
is already pointing to even memory address, it should not be incremented.
The 8086 processor read a word from the memory in one bus cycle while
accessing an even memory address word.
General Form:
EVEN
LABEL
• The directive LABEL enables you to redefine the attribute of a data
variable or instruction label.
• General form :
Variable Name LABEL Type_Specifier
• Examples
TEMP LABEL BYTE
NUM LABEL WORD
DUP: Duplicate memory location
The DUP directive can be used to generate multiple bytes or words with
known as well as un-initialized values.
General form: DUP?
Example
Table dw 100 DUP(0)
Stars db 50 dup(*)
ARRAY3 DB 30 DUP(?)
• Program Organization Directive
• ASSUME
• SEGMENT
• ENDS: END OF THE SEGMENT
• END:END OF THE PROGRAM
• CODE: Simplified CODE Segment directive
• DATA: Simplified DATA Segment directive
• STACK: Simplified Stack Segment directive
• MODEL: Memory model declaration for segments.
• ASSUME
• The directive ASSUME informs the assembler the name of the logical
segments that should be used for a specified segment.
• When program is loaded, the processor segment register should point
to the respective logical segments.
• General form:
ASSUME Seg_Reg: Seg_Name
Where,
ASSUME is a assembler directive.
Seg_Reg is any of the segment register i.e. CS,DS,SS.ES.
Seg_Name is the name of an user defined segment.
Example- ASSUME CS:CODE,DS:DATA.
SEGMENT
• The directive SEGMENT is used to indicate the beginning of the logical
segment.
• The directive SEGMENT follows the name of the segment.
General form:
SEGMENT_Name SEGMENT
Example
DATA SEGMENT…..
……………Program Data definition here
DATA ENDS
CODE SEGMENT….
……………Program Code definition here
CODE ENDS
ENDS: END OF THE SEGMENT
• The directive ENDS informs the assembler the end of the segment.
• the directive ENDS and SEGMENT must enclosed the segment data or
code of the program.
• General form: SEGMENT_Name ENDS
• Example
DATA SEGMENT……..
……Program Data definition here
DATA ENDS
CODE SEGMENT……
…..Program Code definition here
CODE ENDS
CODE: Simplified CODE Segment directive
This simplified segment directive defines the code segment.
All executable code must be placed in this segment.
General form: CODE.CODE[NAME]

DATA: Simplified DATA Segment directive


This simplified segment directive defines the data segment for
initialized near data.
All data define mande declaration must be placed in this segment.
General form: DATA.DATA
STACK: Simplified Stack Segment directive
• This simplified segment directive define the stack segment
• Default size of the stack is 1024 bytes.
• General form:
• STACK .STACK100
MODEL:
• MODEL: Memory model declaration for segments.
• This simplified segment directive creates default segments.
• General form: MODEL .MODEL memory_small
Value Returning Attribute Directive

• LENGTH
• SIZE
• OFFSET
• SEG: SEGMENT
• TYPE
LENGTH
• The directive LENGTH informs the assembler about the number of the
elements in a data items such as array.
• If the array is defined with DB, then it returns number of bytes
allocated to a variable.
• General form:-
LENGTH Variable_Name
EXAMPLE:-
MOV CX, LENGTH NAME
SIZE
• The directive SIZE is same as Length except that it returns number of
bytes allocated to a variable or data item instead of the number of
elements in it
• General form:-
SIZE Variable_Name
EXAMPLE:-
MOV CX, SIZE NAME
OFFSET
• The directive OFFSET informs the assembler to determine the
displacement of the specified variable w.r.to the base of the segment.
• It usually used to load a offset of a variable into the register.
• Using OFFSET value ,a variable can be referred indexed addressing
mode
• General form:-
OFFSET Variable Name
EXAMPLE:-
MOV SI, OFFSET ARRAY
MOV DX, OFFSET MSG
SEG
• The directive SEG is used to determine the segment in which the
specified data items is defined.
• General form:-
SEG Variable_Name
• EXAMPLE:-
MOV DS, SEG MSG
TYPE-
• The directive TYPE is used to determine the type of the data items.
• General form:-
TYPE Variable_Name
• EXAMPLE:- ADD BX, TYPE NUM
# Procedure Definition Directive

• PROC : PROCEDURE
• ENDP: END OF PROCEDURE
Procedure Definition Directive: PROC
• PROC The PROC directive is used to identify the start of a procedure.
• The term near or far is used to specify the type of the procedure if the
term is not specified, then assembler assumes NEAR as a type
Specifies.
• General Form:
Procedure_name PROC [NEAR/FAR]
EXAMPLE:
ADD PROC NEAR
…...PROCEDURE CODES
ADD ENDP
• Procedure Definition Directive: ENDP
• ENDP: END OF PROCEDURE
• ENDP The directive is used along with the name of the procedure to
indicate the end of a procedure to the assembler.
• General Form :
Procedure name ENDP
EXAMPLE:
FACTORIAL ENDP
# MACRO Definition Directive

• MACRO
• ENDM: END OF MACRO

You might also like