Professional Documents
Culture Documents
BASIC INSTRUCTIONS
1 CAP221 10/23/2010
MOV instruction
2 CAP221 10/23/2010
Examples:
MOV AX , WORD1
MOV AX , BX
MOV AH , ‘A’
3 CAP221 10/23/2010
XCHG instruction
the contents of
– two registers, or
– a register and a memory location
– Syntax
XCHG destination , source
4 CAP221 10/23/2010
Examples:
XCHG AH , BL
XCHG AX , WORD1
5 CAP221 10/23/2010
Restrictions on MOV & XCHG
MOV Destination Operand
Source General Segment Memory Constant
Operand Register Register Location
General
Register yes yes yes no
Segment
Register yes no yes no
Memory
Location yes yes no no
Constant yes no yes no
6 CAP221 10/23/2010
Restrictions on MOV & XCHG
XCHG Destination Operand
Source General Memory
Operand Register Location
General
Register yes yes
Memory
Location yes no
7 CAP221 10/23/2010
ADD & SUB
– two registers,
– a register & memory location , or
– add ( subtract ) a number to ( from ) a register or a
memory location.
– Syntax
ADD destination , source
8 CAP221 10/23/2010
Example
Examples
ADD WORD1 , AX
SUB AX , DX
ADD BL , 5
9 CAP221 10/23/2010
Legal combinations of operands for
ADD & SUB
Destination operand
Source Operand General Register Memory location
10 CAP221 10/23/2010
INC ( increment )
&DEC ( decrement )
Examples:
INC WORD1
DEC BYTE1
12 CAP221 10/23/2010
NEG
• Syntax
NEG destination
13 CAP221 10/23/2010
Translation of HLL to
Assembly Language
Statement Translation
14 CAP221 10/23/2010
NEG A ; A = -A
ADD A , 5 ;A = 5 - A
15 CAP221 10/23/2010
Translation of HLL to
Assembly Language
Statement Translation
16 CAP221 10/23/2010