Académique Documents
Professionnel Documents
Culture Documents
4/4/2016
Machine Language
Assembly Language
High-Level Language
4/4/2016
Assembly vs HLL
Advantages of HLL
Easier to write
Easier to
understand
Better control
Doesnt depend on
particular machine
4/4/2016
Advgs of Assembly
Closer to Machine
code
Access to specific
memory location
Helps understand
how computer
actually works
Remember
ASSEMBLY language program is machine
specific
ASSEMBLER converts it into machine
code
Not case-sensitive
4/4/2016
Syntax
Each line of an ASSEMBLY program
contains a statement
A statement can either be an instruction
or an assembler directive
Instruction: MOV, SHL, JMP etc
Assembler Directive: ORG, ASSUME, END
etc (Pseudo Op-Code)
4/4/2016
Synatx
General syntax for a statement is
Name: Instruction Operand(s) ; Comment
Example:
MYLABEL :
4/4/2016
MOV
AX,BX
; abrakadabra
Name Field
Used for instruction labels, procedure
names and variable names
1 to 31 characters long
Can contain letters, digits and following
special characters
.
4/4/2016
Syntax
Operand : There can be 1,2 or no operand
at all. For two operands, generally, they are
Destination, Source
Comment : Anything after (;)
One of the operands can be a data
4/4/2016
MOV AX,10
MOV AX,10D
MOV AX,0AH
Syntax
Hex number cant start with an alphabet
+/- sign is allowed
String or character is allowed as data
MOV AX, AB
MOV AX,0ABCDH
MOV AX, ABCD
MOV AX, ABCDH
4/4/2016
Variables
Byte
Word
8
16
DB
DW
Double Word
Quad Word
Ten Bytes
32
64
80
DD
DQ
DT
MYBYTE
DB
15
MYWORD
DW
MYARRAY
DB
MYSTRING DB
4/4/2016
4,5,6,?,?,?
abrakadabra
Named Constant
Name
EQU
constant
MYCONSTANT
EQU
EQU is a pseudo-opcode
Constant can be a string as well
4/4/2016
MOV
MOV destination, source
Source
Operand
Destination Operand
General Segment Memory Constant
Register Register Location
General
Register
Segment
Register
Memory
Location
X
X
Constant
X
X
XCHG
XCHG destination, source
Source
Operand
Destination
Operand
General Memory
Register Location
General
Register
Memory
Location
ADD/SUB
ADD destination, source
Source
Operand
Destination
Operand
General Memory
Register Location
General
Register
Memory
Location
Constant
INC/DEC
Single operand instruction
INC destination
Destination is either a register or a
memory location.
Updates all flags but CF
INC AX ;
ax++
DEC MYBYTE;
mybyte - 4/4/2016
NEG
Single operand instruction
NEG destination
Destination is either a register or a
memory location.
Updates all flags
CF=1 unless result is 0
OF=1 if word destination is 8000h or
byte destination is 80h
4/4/2016
; ah=41H
; ax =0041H
EEE 315: MICROPROCESSOR & INTERFACING
ORG
ORG stands for origin
Assembler directive
Displacement from the start of a segment
ORG 1000H
ORG $+1000H
4/4/2016