SlideShare a Scribd company logo
1 of 20
Download to read offline
B Y
DR. URVASHI SINGH
A S S O C I A T E P R O F E S S O R
D E L H I T E C H N I C A L C A M P U S
G G S I P U N I V E R S I T Y
G R E A T E R N O I D A ( I N D I A )
Assembler directives
and basic steps of ALP
ASSEMBLER DIRECTIVES
Assembly language: low-level languages for
programming computers, microprocessors,
microcontrollers, and other IC
Assembler Directive: a statement to give direction to the
assembler to perform task of the assembly process.
control the organization of the program
provide necessary information to the assembler to understand ALPs
and generate necessary machine codes
Indicate how an operand or a section of the program is to be
processed by the assembler
Consists of two types of statements: instructions and directives
Instructions: translated to the machine code by the assembler
Directives are not translated to the machine codes
Important terms and rules
SYMBOLS: to signify different components of the ALP (assembly Language
Program)
Symbols consist of following characters:-
Upper case & lower case alphabets: A to Z; a to z
Digits: 0 to 9
Special characters: $, ?, @, _ (underscore)
No distinction between an uppercase and lowercase letter
A hexadecimal no. starting with A to F must begin with β€œ0” (zero) ; otherwise will be taken as a symbol
VARIABLE: these are symbols whose values can be varied while running a program
Names of variables: should be meaningful to make program maintenance easy
A variable can use: A to Z; a to z; 0 to 9; @; _ (underscore)
Digit can not be used as 1st character of an Assembler variable
CONSTANT: these are symbols whose values can not be varies while running a
program
A numeric constant may be a binary, decimal or hexadecimal number.
Symbols B, D & H must be used at the end of a binary, decimal and hexadecimal number,
respectively.
Important Assembler Directives of the 8086
Microprocessor
Data declaration directives: DB, DW, DD, DQ, DT
ASSUME
END directives
EQU Directive
PROC
ORG
SEGMENT
GROUP, INCLUDE, EVEN, ALIGN
EXTRN, PUBLIC,
TYPE, PTR,
LENGTH, OFFSET
NAME, LABEL, SHORT, GLOBAL
Data declaration directives
1. DB - The DB directive is used to declare a BYTE -2-BYTE variable - A BYTE
is made up of 8 bits.
examples:
PRICES DB 49H, 98H, 29H; Declare array of 3 bytes named PRICES and initialize them
with specified values
TEMP DB 100 DUP (?); Set aside 100 bytes of storage in memory and give it the name
TEMP. But leave the 100 bytes un-initialized
2. DW - The DW directive is used to declare a WORD type variable - A WORD
occupies 16 bits or (2 BYTE).
examples:
WORDS DW 1234H, 3456H; Declares an array of 2 words and initialize them with the
specified values
3. DD - The DD directive is used to declare a DWORD - A DWORD double
word is made up of 32 bits =2 Word's or 4 BYTE.
examples:
ARRAY DD 25629261H; This will define a double word named ARRAY and initialize the
double word with the specified value when the program is loaded into memory to be run.
The low word, 9261H, will be put in memory at a lower address than the high word.
Data declaration directives (cont.)
DQ (DEFINE QUADWORD)
The DQ directive is used to tell the assembler to declare a variable 4 words
in length or to reserve 4 words of storage in memory.
Example:
BIG_NUMBER DQ 243598740192A92BH; This will declare a variable named
BIG_NUMBER and initialize the 4 words set aside with the specified number when the
program is loaded into memory to be run.
DT (DEFINE TEN BYTES)
The DT directive is used to tell the assembler to declare a variable, which is
10 bytes in length or to reserve 10 bytes of storage in memory.
Example:
PACKED_BCD DT 11223344556677889900
This will declare an array named PACKED_BCD, which is 10 bytes in length. It will initialize
the 10 bytes with the values 11, 22, 33, 44, 55, 66, 77, 88, 99, and 00 when the program is
loaded into memory to be run. The statement RESULT DT 20H DUP (0) will declare an
array of 20H blocks of 10 bytes each and initialize all 320 bytes to 00 when the program is
loaded into memory to be run.
ASSUME DIRECTIVE
ASSUME Directive - The ASSUME directive is used to tell the
assembler that the name of the logical segment should be used
for a specified segment. The 8086 works directly with only 4
physical segments: a Code segment, a data segment, a stack
segment, and an extra segment.
Example:
ASSUME CS:CODE ;This tells the assembler that the logical
segment named CODE contains the instruction statements for
the program and should be treated as a code segment.
ASSUME DS:DATA ;This tells the assembler that for any
instruction which refers to a data in the data segment, data
will found in the logical segment DATA.
End directive
END - End Program
ENDP - End Procedure
ENDS - End Segment
END – it signifies the end of the program module
The assembler will ignore any statement after an END directive
ENDP - indicates the end of a procedure
Syntax: Procedure_name ENDP
ENDS - indicates the end of a logical segment
Syntax: Segment_name ENDS
Equate (EQU) Directive
EQU - This EQU directive is used to give a name to some
value or to a symbol. Each time the assembler finds the
name in the program, it will replace the name with the
value or symbol you given to that name.
Example:
FACTOR EQU 03H ; you has to write this statement at the starting of
your program
later in the program you can use this as follows :
ADD AL, FACTOR ; When it codes this instruction the assembler will
code it as ADDAL, 03H ;The advantage of using EQU in this manner
is, if FACTOR is used many no of times in a program and you want to
change the value, all you had to do is change the EQU statement at
beginning, it will changes the rest of all.
PROC (Procedure) Directive
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.
Example:
SMART PROC FAR ; This identifies that the start of a
procedure named as SMART and instructs the assembler that
the procedure is far .
SMART ENDP ; This PROC is used with ENDP to indicate the
break of the procedure.
ORG (ORIGIN)
ORG Changes the starting offset address of the data in the data
segment. As an assembler assembles a section of a data declarations
or instruction statements, it uses a location counter to keep track of
how many bytes it is from the start of a segment at any time.
The location counter is automatically set to 0000 when assembler
starts reading a segment.
The ORG directive allows you to set the location counter to a desired
value at any point in the program.
Example:
The statement ORG 2000H tells the assembler to set the location counter to
2000H.
SEGMENT
SEGMENT directive : to indicate the start of a logical segment
Syntax: Segment_name SEGMENT
Additional terms are often added to a SEGMENT directive
statement to indicate some special way in which we want the
assembler to treat the segment.
Example:
CODE SEGMENT WORD ; tells the assembler that we want the content
of this segment located on the next available word (even address) when
segments are combined and given absolute addresses.
Without this WORD addition, the segment will be located on the next
available paragraph (16-byte) address, which might waste as much as 15
bytes of memory.
The statement CODE SEGMENT PUBLIC tells the assembler that the
segment may be put together with other segments named CODE from
other assembly modules when the modules are linked together.
GROUP, INCLUDE, EVEN, ALIGN
GROUP - used to group the logical segments named after the
directive into one logical group segment.
INCLUDE - used to insert a block of source code from the named
file into the current source module.
EVEN - instructs the assembler to increment the location of the
counter to the next even address if it is not already in the even
address.
If the word is at even address 8086 can read a memory in 1 bus cycle. If the word
starts at an odd address, the 8086 will take 2 bus cycles to get the data.
A series of words can be read much more quickly if they are at even address.
When EVEN is used the location counter will simply incremented to next address
and NOP instruction is inserted in that incremented location.
ALIGN: Memory array is stored in word boundaries.
Example:
ALIGN 2 means storing from an even address
EXTRN, PUBLIC
EXTRN : used to tell the assembler that the name or labels following the
directive are in some other assembly module.
For example, if you want to call a procedure, which in a program module assembled at a
different time from that which contains the CALL instruction, you must tell the assembler
that the procedure is external. The assembler will then put this information in the object
code file so that the linker can connect the two modules together.
For a reference to externally named variable, you must specify the type of the variable, as in
the statement EXTRN DIVISOR: WORD. The statement EXTRN DIVIDE: FAR tells the
assembler that DIVIDE is a label of type FAR in another assembler module. Name or labels
referred to as external in one module must be declared public with the PUBLIC directive in
the module in which they are defined.
PUBLIC - The PUBLIC directive is used to instruct the assembler that a
specified name or label will be accessed from other modules.
Example:
PUBLIC DIVISOR, DIVIDEND ;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 that module by declaring as EXTRN directive.
TYPE, PTR(POINTER)
TYPE - instructs the assembler to determine the type of a variable and
determines the number of bytes specified to that variable.
Example:
Byte type variable – assembler will give a value 1 Word type variable – assembler will give a
value 2 Double word type variable – assembler will give a value 4 ADD BX, TYPE WORD_
ARRAY ; hear we want to increment BX to point to next word in an array of words.
PTR (POINTER) : used to assign a specific type to a variable or a label. It is
necessary to do this in any instruction where the type of the operand is not
clear.
Example:
INC [BX]; It will not know whether to increment the byte pointed to by BX. We use the
PTR operator to clarify how we want the assembler to code the instruction.
INC BYTE PTR [BX] ; This statement tells the assembler that we want to increment the
byte pointed to by BX.
INC WORD PTR [BX] ; This statement tells the assembler that we want to increment the
word pointed to by BX. The PTR operator assigns the type specified before PTR to the
variable specified after PTR.
LENGTH, OFFSET
LENGTH : tells the assembler to determine the number of
elements in some named data item, such as a string or an array.
Example:
MOV CX, LENGTH STRING1; This will determine the number of elements in
STRING1 and load it into CX. If the string was declared as a string of bytes,
LENGTH will produce the number of bytes in the string. If the string was
declared as a word string, LENGTH will produce the number of words in the
string.
OFFSET : tells the assembler to determine the offset or
displacement of a named data item (variable), a procedure from the
start of the segment, which contains it.
Example:
MOV BX, OFFSET PRICES; It will determine the offset of the variable PRICES
from the start of the segment in which PRICES is defined and will load this value
into BX.
NAME, LABEL, SHORT, GLOBAL
NAME : used to give a specific name to each assembly module when programs consisting of
several modules are written.
LABEL : As an assembler assembles a section of a data declarations or instruction statements,
it uses a location counter to be keep track of how many bytes it is from the start of a segment at
any time.
If the label is going to be used as the destination for a jump or a call, then the label must be
specified as type near or type far.
SHORT
The SHORT operator is used to tell the assembler that only a 1 byte displacement is
needed to code a jump instruction in the program. The destination must in the range of –
128 bytes to +127 bytes from the address of the instruction after the jump.
Example: JMP SHORT NEARBY_LABEL
GLOBAL (DECLARE SYMBOLS AS PUBLIC OR EXTRN) : can be used in place of a
PUBLIC directive or in place of an EXTRN directive. For a name or symbol defined in the
current assembly module, the GLOBAL directive is used to make the symbol available to other
modules.
Example:
GLOBAL DIVISOR
This statement makes the variable DIVISOR public so that it can be accessed from
other assembly modules.
8086 Programming using Assembler Directives
Basic structure of a program:
Name_data segment SEGMENT
Data declaration statement 1
:
:
Data declaration statement n
DATA ENDS
Name_codeseg SEGMENT
ASSUME CS:CODE, DS:DATA, ES:EXTRA, SS: STACK
START:
Program line 1
:
:
Program line n
Name_codeseg ENDS
END START
example
Program to multiply 2 16-bit words in memory locations called MULTIPLICAND
and MULTIPLIER. Result is stored in memory location PRODUCT.
DATA SEGMENT
MULTIPLICAND DW 204A H; 1ST Word
MULTIPLIER DW 3B2A H; 2nd word
PRODUCT DW 2 DUP(0); sets aside storage for 2 words in memory and gives starting address of 1st word
the name PRODUCT. The DUP(0) part of the statement tells assembler to initialize 2 words to all zeros.
DATA ENDS
CODE SEGMENT
ASSUMER CS:CODE, DS:DATA;
START:
MOV AX, DATA
MOV DS, AX
MOV AX, MULTIPLICAND;
MUL MULTIPLIER;
MOV PRODUCT, AX;
MOV PRODUCT+2, DX;
INT3
CODE ENDS
END START
Thank you

More Related Content

What's hot

Stacks & subroutines 1
Stacks & subroutines 1Stacks & subroutines 1
Stacks & subroutines 1deval patel
Β 
Minimum mode and Maximum mode Configuration in 8086
Minimum mode and Maximum mode Configuration in 8086Minimum mode and Maximum mode Configuration in 8086
Minimum mode and Maximum mode Configuration in 8086Jismy .K.Jose
Β 
8086 microprocessor-architecture
8086 microprocessor-architecture8086 microprocessor-architecture
8086 microprocessor-architectureprasadpawaskar
Β 
Interrupts of 8086
Interrupts of 8086Interrupts of 8086
Interrupts of 8086Albin Panakkal
Β 
Internal architecture-of-8086
Internal architecture-of-8086Internal architecture-of-8086
Internal architecture-of-8086Estiak Khan
Β 
Byte and string manipulation 8086
Byte and string manipulation 8086Byte and string manipulation 8086
Byte and string manipulation 8086mpsrekha83
Β 
Instruction sets of 8086
Instruction sets of 8086Instruction sets of 8086
Instruction sets of 8086Mahalakshmiv11
Β 
flag register of 8086
flag register of 8086flag register of 8086
flag register of 8086asrithak
Β 
Interfacing memory with 8086 microprocessor
Interfacing memory with 8086 microprocessorInterfacing memory with 8086 microprocessor
Interfacing memory with 8086 microprocessorVikas Gupta
Β 
Serial Communication
Serial CommunicationSerial Communication
Serial CommunicationUshaRani289
Β 
Control Units : Microprogrammed and Hardwired:control unit
Control Units : Microprogrammed and Hardwired:control unitControl Units : Microprogrammed and Hardwired:control unit
Control Units : Microprogrammed and Hardwired:control unitabdosaidgkv
Β 
80486 microprocessor
80486 microprocessor80486 microprocessor
80486 microprocessorMihika Shah
Β 
8086 pin details
8086 pin details8086 pin details
8086 pin detailsAJAL A J
Β 
8085 interfacing with memory chips
8085 interfacing with memory chips8085 interfacing with memory chips
8085 interfacing with memory chipsSrikrishna Thota
Β 
8086 pin diagram description
8086 pin diagram description8086 pin diagram description
8086 pin diagram descriptionAkhil Singal
Β 
Memory & I/O interfacing
Memory & I/O  interfacingMemory & I/O  interfacing
Memory & I/O interfacingdeval patel
Β 
DMA operation
DMA operationDMA operation
DMA operationImran Khan
Β 

What's hot (20)

Stacks & subroutines 1
Stacks & subroutines 1Stacks & subroutines 1
Stacks & subroutines 1
Β 
8086 micro processor
8086 micro processor8086 micro processor
8086 micro processor
Β 
Minimum mode and Maximum mode Configuration in 8086
Minimum mode and Maximum mode Configuration in 8086Minimum mode and Maximum mode Configuration in 8086
Minimum mode and Maximum mode Configuration in 8086
Β 
8086 microprocessor-architecture
8086 microprocessor-architecture8086 microprocessor-architecture
8086 microprocessor-architecture
Β 
Interrupts of 8086
Interrupts of 8086Interrupts of 8086
Interrupts of 8086
Β 
Timing diagram 8085 microprocessor
Timing diagram 8085 microprocessorTiming diagram 8085 microprocessor
Timing diagram 8085 microprocessor
Β 
Internal architecture-of-8086
Internal architecture-of-8086Internal architecture-of-8086
Internal architecture-of-8086
Β 
Byte and string manipulation 8086
Byte and string manipulation 8086Byte and string manipulation 8086
Byte and string manipulation 8086
Β 
8251 USART
8251 USART8251 USART
8251 USART
Β 
Instruction sets of 8086
Instruction sets of 8086Instruction sets of 8086
Instruction sets of 8086
Β 
flag register of 8086
flag register of 8086flag register of 8086
flag register of 8086
Β 
Interfacing memory with 8086 microprocessor
Interfacing memory with 8086 microprocessorInterfacing memory with 8086 microprocessor
Interfacing memory with 8086 microprocessor
Β 
Serial Communication
Serial CommunicationSerial Communication
Serial Communication
Β 
Control Units : Microprogrammed and Hardwired:control unit
Control Units : Microprogrammed and Hardwired:control unitControl Units : Microprogrammed and Hardwired:control unit
Control Units : Microprogrammed and Hardwired:control unit
Β 
80486 microprocessor
80486 microprocessor80486 microprocessor
80486 microprocessor
Β 
8086 pin details
8086 pin details8086 pin details
8086 pin details
Β 
8085 interfacing with memory chips
8085 interfacing with memory chips8085 interfacing with memory chips
8085 interfacing with memory chips
Β 
8086 pin diagram description
8086 pin diagram description8086 pin diagram description
8086 pin diagram description
Β 
Memory & I/O interfacing
Memory & I/O  interfacingMemory & I/O  interfacing
Memory & I/O interfacing
Β 
DMA operation
DMA operationDMA operation
DMA operation
Β 

Similar to Assembler directives and basic steps ALP of 8086

8086 Assembly Language and Serial Monitor Operation of 8086 Trainer Kit
8086 Assembly Language and Serial Monitor Operation of 8086 Trainer Kit8086 Assembly Language and Serial Monitor Operation of 8086 Trainer Kit
8086 Assembly Language and Serial Monitor Operation of 8086 Trainer KitAmit Kumer Podder
Β 
unit 2.pptx
unit 2.pptxunit 2.pptx
unit 2.pptxrrbornarecm
Β 
Assembly level language
Assembly level languageAssembly level language
Assembly level languagePDFSHARE
Β 
unit-2.pptx
unit-2.pptxunit-2.pptx
unit-2.pptxnorajobai
Β 
assembler Directives hnotesnnnnnnnn.pptx
assembler Directives hnotesnnnnnnnn.pptxassembler Directives hnotesnnnnnnnn.pptx
assembler Directives hnotesnnnnnnnn.pptxDrkoteswararaoseelam
Β 
Chapter 2 programming concepts - I
Chapter 2  programming concepts - IChapter 2  programming concepts - I
Chapter 2 programming concepts - ISHREEHARI WADAWADAGI
Β 
Microcontroller directives
Microcontroller directivesMicrocontroller directives
Microcontroller directivesManoj Harsule
Β 
Lec 04 intro assembly
Lec 04 intro assemblyLec 04 intro assembly
Lec 04 intro assemblyAbdul Khan
Β 
06 chapter03 04_control_logix_tags_memory_structure_fa16
06 chapter03 04_control_logix_tags_memory_structure_fa1606 chapter03 04_control_logix_tags_memory_structure_fa16
06 chapter03 04_control_logix_tags_memory_structure_fa16John Todora
Β 
Assembly Language Basics
Assembly Language BasicsAssembly Language Basics
Assembly Language BasicsEducation Front
Β 
9CM405.24.ppt
9CM405.24.ppt9CM405.24.ppt
9CM405.24.pptsdjflksdkjf
Β 

Similar to Assembler directives and basic steps ALP of 8086 (20)

8086 Assembly Language and Serial Monitor Operation of 8086 Trainer Kit
8086 Assembly Language and Serial Monitor Operation of 8086 Trainer Kit8086 Assembly Language and Serial Monitor Operation of 8086 Trainer Kit
8086 Assembly Language and Serial Monitor Operation of 8086 Trainer Kit
Β 
unit 2.pptx
unit 2.pptxunit 2.pptx
unit 2.pptx
Β 
Assembly level language
Assembly level languageAssembly level language
Assembly level language
Β 
unit-2.pptx
unit-2.pptxunit-2.pptx
unit-2.pptx
Β 
report-MICRO-P (2).pptx
report-MICRO-P (2).pptxreport-MICRO-P (2).pptx
report-MICRO-P (2).pptx
Β 
assembler Directives hnotesnnnnnnnn.pptx
assembler Directives hnotesnnnnnnnn.pptxassembler Directives hnotesnnnnnnnn.pptx
assembler Directives hnotesnnnnnnnn.pptx
Β 
Chapter 2 programming concepts - I
Chapter 2  programming concepts - IChapter 2  programming concepts - I
Chapter 2 programming concepts - I
Β 
Programming
ProgrammingProgramming
Programming
Β 
Mp lab manual
Mp lab manualMp lab manual
Mp lab manual
Β 
Microcontroller directives
Microcontroller directivesMicrocontroller directives
Microcontroller directives
Β 
Chapter 5 notes new
Chapter 5 notes newChapter 5 notes new
Chapter 5 notes new
Β 
Chapter 6 notes
Chapter 6 notesChapter 6 notes
Chapter 6 notes
Β 
Lec 04 intro assembly
Lec 04 intro assemblyLec 04 intro assembly
Lec 04 intro assembly
Β 
Chapter 5 notes
Chapter 5 notesChapter 5 notes
Chapter 5 notes
Β 
06 chapter03 04_control_logix_tags_memory_structure_fa16
06 chapter03 04_control_logix_tags_memory_structure_fa1606 chapter03 04_control_logix_tags_memory_structure_fa16
06 chapter03 04_control_logix_tags_memory_structure_fa16
Β 
Assembly Language Basics
Assembly Language BasicsAssembly Language Basics
Assembly Language Basics
Β 
Unit-2.pptx
Unit-2.pptxUnit-2.pptx
Unit-2.pptx
Β 
9CM405.24.ppt
9CM405.24.ppt9CM405.24.ppt
9CM405.24.ppt
Β 
Loader
LoaderLoader
Loader
Β 
Loaders
LoadersLoaders
Loaders
Β 

Recently uploaded

VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
Β 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxhumanexperienceaaa
Β 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
Β 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
Β 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
Β 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
Β 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
Β 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
Β 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
Β 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
Β 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
Β 
Model Call Girl in Narela Delhi reach out to us at πŸ”8264348440πŸ”
Model Call Girl in Narela Delhi reach out to us at πŸ”8264348440πŸ”Model Call Girl in Narela Delhi reach out to us at πŸ”8264348440πŸ”
Model Call Girl in Narela Delhi reach out to us at πŸ”8264348440πŸ”soniya singh
Β 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
Β 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
Β 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
Β 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
Β 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoΓ£o Esperancinha
Β 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
Β 

Recently uploaded (20)

VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
Β 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
Β 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
Β 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
Β 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
Β 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
Β 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
Β 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Β 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
Β 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
Β 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
Β 
Model Call Girl in Narela Delhi reach out to us at πŸ”8264348440πŸ”
Model Call Girl in Narela Delhi reach out to us at πŸ”8264348440πŸ”Model Call Girl in Narela Delhi reach out to us at πŸ”8264348440πŸ”
Model Call Girl in Narela Delhi reach out to us at πŸ”8264348440πŸ”
Β 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Β 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
Β 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
Β 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
Β 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Β 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Β 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Β 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
Β 

Assembler directives and basic steps ALP of 8086

  • 1. B Y DR. URVASHI SINGH A S S O C I A T E P R O F E S S O R D E L H I T E C H N I C A L C A M P U S G G S I P U N I V E R S I T Y G R E A T E R N O I D A ( I N D I A ) Assembler directives and basic steps of ALP
  • 2. ASSEMBLER DIRECTIVES Assembly language: low-level languages for programming computers, microprocessors, microcontrollers, and other IC Assembler Directive: a statement to give direction to the assembler to perform task of the assembly process. control the organization of the program provide necessary information to the assembler to understand ALPs and generate necessary machine codes Indicate how an operand or a section of the program is to be processed by the assembler Consists of two types of statements: instructions and directives Instructions: translated to the machine code by the assembler Directives are not translated to the machine codes
  • 3. Important terms and rules SYMBOLS: to signify different components of the ALP (assembly Language Program) Symbols consist of following characters:- Upper case & lower case alphabets: A to Z; a to z Digits: 0 to 9 Special characters: $, ?, @, _ (underscore) No distinction between an uppercase and lowercase letter A hexadecimal no. starting with A to F must begin with β€œ0” (zero) ; otherwise will be taken as a symbol VARIABLE: these are symbols whose values can be varied while running a program Names of variables: should be meaningful to make program maintenance easy A variable can use: A to Z; a to z; 0 to 9; @; _ (underscore) Digit can not be used as 1st character of an Assembler variable CONSTANT: these are symbols whose values can not be varies while running a program A numeric constant may be a binary, decimal or hexadecimal number. Symbols B, D & H must be used at the end of a binary, decimal and hexadecimal number, respectively.
  • 4. Important Assembler Directives of the 8086 Microprocessor Data declaration directives: DB, DW, DD, DQ, DT ASSUME END directives EQU Directive PROC ORG SEGMENT GROUP, INCLUDE, EVEN, ALIGN EXTRN, PUBLIC, TYPE, PTR, LENGTH, OFFSET NAME, LABEL, SHORT, GLOBAL
  • 5. Data declaration directives 1. DB - The DB directive is used to declare a BYTE -2-BYTE variable - A BYTE is made up of 8 bits. examples: PRICES DB 49H, 98H, 29H; Declare array of 3 bytes named PRICES and initialize them with specified values TEMP DB 100 DUP (?); Set aside 100 bytes of storage in memory and give it the name TEMP. But leave the 100 bytes un-initialized 2. DW - The DW directive is used to declare a WORD type variable - A WORD occupies 16 bits or (2 BYTE). examples: WORDS DW 1234H, 3456H; Declares an array of 2 words and initialize them with the specified values 3. DD - The DD directive is used to declare a DWORD - A DWORD double word is made up of 32 bits =2 Word's or 4 BYTE. examples: ARRAY DD 25629261H; This will define a double word named ARRAY and initialize the double word with the specified value when the program is loaded into memory to be run. The low word, 9261H, will be put in memory at a lower address than the high word.
  • 6. Data declaration directives (cont.) DQ (DEFINE QUADWORD) The DQ directive is used to tell the assembler to declare a variable 4 words in length or to reserve 4 words of storage in memory. Example: BIG_NUMBER DQ 243598740192A92BH; This will declare a variable named BIG_NUMBER and initialize the 4 words set aside with the specified number when the program is loaded into memory to be run. DT (DEFINE TEN BYTES) The DT directive is used to tell the assembler to declare a variable, which is 10 bytes in length or to reserve 10 bytes of storage in memory. Example: PACKED_BCD DT 11223344556677889900 This will declare an array named PACKED_BCD, which is 10 bytes in length. It will initialize the 10 bytes with the values 11, 22, 33, 44, 55, 66, 77, 88, 99, and 00 when the program is loaded into memory to be run. The statement RESULT DT 20H DUP (0) will declare an array of 20H blocks of 10 bytes each and initialize all 320 bytes to 00 when the program is loaded into memory to be run.
  • 7. ASSUME DIRECTIVE ASSUME Directive - The ASSUME directive is used to tell the assembler that the name of the logical segment should be used for a specified segment. The 8086 works directly with only 4 physical segments: a Code segment, a data segment, a stack segment, and an extra segment. Example: ASSUME CS:CODE ;This tells the assembler that the logical segment named CODE contains the instruction statements for the program and should be treated as a code segment. ASSUME DS:DATA ;This tells the assembler that for any instruction which refers to a data in the data segment, data will found in the logical segment DATA.
  • 8. End directive END - End Program ENDP - End Procedure ENDS - End Segment END – it signifies the end of the program module The assembler will ignore any statement after an END directive ENDP - indicates the end of a procedure Syntax: Procedure_name ENDP ENDS - indicates the end of a logical segment Syntax: Segment_name ENDS
  • 9. Equate (EQU) Directive EQU - This EQU directive is used to give a name to some value or to a symbol. Each time the assembler finds the name in the program, it will replace the name with the value or symbol you given to that name. Example: FACTOR EQU 03H ; you has to write this statement at the starting of your program later in the program you can use this as follows : ADD AL, FACTOR ; When it codes this instruction the assembler will code it as ADDAL, 03H ;The advantage of using EQU in this manner is, if FACTOR is used many no of times in a program and you want to change the value, all you had to do is change the EQU statement at beginning, it will changes the rest of all.
  • 10. PROC (Procedure) Directive 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. Example: SMART PROC FAR ; This identifies that the start of a procedure named as SMART and instructs the assembler that the procedure is far . SMART ENDP ; This PROC is used with ENDP to indicate the break of the procedure.
  • 11. ORG (ORIGIN) ORG Changes the starting offset address of the data in the data segment. As an assembler assembles a section of a data declarations or instruction statements, it uses a location counter to keep track of how many bytes it is from the start of a segment at any time. The location counter is automatically set to 0000 when assembler starts reading a segment. The ORG directive allows you to set the location counter to a desired value at any point in the program. Example: The statement ORG 2000H tells the assembler to set the location counter to 2000H.
  • 12. SEGMENT SEGMENT directive : to indicate the start of a logical segment Syntax: Segment_name SEGMENT Additional terms are often added to a SEGMENT directive statement to indicate some special way in which we want the assembler to treat the segment. Example: CODE SEGMENT WORD ; tells the assembler that we want the content of this segment located on the next available word (even address) when segments are combined and given absolute addresses. Without this WORD addition, the segment will be located on the next available paragraph (16-byte) address, which might waste as much as 15 bytes of memory. The statement CODE SEGMENT PUBLIC tells the assembler that the segment may be put together with other segments named CODE from other assembly modules when the modules are linked together.
  • 13. GROUP, INCLUDE, EVEN, ALIGN GROUP - used to group the logical segments named after the directive into one logical group segment. INCLUDE - used to insert a block of source code from the named file into the current source module. EVEN - instructs the assembler to increment the location of the counter to the next even address if it is not already in the even address. If the word is at even address 8086 can read a memory in 1 bus cycle. If the word starts at an odd address, the 8086 will take 2 bus cycles to get the data. A series of words can be read much more quickly if they are at even address. When EVEN is used the location counter will simply incremented to next address and NOP instruction is inserted in that incremented location. ALIGN: Memory array is stored in word boundaries. Example: ALIGN 2 means storing from an even address
  • 14. EXTRN, PUBLIC EXTRN : used to tell the assembler that the name or labels following the directive are in some other assembly module. For example, if you want to call a procedure, which in a program module assembled at a different time from that which contains the CALL instruction, you must tell the assembler that the procedure is external. The assembler will then put this information in the object code file so that the linker can connect the two modules together. For a reference to externally named variable, you must specify the type of the variable, as in the statement EXTRN DIVISOR: WORD. The statement EXTRN DIVIDE: FAR tells the assembler that DIVIDE is a label of type FAR in another assembler module. Name or labels referred to as external in one module must be declared public with the PUBLIC directive in the module in which they are defined. PUBLIC - The PUBLIC directive is used to instruct the assembler that a specified name or label will be accessed from other modules. Example: PUBLIC DIVISOR, DIVIDEND ;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 that module by declaring as EXTRN directive.
  • 15. TYPE, PTR(POINTER) TYPE - instructs the assembler to determine the type of a variable and determines the number of bytes specified to that variable. Example: Byte type variable – assembler will give a value 1 Word type variable – assembler will give a value 2 Double word type variable – assembler will give a value 4 ADD BX, TYPE WORD_ ARRAY ; hear we want to increment BX to point to next word in an array of words. PTR (POINTER) : used to assign a specific type to a variable or a label. It is necessary to do this in any instruction where the type of the operand is not clear. Example: INC [BX]; It will not know whether to increment the byte pointed to by BX. We use the PTR operator to clarify how we want the assembler to code the instruction. INC BYTE PTR [BX] ; This statement tells the assembler that we want to increment the byte pointed to by BX. INC WORD PTR [BX] ; This statement tells the assembler that we want to increment the word pointed to by BX. The PTR operator assigns the type specified before PTR to the variable specified after PTR.
  • 16. LENGTH, OFFSET LENGTH : tells the assembler to determine the number of elements in some named data item, such as a string or an array. Example: MOV CX, LENGTH STRING1; This will determine the number of elements in STRING1 and load it into CX. If the string was declared as a string of bytes, LENGTH will produce the number of bytes in the string. If the string was declared as a word string, LENGTH will produce the number of words in the string. OFFSET : tells the assembler to determine the offset or displacement of a named data item (variable), a procedure from the start of the segment, which contains it. Example: MOV BX, OFFSET PRICES; It will determine the offset of the variable PRICES from the start of the segment in which PRICES is defined and will load this value into BX.
  • 17. NAME, LABEL, SHORT, GLOBAL NAME : used to give a specific name to each assembly module when programs consisting of several modules are written. LABEL : As an assembler assembles a section of a data declarations or instruction statements, it uses a location counter to be keep track of how many bytes it is from the start of a segment at any time. If the label is going to be used as the destination for a jump or a call, then the label must be specified as type near or type far. SHORT The SHORT operator is used to tell the assembler that only a 1 byte displacement is needed to code a jump instruction in the program. The destination must in the range of – 128 bytes to +127 bytes from the address of the instruction after the jump. Example: JMP SHORT NEARBY_LABEL GLOBAL (DECLARE SYMBOLS AS PUBLIC OR EXTRN) : can be used in place of a PUBLIC directive or in place of an EXTRN directive. For a name or symbol defined in the current assembly module, the GLOBAL directive is used to make the symbol available to other modules. Example: GLOBAL DIVISOR This statement makes the variable DIVISOR public so that it can be accessed from other assembly modules.
  • 18. 8086 Programming using Assembler Directives Basic structure of a program: Name_data segment SEGMENT Data declaration statement 1 : : Data declaration statement n DATA ENDS Name_codeseg SEGMENT ASSUME CS:CODE, DS:DATA, ES:EXTRA, SS: STACK START: Program line 1 : : Program line n Name_codeseg ENDS END START
  • 19. example Program to multiply 2 16-bit words in memory locations called MULTIPLICAND and MULTIPLIER. Result is stored in memory location PRODUCT. DATA SEGMENT MULTIPLICAND DW 204A H; 1ST Word MULTIPLIER DW 3B2A H; 2nd word PRODUCT DW 2 DUP(0); sets aside storage for 2 words in memory and gives starting address of 1st word the name PRODUCT. The DUP(0) part of the statement tells assembler to initialize 2 words to all zeros. DATA ENDS CODE SEGMENT ASSUMER CS:CODE, DS:DATA; START: MOV AX, DATA MOV DS, AX MOV AX, MULTIPLICAND; MUL MULTIPLIER; MOV PRODUCT, AX; MOV PRODUCT+2, DX; INT3 CODE ENDS END START