0% found this document useful (0 votes)
29 views29 pages

MPMC Unit 2 8086 Instructions

The document provides an overview of the 8086 instruction set, emphasizing the importance of understanding it for writing machine code that a CPU can execute. It details various types of instructions, including data transfer, arithmetic, logical, shift, branch, loop, machine control, flag manipulation, and string instructions, along with examples for each. The content serves as a foundational guide for assembly language programming and the operations that can be performed using the 8086 architecture.

Uploaded by

nemisha.doshi13
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views29 pages

MPMC Unit 2 8086 Instructions

The document provides an overview of the 8086 instruction set, emphasizing the importance of understanding it for writing machine code that a CPU can execute. It details various types of instructions, including data transfer, arithmetic, logical, shift, branch, loop, machine control, flag manipulation, and string instructions, along with examples for each. The content serves as a foundational guide for assembly language programming and the operations that can be performed using the 8086 architecture.

Uploaded by

nemisha.doshi13
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 29

Instruction Set of

8086
Why study instruction set?

 Study of instruction set is required to write instructions in machine


code that can be recognized and executed by a central processing unit.
 The knowledge will help you write lines of code or program by which
you will be able to tell the processor, the sequence of operations to be
performed.
What are we going to study?

Instruction Set
 Different types of instructions with examples
 How to use instructions in assembly language programming
Types of instructions in 8086

1. Data Copy/Transfer instructions

2. Arithmetic

3. Logical instructions

4. Shift & Rotate instructions

5. Branch instructions

6. Loop instructions

7. Machine Control instructions

8. Flag Manipulation instructions

9. String instructions
1: Data Copy/Transfer instructions

MOV Destination, Source


 There will be transfer of data from source to destination.

Eg: MOV AX,BX


 Source can be register, memory
location or immediate data.
 Destination can be register or AX BX
memory operand.
 Both Source and Destination FF 33 10 AB
cannot be memory location AH AL BH AL
or segment registers at the
same time.
1: Data Copy/Transfer instructions
PUSH Source
 Pushes the 16 bit content specified by source in the
instruction on to the stack
Eg:PUSH BX
 Pushing operation
decrements stack pointer SP 5000
stack pointer. 01
50 02
00 5001
 Stack pointer is a 16-bit 5002 FF
register, contains the BX
address of the data item
5003 33
currently on top of the
10
10 AB AB
stack. BH AL
1: Data Copy/Transfer instructions
POP Destination
 Pops the 16 bit content from stack to destination specified in
instruction.
Eg: POP DS
 Popping operation SP 5000
10
increments stack pointer DS 01
00
50 02 5001 AB
stack pointer. 5002 FF
22 33
5003 33
1: Data Copy/Transfer instructions
XCHG Destination, Source
 This instruction exchanges contents of Source with
destination.
Eg: XCHG BX,AX

• 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.

Eg:IN AL, 80H Eg:IN AX, DX

 DX is the only register is


allowed to carry port 80 34
00
AX 12
address.
AX 12
80 AH AL PORT
AH AL PORT
80 00 DX
1: Data Copy/Transfer instructions
XLAT
 Translate instruction is used to find out codes in case of code
conversion.
:
EgMOV AX, TABLE SEGMENT ADDRESS
 It translates code of the MOV DS, AX
key pressed to the
MOV AL, DISPLAY CODE 3000:5000 7E
corresponding 7-
segment code. MOV BX, OFFSET TABLE 3000:5001 30
 After execution this XLAT
3000:5002 6D
instruction contents of 3000:5003 79
AL register always gets
12 DS
replaced. 30
X 02 00 AX
AH AL 50 12
00 BX
2: Arithmetic Instructions

 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)

xxxx xxxx AND 0000 1111 = 0000 xxxx

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

0010 0000 OR 0000 1000 = 0010 1000


This sets bit 4 in the AX register
4: Instructions to perform shift operations

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

Eg: MOV BL,5d 0A


XX 05 XX 05
SHL BL,1 BH BL BH BL
0 0 0 0 1 0 1 0 0 0 0 0 0 1 0 1
5: Branch instructions

 CALL − Used to call a procedure and save their return address to the
stack.
 Eg: CALL Label

 RET − Used to return from the procedure to the main program.

 JMP − Used to jump to the provided address to proceed to the next


instruction.
 JMP Label
5: Branch instructions
Instructions to transfer the instruction during an execution with some conditions
6. Loop Instructions
Loop Example
7. Machine Control Instructions
8. Flag Manipulation/ Process
Control Instructions

8086 Flag register


9. String Instructions
MOVSB Example
CMPSB Example

You might also like