Microprocessor Instruction Set 8085

The ins truction set of the 8085 microprocessor is designed to provide a wide range of functionalities, making it suitable for various applications. It includes instructions for data transfer, arithmetic and logical operations, branching and looping, and input/output operations.
Data transfer instructions allow the microprocessor to move data between memory locations and registers. These instructions include the MOV instruction, which transfers data from one register to another, and the MVI instruction, which loads immediate data into a register or memory location. The 8085 microprocessor also supports stack operations, such as PUSH and POP, which are used for storing and retrieving data from the stack.
Arithmetic and logical instructions enable the microprocessor to perform mathematical operations on data. These instructions include ADD, SUB, INR, and DCR, which are used for addition, subtraction, increment, and decrement operations respectively. The microprocessor also supports logical operations such as AND, OR, and XOR, which are used for bitwise operations on data.
Branching and looping instructions are essential for controlling the flow of program execution. The 8085 microprocessor includes instructions like JMP, JZ, JNZ, JC, and JNC, which are used for unconditional and conditional branching. These instructions allow the program to jump to a specific memory location based on certain conditions. The microprocessor also supports looping instructions like LOOP and LDA, which are used for implementing loops in a program.
Input/output instructions enable the microprocessor to communicate with external devices. These instructions include IN and OUT, which are used for input and output operations respectively. The microprocessor can read data from input devices and write data to output devices using these instructions. It also supports instructions for controlling the interrupt system, which allows the microprocessor to respond to external events.
In addition to these basic instructions, the 8085 microprocessor also includes instructions for handling interrupts, manipulating flags, and performing string operations. These instructions provide advanced functionalities and enhance the versatility of the microprocessor.
Overall, the instruction set of the 8085 microprocessor is comprehensive and flexible, allowing programmers to write efficient and complex programs. Its wide range of instructions enables the microprocessor to perform a variety of tasks, making it a popular choice for many applications. Whether it is performing mathematical calculations, controlling external devices, or implementing complex algorithms, the 8085 microprocessor’s instruction set provides the necessary tools for efficient and effective programming. The basic structure of an instruction in the 8085 microprocessor is crucial to understand the functioning of the processor. Each instruction is composed of an opcode and zero or more operands, which together determine the operation to be performed.
The opcode, or operation code, is a binary code that specifies the particular operation to be executed by the microprocessor. It acts as a command that tells the processor what action to take. For instance, in the instruction “ADD B”, the opcode is “ADD”, which indicates that the processor should perform an addition operation.
In addition to the opcode, an instruction may also contain operands. These operands provide the data or addresses on which the operation is to be performed. They can be registers, memory locations, or immediate values.
In the example given, “B” is the operand. It refers to register B, which contains a specific value. The instruction “ADD B” instructs the microprocessor to add the contents of register B to the accumulator. The accumulator is a special register that holds the intermediate results of arithmetic and logical operations.
By specifying the opcode and operands, the instruction conveys a specific task for the microprocessor to execute. The structure of an instruction is designed to be concise and efficient, allowing the processor to perform complex operations with a minimal number of instructions.
Understanding the basic structure of an instruction is fundamental for programming and working with the 8085 microprocessor. It enables programmers to write code that precisely controls the processor’s behavior and utilizes its capabilities effectively. Additionally, knowledge of the instruction structure is essential for debugging and troubleshooting programs, as it helps identify errors and optimize performance.

Types of Instructions

The instruction set of the 8085 microprocessor can be classified into the following categories:
1. Data Transfer Instructions:
– MOV: This instruction is used to transfer data between registers or between a register and a memory location. For example, “MOV A, B” transfers the contents of register B to the accumulator.
– MVI: This instruction is used to move an immediate value into a register or a memory location. For example, “MVI A, 10” moves the value 10 into the accumulator.
– LXI: This instruction is used to load a 16-bit immediate value into a register pair. For example, “LXI H, 2050H” loads the value 2050H into the HL register pair.
– LDA: This instruction is used to load the contents of a memory location into the accumulator. For example, “LDA 3000H” loads the contents of memory location 3000H into the accumulator.
– STA: This instruction is used to store the contents of the accumulator into a memory location. For example, “STA 4000H” stores the contents of the accumulator into memory location 4000H.
– LHLD: This instruction is used to load the contents of a memory location into the HL register pair. For example, “LHLD 5000H” loads the contents of memory location 5000H into the HL register pair.
– SHLD: This instruction is used to store the contents of the HL register pair into a memory location. For example, “SHLD 6000H” stores the contents of the HL register pair into memory location 6000H.
– XCHG: This instruction is used to exchange the contents of the HL register pair with the DE register pair. For example, “XCHG” exchanges the contents of the HL register pair with the DE register pair.
2. Arithmetic Instructions:
– ADD: This instruction is used to add the contents of a register or a memory location to the accumulator. For example, “ADD B” adds the contents of register B to the accumulator.
– ADC: This instruction is used to add the contents of a register or a memory location to the accumulator along with the carry flag. For example, “ADC C” adds the contents of register C and the carry flag to the accumulator.
– SUB: This instruction is used to subtract the contents of a register or a memory location from the accumulator. For example, “SUB C” subtracts the contents of register C from the accumulator.
– SBB: This instruction is used to subtract the contents of a register or a memory location from the accumulator along with the carry flag. For example, “SBB D” subtracts the contents of register D and the carry flag from the accumulator.
– INR: This instruction is used to increment the contents of a register or a memory location by 1. For example, “INR A” increments the contents of the accumulator by 1.
– DCR: This instruction is used to decrement the contents of a register or a memory location by 1. For example, “DCR B” decrements the contents of register B by 1.
– INX: This instruction is used to increment a register pair by 1. For example, “INX H” increments the HL register pair by 1.
– DCX: This instruction is used to decrement a register pair by 1. For example, “DCX D” decrements the DE register pair by 1.
3. Logical Instructions:
– AND: This instruction performs a bitwise AND operation between the accumulator and a register or a memory location. For example, “AND A” performs a bitwise AND operation between the accumulator and itself.
– OR: This instruction performs a bitwise OR operation between the accumulator and a register or a memory location. For example, “OR B” performs a bitwise OR operation between the accumulator and register B.
– XRA: This instruction performs a bitwise XOR operation between the accumulator and a register or a memory location. For example, “XRA C” performs a bitwise XOR operation between the accumulator and register C.
– CMP: This instruction compares the contents of a register or a memory location with the accumulator and sets the flags accordingly. For example, “CMP D” compares the contents of register D with the accumulator.
– CMA: This instruction complements the contents of the accumulator. For example, “CMA” complements the contents of the accumulator.
– RLC: This instruction rotates the contents of the accumulator left through the carry flag. For example, “RLC” rotates the contents of the accumulator left through the carry flag.
– RRC: This instruction rotates the contents of the accumulator right through the carry flag. For example, “RRC” rotates the contents of the accumulator right through the carry flag.
– RAL: This instruction rotates the contents of the accumulator left through the carry flag. For example, “RAL” rotates the contents of the accumulator left through the carry flag.
– RAR: This instruction rotates the contents of the accumulator right through the carry flag. For example, “RAR” rotates the contents of the accumulator right through the carry flag.
4. Branching Instructions:
– JMP: This instruction is used to transfer control to a specified memory location. For example, “JMP 2000H” transfers control to the memory location 2000H.
– JZ: This instruction is used to jump to a specified memory location if the zero flag is set. For example, “JZ 2050H” jumps to the memory location 2050H if the zero flag is set.
– JNZ: This instruction is used to jump to a specified memory location if the zero flag is not set. For example, “JNZ 2100H” jumps to the memory location 2100H if the zero flag is not set.
– JC: This instruction is used to jump to a specified memory location if the carry flag is set. For example, “JC 2150H” jumps to the memory location 2150H if the carry flag is set.
– JNC: This instruction is used to jump to a specified memory location if the carry flag is not set. For example, “JNC 2200H” jumps to the memory location 2200H if the carry flag is not set.
– JP: This instruction is used to jump to a specified memory location if the sign flag is not set. For example, “JP 2250H” jumps to the memory location 2250H if the sign flag is not set.
– JM: This instruction is used to jump to a specified memory location if the sign flag is set. For example, “JM 2300H” jumps to the memory location 2300H if the sign flag is set.
– JPE: This instruction is used to jump to a specified memory location if the parity flag is set. For example, “JPE 2350H” jumps to the memory location 2350H if the parity flag is set.
– JPO: This instruction is used to jump to a specified memory location if the parity flag is not set. For example, “JPO 2400H” jumps to the memory location 2400H if the parity flag is not set.
5. Input/Output Instructions:
– IN: This instruction is used to read data from an input device into a register or a memory location. For example, “IN A, 01H” reads data from input port 01H into the accumulator.
– OUT: This instruction is used to send data from a register or a memory location to an output device. For example, “OUT 02H, A” sends the contents of the accumulator to output port 02H.
– EI: This instruction enables the interrupt system. For example, “EI” enables the interrupt system.
– DI: This instruction disables the interrupt system. For example, “DI” disables the interrupt system.

These are some of the most commonly used instructions in the 8085 microprocessor. Each instruction performs a specific operation and plays a crucial role in the execution of programs. Understanding these instructions is essential for writing efficient and effective assembly language programs for the 8085 microprocessor.

Examples of 8085 Instructions

Let’s take a look at some examples of 8085 instructions:
1. MOV A, B:
– This instruction transfers the contents of register B to the accumulator.
– Syntax: MOV A, B
– Example: MOV A, B
– Explanation: In this example, the value stored in register B is moved to the accumulator register A. This instruction is commonly used to transfer data between registers in the 8085 microprocessor.
2. MVI A, 10:
– This instruction moves the value 10 into the accumulator.
– Syntax: MVI A, 10
– Example: MVI A, 10
– Explanation: In this example, the immediate value 10 is moved into the accumulator register A. This instruction is used to load a constant value into a register.
3. ADD B:
– This instruction adds the contents of register B to the accumulator.
– Syntax: ADD B
– Example: ADD B
– Explanation: In this example, the value stored in register B is added to the value in the accumulator register A. The result is stored in the accumulator. This instruction is used for addition operations in the 8085 microprocessor.
4. SUB C:
– This instruction subtracts the contents of register C from the accumulator.
– Syntax: SUB C
– Example: SUB C
– Explanation: In this example, the value stored in register C is subtracted from the value in the accumulator register A. The result is stored in the accumulator. This instruction is used for subtraction operations in the 8085 microprocessor.
5. AND A:
– This instruction performs a bitwise AND operation between the accumulator and itself.
– Syntax: AND A
– Example: AND A
– Explanation: In this example, the value in the accumulator register A is bitwise ANDed with itself. The result is stored in the accumulator. This instruction is used for logical AND operations in the 8085 microprocessor.
6. OR B:
– This instruction performs a bitwise OR operation between the accumulator and register B.
– Syntax: OR B
– Example: OR B
– Explanation: In this example, the value in the accumulator register A is bitwise ORed with the value in register B. The result is stored in the accumulator. This instruction is used for logical OR operations in the 8085 microprocessor.
7. JMP 2000H:
– This instruction transfers control to the memory location 2000H.
– Syntax: JMP 2000H
– Example: JMP 2000H
– Explanation: In this example, the program execution is transferred to the memory location 2000H. This instruction is used for unconditional jumps in the 8085 microprocessor.
8. JZ 2050H:
– This instruction jumps to the memory location 2050H if the zero flag is set.
– Syntax: JZ 2050H
– Example: JZ 2050H
– Explanation: In this example, if the zero flag is set, the program execution is transferred to the memory location 2050H. This instruction is used for conditional jumps based on the zero flag in the 8085 microprocessor.
9. IN A, 01H:
– This instruction reads data from input port 01H into the accumulator.
– Syntax: IN A, 01H
– Example: IN A, 01H
– Explanation: In this example, data from the input port 01H is read and stored in the accumulator register A. This instruction is used for input operations in the 8085 microprocessor.
10. OUT 02H, A:
– This instruction sends the contents of the accumulator to output port 02H.
– Syntax: OUT 02H, A
– Example: OUT 02H, A
– Explanation: In this example, the value in the accumulator register A is sent to the output port 02H. This instruction is used for output operations in the 8085 microprocessor. The value in the accumulator is typically sent to an output device connected to the specified port.

Scroll to Top