You are on page 1of 42

EE-16102: MICROPROCESSOR & COMPUTER ORGANIZATION

8085 Microprocessor: Instruction Set

Dr. Vishal Kumar Gaur


Microprocessor: 8085A
Instruction Set

 Instruction is a binary pattern designed indicates a microprocessor to perform a specific function.


 Each instruction has two parts: one is the task to be performed, called the operation code
(opcode), and the second is the data to be operand on, called the operand.
 The operand (or data) can be specified in various ways. It may include 8-bit (or 16-bit) data, an
internal register, a memory location, or an 8-bit (or 16-bit) address.
 In some instructions, the operand is implicit.

 The entire group of instructions, called the instruction set, determines what functions the
microprocessor can perform.
 8085 microprocessor instructions can be classified into the following five functional categories:
data transfer operations, arithmetic operations, logical operations, branching operations, and
machine-control operations.

2
Microprocessor: 8085A
Instruction Set

 Instruction/Opcode Format
 Consider a single byte instruction available at memory location ‘N’.
 The 8-bit of the op-code is divided into three portions.
 D2 D1 D0 when necessary contains the source code SSS.
 D2 D1 D0 group contains the code of destination register DDD.
 The first group D7 D6 gives the idea of the mnemonic of the operation code.

3
Microprocessor: 8085A
Instruction Set

 In the design of 8085, all operations, registers, and status flags are identified with a
specific code.
 For example, all internal registers are identified as follows:

4
Microprocessor: 8085A
Instruction Set

 An instruction to move the content of accumulator in register C.

 Move the content: 01


 To register C: 001 (DDD)
 From register A: 111 (SSS)

 Binary instruction: 01001111 4FH

5
Microprocessor: 8085A
Instruction Set

8085 instruction set is classified based


1) on the word size, and
2) on the function performed.

6
Microprocessor: 8085A
Instruction Set

8085 instruction set is classified into following three groups according to word size or byte
size.
1) 1-byte instructions
2) 2-byte instructions
3) 3-byte instructions

In 8085, terms “byte” and “word” are synonymous because it is an 8-bit microprocessor.

7
Microprocessor: 8085A
Instruction Set

1) 1-byte instructions: This type of instructions includes the opcode and the operand in the
same byte.
For example:

 These instructions are stored in 8-bit binary format in memory.

8
Microprocessor: 8085A
Instruction Set

2) 2-byte instructions: In this type of instructions, the first byte specifies the operation code
and the second byte specifies the operand.
For example:

 These instructions would require two memory locations each to store the binary codes.

9
Microprocessor: 8085A
Instruction Set

3) 3-byte instructions: In this type of instructions, the first byte specifies the operation code
and the following two bytes specifies the 16-bit address.
For example:

 These instructions would require three memory locations each to store the binary codes.

10
Microprocessor: 8085A
Instruction Set

 Whenever a 2-byte instruction is used the first byte at memory location N is the op-code
of the instruction followed by either an 8-bit data or an 8-bit address at memory location
N+1.

 Whenever a 3-byte instruction is involved, the first byte at memory location N is the
opcode followed by either a-16 bit address or a 16-bit data. The second memory location
i.e., N+1 contains the lower order addresses or data and the third memory location N+2
contains the higher order address or data.

11
Microprocessor: 8085A
Instruction Set

8085 instruction set is classified into following categories based on the the type of actions
taken by the processor.
1) Data Transfer Instructions
2) Arithmetic Instructions
3) Logic and Bit Manipulation Instructions
4) Branch Instructions
5) Machine Control Instructions

The 8085 microprocessor instruction set has 74 operation code that result in 246
instructions.

12
Microprocessor: 8085A
Instruction Set

1) Data Transfer Instructions


There are 15 such basic instructions and 86 variations.
This group comprises instructions that move data between internal registers of 𝜇𝑝, between internal register
and external memory location and I/O transfer.

One of the register is always located in the 𝜇𝑝 itself; the other may be located in one of the following:
1) An I/o device
2) Memory
3) The microprocessor (internal register)

It means, this group of instructions includes transfer of data from internal register to another internal
register, internal register to memory, memory to internal register, accumulator (A) to output device,
or from input device to accumulator

13
Microprocessor: 8085A
Instruction Set

1) Data Transfer Instructions

Summary: These type of instructions perform the following six operations.


 Load an 8-bit number in a register  Load an 16-bit number in a register pair

 Copy from register to register  Copy between register and memory

 Copy between I/O and accumulator  Copy between registers and stack memory

14
Microprocessor: 8085A
Instruction Set

1) Data Transfer Instructions


MOV r1, r2
 This is a single byte instruction at memory location N. The opcode of the instruction will be

 This instruction can have 49 variations (7x7), seven combinations for source registers (SSS) and seven
combinations for destination registers (DDD) other than 110.
MOV r1, M
 Move the content of the memory location whose address is available into (H,L) pair into the internal
general purpose register r1”
 M(H,L) is the source register, (r) is the destination register.
 It is a single byte instruction at memory location N. It has 7 variation as DDD can not be 110 because
direct memory to memory data transfer is not allowed.
 The operation code is,

15
Microprocessor: 8085A
Instruction Set

1) Data Transfer Instructions


MOV M, r1
 Move the content of the internal general purpose register r into the memory location whose address is
available in (H,L) register pair.
 It is a single byte instruction. The operation code is

 It has seven variations. SSS cannot be 110 because direct memory to memory data transfer is not
allowed

16
Microprocessor: 8085A
Instruction Set

1) Data Transfer Instructions


MVI r1, DATA
 DATA is the symbolic name given to 8-bit data which is immediately available as second byte of the
instruction.
 Therefore, the source of data is the 2nd byte of the instruction itself.

 It is a 2 byte instruction (and has 7 variations) at the memory location N & N+1. The opcode of the
instruction is
MVI M, DATA
 Move 8-bit data available immediately as a 2nd byte of the instruction to the memory location whose
address is available in memory pointed by (H, L) register pair.
 It is a 2 byte instruction (no variation) at the memory location N & N+1. The opcode of the instruction is

17
Microprocessor: 8085A
Instruction Set

2) Arithmetic Instructions
Instructions meant for arithmetic operations that add, subtract, increment or decrement data in a register are
put in this group.

Normally two operands are necessary for any arithmetic operation. One of the operand is always assumed
to be available in accumulator.

The other operand can be made available in one of the three locations:
(a) In an internal general purpose register (r).
(b) In a memory location pointed by M-pointer i.e., (H, L) pair.
(c) Immediately in the instruction itself as a 2nd byte.

The frequently used arithmetic operations are:


 Add  Subtract

 Increment (Add 1)  Decrement (Subtract 1)

18
Microprocessor: 8085A
Instruction Set

2) Arithmetic Instructions
ADD r
 Add the content of register (r) to the content of accumulator and store the result back into the accumulator.
 This is a single byte instruction.
 The opcode of the instruction is,
 It has 7 variations for 7 internal general purpose registers.

ADD M
 Add the content of memory location whose address is in (H,L) pair to the content of accumulator and store
the result back into the accumulator.

 This is a single byte instruction and has no variations.

19
Microprocessor: 8085A
Instruction Set

2) Arithmetic Instructions
ADD DATA
 Add the content available as the second byte of the instruction to the content of accumulation and store
the result back into the accumulator.
 This is a single byte instruction and has no variations.
 The opcode of the instruction is,

ADC r
 Add the content of register (r) to the content of accumulator with carry and store the result back into
accumulator.

 This is a single byte instruction and has 7 variations for 7 internal general purpose registers.

20
Microprocessor: 8085A
Instruction Set

2) Arithmetic Instructions
INR M
 Increment the content of memory location by 1 whose address is available in (H, L) pair and stores the
result back in the same location.
 This is a single byte instruction and has no variations.
 The opcode of the instruction is,

ADC r
 Add the content of register (r) to the content of accumulator with carry and store the result back into
accumulator.

 This is a single byte instruction and has 7 variations for 7 internal general purpose registers.

21
Microprocessor: 8085A
Instruction Set

3) Logic and Bit Manipulation Instructions


 Instructions that carry out logic operation, such as AND, OR, EX-OR, compare data in the accumulator
with another internal or external register, complement and rotate data in the accumulator are considered
in this group.

The frequently used operations are:


 AND  OR

 XOR  Compare, Rotate Bits

22
Microprocessor: 8085A
Instruction Set

3) Logic and Bit Manipulation Instructions


ANA r
 AND bit by bit the content of register (r) to the content of accumulator and store the result back in the
accumulator
 This is a single byte instruction and has no variations.
 The opcode of the instruction is,

ANI DATA
 AND bit by bit the content available as a second byte of instruction to the content of the accumulator and
store the result back in the accumulator.
 This is a two byte instruction and has no variations.
 The opcode of the instruction is,

23
Microprocessor: 8085A
Instruction Set

4) Branch Instructions
 This group of instructions is used to alter the normal sequential program flow and force the program to
proceed from a different point.
 Branch instructions can be of two types: conditional & unconditional.
 Unconditional branch instructions simply cause the program to branch to the indicated instruction
whenever these instructions are encountered, i.e., (PC) is loaded with a new address.
 Conditional branch instructions examine the status of one of the four processor flags (Z, CY, P, S) to
determine if the specified branch instruction is to be executed. If the condition tested is TRUE, it causes
a branching to occur otherwise not.
 Condition flags are not affected by any instruction in this group only program counter (PC) is affected.
 AC is not used for specifying condition. The 8 conditions that are tested are given below:

24
Microprocessor: 8085A
Instruction Set

4) Branch Instructions
 AC is not used for specifying condition. The 8 conditions that are tested are given below:

25
Microprocessor: 8085A
Instruction Set

4) Branch Instructions
Jcond ADDR
 There are 8 conditions that can be checked. They are JNZ, JZ, JNC, JC, JPO, JPE, JP, and JM.
 So, there are 8 variations for this instruction.
 The I6-bit address in the (PC) just at the end of the instruction depends upon the condition to be
tested. (PC) will be loaded with B3B2 if the given condition is TRUE, otherwise (PC) will go to
(PC)i+3.

Figure: Operation code format of instruction Figure: Flow chart for conditional jump instruction
26
Microprocessor: 8085A
Instruction Set

4) Branch Instructions
JMP ADDR
 ADDR is the symbolic name given to the 16- bit address data available as the 2nd and 3rd
 bytes of the instruction.
 Load the PC with the 16- bit address data available in the instruction itself as the 2nd and 3rd
bytes of instruction so that the next instruction is fetched from this address in the succeeding
instruction cycle.
 This is a three byte instruction.
 The operation code format is,

27
Microprocessor: 8085A
Instruction Set

5) Machine Control Instructions


EI (Enable Interrupts)
 The interrupt system is disabled just after RESET operation.
 There is an internal INTE F/F (interrupt enable flip-flop) which is reset in RESET operation.
 It is a single byte instruction.

 The interrupt system is enabled using EI instruction.


 When this instruction is executed, then INTE F/F is set so that all the interrupts are enabled
and 8085A will recognize external interrupt request except those that are masked.
 It has no variation and none of the flags are affected.

28
Microprocessor: 8085A
Instruction Set

5) Machine Control Instructions


DI (Disable Interrupts)
 It is also a single byte instruction.
 The interrupt system is disabled just immediately this instruction, i.e., INTE F/F is reset.
 There is an internal INTE F/F (interrupt enable flip-flop) which is reset in RESET operation.

 The interrupt system is enabled using EI instruction.


 When this instruction is executed, then INTE F/F is reset so that all the interrupts are
disabled except TRAP
 8085A will not recognize any external interrupt request except TRAP.
 It has no variation and none of the flags are affected.

29
Microprocessor: 8085A
Instruction Set

5) Machine Control Instructions


NOP (No operation)
 It is a single byte instruction.
 The meaning of the instruction is “No operation is performed”.
 The registers and flags are unaffected.

 It has no variation and none of the flags are affected.

30
Microprocessor: 8085A
Instruction Set

5) Machine Control Instructions


HLT (Halt)
 It is a single byte instruction.
 When this instruction is executed, it stops processor fetching and executing instructions from
the program memory.
 The address bus, data bus, and control bus are tri-stated.

 It has no variation.
 Registers and flags are unaffected.

31
Microprocessor: 8085A
Instruction Set

 Addressing Modes
 Most of the instruction execution requires two operands, e.g., transfer of data between two
registers.
 Whenever two operands are involved in an instruction, the first operand is assumed to be in
any register of the 𝜇𝑝 itself.
 The second operand may be located in one of the following.
i. In any general purpose register of the microprocessor.
ii. In a particular external memory location.
iii. It can be immediately available in an instruction format.
iv. In an I/O device.

 How the microprocessor knows the position of these operands?


 The method of identifying the second operands position by the instruction format is
knows as addressing modes.

32
Microprocessor: 8085A
Instruction Set

 Addressing Modes

1.Register Addressing Mode

2.Direct Addressing Mode

3.Register Indirect Addressing Mode

4.Immediate Addressing Mode

5.Implied Addressing Mode

33
Microprocessor: 8085A
Instruction Set

1. Register Addressing Modes


 When the operands for any instruction are available in internal general purpose
registers, only the registers need to be specified as the address of the operands.
Such instruction are said to use the register addressing mode.
 These instructions are one byte instructions. Within that byte i.e. op-code, the
registers are specified.

34
Microprocessor: 8085A
Instruction Set

1. Register Addressing Modes


 For example, MOV r1, r2; ADD r; XCHG, etc.

 MOV r1, r2: The opcode for the instruction is 01 DDD SSS.
 The first two bits 01 specify the MOV operation e.g., MOV B, A
 The opcode of the instruction is (01 000 111)2 = 47H

 ADD H. The opcode is (10 000 100)2 = 84H

35
Microprocessor: 8085A
Instruction Set

2. Direct Addressing Modes


 In this addressing mode, the instruction contains directly the address of the
operand (external register) involved in the transfer.
 The 8085A provides16-bit memory address.
 The address contained in the instruction will be 16-bit long as a second and third
bytes of the instruction.

 Thus it is invariably a 3-byte instruction.

36
Microprocessor: 8085A
Instruction Set

2. Direct Addressing Modes


 For example:
 LDA addr. This is an ALP statement ‘addr’ in operand field is a symbolic name
given to 16-bit address.

37
Microprocessor: 8085A
Instruction Set

3. Register Indirect Addressing Modes


 In this case, the instruction specifies a register pair which contains the address of
the memory where the data is located or into which the data in to be placed.
 Thus the address of the operand is given indirectly through a register pair.
 In other words, the operand is in memory location or external register whose
address is available in an internal general purpose register pair.

38
Microprocessor: 8085A
Instruction Set

3. Register Indirect Addressing Modes


Opcode
MOV r, M
<B2>
 It transfers single byte from an external register (M) to any of internal register.
 External register (M) means memory location pointed by H,L register pair.

LDAX rp
 This instruction load the accumulator with content available at memory location
pointed by internal register pair. Opcode
<B2>
 Here, register pair are used as memory register pointer. <B3>

39
Microprocessor: 8085A
Instruction Set

4. Immediate Addressing Mode


 In this type of addressing mode, the operand is available directly in the instruction
itself.
 If the operand data involved is of 8-bits, then the instruction is of two bytes
 If 16-bit data is involved in the instruction, then the first byte is opcode at memory
location N followed by the lower order data byte at memory location N+1 and
higher order data byte at memory location N+2.
MVI r, DATA
 Move the 8-bit data immediately available in the instruction as the 2 nd byte to
destination register.
40
Microprocessor: 8085A
Instruction Set

5. Implied Addressing Mode


 There are certain instructions that operate on one operand.
 Such instructions assume that the operand is in the accumulator and, therefore,
need not specify any address.
 Many instructions of logical group like RLC, RRC, RAR, RAL, and CMA fall into this
category.
 All these are one byte instruction.
 Sometimes, instructions specify address of one operand, use implied addressing
for the other operand.

41
Thank You

42

You might also like