Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
PROGRAMMING AND
INTERFACING
ES 205
Program
Raj Gau
machine code modules which may further be
converted to executable codes.
codes
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
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
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
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
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.
M
language modules.
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.
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.
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
28
28. ‘+
+ and – ’ Operators – represents arithmetic addition and
M
subtraction.
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
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
M or
12