MPMC Unit 2 8086 Instructions
MPMC Unit 2 8086 Instructions
8086
Why study instruction set?
Instruction Set
Different types of instructions with examples
How to use instructions in assembly language programming
Types of instructions in 8086
2. Arithmetic
3. Logical instructions
5. Branch instructions
6. Loop instructions
9. String instructions
1: Data Copy/Transfer instructions
• It cannot exchange
two memory locations
directly. 10 AB FF 33
BX AX
1: Data Copy/Transfer instructions
IN AL/AX, 8-bit/16-bit port address
It copies data to accumulator from a port with 8-bit or 16-bit address.
Addition
Subtraction
Increment
Decrement
Multiply
Divide
2: Arithmetic Instructions
ADD Destination, Source
This instruction adds the contents of source operand with the contents
of destination operand. The result is stored in destination operand.
Eg: ADD AX,BX
The source may be immediate
data, memory location or
register. AX AX BX
20 00 + 50 12
The destination may be
memory location or register. 70 XX
XX 00 00
AX is the default destination AH AL AH AL BH BL
register.
2: Arithmetic Instructions
ADC Destination, Source
This instruction adds the contents of source operand with the contents
of destination operand with carry flag bit.
Eg: ADD AX,BX
The source may be immediate
data, memory location or
register.
AX AX BX CY
The destination may be
memory location or register.
XX XX
70 01 20 00 + 50 12
00 + 1
The result is stored in
destination operand. AH AL AH AL BH BL
AX is the default destination
register.
2: Arithmetic Instructions
INC source
This instruction increases the contents of source operand by 1.
Eg: INC AX
The source may be memory
location or register.
The source can not be AX AX
immediate data.
The result is stored in the 70 00
01 70 00 + 1
same place. AH AL AH AL
2: Arithmetic Instructions
MUL operand
This instruction will multiple unsigned operand 8-bit/16-bit with AL/AX
and store the result in AX/DX-AX.
Eg: MUL BH
Operand may be general
purpose register or memory
location. AX AX BX
If operand is of 8-bit then
multiply it with contents of AL. XX XX
00 08 XX 04 X 02 12
XX
If operand is of 16-bit then
multiply it with contents of AX. AH AL AH AL BH BL
Result is stored in
accumulator AX in 8 bit
operation and DX-AX in 16bit
operation.
2: Arithmetic Instructions
DIV Operand
This instruction will divide unsigned operand AX/DX-AX by 8-bit/16-bit
number and store the result in AX/DX-AX
Eg: DIV BL
Operand may be general
purpose register or memory
location. AX AX BX
AL=AX/Operand (8-bit)
AL= Quotient,
88
04 88
04 88 88 / XX 12
22
AH=Remainder. AH AL AH AL BH BL
AX=DX-AX/Operand (16-bit)
AX= Quotient,
DX=Remainder.
3: Bit Manipulation Instructions (LOGICAL
Instructions)
AND
OR
XOR
NOT
3: Bit Manipulation Instructions (LOGICAL
Instructions)
AND
Especially used in clearing certain bits (masking)
AX BX
Eg: AND BL, 0FH XX 88
08 XX 88 X XX 12
0F
AH AL BH BL
OR
Used to OR each bit in a byte/word with the corresponding bit in
another byte/word.
xxxx xxxx OR 0000 1111 = xxxx 1111
AX AX
Eg: MOV AX, 2000h 20 00
08 20 00 or 00 12
08
OR AX, 0008h AH AL AH AL
SHL
The SHL (shift left) instruction performs a logical left shift on the
destination operand, filling the lowest bit with 0.
0
CF
After Before
CALL − Used to call a procedure and save their return address to the
stack.
Eg: CALL Label