L3 8085 Instruction Set 1
L3 8085 Instruction Set 1
Microcontrollers (EC3L007)
2
Learning Objectives
• Machine Cycles
• Instruction set classification
• Data Transfer Instructions
• Arithmetic Instructions
• Logical Instructions
• Branching Instructions
• Control Instructions
3
Introduction
4
Introduction
• Each instruction in the program is a command, in binary,
to perform an operation.
5
Format of 8085 Instructions
• The size of 8085 can be one byte, two byte or three
byte.
6
Addressing Modes
7
Addressing Modes
• In each instruction, programmer has to specify 3 things:
1. Operation to be performed.
2. Address of source data.
3. Address of destination of result.
8
Addressing Modes
The 8085 supports the following Five addressing modes.
1. Immediate Addressing
2. Direct Addressing
3. Register Addressing
5. Implied/Implicit Addressing
9
Immediate Addressing
• The data is specified in the instruction itself. The data
will be part of the program instruction.
10
Direct Addressing Mode
• The address of the operand is given in the instruction
itself.
11
Register Addressing Mode
• The operand is in general purpose register.
12
Register Indirect Addressing Mode
• In this mode, the address of operand is specified by a
register pair.
13
Implicit Addressing Mode
• If address of source of data as well as address of
destination of result is fixed, then there is no need to
give any operand along with the instruction.
14
Machine (Processor) Cycles
15
Machine Cycles
• The time required to complete the execution of an
instruction is called an “Instruction Cycle”.
16
Machine cycles of 8085
• The 8085 processor has seven basic machine cycles:
17
T-state
• The time taken by the processor to execute a machine
cycle is expressed in T-states.
Clock Signal
18
Timing Diagram
19
Opcode Fetch Machine Cycle
20
Opcode Fetch Machine Cycle
• The Opcode fetch cycle, fetches the instructions from
memory and delivers it to the instruction register of the
microprocessor.
T1 State
• The high order 8 address bits are placed on the address
lines A8 – A15 and the low order bits are placed on
AD7–AD0.
• The ALE signal goes high to indicate that AD0 – AD7 are
carrying an address.
ഥ signal goes low to
• At exactly the same time, the IO/M
indicate a memory access operation.
21
Opcode Fetch Machine Cycle
T2 State
22
Opcode Fetch Machine Cycle
T3 State
• During T3 the RD signal is Disabled (goes high). This
turns off the output Tristate buffers in the memory.
• That makes the AD7– AD0 lines go to high impedance
mode.
• In this state of the cycle, the opcode of the AD bus is
transferred to the instruction register of the
microprocessor.
T4 State
• In this state the opcode which was fetched from the
memory is decoded.
23
Memory Read Machine Cycle
24
Memory Read Machine Cycle
T1 state
25
Memory Read Machine Cycle
T2 state
• RD’ goes LOW
• Selected memory location is placed on the AD0-AD7.
The time allowed for memory to output the data is the
time during which RD’ remains low.
T3 State
• At the end of T3, the read signal is asserted high. On
the rising edge of read signal, the data is latched into the
microprocessor.
26
Memory write cycle
27
Memory Write Machine Cycle
T1 state
28
Memory Write Machine Cycle
T2 state
• At the falling edge of T2, the processor outputs the data
on AD0-AD7 lines, request memory for write operation
by asserting the write control signal WR’ to low.
T3 State
• At the end of T3, the write signal is asserted high. This
enables the memory to latch the data into it. The
memory should prepare itself to accept data within the
time duration in which the write control signal remains
low.
29
Instruction Set Classification
• The 8085 instructions can be classified into the following
five functional groups:
• Arithmetic Instructions
• Logical Instructions
• Branching Instructions
• Control Instructions
30
Data Transfer Instructions
31
Data Transfer (Copy) Instructions
• These instructions move data between registers, or
between memory and registers.
32
Data Transfer Instructions
Opcode Operand Description
MOV Rd, Rs Copy data from source register to
destination register.
1 byte instruction
M, Rs Copy data from source register to
Rd, M memory location or vice versa.
1 byte instruction
34
Example:
35
Example:
36
Data Transfer Instructions
37
Example:
38
Example:
39
Data Transfer Instructions
40
Example:
41
Data Transfer Instructions
• Example: LDAX B
42
Example:
43
Data Transfer Instructions
44
Example:
45
Data Transfer Instructions
47
Data Transfer Instructions
48
Example:
49
Data Transfer Instructions
• Example: STAX B
50
Example:
51
Data Transfer Instructions
52
Example:
53
Data Transfer Instructions
• Example: XCHG
54
Example:
55
Data Transfer Instructions
• Example: SPHL
56
Example:
57
Data Transfer Instructions
• Example: XTHL
58
Example:
59
Data Transfer Instructions
• Example: PCHL
60
Data Transfer Instructions
• Example: PUSH B
61
Example:
62
Example:
63
Data Transfer Instructions
• Example: POP H
64
Example:
65
Example:
66
Data Transfer Instructions
• Example: IN 8C H
67
IN
68
Data Transfer Instructions
• Example: OUT 78 H
69
OUT
70
References
• Ramesh Gaonkar, “Microprocessor, Architecture,
Programming, & Applications with the 8085 6/e”
• Reading:
Chapter 6 & 7, Ramesh Gaonkar
71