Logical instructions in 8085 microprocessor performs the logical operations like AND, OR, EXCLUSIVE- OR, complement, compare and rotate. The flag conditions are altered after execution of an instruction in this group.
Logical Instructions in 8085
Opcode | Operand | Explanation of Instruction | Description |
CMP | R M | Compare register or memory with accumulator | The contents of the operand (register or memory) are M compared with the contents of the accumulator. Both contents are preserved . The result of the comparison is shown by setting the flags of the PSW as follows: if (A) < (reg/mem): carry flag is set Example: CMP B or CMP M |
CPI | 8-bit data | Compare immediate with accumulator | The second byte (8-bit data) is compared with the contents of the accumulator. The values being compared remain unchanged. The result of the comparison is shown by setting the flags of the PSW as follows: if (A) < data: carry flag is set Example: CPI 89H |
ANA | R M | Logical AND register or memory with accumulator | The contents of the accumulator are logically ANDed with M the contents of the operand (register or memory), and the result is placed in the accumulator. If the operand is a memory location, its address is specified by the contents of HL registers. S, Z, P are modified to reflect the result of the operation. CY is reset. AC is set. Example: ANA B or ANA M |
ANI | 8-bit data | Logical AND immediate with accumulator | The contents of the accumulator are logically ANDed with the Example: ANI 86H |
XRA | R M | Exclusive OR register or memory with accumulator | The contents of the accumulator are Exclusive ORed with M the contents of the operand (register or memory), and the result is placed in the accumulator. If the operand is a memory location, its address is specified by the contents of HL registers. S, Z, P are modified to reflect the result of the operation. CY and AC are reset. Example: XRA B or XRA M |
XRI | 8-bit data | Exclusive OR immediate with accumulator | The contents of the accumulator are Exclusive ORed with the 8-bit data (operand) and the result is placed in the accumulator. S, Z, P are modified to reflect the result of the operation. CY and AC are reset. Example: XRI 86H |
ORA | R M | Logical OR register or memory with accumulator | The contents of the accumulator are logically ORed with M the contents of the operand (register or memory), and the result is placed in the accumulator. If the operand is a memory location, its address is specified by the contents of HL registers. S, Z, P are modified to reflect the result of the operation. CY and AC are reset. Example: ORA B or ORA M |
ORI | 8-bit data | Logical OR immediate with accumulator | The contents of the accumulator are logically ORed with the 8-bit data (operand) and the result is placed in the accumulator. S, Z, P are modified to reflect the result of the operation. CY and AC are reset. Example: ORI 86H |
RLC | none | Rotate accumulator left | Each binary bit of the accumulator is rotated left by one position. Bit D7 is placed in the position of D0 as well as in the Carry flag. CY is modified according to bit D7. S, Z, P, AC are not affected. Example: RLC |
RRC | none | Rotate accumulator right | Each binary bit of the accumulator is rotated right by one position. Bit D0 is placed in the position of D7 as well as in the Carry flag. CY is modified according to bit D0. S, Z, P, AC are not affected. Example: RRC |
RAL | none | Rotate accumulator left through carry | Each binary bit of the accumulator is rotated left by one position through the Carry flag. Bit D7 is placed in the Carry flag, and the Carry flag is placed in the least significant position D0. CY is modified according to bit D7. S, Z, P, AC are not affected. Example: RAL |
RAR | none | Rotate accumulator right through carry | Each binary bit of the accumulator is rotated right by one position through the Carry flag. Bit D0 is placed in the Carry flag, and the Carry flag is placed in the most significant position D7. CY is modified according to bit D0. S, Z, P, AC are not affected. Example: RAR |
CMA | none | Complement accumulator | The contents of the accumulator are complemented. No flags are affected. Example: CMA |
CMC | none | Complement carry | The Carry flag is complemented. No other flags are affected. Example: CMC |
STC | none | Set Carry | Set Carry Example: STC |
Recent posts
Related posts:
- Terminology Used in Microprocessor and Microcontroller
- CISC and RISC Processor Architecture
- Von Neumann and Harvard Architecture
- Basics of Microprocessor and Microcontroller
- Introduction to Microprocessor 8085
- Architecture of 8085 Microprocessor
- Pin Diagram of 8085 Microprocessor and Pin Description
- Addressing Modes in 8085 Microprocessor
- Data Transfer Instructions in 8085 Microprocessor
- Arithmetic Instructions in 8085 Microprocessor
- Branching instructions in 8085 Microprocessor
- Machine Control Instructions in 8085 Microprocessor
- Timing Diagram of 8085 Instructions
- Stack and Subroutine in 8085 Microprocessor
- Interrupts in 8085 Microprocessor
- Assembler Directives of 8085 Microprocessor
- Simple Data Transfer Program in 8085 Microprocessor
- Microprocessor 8085 Addition and Subtraction Programs
- Programs on Logical Instructions in 8085 Microprocessor
- Multiplication Programs in 8085 Microprocessor
- Division Programs in 8085 Microprocessor
- Introduction to Assembly Language Programming
- 8085 Program to Find the Largest Number in an Array of Data
- 8085 Program to Count Negative Numbers | ALP to Count Negative Numbers
- 8085 Program to Find the Smallest Number in An Array of Data
- 8085 Program to Arrange an Array of Data in Ascending Order
- 8085 Program to Arrange an Array of Data in Descending Order
- 8085 Program to Find the Square of a Number from 0 to 9 Using a Table of Square