










Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!











M. Krishna Kumar^
MAM/M2/LU6/V1/
-^ Defined Byte. ¾^ DD^ -^ Defined Double Word ¾^ DQ^ -^ Defined Quad Word ¾^ DT^ -^ Define Ten Bytes ¾^ DW^ -^ Define Word
M. Krishna Kumar^
MAM/M2/LU6/V1/ ¾^ ASSUME
Directive
The ASSUME directive is
used to tell the assembler that the name of the logical segmentshould be used for a specified segment. The 8086 worksdirectly with only 4 physical segments: a Code segment, a datasegment, a stack segment, and an extra segment. ¾ Example:ASUME
;This tells the assembler
that the logical segment named CODE contains the instructionstatements for the program and should be treated as a codesegment.^ ASUME
;This tells the assembler
M. Krishna Kumar^
MAM/M2/LU6/V1/ ¾^ DW^
-^ The DW directive is used to define a variable of type word or to reserve storage location of typeword in memory. ¾ Example:MULTIPLIER
437Ah ;
this declares a
variable of type word and named it as MULTIPLIER. Thisvariable is initialized with the value 437Ah when it is loadedinto memory to run.^ EXP1 DW
1234h, 3456h, 5678h ;
this declares an
array of 3 words and initialized with specified values.^ STOR
DUP(0);^ Reserve an array
M. Krishna Kumar^
MAM/M2/LU6/V1/ ¾^ END^
-^ END directive is placed after the last statement of a program to tell the assembler that this is the endof the program module. The assembler will ignore anystatement after an END directive. Carriage return is requiredafter the END directive. ¾ ENDP^ -^ ENDP directive is used along with the name of the procedure to indicate the end of a procedure to theassembler ¾ Example:SQUARE_NUM
; It start the procedure ;Some steps to find the square root of a number SQUARE_NUM
ENDP^ ;Hear it is the End for the procedure
M. Krishna Kumar^
MAM/M2/LU6/V1/ ¾^ ENDS^
-^ This ENDS directive is used with name of the segment to indicate the end of that logic segment. ¾ Example:CODE
;Hear it Start the logic;segment containing code ; Some instructions statements to perform the logical;operation CODE^
;End of segment named as;CODE
M. Krishna Kumar^
MAM/M2/LU6/V1/ ¾^ EQU^
-^ This EQU directive is used to give a name to some value or to a symbol. Each time the assembler findsthe name in the program, it will replace the name with thevalue or symbol you given to that name. ¾ Example:FACTOR
03H^ ; you has to write this statement at the starting of your program and later in theprogram you can use this as follows^ ADD
; When it codes this
M. Krishna Kumar^
MAM/M2/LU6/V1/ ¾^ Example
: DATA1 SEGMENT ; Location counter will point to 0009 after assembler reads;next statement SALES DB 9 DUP(?)
;declare an array of 9 bytes EVEN^
; increment location counter to 000AH RECORD DW 100 DUP( 0 )
;Array of 100 words will start ;from an even address for quicker read DATA^
M. Krishna Kumar^
MAM/M2/LU6/V1/ ¾^ GROUP
Group Related Segments ¾^ LABLE ¾^ NAME ¾^ OFFSET ¾^ ORG^
-^ Originate
M. Krishna Kumar^
MAM/M2/LU6/V1/ ¾^ PROC
Procedure ¾^ PTR^
-^ Pointer
M. Krishna Kumar^
MAM/M2/LU6/V1/ ¾^ PROC
The^ PROC
directive is used to identify the
start of a procedure. The term near or far is used to specify thetype of the procedure. ¾ Example:^ SMART
; This identifies that
the start of a procedure named as SMART and instructs theassembler that the procedure is far.^ SMART
ENDP This PROC is used with ENDP to indicate the break of
M. Krishna Kumar^
MAM/M2/LU6/V1/ ¾^ PUBLIC
The^ PUBLIC
directive is used to instruct
the assembler that a specified name or label will be accessedfrom other modules. ¾ Example:^ PUBLIC
;these two
variables are public so these are available to all modules.
If an instruction in a module refers to a variable in another assembly module, we can access thatmodule by declaring as
directive.
M. Krishna Kumar^
MAM/M2/LU6/V1/ ¾^ TYPE^
operator instructs the assembler to determine the type of a variable and determines the number ofbytes specified to that variable. ¾ Example:Byte type variable – assembler will give a value 1Word type variable – assembler will give a value 2Double word type variable – assembler will give a value 4ADD^
BX, TYPE WORD_ ARRAY ; hear we want to increment BX to point to next word in an array of words.