CH 3.3 - INSTRUCTION SET OF 8085
CH 3.3 - INSTRUCTION SET OF 8085
MICROPROCESSOR INSTRUCTIONS
2
MICROPROCESSOR INSTRUCTIONS
• The purpose of an instruction set is to facilitate
the development of efficient programs by
users/programmers.
• The instruction set is based on the architecture
of the processor.
• So, to understand the instruction set of a
processor, it is necessary to understand the
basic architecture of the microprocessor and
the user accessible registers in it.
3
MICROPROCESSOR INSTRUCTIONS
• An instruction is a binary bit pattern that can be
decoded inside a microprocessor to perform a
specific function.
• The assembly language mnemonics are the codes
for these binary patterns so that the user can easily
understand the function performed by these
instructions.
• The entire group of instructions is called the
instruction set, and this determines the
functionalities the microprocessor can perform.
4
MICROPROCESSOR INSTRUCTIONS
• Intel 8085 processor has its own set of
instructions listed both in mnemonics and
machine code, also called as object code.
• As 8085 is an 8-bit processor, the machine
codes for the instructions are also 8-bits wide.
5
MICROPROCESSOR INSTRUCTIONS
An instruction is a binary pattern designed for a
microprocessor to perform a specific function.
The entire group of instructions that a microprocessor
supports is called Instruction Set.
8085 has 246 different patterns and 74 instructions.
Each instruction is represented by an 8-bit binary value.
These 8-bits of binary value is called Op-Code or
machine code or Instruction Byte.
6
MICROPROCESSOR INSTRUCTIONS
• The microprocessor instruction can be classified based
on many parameters such as the functionality, length
and operand addressing.
• Instructions can be classified into five categories based
on the functionality provided by the instructions.
• a) Data Transfer (copy) operations,
• b) Arithmetic operations,
• c) Logical operations,
• d) Branching operations
• e) Machine-control operations
7
MICROPROCESSOR INSTRUCTIONS
• Based on the length of the instructions, the
instruction set can be classified into following
types:
• a) One-byte instructions,
• b) Two-byte instructions and
• c) Three-byte instructions etc.
8
INSTRUCTION CLASSIFICATION
BASED ON FUNCTIONALITY
9
Classification of Instruction Set
11
Data Transfer Instructions
Opcode Operand Description
MOV Rd, Rs Copy from source to destination.
M, Rs
Rd, M
13
Data Transfer Instructions
Opcode Operand Description
LDA 16-bit address Load Accumulator
14
Data Transfer Instructions
Opcode Operand Description
LDAX B/D Register Pair Load accumulator indirect
This instruction copies the contents of that memory location into the
accumulator.
The contents of either the register pair or the memory location are not
altered.
16
Data Transfer Instructions
Opcode Operand Description
STA 16-bit address Store accumulator direct
18
Data Transfer Instructions
Opcode Operand Description
STAX Reg. pair Store accumulator indirect
Example: STAX B
19
Data Transfer Instructions
Opcode Operand Description
XCHG None Exchange H-L with D-E
Example: XCHG
21
Data Transfer Instructions
Opcode Operand Description
OUT 8-bit port address Copy data from accumulator to a port with 8-bit
address
Example: OUT 78 H
27
Data Transfer Instructions
Opcode Operand Description
IN 8-bit port address Copy data to accumulator from a port with 8-bit
address
Example: IN 8C H
28
Arithmetic Instructions
• These instructions perform the operations
like:
– Addition
– Subtract
– Increment
– Decrement
29
Arithmetic Instructions
Opcode Operand Description
ADD R Add register or memory to accumulator
M
If the operand is memory location, its address is specified by H-L pair.
The contents of register or memory and Carry Flag (CY) are added to
the contents of accumulator.
If the operand is memory location, its address is specified by H-L pair.
Example: ADI 45 H 35
Arithmetic Instructions
Opcode Operand Description
ACI 8-bit data Add immediate to accumulator with carry
The 8-bit data and the Carry Flag (CY) are added to the
contents of accumulator.
Example: ACI 45 H
36
Arithmetic Instructions
Opcode Operand Description
SUB R Subtract register or memory from accumulator
M
If the operand is memory location, its address is specified by H-L pair.
The contents of the register or memory location and Borrow Flag (i.e.
CY) are subtracted from the contents of the accumulator.
If the operand is memory location, its address is specified by H-L pair.
Example: SUI 45 H
40
Arithmetic Instructions
Opcode Operand Description
SBI 8-bit data Subtract immediate from accumulator with
borrow
The 8-bit data and the Borrow Flag (i.e. CY) is subtracted
from the contents of the accumulator.
Example: SBI 45 H
41
Arithmetic Instructions
Opcode Operand Description
INR R Increment register or memory by 1
M
Example: INX H
43
Arithmetic Instructions
Opcode Operand Description
DCR R Decrement register or memory by 1
M
Example: DCX H
45
Logical Instructions
• These instructions perform logical operations on data stored
in registers, memory and status flags.
46
AND, OR, XOR
• Any 8-bit data, or the contents of register, or
memory location can logically have
– AND operation
– OR operation
– XOR operation
48
Compare
• Any 8-bit data, or the contents of register, or
memory location can be compares for:
– Equality
– Greater Than
– Less Than
50
Logical Instructions
Opcode Operand Description
ANA R Logical AND register or memory with
M accumulator
The contents of the accumulator are logically ANDed with the contents of register
or memory.
The result is placed in the accumulator.
If the operand is a memory location, its address is specified by the contents of H-L
pair.
S, Z, P are modified to reflect the result of the operation.
CY is reset.
Example: ANA B or ANA M.
52
Logical Instructions
Opcode Operand Description
ANI 8-bit data Logical AND immediate with accumulator
CY is reset.
The contents of the accumulator are logically ORed with the contents of the register or
memory.
If the operand is a memory location, its address is specified by the contents of H-L pair.
54
Logical Instructions
Opcode Operand Description
ORI 8-bit data Logical OR immediate with accumulator
The contents of the accumulator are logically ORed with the 8-bit
data.
The result is placed in the accumulator.
The contents of the accumulator are XORed with the contents of the register
or memory.
The result is placed in the accumulator.
If the operand is a memory location, its address is specified by the contents
of H-L pair.
S, Z, P are modified to reflect the result of the operation.
CY and AC are reset.
Example: XRA B or XRA M.
56
Logical Instructions
Opcode Operand Description
XRI 8-bit data XOR immediate with accumulator
58
Logical Instructions (continued...)
• RLC (Rotate Accumulator Left) instruction
Format: RLC
www.eazynotes.com 59
Logical Instructions
Opcode Operand Description
RRC None Rotate accumulator right
60
Logical Instructions
Opcode Operand Description
RAL None Rotate accumulator left through carry
www.eazynotes.com 62
Logical Instructions
Opcode Operand Description
RAR None Rotate accumulator right through carry
64
Logical Instructions
Opcode Operand Description
CMP R Compare register or memory with accumulator
M
65
Logical Instructions
Opcode Operand Description
CMP R Compare register or memory with accumulator
M
if (A) > (reg/mem): carry and zero flags are reset.
66
Logical Instructions
Opcode Operand Description
CPI 8-bit data Compare immediate with accumulator
67
Logical Instructions
Opcode Operand Description
CPI 8-bit data Compare immediate with accumulator
if (A) > data: carry and zero flags are reset
68
Branching Instructions
• The branching instruction alter the normal
sequential flow.
71
Branching Instructions
Opcode Operand Description
JMP 16-bit address Jump unconditionally
72
Branching Instructions
Opcode Operand Description
Jx 16-bit address Jump conditionally
73
Jump Conditionally
Opcode Description Status Flags
JC Jump if Carry CY = 1
74
Branching Instructions
Opcode Operand Description
CALL 16-bit address Call unconditionally
75
Branching Instructions
Opcode Operand Description
RET None Return unconditionally
83
Control Instructions
Opcode Operand Description
NOP None No operation
84
Control Instructions
Opcode Operand Description
HLT None Halt
85