Instruction Set and addressing modes of 8051
Instruction Set and addressing modes of 8051
Intel x86
Module 2
1
ADDRESSING MODES
8086 Microprocessor
Addressing Modes
1. Register Addressing
Group I : Addressing modes for
2. Immediate Addressing register and immediate data
3. Direct Addressing
5. Based Addressing
6. Indexed Addressing
Group II : Addressing modes for
7. Based Index Addressing memory data
3
8086 Microprocessor Group I : Addressing modes for
Addressing Modes register and immediate data
4
8086 Microprocessor Group I : Addressing modes for
Addressing Modes register and immediate data
1. Register Addressing
In immediate addressing mode, an 8-bit or 16-bit
2. Immediate Addressing data is specified as part of the instruction
3. Direct Addressing
Example:
4. Register Indirect Addressing
MOV DL, 08H
5. Based Addressing
The 8-bit data (08H) given in the instruction is
6. Indexed Addressing moved to DL
(AX) 0A9FH
5
8086 Microprocessor Group II : Addressing modes
Addressing Modes for memory data
1. Register Addressing
2. Immediate Addressing
Here, the effective address of the memory
3. Direct Addressing
location at which the data operand is stored is
4. Register Indirect Addressing given in the instruction.
6
8086 Microprocessor Group II : Addressing modes
Addressing Modes for memory data
CX = 10H*DS+[BX]
7
8086 Microprocessor Group II : Addressing modes
Addressing Modes for memory data
Operations:
AX = 10H*DS+[BX] + [08H]
8
8086 Microprocessor Group II : Addressing modes
Addressing Modes for memory data
CX = 10HxDS+[SI]
9
8086 Microprocessor Group II : Addressing modes
Addressing Modes for memory data
10
8086 Microprocessor Group II : Addressing modes
Addressing Modes for memory data
11
8086 Microprocessor Group II : Addressing modes
Addressing Modes for memory data
1. Register Addressing
In this addressing mode, effective address is
2. Immediate Addressing formed by adding 8 or 16 bit displacement with
sum of contents of any one of the base registers
3. Direct Addressing (BX or BP) and any one of the index registers in a
default segment.
4. Register Indirect Addressing
Example:
5. Based Addressing
MOV AX,50H [BX][ SI]
6. Indexed Addressing
12
INSTRUCTION SET
8086 Microprocessor
Instruction Set
2. Arithmetic Instructions
3. Logical Instructions
8. String Instructions
14
8086 Microprocessor
Instruction Set
These instructions are used to transfer the data from the source operand to the
destination operand. Following are the list of instructions under this group :
15
8086 Microprocessor
Instruction Set
2. Arithmetic Instructions
Instructions to perform addition:
ADD − Used to add the provided byte to byte/word to word.
ADC − Used to add with carry.
INC − Used to increment the provided byte/word by 1.
AAA − Used to adjust ASCII after addition.
DAA − Used to adjust the decimal after the addition/subtraction operation.
Instructions to perform subtraction
SUB − Used to subtract the byte from byte/word from word.
SBB − Used to perform subtraction with borrow.
DEC − Used to decrement the provided byte/word by 1.
AAS − Used to adjust ASCII codes after subtraction.
DAS − Used to adjust decimal after subtraction.
17
8086 Microprocessor
Instruction Set
2. Arithmetic Instructions
Instruction to perform multiplication:
MUL − Used to multiply unsigned byte by byte/word by word.
IMUL − Used to multiply signed byte by byte/word by word.
AAM − Used to adjust ASCII codes after multiplication.
Instructions to perform division
DIV − Used to divide the unsigned word by byte or unsigned double word by
word.
IDIV − Used to divide the signed word by byte or signed double word by word.
AAD − Used to adjust ASCII codes after division.
18
8086 Microprocessor
Instruction Set
2. Arithmetic Instructions
Other Arithmetic Instruction:
CMP − Used to compare 2 provided byte/word.
NEG − Used to negate each bit of the provided byte/word and forms 2’s
complement.
CBW − Used to covert a signed byte to a signed word.
CWD − Used to covert a signed word to double word.
19
8086 Microprocessor
Instruction Set
3. Logical Instructions
NOT − Used to invert each bit of a byte or word.
AND − Used for adding each bit in a byte/word with the corresponding bit in
another byte/word.
OR − Used to multiply each bit in a byte/word with the corresponding bit in
another byte/word.
XOR − Used to perform Exclusive-OR operation over each bit in a byte/word with
the corresponding bit in another byte/word.
TEST − Used to add operands to update flags, without affecting operands.
SHL− Used to shift bits of a byte/word towards left and put zero(S) in LSBs.
SHR − Used to shift bits of a byte/word towards the right and put zero(S) in
MSBs.
20
8086 Microprocessor
Instruction Set
4. Shift and Rotate Instructions
SHL− Used to shift bits of a byte/word towards left and put zero(S) in LSBs.
SHR − Used to shift bits of a byte/word towards the right and put zero(S) in
MSBs.
SAR − Used to shift bits of a byte/word towards the right and copy the old MSB
into the new MSB.
ROL − Used to rotate bits of byte/word towards the left, i.e. MSB to LSB and to
Carry Flag [CF].
ROR − Used to rotate bits of byte/word towards the right, i.e. LSB to MSB and to
Carry Flag [CF].
RCR − Used to rotate bits of byte/word towards the right, i.e. LSB to CF and CF
to MSB.
RCL − Used to rotate bits of byte/word towards the left, i.e. MSB to CF and CF to
LSB.
21
8086 Microprocessor
Instruction Set
22
8086 Microprocessor
Instruction Set
5. Branch and Loop Instructions
Conditional Jump Instruction:
23
8086 Microprocessor
Instruction Set
24
8086 Microprocessor
Instruction Set
25
8086 Microprocessor
Instruction Set
26
8086 Microprocessor
Instruction Set
27