Logical instructions in 8086 microprocessor
Last Updated :
24 Apr, 2023
Introduction :
Logical instructions in the 8086 microprocessor are instructions that perform logical operations on data stored in registers or memory locations. These instructions can manipulate bits within a byte, set or clear individual bits, or perform Boolean operations such as AND, OR, XOR, and NOT.
Some of the commonly used logical instructions in the 8086 microprocessor include:
- AND - Performs a bitwise logical AND operation between two operands and stores the result in the destination operand.
- OR - Performs a bitwise logical OR operation between two operands and stores the result in the destination operand.
- XOR - Performs a bitwise logical XOR (exclusive OR) operation between two operands and stores the result in the destination operand.
- NOT - Performs a bitwise logical NOT (negation) operation on the operand and stores the result in the destination operand.
- TEST - Performs a bitwise logical AND operation between two operands, but does not store the result. Instead, it sets the condition code flags based on the result of the operation.
Logical instructions are used in many applications, including bit manipulation, data encryption, and data compression. They are an important part of the instruction set of the 8086 microprocessor and are used extensively in assembly language programming.
Logical instructions are the instructions which perform basic logical operations such as AND, OR, etc. In 8086 microprocessor, the destination operand need not be the accumulator. Following is the table showing the list of logical instructions:
OPCODE | OPERAND | DESTINATION | EXAMPLE |
---|
AND | D, S | D = D AND S | AND AX, 0010 |
OR | D, S | D = D OR S | OR AX, BX |
NOT | D | D = NOT of D | NOT AL |
XOR | D, S | D = D XOR S | XOR AL, BL |
TEST | D, S | performs bit-wise AND operation and affects the flag register | TEST [0250], 06 |
SHR | D, C | shifts each bit in D to the right C times and 0 is stored at MSB position | SHR AL, 04 |
SHL | D, C | shifts each bit in D to the left C times and 0 is stored at LSB position | SHL AX, BL |
ROR | D, C | rotates all bits in D to the right C times | ROR BL, CL |
ROL | R, C | rotates all bits in D to the left C times | ROL BX, 06 |
RCR | D, C | rotates all bits in D to the right along with carry flag C times | RCR BL, CL |
RCL | R, C | rotates all bits in D to the left along with carry flag C times | RCL BX, 06 |
Here D stands for destination, S stands for source and C stands for count. They can either be register, data or memory address.
Why use Logical instructions in 8086 microprocessor ?
Here are some reasons why logical instructions are used in the 8086 microprocessor:
- Bit manipulation: Logical instructions allow the programmer to manipulate individual bits within a byte, which is useful in many applications, including device control, signal processing, and graphics programming.
- Data encryption: Logical instructions are used in data encryption algorithms to scramble data by performing bitwise operations on the data.
- Data compression: Logical instructions are used in data compression algorithms to reduce the size of the data by removing redundant or irrelevant bits.
- Boolean operations: Logical instructions are used to perform Boolean operations such as AND, OR, XOR, and NOT, which are used in many applications, including control systems, signal processing, and mathematical operations.
- Condition code flags: Logical instructions can set the condition code flags in the flags register, which can be used to control program flow or make decisions based on the result of the logical operation.
Advantages of Logical instructions in 8086 microprocessor :
- Efficient data manipulation: Logical instructions allow for efficient manipulation of data in memory or registers, providing a powerful and flexible tool for programmers.
- Bitwise operations: Logical instructions allow for bitwise operations on individual bits within a byte, providing a powerful tool for device control, signal processing, and graphics programming.
- Boolean operations: Logical instructions can perform Boolean operations such as AND, OR, XOR, and NOT, providing a powerful tool for control systems, signal processing, and mathematical operations.
- Condition code flags: Logical instructions can set the condition code flags in the flags register, providing a way to control program flow or make decisions based on the result of the logical operation.
- Data encryption and compression: Logical instructions can be used in data encryption and compression algorithms, providing a way to scramble data by performing bitwise operations on the data or reducing the size of the data by removing redundant or irrelevant bits.
- Faster execution: Logical instructions execute faster than other instructions that perform similar operations, providing a way to optimize performance in time-critical applications.
Dis-advantages of Logical instructions in 8086 microprocessor :
- Limited precision: Logical instructions can only operate on 8-bit or 16-bit data, which can limit their precision in applications that require higher precision.
- Limited functionality: Logical instructions can only perform simple bitwise and Boolean operations, which may not be sufficient for more complex applications.
- Register limitations: Logical instructions require the use of registers, which can be a limited resource in the 8086 microprocessor, especially in applications that require many different operations to be performed simultaneously.
- Complex programming: Logical instructions can be difficult to program, especially for novice programmers who may not be familiar with the syntax and semantics of assembly language programming.
- Debugging challenges: Logical instructions can introduce subtle errors into programs, especially if they are used incorrectly or in combination with other instructions.
Similar Reads
Microprocessor Tutorials
A microprocessor is fabricated on a single integrated circuit (IC) or chip that is used as a central processing unit (CPU). It is used as an electronic device, giving output instructions and executing data. In the microprocessor tutorial page, We will cover some basic topics like the introduction to
9 min read
Introduction of Microprocessor
In this article we will go through the Microprocessor, we will first define what is a Microprocessor, then we will go through its different types with its block diagram and we will see different types of processors, At last, we will conclude our article with some applications and FAQs.What is Microp
6 min read
Types of Microprocessors
This article provides an overview of the microprocessor, one of the most important components of a modern computing device. It describes how they function like the "brain" of the computer and enumerates the different types of Microprocessors. This also includes the vector processors, array processor
6 min read
Microprocessor | Intel x86 evolution and main features
Intel x86 architecture has evolved over the years. From a 29, 000 transistors microprocessor 8086 that was the first introduced to a quad-core Intel core 2 which contains 820 million transistors, the organization and technology have changed dramatically. Some of the highlights of the evolution of x8
5 min read
Evolution of Microprocessors
Transistor was invented in 1948 (23 December 1947 in Bell lab). IC was invented in 1958 (Fair Child Semiconductors) By Texas Instruments J Kilby. The first microprocessor was invented by INTEL(INTegrated ELectronics). Size of the microprocessor - 4 bit NameYear of InventionClock speedNumber of trans
5 min read
Architecture of 8085 microprocessor
A microprocessor is fabricated on a single integrated circuit (IC) or chip that is used as a central processing unit (CPU).The 8085 microprocessor is an 8-bit microprocessor that was developed by Intel in the mid-1970s. It was widely used in the early days of personal computing and was a popular cho
11 min read
Pin diagram of 8085 microprocessor
The 8085 microprocessor is a popular 8-bit microprocessor developed by Intel. It has 40 pins, each with a specific function for interfacing with memory, input/output devices, and other components.Pin diagram of 8085 microprocessor is shown below: Key Pin Descriptions1. Address Bus and Data BusAddres
5 min read
Registers of 8085 microprocessor
Introduction : A microprocessor is a multipurpose, programmable, clock-driven, register-based electronic device that reads binary instructions from a storage device called memory, accepts binary data as input and processes data according to those instructions and provide results as output. A 8085 mi
8 min read