Introduction :

A microprocessor is a programmable device which can be programmed to perform various tasks by writing a program using instruction set of the microprocessor. A program is a sequence of instructions arranged logically in order and performs a specified task. For each separate task, a separate program should be written. once program is written, it can be executed by a processor and as a result the task denoted by program is performed.

The 8085f is an 8-bit microprocessor having 74 different instructions. For each instruction, 8085 specifies the instruction format which includes the identification code (opcode) of instruction and operands. The 8085 has three types of instructions as per the length of instruction : single byte, two byte and three byte. The length of instruction denotes how much space instruction occupies in memory. An instruction can specify the operands in various way known as addressing modes. Each instruction takes predefined amount of time to execute. It is known as instruction time. The 8085 instructions are grouped into five groups : data transfer, arithmetic, logical, branch and stack, I/O and machine control instructions.

In this chapter, we will learn about 8085 instruction set in detail. At the end of the chapter, assembly and machine language programming is introduced.

What is an instruction?        
                                                                                                              
The microprocessor can be programmed using instructions from its instruction set. An instruction may be a command to the microprocessor to perform a given operation on specified data. An instruction consists of two parts order code (opcode) which specifies what operation to be performed and data to be operated on called the operand. The 8085 microprocessor uses 8-bit code referred to as opcode to specify an instruction. The operands for an instruction can be specified in different ways known as addressing modes, which are explained later in detail.

MOV A, B is an example of 8085 instruction which moves an 8-bit value stored in register B into accumulator (register A). Here, MOV specifies the meaning of instruction that data is to be moved from one place to another place. A and B are operands where B specifies source operand and A specifies destination operand. The 8085 binary code for MOV A, B is 78h. in 78h, (0 1 1 1 1 0 0 0) upper two bits 01 is opcode and denotes move operation. The next three bits 111 is code for A denoting destination and last three bits 000 is code for B denoting source. We will learn more about this in subsequent topics.



Instruction size :

The size of an instruction is measured in bytes and it is no. of bytes instruction occupies in memory. The 8085 instruction s are one to three byte lone and classified as
Single-byte instructions
Two-byte instructions
Three-byte instructions
The first byte I any instruction is always code for that instruction. In single-byte instruction, operands are implicit as it has only one byte which is opcode. Two-byte instruction consists of the opcode followed by 8-bit data, while three-byte instructions consist of the opcode followed by 16-bit address or 16-bit data.

Single-byte instruction :

A single byte instruction specifies both the opcode and operand in same byte and requires just one byte storage within the memory. The examples of single byte instructions are listed below :
Mnemonic     operand    Machine code      Remark
MOV               A, B             78h                     Copy contents of register B into accumulator.
ADD                C                  89h                     Add contents of register C to accumulator
CMA                                    2fh                      Complement each bit of accumulator.
MOV A, B is stored in memory as follows and occupies just one byte.
2050h    78h

Two-byte instructions :

In a two-byte instruction, first byte is that the opcode of the instruction and second byte is that the operand. It requires two memory locations in storage.
Mnemonic        Operand            Machine Code                    Remark
MVI                     A, 32h                3eh                                       Load 8-bit
                                                        32h                                       Value 32h into accumulator
ADI                      65h                     c6h                                        Add 65h to accumulator
                                                        65h
MVI A, 32h occupies two consecutive locations in memory and stored as follows :
2050h   3eh
2051h   32h

Three-byte instruction :



A three-byte instruction specifies the opcode followed by 16-bit address. The second byte contains the lower-order address, while third byte contains the higher-order address. It requires three memory locations in storage.
Mnemonic      Operand       Machine code         Remark
LDA                   2050h           3Ah                           Load contents of
                                                 50h                           memory location 2050h
                                                 20h                           into accumulator
STA                  3050h             32h                           Store the contents
                                                 50h                           of accumulator into
                                                 30h                            memory location 3050h
LDA 2050h occupies three consecutive locations in memory and stored as follows :
2050h     3ah
2051h     50h
2052h     20h
Note that, when 16-bit value is stored in memory, 8085 stores lower byte first and higher byte next i.e. in above case 50h is stored first (at 2051h) and 20h is stored next (at 2050h).

The 8085 PIN Function


Instruction format :



The 8085has specific format for each of its instruction, known as instruction format.
Instruction format shows the internal design of an instruction of the microprocessor. An instruction contains both opcode and operands. In single-byte instruction operands are inherently specified in the opcode itself. In two-byte and three-byte instructions, the first byte is the opcode while rest byte or bytes or bytes specifies the operands. The first byte in every instruction is the 8-bit opcode which is divided into various groups. It is necessary for us to know the binary format of opcode for different types of instructions in order to convert an assembly language instruction to its equivalent machine representation i.e. sequence of machine codes.
Instruction and Timing
Example of Instruction Format

The 8085 identifies all operations, registers and status flags using a specific code. The codes for all the registers and register pairs are listed in table.
Code     Register               Code     Register pair
000         B                             00           BC
001         C                             01           DE
010         D                             10           HL
011         E                              11           AF or SP
100         H                            
101         L
111         A
Codes for internal registers

Addressing modes :

An instruction specifies opcode and operands. There are various sources in which operands can be stored like CPU registers or memory locations. An instruction specifies from which of above sources the operands for the operation to be performed are available. The various ways of specifying operands for an instruction are called addressing modes. It is also possible that same instruction may specify operands in different way i.e. instruction follows more than one addressing mode. Addressing modes provide flexibility to the instructions. More the addressing modes, more flexible instructions are.

If you can more about in Addressing modes. you can check out in this click.

Implied addressing
Register addressing
Immediate addressing
Direct addressing
Indirect addressing
Instruction timings :
8085 Instruction and Timing/Instruction and Timing
Immediate Addressing
Instruction Timings :

In order to execute an instruction, the 8085 performs various operations. The 8085 identifies various operations, also called machine cycles through the status signals IO/M, S0 and S1. The microprocessor operations include opcode fetch, memory read, memory write, I/O read, I/O write etc. before we discuss the execution and timings for various operations as well as instructions, we must following :
T-state : each operation of the microprocessor is performed in synchronization with the interior clock. One clock pulse is called a T-state. The microprocessor performs a part of an operation during a T-state.
8085 Instruction and Timing/Instruction and Timing
Instruction Timing

Machine cycle : it is defined as time required to perform a memory or an I/O operation. The 8085 machine cycle requires three to 6 T-states counting on sort of operation. We have seen that memory read memory write, I/O read and I/O write operations require three T-states.
Instruction cycle : it is defined as time required to execute an instruction. The 8085 instruction cycle consists of 1 to 5 machine cycles. 

Instruction classification :

The 8085 supports variety of instructions to perform various operations in its instruction set. The 8085 instructions are classified into five functional groups.
They are :
Data transfer group
Branch group
Arithmetic group
Stack, I/O and machine control group
Logic group
Data transfer group : this group of instructions move the data between registers or between memory and registers. The move instructions, load and store instructions and exchange instruction are included in data transfer group.

ARCHITECTURE OF THE 8085 MICROPROCESSOR

Arithmetic group : this group of instructions perform the arithmetic operations like addition, substraction, increment, decrement on contents of registers or memory locations.
Logic group : this group of instructions perform the various logic operations. This includes logical AND, OR, XOR, NOT, comparison of knowledge in registers or between register and memory, rotation of knowledge and complements of knowledge.
Breach group : this group of instructions allow the transfer of control unconditionally or conditionally on the fulfillment of certain conditions on its execution. It includes various unconditional and conditional jumps, calls, returns and restarts.

Stack, I/O and machine control group : this group of instructions include the instructions for stack operations like push and pop, instructions to read and write the I/O ports, setting and reading the interrupt masks and setting and clearing thee flags.

Overview of 8085 instruction set :

The 8085 microprocessor provides 74 different opcode formats that result in 239 instructions. The idea of presenting the complete instruction set here is to make reader aware of various instructions and their functions, but not all the details. It is possible that you will find it difficult at this stage to grasp the details of each instruction and their use.
We will be using the following notation, in our discussion of instructions.
Notation              Meaning
R                             8-bit register
Rs                           source register
Rd                           destination register
Rp                           register pair
Rh                           higher order register of register pair
Rl                            lower order register of register pair
M                            memory register (HL pair)
data8                       8-bit data
data16                     16-bit data
addr                        16-bit address
port                        8-bit port address
()                             contents of

Post a Comment

Please do not enter any spam link in the comment box.

Previous Post Next Post