0% found this document useful (0 votes)
354 views21 pages

Logical Instructions in 8086 Micro Processor

Logical instructions in the 8086 microprocessor perform bitwise operations like AND, OR, XOR, and NOT on operands in registers and memory. They manipulate individual bits and affect status flags. Examples show using AND to preserve lower bits, OR to preserve higher bits, and shift instructions to move bits left or right in a register. Logical instructions are important for assembly programming and conditional branching.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
354 views21 pages

Logical Instructions in 8086 Micro Processor

Logical instructions in the 8086 microprocessor perform bitwise operations like AND, OR, XOR, and NOT on operands in registers and memory. They manipulate individual bits and affect status flags. Examples show using AND to preserve lower bits, OR to preserve higher bits, and shift instructions to move bits left or right in a register. Logical instructions are important for assembly programming and conditional branching.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 21

Logical Instructions In 8086 Micro Processor

SlideMake.com
Introduction to Logical Instructions in 8086 Micro Processor

• Logical instructions in 8086 micro processor are used to perform logical


operations on binary data.

• These instructions manipulate individual bits or groups of bits within


registers or memory locations.

• Logical instructions include AND, OR, XOR, NOT, and shift/rotate


instructions.
AND Instruction

• The AND instruction performs a bitwise AND operation between two


operands.

• It sets the result to 1 if both corresponding bits are 1; otherwise, it sets the
result to 0.

• The operands can be registers, memory locations, or immediate values.


OR Instruction

• The OR instruction performs a bitwise OR operation between two


operands.

• It sets the result to 1 if at least one of the corresponding bits is 1;


otherwise, it sets the result to 0.

• The operands can be registers, memory locations, or immediate values.


XOR Instruction

• The XOR instruction performs a bitwise exclusive OR operation between


two operands.

• It sets the result to 1 if the corresponding bits are different; otherwise, it


sets the result to 0.

• The operands can be registers, memory locations, or immediate values.


NOT Instruction

• The NOT instruction performs a bitwise complement operation on an


operand.

• It inverts all the bits of the operand, changing 1s to 0s and vice versa.

• The operand can be a register or a memory location.


Shift Instructions

• Shift instructions are used to shift the bits of a value left or right.

• The SHL (shift left) instruction shifts the bits to the left, filling the empty
positions with zeros.

• The SHR (shift right) instruction shifts the bits to the right, filling the
empty positions with zeros.
Rotate Instructions

• Rotate instructions are similar to shift instructions but with a circular shift
behavior.

• The ROL (rotate left) instruction shifts the bits to the left, moving the
leftmost bit to the rightmost position.

• The ROR (rotate right) instruction shifts the bits to the right, moving the
rightmost bit to the leftmost position.
Flags Affected by Logical Instructions

• The logical instructions in 8086 micro processor affect various flags in the
FLAGS register.

• The flags affected include the carry flag (CF), zero flag (ZF), sign flag
(SF), parity flag (PF), and overflow flag (OF).

• These flags are updated based on the result of the logical operation
performed.
AND Instruction Example

• Example: AND AX, 0xFF00

• This instruction performs a bitwise AND operation between the value in


AX and 0xFF00.

• The result is stored back in AX, preserving the original value of the lower
8 bits.
OR Instruction Example

• Example: OR BX, 0x00FF

• This instruction performs a bitwise OR operation between the value in BX


and 0x00FF.

• The result is stored back in BX, preserving the original value of the higher
8 bits.
XOR Instruction Example

• Example: XOR CX, 0xAAAA

• This instruction performs a bitwise exclusive OR operation between the


value in CX and 0xAAAA.

• The result is stored back in CX, changing the bits that correspond with the
1s in 0xAAAA.
NOT Instruction Example

• Example: NOT DL

• This instruction performs a bitwise complement operation on the value in


DL.

• The result is stored back in DL, inverting all the bits of the original value.
Shift Instructions Example

• Example: SHL SI, 2

• This instruction shifts the bits of SI to the left by 2 positions.

• The empty positions are filled with zeros, and the shifted result is stored
back in SI.
Rotate Instructions Example

• Example: ROR DI, 3

• This instruction rotates the bits of DI to the right by 3 positions.

• The rightmost 3 bits are moved to the leftmost positions, and the rotated
result is stored back in DI.
Logical Instructions and Conditional Branching

• Logical instructions are often used in conjunction with conditional


branching instructions.

• Conditional branches allow the program to change its flow based on the
result of a logical operation.

• For example, the JZ (jump if zero) instruction jumps to a specified location


if the zero flag (ZF) is set.
Logical Instructions in Assembly Language Programming

• Logical instructions play a crucial role in assembly language programming.

• They allow programmers to manipulate and control binary data efficiently.

• Understanding the behavior and usage of logical instructions is essential


for writing efficient assembly code.
Summary of Logical Instructions

• Logical instructions in 8086 micro processor perform operations on binary


data.

• They include AND, OR, XOR, NOT, shift, and rotate instructions.

• These instructions manipulate individual bits or groups of bits within


registers or memory locations.
Conclusion

• Logical instructions are fundamental in 8086 micro processor


programming.

• They provide powerful capabilities for manipulating and controlling binary


data.

• Mastering the usage of logical instructions is essential for efficient


assembly language programming.
References

• Reference 1: "8086/8088 Primer: An Introduction to their Architecture,


System Design, and Programming" by Stephen P. Morse.

• Reference 2: "Microprocessor Architecture, Programming, and


Applications with the 8085/8080A" by Ramesh S. Gaonkar.

• Your third bullet


Questions?

• Any questions about logical instructions in 8086 micro processor?

• Your second bullet

• Your third bullet

You might also like