Logical, Shift and Rotate Instructions in 8085

A microprocessor can perform all the logic functions of the hard-wired logic through its instruction set. These instructions include:

  • AND
  • OR
  • Exclusive-OR
  • Compare
  • Rotate Bits

All logic operations are performed in relation to the contents of the accumulator. The complete list of logical instructions in 8085 is described in the following table.

MnemonicDescriptionExample
ANA RThis is a 1-byte instruction.
Logically ANDs the contents of the register R with the contents of the accumulator.
8085: CY is reset and AC is set
ANA B
ANI 8-bitThis is a 2-byte instruction.
Logically ANDs the second byte with the contents of the accumulator.
8085: CY is reset and AC is set.
ANI 2FH
ANA MLogically AND the contents of the memory with the contents of A.ANA M
ORA RThis is a 1-byte instruction.
Logically ORS the contents of the register R with the contents of the accumulator
ORA B
ORI 8-bitThis is a 2-byte instruction.
Logically ORS the second byte with the contents of the accumulator.
ORI 37H
ORA MLogically OR the contents of the memory with the contents of A.ORA M
XRA RThis is a I-byte instruction.
Exclusive-ORs the contents of register R with the contents of the accumulator.
XRA B
XRI 8-bitThis is a 2-byte instruction.
Exclusive-ORs the second byte with the contents of the accumulator.
XRI 6AH
XRA MExclusive OR the contents of the memory with the contents of A.XRA M
CMP RCompare the contents of register with the contents of A for less than, or equal to, or greater than.CMP B
CPI 8-bitCompare 8-bit data with the contents of register with the contents of A for less than, or equal to, or greater than.CPI 4FH
CMAThis is an I-byte instruction that complements the contents of the accumulator
No flags are affected
CMA
RLCRotate Accumulator left by one position.
RRCRotate Accumulator right by one position.
RALRotate Accumulator left by one position through carry flag.
RARRotate Accumulator right by one position through carry flag.

The logic instructions:

  • Assume implicitly that the accumulator is one of the operands.
  • Reset (clear) the CY flag. The instruction CMA is an exception; it has no effect on any flags.
  • Modify the Z, P, and S flags based on the result’s data conditions.
  • Store the result into the accumulator.
  • Do not change the operand register’s contents.
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments