Sei sulla pagina 1di 12

MICROPROCESSOR

PROGRAMMING AND
INTERFACING
ES 205

Assembler Directives and Operators

RAJ GAURAV MISHRA


Dept of Electronics & Communication
ASSEMBLER DIRECTIVES & OPERATORS
| Assembler:
An Assembler is a program used to convert an
assembly language program into the equivalent

Program
Raj Gau
machine code modules which may further be
converted to executable codes.
codes

mming & Interrfacings


urav Mishra - Microprocesso
It decides the address of each label and substitutes
the values for each of the constants and variables
variables. It

M
then forms the machine code for the mnemonics and
data in the assembly language program.

or
While doing these things, the assembler may find out
syntax errors. The logical errors and other
programming errors are NOT found out by assembler.
2
ASSEMBLER DIRECTIVES & OPERATORS
| Assembler directives:
For completing all of its tasks, an assembler needs

Program
Raj Gau
some hints from the programmer, i.e. the required
storage for a particular constant or a variable,
variable logical

mming & Interrfacings


urav Mishra - Microprocesso
names of the segments, types of different routines and
modules, end of file, etc.

M
These types of hints are given to the assembler using
some ppredefined
f alphabetical
p strings
g called as

or
Assembly Directives, which help the assembler to
correctly understand the assembly language
programs
p g to p
prepare
p the machine codes.
3
ASSEMBLER DIRECTIVES & OPERATORS
| Operator:
p
Another type of hint which helps the assembler

Program
Raj Gau
to assign a particular constant with a label or
i iti li particular
initialize ti l memory llocations
ti or labels
l b l

mming & Interrfacings


urav Mishra - Microprocesso
with constants is an operator.

M
Two commonly used Assemblers for practicing
assembly language programming are:

or
1. Microsoft Macro Assembler,
2. Turbo Assembler.
4
ASSEMBLER DIRECTIVES & OPERATORS
1. DB : Define Byte – Directive – used to reserve byte or
b
bytes for
f memory llocations
i in
i the
h available
il bl memory.
RANKS DB 01H, 02H, 03H, 04H

Program
Raj Gau
MESSAGE DB ‘GOOD MORNING’
VALUE DB 50H

mming & Interrfacings


urav Mishra - Microprocesso
2. DW: Define Word – Directive – used to reserve 1 word
((16-bit)) for memory
y locations in the available memory.
y

M
3. DQ : Define Quadword – Directive – used to reserve 4
y locations in the available memory.
words for memory y

or
4. DT : Define Ten Bytes – Directive – used to define the
p
specified variable requiring
q g 10-bytes.
y
5
ASSEMBLER DIRECTIVES & OPERATORS
5. ASSUME : Assume Logical g Segment
g Name Byte
y –
Directive – is used to inform the assembler the names of
the logical segments to be assumed for different segments
used in the program.

Program
Raj Gau
ASSUME CS : CODE

mming & Interrfacings


urav Mishra - Microprocesso
ASSUME DS : DATA

6. END : End of Program – Directive – is used to mark the


end of an assembly language program.

M
7. ENDP : End of Procedure – Directive – is used to mark
the end of an assembly language procedure (subroutines).
(subroutines)

or
8. ENDS : End of Segment Procedure – Directive – is used to
mark the end of a logical segment.
6
ASSEMBLER DIRECTIVES & OPERATORS
9. EVEN: Align on Even Memory Address – Directive – is used
to updates the location counter to the next even address.
address

Program
Raj Gau
10. EQU : Equate – Directive – is used to assign a label with a
y
value or a symbol.

mming & Interrfacings


urav Mishra - Microprocesso
11. EXTRN : External – Directive – informs the assembler that
the names, procedures and labels declared after this
directive have already been defined in some other assembly

M
language modules.

12. PUBLIC : Public – Directive – the module where the names,


procedures
d and
d llabels
b l actually
ll appears, they
h must be
b

or
declared Public, using this directive.

13
13. GROUP : Group the Related Segments – Directive – is used
to form logical groups of segments with similar purpose or 7
type. PROGRAM GROUP CODE, DATA, STACK
ASSEMBLER DIRECTIVES & OPERATORS
14. LABEL : Label – Directive – is used to assign a name to
th currentt content
the t t off th
the location
l ti counter.
t

Program
Raj Gau
15. LENGTH : Byte Length of a Label – Directive – is used to
refer to the length of a data array or a string.

mming & Interrfacings


urav Mishra - Microprocesso
16. LOCAL : Local – Directive – The labels, variables,
constants or procedures declared as LOCAL in a module
are to be
b usedd only
l by
b that
h particular
i l module.
d l

M
17. NAME : Logical Name of a Module – Directive – is used to
assign a name to an assembly language program module.
module

or
18. OFFSET : Offset of a Label – Directive – is used with
y , strings,
arrays, g , labels and procedures
p to decide their
offsets in their default segments. 8
ASSEMBLER DIRECTIVES & OPERATORS
19. ORG : Origin – Directive – is used to direct the assembler to start the
memory allotment for a particular segment, block or code from the declared
address in the ORG statement.

Program
Raj Gau
20. PROC : Procedure – Directive – is used to mark the start of a named
procedure in the statement.

mming & Interrfacings


urav Mishra - Microprocesso
21. PTR : Pointer – Operator – is used to declare the type of a label, variable or
memory operand.

SEG : Segment of a Label – Operator – is used to decide the segment address

M
23.
of the label, variable, or procedure and substitutes the segment base address
in place of SEG label.

24
24. SEGMENT : Logical Segment – Directive – is used to mark the starting of a

or
logical segment.

25. SHORT : Short – Operator – is used to indicate the assembler that one bit is
required
q to code the displacement
p for the jjump,
p and thus this method of jjump
p
saves memory. 9
ASSEMBLER DIRECTIVES & OPERATORS
26. TYPE : Type – Operator – directs the assembler to decide the
data type of the specified label and replaces the TYPE label
by the decided data type.

Program
Raj Gau
27. GLOBAL : Global – Directive – The labels,, procedures
p or

mming & Interrfacings


urav Mishra - Microprocesso
constants declared GLOBAL may be used by other modules
of the program.

28
28. ‘+
+ and – ’ Operators – represents arithmetic addition and

M
subtraction.

29. FAR PTR : Far Pointer – Directive – indicates the assembler


that
h the
h llabel
b l ffollowing
ll i FAR PTR is i not available
il bl within
i hi the
h

or
same segment.

30
30. NEAR PTR : Near Pointer – Directive – indicates the
assembler that the label following NEAR PTR is available 10
within the same segment.
GOOGLE-GROUP

For all study related reference material:

Program
Raj Gau
mming & Interrfacings
urav Mishra - Microprocesso
| http://groups.google.co.in/group/microprocessor-8086-icfai

M or
11
REFERENCES

| “Advanced Microprocessors
p and Peripherals”,
p by
y A. K.
Ray and K. M. Bhurchandi.

Program
Raj Gau
| “Microprocessor
Microprocessor and Interfacing
Interfacing”, by Douglas V.
V Hall.
Hall

mming & Interrfacings


urav Mishra - Microprocesso
| Some definitions from Wikipedia - the free online
encyclopedia.

M or
12

Potrebbero piacerti anche