Unit-2 Microprocessor - DTU
Unit-2 Microprocessor - DTU
9/19/2025 1
Instruction Set of 8085
9/19/2025 2
Daily Quiz
9/19/2025 3
Daily Quiz
• Which control instruction is followed by an un-conditional branch
instructions so as to branch to a single location from the double
ones with respect to specified status-bit condition?
A. jump instruction
B. branch instruction
C. skip instruction
D. return- from-subroutine instructions
• Which category of microprocessor instructions detect the status
conditions in registers and accordingly exhibit the variations in
program sequence on the basis of detected results?
A. Transfer Instructions
B. Operation Instructions
C. Control Instructions
D. All of the above
9/19/2025 4
Data Transfer Operation
9/19/2025 5
Data Transfer Operation
Data Transfer Instructions
• This instruction perform following six operation.
9/19/2025 6
Data Transfer Operation
Data Transfer Instructions
Opcode Operand Description
MOV Rd, Rs Copy from source to destination.
M, Rs
Rd, M
• This instruction copies the contents of the source register into the
destination register.
9/19/2025 7
Data Transfer Operation
Data Transfer Instructions
9/19/2025 8
Data Transfer Operation
Data Transfer Instructions
9/19/2025 9
Data Transfer Operation
Data Transfer Instructions
Opcode Operand Description
LDAX B/D Register Load accumulator indirect
Pair
The contents of the designated register pair point to a memory location.
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. FFFFH
Example: LDAX B
A =C2 F
B =2A C =50 2A50H C2
D E
H L
0000H
9/19/2025 10
Data Transfer Operation
Data Transfer Instructions
9/19/2025 11
Data Transfer Operation
Data Transfer Instructions
Opcode Operand Description
LHLD 16-bit address Load H-L registers direct
0000H
9/19/2025 12
Data Transfer Operation
Data Transfer Instructions
0000H
9/19/2025 13
Data Transfer Operation
Data Transfer Instructions
Opcode Operand Description
STAX Reg. pair Store accumulator indirect
A =C2 F
B =2A C =50 2A50H C2
D E
H L
0000H
9/19/2025 14
Data Transfer Operation
Data Transfer Instructions
Opcode Operand Description
SHLD 16-bit address Store H-L registers direct
9/19/2025 15
Data Transfer Operation
Data Transfer Instructions
Opcode Operand Description
XCHG None Exchange H-L with D-E
Example: XCHG A F A F
B C B C
D =20 E =50 D =75 E =32
H =75 L =32 H =20 L =50
9/19/2025 16
Data Transfer Operation
Data Transfer Instructions
Example: SPHL
9/19/2025 17
Data Transfer Operation
Data Transfer Instructions
The contents of H register are exchanged with the next location (SP
+ 1).
Example: XTHL
9/19/2025 18
Data Transfer Operation
Data Transfer Instructions
Opcode Operand Description
PCHL None Load program counter with H-L
contents
The contents of H are placed as the high-order byte and the contents
of L as the low-order byte.
Example: PCHL
9/19/2025 19
Data Transfer Operation
Data Transfer Instructions
Example: PUSH D
9/19/2025 20
Data Transfer Operation
Example : PUSH D
FFFFH FFFFH
A F
A F
B C 2001H 2001H
B C
D =10 E =50 2000H 2000H
D =10 E =50
H L 1FFFH 1FFFH 10
H L
SP = 2000H 1FFEH 1FFEH 50
SP = 1FFEH
0000H 0000H
9/19/2025 21
Data Transfer Operation
Data Transfer Instructions
Example: POP H
9/19/2025 22
Data Transfer Operation
Example : POP D
FFFFH FFFFH
A F
A F
B C 2053H 2053H
B C
D E 2052H 2052H
D =45 E =30
H L 2051H 45 2051H 45
30 H L
SP = 2050H 2050H 2050H 30
SP = 2052H
0000H 0000H
9/19/2025 23
Data Transfer Operation
Data Transfer Instructions
Example: OUT 78 H
9/19/2025 24
Data Transfer Operation
Data Transfer Instructions
Example: IN 8C H
9/19/2025 25
Daily Quiz
9/19/2025 26
Daily Quiz
9/19/2025 27
Arithmetic operations
Arithmetic Instructions
Addition
9/19/2025 28
Arithmetic operations
Arithmetic Instructions
Subtraction
• Any 8-bit number, or the contents of register, or the contents of
memory location can be subtracted from the contents of
accumulator.
9/19/2025 29
Arithmetic operations
Arithmetic Instructions
Increment / Decrement
• The 8-bit contents of a register or a memory location can be
incremented or decremented by 1.
9/19/2025 30
Arithmetic operations
Arithmetic Instructions
Opcode Operand Description
ADD R Add register or memory to accumulator
M
The contents of register or memory are added to the contents of
accumulator. The result is stored in accumulator.
ADD M ( A+ M(HL) A)
9/19/2025 31
Arithmetic operations
Arithmetic Instructions
Opcode Operand Description
ADC R Add register or memory to accumulator
M with carry
The contents of register or memory and Carry Flag (CY) are added to the
contents of accumulator. The result is stored in accumulator.
ADC M ( A+M(HL) + CY A)
9/19/2025 32
Arithmetic operations
Arithmetic Instructions
Example: ADI 45 H ( A + 45 A)
9/19/2025 33
Arithmetic operations
Arithmetic Instructions
Example: ACI 45 H ( A + 45 + CY A)
9/19/2025 34
Arithmetic operations
Arithmetic Instructions
The 16-bit contents of the register pair are added to the contents of
H-L pair.
9/19/2025 35
Arithmetic operations
Arithmetic Instructions
PROBLEM
DAD D
Let D=30H, E=20H
H= 1AH, L = 42 H
SOLUTION
9/19/2025 36
Arithmetic operations
Arithmetic Instructions
Opcode Operand Description
SUB R Subtract register or memory from
M accumulator
The contents of the register or memory location are subtracted from the
contents of the accumulator. The result is stored in accumulator.
Example: SUB B (A – B A)
SUB M (A – M (HL) A)
9/19/2025 37
Arithmetic operations
Arithmetic Instructions
Opcode Operand Description
SBB R Subtract register or memory from
M accumulator with borrow
The contents of the register or memory location and Borrow Flag
(i.e. CY) are subtracted from the contents of the accumulator. The
result is stored in accumulator.
Example: SBB B (A – B – CY A)
9/19/2025
SBB M (A – M (HL) – CY A) 38
Arithmetic operations
Arithmetic Instructions
Example: SUI 54 H (A – 54 A)
9/19/2025 39
Arithmetic operations
Arithmetic Instructions
Example: SBI 45 H (A – 45 – CY A)
9/19/2025 40
Arithmetic operations
Arithmetic Instructions
Example: INR B (B + 1 B)
INR M (M + 1 M)
9/19/2025 41
Arithmetic operations
Arithmetic Instructions
9/19/2025 42
Arithmetic operations
Arithmetic Instructions
Opcode Operand Description
DCR R Decrement register or memory by 1
M
Example: DCR B (B – 1 B)
DCR M (M – 1 M)
9/19/2025 43
Arithmetic operations
Arithmetic Instructions
9/19/2025 44
Arithmetic operations
Arithmetic Instructions
Operation:
9/19/2025 45
Arithmetic operations
Arithmetic Instructions
9/19/2025 46
Daily Quiz
9/19/2025 47
Daily Quiz
• What is the status of z flag, cy flag, sign flag at the end of this program?
MVI A, 02H
MVI B, 03H
ADD B
XRA A
a) 1,0,0 b)0,1,0 c)1,0,0 d)1,0,1
• What is the content of Register A at the end?
XRA A
MVI B, 4DH
SUI 4FH
ANA B
HLT
a) 00h b) 01h c) 4Dh
9/19/2025 48
Logic Operations
Logical Instructions
9/19/2025 49
Logic Operations
AND, OR, XOR
• Any 8-bit data, or the contents of register, or memory location
can logically have
• AND operation
• OR operation
• XOR operation
with the contents of accumulator.
• The result is stored in accumulator.
9/19/2025 50
Logic Operations
Rotate
• Each bit in the accumulator can be shifted either left or right to
the next position.
9/19/2025 51
Logic Operations
Compare
• Any 8-bit data, or the contents of register, or memory location
can be compares for:
• Equality
• Greater Than
• Less Than
with the contents of accumulator.
• The result is reflected in status flags.
9/19/2025 52
Logic Operations
Complement
9/19/2025 53
Logic Operations
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 and AC is set.
Example: ANA B or ANA M.
9/19/2025 54
Logic Operations
Logical Instructions
The contents of the accumulator are logically ANDed with the 8-bit
data.
CY is reset, AC is set.
9/19/2025 55
Logic Operations
Logical Instructions
Opcode Operand Description
ORA R Logical OR register or memory with
M accumulator
The contents of the accumulator are logically ORed with the contents of
the register or memory. The result is placed in the accumulator.
9/19/2025 56
Logic Operations
Logical Instructions
The contents of the accumulator are logically ORed with the 8-bit
data.
9/19/2025 57
Logic Operations
Logical Instructions
Opcode Operand Description
XRA R Logical XOR register or memory with
M 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 D or XRA M.
9/19/2025 58
Logic Operations
Logical Instructions
The contents of the accumulator are XORed with the 8-bit data.
The result is placed in the accumulator.
S, Z, P are modified to reflect the result.
CY and AC are reset.
Example: XRI 23H.
9/19/2025 59
Logic Operations
Logical Instructions
9/19/2025 60
Logic Operations
Logical Instructions
if (A) > (reg/mem): carry and zero flags are reset.
9/19/2025 61
Logic Operations
Logical Instructions
9/19/2025 62
Logic Operations
Logical Instructions
if (A) > data: carry and zero flags are reset
9/19/2025 63
Logic Operations
Logical Instructions
Opcode Operand Description
RLC None Rotate accumulator left
9/19/2025 64
Logic Operations
Logical Instructions
9/19/2025 65
Logic Operations
Logical Instructions
9/19/2025 66
Logic Operations
Logical Instructions
9/19/2025 67
Logic Operations
Logical Instructions
Example: CMA
A= ABH
9/19/2025 68
Logic Operations
Logical Instructions
Example: CMC
9/19/2025 69
Logic Operations
Logical Instructions
Example: STC.
9/19/2025 70
Daily Quiz
9/19/2025 71
Daily Quiz
9/19/2025 72
Branch operation
Before the transfer, the address of the next instruction after CALL
(the contents of the program counter) is pushed onto the stack.
9/19/2025 73
Branch operation
Example : CALL 6030H
FFFFH FFFFH
A F
A F
B C 3001H 3001H
B C
D E 3000H 3000H
D E
H L 2FFFH 2FFFH 20 = PCH
H L
SP = 3000H 2FFEH 2FFEH 40=PCL
SP = 2FFEH
PC= 2040H
PC= 6030H
0000H 0000H
9/19/2025 74
Branch operation
Before the transfer, the address of the next instruction after the call
(the contents of the program counter) is pushed onto the stack.
Example: CZ 2034 H.
9/19/2025 75
Branch operation
Call Conditionally
9/19/2025 76
Branch operation
Example : 2030H CZ 7050H
FFFFH FFFFH
A=00 F, Z=1
A=00 F, Z=1
B C 3001H 3001H
B C
D E 3000H 3000H
D E
H L 2FFFH 2FFFH 20 = PCH
H L
SP = 3000H 2FFEH 2FFEH 30=PCL
SP = 2FFEH
PC= 2030H
PC= 7050H
0000H 0000H
9/19/2025 77
Branch operation
The two bytes from the top of the stack are copied into the program
counter, and program execution begins at the new address.
Example: RET.
9/19/2025 78
Branch operation
The two bytes from the top of the stack are copied into the program
counter, and program execution begins at the new address.
Example: RZ.
9/19/2025 79
Branch operation
Return Conditionally
9/19/2025 80
Branch operation
Branching Instructions
PC = 2015H PC = 2008H
Before After
9/19/2025 81
Branch operation
Branching Instructions
Example: JZ 2034 H.
9/19/2025 82
Branch operation
Jump Conditionally
9/19/2025 83
Branch operation
Example: RST 3.
9/19/2025 84
Branch operation
9/19/2025 85
Control Operation
Control Instructions
No operation is performed.
Example: NOP
9/19/2025 86
Control Operation
The CPU finishes executing the current instruction and halts any
further execution.
Example: HLT
9/19/2025 87
Control Operation
The interrupt enable flip-flop is reset and all the interrupts except the
TRAP are disabled.
Example: DI
9/19/2025 88
Control Operation
The interrupt enable flip-flop is set and all interrupts are enabled.
Example: EI
9/19/2025 89
Control Operation
The instruction loads eight bits in the accumulator with the following
interpretations.
Example: RIM
9/19/2025 90
Control Operation
RIM Instruction
9/19/2025 91
Control Operation
Example: SIM
9/19/2025 92
Control Operation
SIM Instruction
9/19/2025 93
Daily Quiz
• What does the last instruction of each subroutine that transfer the control
to the instruction in the calling program with temporary address storage ,
called as?
A. jump to subroutine
B. branch to subroutine
C. return from subroutine
D. call subroutine
• What is SIM?
A. Select interrupt mask
B. Sorting interrupt mask
C. Set interrupt mask
D. None of these
9/19/2025 94
Daily Quiz
9/19/2025 95