Download - Instruction set
![Page 1: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/1.jpg)
Instruction Set of 8085 µP
Compiled by:Parthesh Mankodi, Assistant Professor,
Department of Electronics & Communication
April 17, 2023 140701: Microprocessor & Interfacing 1
![Page 2: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/2.jpg)
What is Instruction ?????
An instruction is a binary pattern designed inside a microprocessor to perform a specific function.
8085 has 246 instructions.
Each instruction is represented by an 8-bit binary value.
April 17, 2023 140701: Microprocessor & Interfacing 2
![Page 3: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/3.jpg)
Classification Of Instructions
There are 5 Types,
(1) Data Transfer Instruction,(2) Arithmetic Instructions,(3) Logical Instructions,(4) Branching Instructions,(5) Control Instructions,
April 17, 2023 140701: Microprocessor & Interfacing 3
![Page 4: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/4.jpg)
(1) Data Transfer Instructions
MOV Rd, RsMOV M, RsMOV Rd, MThis instruction copies the contents of the source register into the destination register.The contents of the source register are not altered.Example: MOV B,A or MOV M,B or MOV C,M
April 17, 2023 140701: Microprocessor & Interfacing 4
![Page 5: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/5.jpg)
A 20 B 20
A F
B 30 C
D E
H 20 L 50
April 17, 2023 140701: Microprocessor & Interfacing 5
A 20 B
BEFORE EXECUTION AFTER EXECUTION
MOV B,A
A F
B 30 C
D E
H 20 L 50
A F
B C
D E
H 20 L 50
A F
B C 40
D E
H 20 L 50
MOV M,B
MOV C,M40 40
30
![Page 6: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/6.jpg)
(2) Data Transfer Instructions
MVI R, Data(8-bit)MVI M, Data(8-bit)
The 8-bit immediate data is stored in the destination register (R) or memory (M), R is general purpose 8 bit register such as A,B,C,D,E,H and L.
Example: MVI B, 60H or MVI M, 40HApril 17, 2023 140701: Microprocessor & Interfacing 6
![Page 7: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/7.jpg)
A F
B C
D E
H L
April 17, 2023 140701: Microprocessor & Interfacing 7
A F
B 60 C
D E
H L
AFTER EXECUTIONBEFORE EXECUTION
MVI B,60H
40HL=2050H
2051H
204FH 204FH
HL=2050H
2051H
MVI M,40H
BEFORE EXECUTION AFTER EXECUTION
![Page 8: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/8.jpg)
(3) Data Transfer Instructions
LDA 16-bit address
The contents of a memory location, specified by a 16-bit address in the operand, are copied to the accumulator (A).The contents of the source are not altered.
Example: LDA 2000HApril 17, 2023 140701: Microprocessor & Interfacing 8
![Page 9: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/9.jpg)
A
30
A 30
30
AFTER EXECUTIONBEFORE EXECUTION
LDA 2000H2000H 2000H
April 17, 2023 140701: Microprocessor & Interfacing 9
![Page 10: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/10.jpg)
(4) Data Transfer Instructions
LDAX Register PairLoad accumulator (A) with the contents of memory location whose address is specified by BC or DE or register pair.The contents of either the register pair or the memory location are not altered.
Example: LDAX D
April 17, 2023 140701: Microprocessor & Interfacing 10
![Page 11: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/11.jpg)
A F
B C
D 20
E 30
April 17, 2023 140701: Microprocessor & Interfacing 11
A 80
F
B C
D 20
E 30
80 80
AFTER EXECUTIONBEFORE EXECUTION
LDAX D
2030H
2030H
![Page 12: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/12.jpg)
(5) Data Transfer Instructions
STA 16-bit address
The contents of accumulator are copied into the memory location i.e. address specified by the operand in the instruction.
Example: STA 2000 H
April 17, 2023 140701: Microprocessor & Interfacing 12
![Page 13: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/13.jpg)
A 50 A 50
50
AFTER EXECUTIONBEFORE EXECUTION
STA 2000H2000H 2000H
April 17, 2023 140701: Microprocessor & Interfacing 13
![Page 14: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/14.jpg)
(6) Data Transfer Instructions
STAX Register Pair
Store the contents of accumulator (A) into the memory location whose address is specified by BC Or DE register pair.
Example: STAX B
April 17, 2023 140701: Microprocessor & Interfacing 14
![Page 15: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/15.jpg)
A 50
F
B 10
C 20
D E
April 17, 2023 140701: Microprocessor & Interfacing 15
A 50
F
B 10
C 20
D E
50
AFTER EXECUTIONBEFORE EXECUTION
STAX B
1020H 1020H
![Page 16: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/16.jpg)
(7) Data Transfer Instructions
SHLD 16-bit address
Store H-L register pair in memory. The contents of register L are stored into memory location specified by the 16-bit address.The contents of register H are stored into the next memory location.
Example: SHLD 2500 H
April 17, 2023 140701: Microprocessor & Interfacing 16
![Page 17: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/17.jpg)
H 30 L 60
BEFORE EXECUTION AFTER EXECUTION
60
30
H 30 L 60
SHLD 2500H
2500H 2500H
204FH
2502H
204FH
2502H
April 17, 2023 140701: Microprocessor & Interfacing 17
![Page 18: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/18.jpg)
(8) Data Transfer Instructions
XCHG
The contents of register H are exchanged with the contents of register D.The contents of register L are exchanged with the contents of register E.Example: XCHG
April 17, 2023 140701: Microprocessor & Interfacing 18
![Page 19: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/19.jpg)
D 20 E 40
H 70 L 80
April 17, 2023 140701: Microprocessor & Interfacing 19
D 70 E 80
H 20 L 40
BEFORE EXECUTION AFTER EXECUTION
XCHG
![Page 20: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/20.jpg)
(9) Data Transfer Instructions
SPHL
Move data from H-L pair to the Stack Pointer (SP)This instruction loads the contents of H-L pair into SP.
Example: SPHL
April 17, 2023 140701: Microprocessor & Interfacing 20
![Page 21: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/21.jpg)
H 25 L 00
SP
BEFORE EXECUTION
AFTER EXECUTION
H 25 L 00
SP 2500
SPHL
April 17, 2023 140701: Microprocessor & Interfacing 21
![Page 22: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/22.jpg)
(10) Data Transfer Instructions
XTHLExchange H–L with top of stackThe contents of L register are exchanged with the location pointed out by the contents of the SP.The contents of H register are exchanged with the next location (SP + 1).
Example: XTHLApril 17, 2023 140701: Microprocessor & Interfacing 22
![Page 23: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/23.jpg)
H 30
L 40
SP 2700
BEFORE EXECUTION
50
60H
60
L 50
SP 2700
40
30
AFTER EXECUTION
XTHL
2700H
2701H
2702H
2700H
2701H
2702H
L=SPH=(SP+1)
April 17, 2023 140701: Microprocessor & Interfacing 23
![Page 24: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/24.jpg)
(11) Data Transfer Instructions
PCHL
Load program counter with H-L contentsThe contents of registers H and L are copied into the program counter (PC).The contents of H are placed as the high-order byte and the contents of L as the low-order byte.
Example: PCHL
April 17, 2023 140701: Microprocessor & Interfacing 24
![Page 25: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/25.jpg)
H 60
L 00
PC
BEFORE EXECUTION AFTER EXECUTION
H 60
L 00
PC 6000
PCHL
April 17, 2023 140701: Microprocessor & Interfacing 25
![Page 26: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/26.jpg)
(12) Data Transfer Instructions
IN 8-bit port address
Copy data to accumulator from a port with 8-bit address.The contents of I/O port are copied into accumulator.
Example: IN 80 H
April 17, 2023 140701: Microprocessor & Interfacing 26
![Page 27: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/27.jpg)
10 A
10 A 10
BEFORE EXECUTION
AFTER EXECUTION
IN 80H
PORT 80H
PORT 80H
April 17, 2023 140701: Microprocessor & Interfacing 27
![Page 28: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/28.jpg)
(13) Data Transfer Instructions
OUT 8-bit port address
Copy data from accumulator to a port with 8-bit addressThe contents of accumulator are copied into the I/O port.
Example: OUT 50 H
April 17, 2023 140701: Microprocessor & Interfacing 28
![Page 29: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/29.jpg)
10 A 40
40 A 40
BEFORE EXECUTION
AFTER EXECUTION
OUT 50H
PORT 50H
PORT 50H
April 17, 2023 140701: Microprocessor & Interfacing 29
![Page 30: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/30.jpg)
Arithmetic Instructions
These instructions perform the operations like:
AdditionSubtractionIncrementDecrement
April 17, 2023 140701: Microprocessor & Interfacing 30
![Page 31: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/31.jpg)
(1) Arithmetic Instructions
ADD R ADD M
The contents of register or memory are added to the contents of accumulator.The result is stored in accumulator.If the operand is memory location, its address is specified by H-L pair.
Example: ADD C or ADD MApril 17, 2023 140701: Microprocessor & Interfacing 31
![Page 32: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/32.jpg)
B C 30
D E
H L
April 17, 2023 140701: Microprocessor & Interfacing 32
B C 30
D E
H L
AFTER EXECUTIONBEFORE EXECUTION
B C
D E
H 20 L 50
B C
D E
H 20 L 50
AFTER EXECUTIONBEFORE EXECUTION
A 20
A 50A 20
A 30
ADD C A=A+R
ADD MA=A+M10 10
2050 2050
![Page 33: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/33.jpg)
(2) Arithmetic Instructions
ADC RADC M
The contents of register or memory and Carry Flag (CY) are added to the contents of accumulator.The result is stored in accumulator.If the operand is memory location, its address is specified by H-L pair. All flags are modified to reflect the result of the addition.
Example: ADC C or ADC M
April 17, 2023 140701: Microprocessor & Interfacing 33
![Page 34: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/34.jpg)
B C 20
D E
H L
April 17, 2023 140701: Microprocessor & Interfacing 34
A 50
B C 20
D E
H L
A 71
AFTER EXECUTIONBEFORE EXECUTION
ADC CA=A+R+CY
CY 1 CY 0
CY 1 CY 0
A 20 A 51
H 20 L 50 H 20 L 50
ADC MA=A+M+CY
AFTER EXECUTIONBEFORE EXECUTION
30 302050H 2050H
![Page 35: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/35.jpg)
(3) Arithmetic Instructions
ADI 8-bit data
The 8-bit data is added to the contents of accumulator.The result is stored in accumulator.
Example: ADI 10 H
April 17, 2023 140701: Microprocessor & Interfacing 35
![Page 36: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/36.jpg)
A 50 A 60
AFTER EXECUTIONBEFORE EXECUTION
ADI 10HA=A+DATA(8)
April 17, 2023 140701: Microprocessor & Interfacing 36
![Page 37: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/37.jpg)
(4) Arithmetic Instructions
ACI 8-bit data
The 8-bit data and the Carry Flag (CY) are added to the contents of accumulator.The result is stored in accumulator.
Example: ACI 20 H
April 17, 2023 140701: Microprocessor & Interfacing 37
![Page 38: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/38.jpg)
CY 1 CY 0
A 30 A 51
AFTER EXECUTIONBEFORE EXECUTION
ACI 20HA=A+DATA(8)+CY
April 17, 2023 140701: Microprocessor & Interfacing 38
![Page 39: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/39.jpg)
(5) Arithmetic Instructions
DAD Register pair
The 16-bit contents of the register pair are added to the contents of H-L pair.The result is stored in H-L pair.If the result is larger than 16 bits, then CY is set.
Example: DAD D
April 17, 2023 140701: Microprocessor & Interfacing 39
![Page 40: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/40.jpg)
AFTER EXECUTIONBEFORE EXECUTION
B C
D 10 E 20
H 20 L 50
SP
B C
D 10 E 20
H 30 L 70
SP
CY 0 CY 0
DAD DHL=HL+R
April 17, 2023 140701: Microprocessor & Interfacing 40
![Page 41: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/41.jpg)
(6) Arithmetic Instructions
SUB RSUB M
The contents of the register or memory location are subtracted from the contents of the accumulator.The result is stored in accumulator.If the operand is memory location, its address is specified by H-L pair.
Example: SUB B or SUB MApril 17, 2023 140701: Microprocessor & Interfacing 41
![Page 42: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/42.jpg)
B 30 C
D E
H L
April 17, 2023 140701: Microprocessor & Interfacing 42
A 50
B 30 C
D E
H L
A 20
AFTER EXECUTIONBEFORE EXECUTION
SUB BA=A-R
AFTER EXECUTIONBEFORE EXECUTION
A 50 A 40
H 10
L 20
H 10
L 20
SUB M A=A-M
10 101020H1020H
![Page 43: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/43.jpg)
(7) Arithmetic Instructions
SBB RSBB M
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. If the operand is memory location, its address is specified by H-L pair.
Example: SBB C or SBB M
April 17, 2023 140701: Microprocessor & Interfacing 43
![Page 44: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/44.jpg)
B C 20
D E
H L
April 17, 2023 140701: Microprocessor & Interfacing 44
A 40
CY 1
B C 20
D E
H L
A 19
CY 0
SBB CA=A-R-CY
AFTER EXECUTIONBEFORE EXECUTION
CY 1
A 50
H 20
L 50
CY 0
A 39
H 20
L 50
AFTER EXECUTIONBEFORE EXECUTION
SBB MA=A-M-CY
10 102050H 2050H
![Page 45: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/45.jpg)
(8) Arithmetic Instructions
SUI 8-bit data
OPERATION: A=A-DATA(8)The 8-bit immediate data is subtracted from the contents of the accumulator.The result is stored in accumulator.
Example: SUI 45 HApril 17, 2023 140701: Microprocessor & Interfacing 45
![Page 46: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/46.jpg)
(9) Arithmetic Instructions
SBI 8-bit data
The 8-bit data and the Borrow Flag (i.e. CY) is subtracted from the contents of the accumulator.The result is stored in accumulator.
Example: SBI 20 H
April 17, 2023 140701: Microprocessor & Interfacing 46
![Page 47: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/47.jpg)
CY 1
A 50
AFTER EXECUTIONBEFORE EXECUTION
CY 0
A 29SBI 20HA=A-DATA(8)-CY
April 17, 2023 140701: Microprocessor & Interfacing 47
![Page 48: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/48.jpg)
(10) Arithmetic Instructions
INR RINR M
The contents of register or memory location are incremented by 1.The result is stored in the same place.If the operand is a memory location, its address is specified by the contents of H-L pair.
Example: INR B or INR MApril 17, 2023 140701: Microprocessor & Interfacing 48
![Page 49: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/49.jpg)
B 10 C
D E
H L
April 17, 2023 140701: Microprocessor & Interfacing 49
A
B 11 C
D E
H L
A
AFTER EXECUTION
H 20
L 50
H 20
L 50
30 312050H
2050H
AFTER EXECUTIONBEFORE EXECUTION
INR MM=M+1
B 10 C
D E
H L
A
BEFORE EXECUTION
INR BR=R+1
![Page 50: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/50.jpg)
(11) Arithmetic Instructions
INX Rp
The contents of register pair are incremented by 1.The result is stored in the same place.
Example: INX HApril 17, 2023 140701: Microprocessor & Interfacing 50
![Page 51: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/51.jpg)
B C
D E
H 10 L 20
April 17, 2023 140701: Microprocessor & Interfacing 51
B C
D E
H 10 L 21
AFTER EXECUTIONBEFORE EXECUTION
SPSP
INX HRP=RP+1
![Page 52: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/52.jpg)
(12) Arithmetic Instructions
DCR RDCR M
The contents of register or memory location are decremented by 1.The result is stored in the same place.If the operand is a memory location, its address is specified by the contents of H-L pair.Example: DCR E or DCR M
April 17, 2023 140701: Microprocessor & Interfacing 52
![Page 53: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/53.jpg)
B C
D E 19
H L
A
AFTER EXECUTION
B C
D E 20
H L
A
BEFORE EXECUTION
DCR ER=R-1
H 20
L 50
H 20
L 50
21 202050H
AFTER EXECUTIONBEFORE EXECUTION
DCR MM=M-1
2050H
April 17, 2023 140701: Microprocessor & Interfacing 53
![Page 54: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/54.jpg)
(13) Arithmetic Instructions
DCX Rp
The contents of register pair are decremented by 1.The result is stored in the same place.
Example: DCX DApril 17, 2023 140701: Microprocessor & Interfacing 54
![Page 55: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/55.jpg)
B C
D 10 E 20
H L
April 17, 2023 140701: Microprocessor & Interfacing 55
B C
D 10 E 19
H L
AFTER EXECUTIONBEFORE EXECUTION
SPSP
DCX DRP=RP-1
![Page 56: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/56.jpg)
(1) Logical Instructions
ANA RANA M
AND specified data in register or memory with accumulator.Store the result in accumulator (A).
Example: ANA B, ANA MApril 17, 2023 140701: Microprocessor & Interfacing 56
![Page 57: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/57.jpg)
B 10 C
D E
H L
April 17, 2023 140701: Microprocessor & Interfacing 57
A
B 0F C
D E
H L
A 0A
AFTER EXECUTION
ANA BA=A and R
B 0F C
D E
H L
A AA
BEFORE EXECUTION
CY
AC
CY 0
AC 1
AFTER EXECUTIONBEFORE EXECUTION
CY
AC
CY 0
AC 1
A 11A 55
H 20
L 50
H 20
L 50
B3 B32050H
ANA MA=A and M
2050H
1010 1010=AAH0000 1111=0FH
0000 1010=0AH
0101 0101=55H1011 0011=B3H
0001 0001=11H
![Page 58: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/58.jpg)
(2) Logical Instructions
ANI 8-bit data
AND 8-bit data with accumulator (A).Store the result in accumulator (A)
Example: ANI 3FH
April 17, 2023 140701: Microprocessor & Interfacing 58
![Page 59: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/59.jpg)
CY
AC
A B3
AFTER EXECUTIONBEFORE EXECUTION
CY 0
AC 1
A 33
ANI 3FHA=A and DATA(8)
1011 0011=B3H0011 1111=3FH
0011 0011=33H
April 17, 2023 140701: Microprocessor & Interfacing 59
![Page 60: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/60.jpg)
(3) Logical Instructions
XRA Register (8-bit)
XOR specified register with accumulator.Store the result in accumulator.
Example: XRA C
April 17, 2023 140701: Microprocessor & Interfacing 60
![Page 61: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/61.jpg)
B 10 C
D E
H L
April 17, 2023 140701: Microprocessor & Interfacing 61
A
B C 2D
D E
H L
A 87
AFTER EXECUTION
XRA CA=A xor R
B C 2D
D E
H L
A AA
BEFORE EXECUTION
CY
AC
CY 0
AC 0
1010 1010=AAH0010 1101=2DH
1000 0111=87H
![Page 62: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/62.jpg)
(4) Logical Instructions
XRA M
XOR data in memory (memory location pointed by H-L pair) with Accumulator.Store the result in Accumulator.
Example: XRA MApril 17, 2023 140701: Microprocessor & Interfacing 62
![Page 63: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/63.jpg)
H 20 L 50
April 17, 2023 140701: Microprocessor & Interfacing 63
A 55
AFTER EXECUTION
XRA MA=A xor M
BEFORE EXECUTION
CY
AC
CY 0
AC 0
0101 0101=55H1011 0011=B3H
1110 0110=E6H
H 20 L 50
A E6B3 B32050H 2050H
![Page 64: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/64.jpg)
(5) Logical Instructions
XRI 8-bit data
XOR 8-bit immediate data with accumulator (A).Store the result in accumulator.
Example: XRI 39H
April 17, 2023 140701: Microprocessor & Interfacing 64
![Page 65: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/65.jpg)
CY
AC
A B3
AFTER EXECUTIONBEFORE EXECUTION
CY 0
AC 0
A 8A
XRI 39HA=A xor DATA(8)
1011 0011=B3H0011 1001=39H
1000 1010=8AH
April 17, 2023 140701: Microprocessor & Interfacing 65
![Page 66: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/66.jpg)
(6) Logical Instructions
ORA RegisterOR specified register with accumulator (A).Store the result in accumulator.
Example: ORA B
April 17, 2023 140701: Microprocessor & Interfacing 66
![Page 67: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/67.jpg)
AFTER EXECUTIONBEFORE EXECUTION
CY
AC
ORA BA=A or R
1010 1010=AAH0001 0010=12H
1011 1010=BAH
B 12 C
D E
H L
A AA
B 12 C
D E
H L
A BA
CY 0
AC 0
April 17, 2023 140701: Microprocessor & Interfacing 67
![Page 68: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/68.jpg)
(7) Logical Instructions
ORA M
OR specified register with accumulator (A).Store the result in accumulator.
Example: ORA M
April 17, 2023 140701: Microprocessor & Interfacing 68
![Page 69: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/69.jpg)
AFTER EXECUTIONBEFORE EXECUTION
CY
AC
ORA MA=A or M
0101 0101=55H1011 0011=B3H
1111 0111=F7H
H 20 L 50
A 55 A F7
CY 0
AC 0
H 20 L 50
B3 B32050H 2050H
April 17, 2023 140701: Microprocessor & Interfacing 69
![Page 70: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/70.jpg)
(8) Logical Instructions
ORI 8-bit data
OR 8-bit data with accumulator (A).Store the result in accumulator.
Example: ORI 08H
April 17, 2023 140701: Microprocessor & Interfacing 70
![Page 71: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/71.jpg)
CY
AC
A B3
AFTER EXECUTIONBEFORE EXECUTION
CY 0
AC 0
A BB
ORI 08HA=A or DATA(8)
1011 0011=B3H0000 1000=08H
1011 1011=BBH
April 17, 2023 140701: Microprocessor & Interfacing 71
![Page 72: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/72.jpg)
(9) Logical Instructions
CMP RegisterCMP M
Compare specified data in register or memory with accumulator (A).Store the result in accumulator.
Example: CMP D or CMP MApril 17, 2023 140701: Microprocessor & Interfacing 72
![Page 73: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/73.jpg)
B 10 C
D E
H L
April 17, 2023 140701: Microprocessor & Interfacing 73
A
B C
D B9 E
H L
A B8
AFTER EXECUTION
CMP DA-R
B C
D B9 E
H L
A B8
BEFORE EXECUTION
CY
Z
CY 1
Z 0
AFTER EXECUTIONBEFORE EXECUTION
CY
Z
CY 0
Z 1
A B8A B8
H 20
L 50
H 20
L 50
B8 B82050H CMP M
A-M
2050H
A>R: CY=0,Z=0A=R: CY=0,Z=1A<R: CY=1,Z=0
A>M: CY=0,Z=0A=M: CY=0,Z=1A<M: CY=1,Z=0
![Page 74: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/74.jpg)
(10) Logical Instructions
CPI 8-bit data
Compare 8-bit immediate data with accumulator (A).Store the result in accumulator.
Example: CPI 30H
April 17, 2023 140701: Microprocessor & Interfacing 74
![Page 75: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/75.jpg)
CY
Z
A BA
AFTER EXECUTIONBEFORE EXECUTION
CY 0
AC 0
A BA
CPI 30HA-DATA
A>DATA: CY=0,Z=0A=DATA: CY=0,Z=1A<DATA: CY=1,Z=0
1011 1010=BAH
April 17, 2023 140701: Microprocessor & Interfacing 75
![Page 76: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/76.jpg)
(11) Logical Instructions
STC
It sets the carry flag to 1.Example: STC
April 17, 2023 140701: Microprocessor & Interfacing 76
![Page 77: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/77.jpg)
CY 0
AFTER EXECUTIONBEFORE EXECUTION
CY 1STCCY=1
April 17, 2023 140701: Microprocessor & Interfacing 77
![Page 78: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/78.jpg)
(12) Logical Instructions
CMC
It complements the carry flag.Example: CMC
April 17, 2023 140701: Microprocessor & Interfacing 78
![Page 79: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/79.jpg)
CY 1
AFTER EXECUTIONBEFORE EXECUTION
CY 0
CMC
April 17, 2023 140701: Microprocessor & Interfacing 79
![Page 80: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/80.jpg)
(13) Logical Instructions
CMA
It complements each bit of the accumulator.Example: CMA
April 17, 2023 140701: Microprocessor & Interfacing 80
![Page 81: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/81.jpg)
(14) Logical Instructions
RLC
Rotate accumulator leftEach binary bit of the accumulator is rotated left by one position.Bit D7 is placed in the position of D0 as well as in the Carry flag.CY is modified according to bit D7.
Example: RLC.April 17, 2023 140701: Microprocessor & Interfacing 81
![Page 82: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/82.jpg)
B7 B6 B5 B4 B3 B2 B1 B0CY
B6 B5 B4 B3 B2 B1 B0 B7B7
AFTER EXECUTION
BEFORE EXECUTION
April 17, 2023 140701: Microprocessor & Interfacing 82
![Page 83: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/83.jpg)
(15) Logical Instructions
RRC
Rotate accumulator rightEach binary bit of the accumulator is rotated right by one position.Bit D0 is placed in the position of D7 as well as in the Carry flag.CY is modified according to bit D0.
Example: RRC.
April 17, 2023 140701: Microprocessor & Interfacing 83
![Page 84: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/84.jpg)
B7 B6 B5 B4 B3 B2 B1 B0 CY
B0 B7 B6 B5 B4 B3 B2 B1 B0
AFTER EXECUTION
BEFORE EXECUTION
April 17, 2023 140701: Microprocessor & Interfacing 84
![Page 85: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/85.jpg)
(16) Logical Instructions
RAL
Rotate accumulator left through carryEach binary bit of the accumulator is rotated left by one position through the Carry flag.Bit D7 is placed in the Carry flag, and the Carry flag is placed in the least significant position D0.CY is modified according to bit D7.
Example: RAL.April 17, 2023 140701: Microprocessor & Interfacing 85
![Page 86: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/86.jpg)
B7 B6 B5 B4 B3 B2 B1 B0CY
B6 B5 B4 B3 B2 B1 B0 CYB7
AFTER EXECUTION
BEFORE EXECUTION
April 17, 2023 140701: Microprocessor & Interfacing 86
![Page 87: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/87.jpg)
(17) Logical Instructions
RAR
Rotate accumulator right through carryEach binary bit of the accumulator is rotated left by one position through the Carry flag.Bit D7 is placed in the Carry flag, and the Carry flag is placed in the least significant position D0.CY is modified according to bit D7.
Example: RAR
April 17, 2023 140701: Microprocessor & Interfacing 87
![Page 88: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/88.jpg)
B7 B6 B5 B4 B3 B2 B1 B0 CY
CY B7 B6 B5 B4 B3 B2 B1 B0
AFTER EXECUTION
BEFORE EXECUTION
April 17, 2023 140701: Microprocessor & Interfacing 88
![Page 89: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/89.jpg)
Concept of Subroutine
In 8085 microprocessor a subroutine is a separate program written aside from main program ,this program is basically the program which requires to be executed several times in the main program. The microprocessor can call subroutine any time using CALL instruction. after the subroutine is executed the subroutine hands over the program to main program using RET instruction.
April 17, 2023 140701: Microprocessor & Interfacing 89
![Page 90: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/90.jpg)
Branching Instructions
The branch group instructions allows the microprocessor to change the sequence of program either conditionally or under certain test conditions. The group includes,(1) Jump instructions,(2) Call and Return instructions,(3) Restart instructions,
April 17, 2023 140701: Microprocessor & Interfacing 90
![Page 91: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/91.jpg)
(1) Branching Instructions
JUMP ADDRESS
BEFORE EXECUTION AFTER EXECUTION
Jump unconditionally to the address.The instruction loads the PC with the address given within the instruction and resumes the program execution from specified location.Example: JMP 2000H
April 17, 2023 140701: Microprocessor & Interfacing 91
PC PC 2000JMP 2000H
![Page 92: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/92.jpg)
Conditional JumpsInstruction Code
Decription Condition For Jump
JC Jump on carry CY=1
JNC Jump on not carry CY=0
JP Jump on positive S=0
JM Jump on minus S=1
JPE Jump on parity even P=1
JPO Jump on parity odd P=0
JZ Jump on zero Z=1
JNZ Jump on not zero Z=0
April 17, 2023 140701: Microprocessor & Interfacing 92
![Page 93: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/93.jpg)
(2) Branching Instructions
CALL address
Call unconditionally a subroutine whose starting address given within the instruction and used to transfer program control to a subprogram or subroutine.
Example: CALL 2000H
April 17, 2023 140701: Microprocessor & Interfacing 93
![Page 94: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/94.jpg)
Conditional Calls
Instruction Code Description Condition for CALL
CC Call on carry CY=1
CNC Call on not carry CY=0
CP Call on positive S=0
CM Call on minus S=1
CPE Call on parity even P=1
CPO Call on parity odd P=0
CZ Call on zero Z=1
CNZ Call on not zero Z=0
April 17, 2023 140701: Microprocessor & Interfacing 94
![Page 95: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/95.jpg)
(3) Branching Instructions
RET
Return from the subroutine unconditionally.This instruction takes return address from the stack and loads the program counter with this address.
Example: RETApril 17, 2023 140701: Microprocessor & Interfacing 95
![Page 96: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/96.jpg)
SP 27FD
PC
00
62
SP 27FF
PC 6200
00
62
AFTER EXECUTIONBEFORE EXECUTION
RET27FFH
27FEH
27FDH
27FFH
27FEH
27FDH
April 17, 2023 140701: Microprocessor & Interfacing 96
![Page 97: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/97.jpg)
(4) Branching Instructions
RST n
Restart n (0 to 7)This instruction transfers the program control to a specific memory address. The processor multiplies the RST number by 8 to calculate the vector address.
Example: RST 6
April 17, 2023 140701: Microprocessor & Interfacing 97
![Page 98: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/98.jpg)
SP 3000
PC 2000
SP 2999
PC 003001
20
AFTER EXECUTIONBEFORE EXECUTION
RST 6
3000H
2FFFH
2FFEH
SP-1
ADDRESS OF THE NEXT INSTRUCTION IS 2001H
3000H
2FFFH
2FFEH
April 17, 2023 140701: Microprocessor & Interfacing 98
![Page 99: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/99.jpg)
Vector Address For Return Instructions
Instruction Code Vector Address
RST 0 0*8=0000H
RST 1 0*8=0008H
RST 2 0*8=0010H
RST 3 0*8=0018H
RST 4 0*8=0020H
RST 5 0*8=0028H
RST 6 0*8=0030H
Rst 7 0*8=0038H
April 17, 2023 140701: Microprocessor & Interfacing 99
![Page 100: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/100.jpg)
(1) Control Instructions
NOP
No operationNo operation is performed.The instruction is fetched and decoded but no operation is executed.
Example: NOPApril 17, 2023 140701: Microprocessor & Interfacing 100
![Page 101: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/101.jpg)
(2) Control Instructions
HLT
HaltThe CPU finishes executing the current instruction and halts any further execution.An interrupt or reset is necessary to exit from the halt state.
Example: HLT
April 17, 2023 140701: Microprocessor & Interfacing 101
![Page 102: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/102.jpg)
(3) Control Instructions
RIM
Read Interrupt MaskThis is a multipurpose instruction used to read the status of interrupts 7.5, 6.5, 5.5 and read serial data input bit.The instruction loads eight bits in the accumulator with the following interpretations.
Example: RIM
April 17, 2023 140701: Microprocessor & Interfacing 102
![Page 103: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/103.jpg)
RIM Instruction
April 17, 2023 140701: Microprocessor & Interfacing 103
![Page 104: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/104.jpg)
(4) Control Instructions
SIM
Set Interrupt MaskThis is a multipurpose instruction and used to implement the 8085 interrupts 7.5, 6.5, 5.5, and serial data output.The instruction interprets the accumulator contents as follows.
Example: SIMApril 17, 2023 140701: Microprocessor & Interfacing 104
![Page 105: Instruction set](https://reader036.vdocument.in/reader036/viewer/2022062304/55d0293abb61eb8f608b4759/html5/thumbnails/105.jpg)
SIM Instruction
April 17, 2023 140701: Microprocessor & Interfacing 105