8085 Instructions
8085 Instructions
1
3/4/2025
An Instruction is a command to the microprocessor to perform a given task Classification of Instruction Set
on specified data.
Each instruction has two parts: one is the task to be performed, called the
operation code (op-code), and the second is the data to be operated on,
called the operand. • Data Transfer Instruction
The operand (or data) can be specified in various ways. It may include 8-bit • Arithmetic Instructions
(or 16-bit) data, an internal register, a memory location, or an 8-bit (or 16-
bit) address. Example: MOV r1, r2, LDA 2050H, JMP 2080H, XRA M etc. • Logical Instructions
2
3/4/2025
Example: MOV B, C
MOV B, M
MOV M, C
3
3/4/2025
The 8-bit data is stored in the destination register or This instruction loads 16-bit data in the register pair.
memory.
Example: LXI H, 2034 H
If the operand is a memory location, its location is
specified by the contents of the H-L registers.
MVI M, 57H
4
3/4/2025
5
3/4/2025
This instruction copies the contents of memory The contents of accumulator are copied into the
location pointed out by 16-bit address into register L. memory location specified by the operand.
It copies the contents of next memory location into Example: STA 2500 H
register H.
6
3/4/2025
The contents of accumulator are copied into the The contents of register L are stored into memory
memory location specified by the contents of the location specified by the 16-bit address.
register pair.
The contents of register H are stored into the next
Example: STAX B memory location.
7
3/4/2025
• Subtract
The contents of register H are exchanged with the
• Increment
contents of register D.
• Decrement
The contents of register L are exchanged with the
contents of register E.
Example: XCHG
8
3/4/2025
Addition Subtraction
• Any 8-bit number, or the contents of register, or the contents of • Any 8-bit number, or the contents of register, or the contents of
memory location can be added to the contents of accumulator. memory location can be subtracted from the contents of
accumulator.
• The result (sum) is stored in the accumulator.
• The result is stored in the accumulator.
• No two other 8-bit registers can be added directly.
• Subtraction is performed in 2’s complement form.
• Example: The contents of register B cannot be added directly to the
contents of register C. • If the result is negative, it is stored in 2’s complement form.
9
3/4/2025
• The 8-bit contents of a register or a memory location can be Opcode Operand Description
incremented or decremented by 1. ADD R Add register or memory to accumulator
M
• The 16-bit contents of a register pair can be incremented or
decremented by 1.
The contents of register or memory are added to the contents of
accumulator.
• Increment or decrement can be performed on any register or a
memory location. The result is stored in accumulator.
10
3/4/2025
The contents of register or memory and Carry Flag (CY) are added to the
contents of accumulator.
The 8-bit data is added to the contents of accumulator.
11
3/4/2025
The 8-bit data and the Carry Flag (CY) are added to the The 16-bit contents of the register pair are added to the
contents of H-L pair.
contents of accumulator.
The result is stored in H-L pair.
The result is stored in accumulator.
If the result is larger than 16 bits, then CY is set.
All flags are modified to reflect the result of the addition.
No other flags are changed.
Example: ACI 45 H Example: DAD B
12
3/4/2025
The contents of the register or memory location are subtracted from the The contents of the register or memory location and Borrow Flag (i.e. CY)
contents of the accumulator. are subtracted from the contents of the accumulator.
If the operand is memory location, its address is specified by H-L pair. If the operand is memory location, its address is specified by H-L pair.
All flags are modified to reflect the result of subtraction. All flags are modified to reflect the result of subtraction.
13
3/4/2025
The 8-bit data is subtracted from the contents of the The 8-bit data and the Borrow Flag (i.e. CY) is subtracted
accumulator. from the contents of the accumulator.
All flags are modified to reflect the result of subtraction. All flags are modified to reflect the result of subtraction.
14
3/4/2025
The contents of register or memory location are incremented The contents of register pair are incremented by 1.
by 1.
The result is stored in the same place.
The result is stored in the same place.
15
3/4/2025
The contents of register or memory location are decremented The contents of register pair are decremented by 1.
by 1.
The result is stored in the same place.
The result is stored in the same place.
16
3/4/2025
• These instructions perform logical operations on data stored in • Any 8-bit data, or the contents of register, or memory location can
registers, memory and status flags. logically have
• AND operation
• The logical operations are:
• OR operation
• AND
• OR • XOR operation
• XOR
with the contents of accumulator.
• Rotate
• Compare • The result is stored in accumulator.
• Complement
17
3/4/2025
Rotate Compare
• Each bit in the accumulator can be shifted either left or right to the • Any 8-bit data, or the contents of register, or memory location can be
next position. compares for:
• Equality
• Greater Than
• Less Than
18
3/4/2025
19
3/4/2025
if (A) < (reg/mem): carry flag is set The 8-bit data is compared with the contents of
accumulator.
if (A) = (reg/mem): zero flag is set
The values being compared remain unchanged.
if (A) > (reg/mem): carry and zero flags are reset.
The result of the comparison is shown by setting the
Example: CMP B or CMP M flags of the PSW as follows:
20
3/4/2025
if (A) < data: carry flag is set The contents of the accumulator are logically ANDed with the contents of
register or memory.
if (A) = data: zero flag is set The result is placed in the accumulator.
If the operand is a memory location, its address is specified by the contents
if (A) > data: carry and zero flags are reset of H-L pair.
S, Z, P are modified to reflect the result of the operation.
Example: CPI 89H CY is reset and AC is set.
Example: ANA B or ANA M.
21
3/4/2025
The contents of the accumulator are logically ANDed with the 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. S, Z, P are modified to reflect the result of the operation.
22
3/4/2025
The contents of the accumulator are logically ORed with the contents of the register or The contents of the accumulator are logically ORed with the 8-
memory.
bit data.
The result is placed in the accumulator.
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.
S, Z, P are modified to reflect the result.
23
3/4/2025
The contents of the accumulator are XORed with the contents of the The contents of the accumulator are XORed with the
register or memory.
8-bit data.
The result is placed in the accumulator.
If the operand is a memory location, its address is specified by the The result is placed in the accumulator.
contents of H-L pair.
S, Z, P are modified to reflect the result.
S, Z, P are modified to reflect the result of the operation.
CY and AC are reset. CY and AC are reset.
Example: XRA B or XRA M. Example: XRI 86H.
24
3/4/2025
Each binary bit of the accumulator is rotated left by one Each binary bit of the accumulator is rotated right by one
position. position.
Bit D7 is placed in the position of D0 as well as in the Carry Bit D0 is placed in the position of D7 as well as in the Carry
flag. flag.
CY is modified according to bit D7. CY is modified according to bit D0.
S, Z, P, AC are not affected. S, Z, P, AC are not affected.
Example: RLC. Example: RRC.
25
3/4/2025
Each binary bit of the accumulator is rotated left by one Each binary bit of the accumulator is rotated right by one
position through the Carry flag. position through the Carry flag.
Bit D7 is placed in the Carry flag, and the Carry flag is placed in Bit D0 is placed in the Carry flag, and the Carry flag is placed in
the least significant position D0. the most significant position D7.
CY is modified according to bit D7. CY is modified according to bit D0.
S, Z, P, AC are not affected. S, Z, P, AC are not affected.
Example: RAL. Example: RAR.
26
3/4/2025
The contents of the accumulator are complemented. The Carry flag is complemented.
27
3/4/2025
Opcode Operand Description • The branching instruction alter the normal sequential flow.
STC None Set carry
• These instructions alter either unconditionally or conditionally.
Example: STC.
28
3/4/2025
The program sequence is transferred to the memory The program sequence is transferred to the memory
location specified by the 16-bit address given in the location specified by the 16-bit address given in the
operand. operand based on the specified flag of the PSW.
Example: JMP 2034 H. Example: JZ 2034 H.
29
3/4/2025
JNZ Jump if No Zero Z=0 Before the transfer, the address of the next instruction after
CALL (the contents of the program counter) is pushed onto
JPE Jump if Parity Even P=1
the stack.
JPO Jump if Parity Odd P=0
Example: CALL 2034 H.
30
3/4/2025
Before the transfer, the address of the next instruction CNZ Call if No Zero Z=0
after the call (the contents of the program counter) is CPE Call if Parity Even P=1
pushed onto the stack.
CPO Call if Parity Odd P=0
Example: CZ 2034 H.
31
3/4/2025
The program sequence is transferred from the The program sequence is transferred from the
subroutine to the calling program. subroutine to the calling program based on the
specified flag of the PSW.
The two bytes from the top of the stack are copied into
The two bytes from the top of the stack are copied into
the program counter, and program execution begins at
the program counter, and program execution begins at
the new address. the new address.
Example: RET. Example: RZ.
32
3/4/2025
33
3/4/2025
Instructions Restart Address • The control instructions control the operation of microprocessor.
RST 0 0000 H
RST 1 0008 H
RST 2 0010 H
RST 3 0018 H
RST 4 0020 H
RST 5 0028 H
RST 6 0030 H
RST 7 0038 H
34
3/4/2025
35
3/4/2025
The interrupt enable flip-flop is reset and all the The interrupt enable flip-flop is set and all interrupts
interrupts except the TRAP are disabled. are enabled.
36
3/4/2025
37
3/4/2025
38