8 Bit Logical Instructions | 8085 Microprocessor

1. ANA  R

R ⇒ A, B, C, D, E, H, L, and M

Instruction word size  ⇒   1 Byte

Operation ⇒ When this instruction will execute the content of Register R will get AND operation with the accumulator (A) content bit by bit and the final result will store in the accumulator [A].

Addressing Mode ⇒

If R ≠ M  ⇒ Register Addressing Mode

If R = M ⇒ Indirect Addressing Mode

For example:

[A] = 29 H [D] = 56 H

ANA  D

[A] =  0 0 1 0    1 0 0 1 [D] =  0 1 0 1    0 1 1 0

——————————–

0 0 0 0      0 0 0 0 = 00 H

[D] = 56 H [A] = 00 H

2. ANI   8-bit data

Instruction word size  ⇒  2 Byte

Operation ⇒ When this instruction will execute the 8-bit data given in instruction will get AND operation with the accumulator (A) content bit by bit and the final result will store in the accumulator [A].

Addressing Mode ⇒ Immediate Addressing Mode

3. ORA  R

R ⇒ A, B, C, D, E, H, L, and M

Instruction word size  ⇒   1 Byte

Operation ⇒ When this instruction will execute the content of Register R will get OR operation with the accumulator (A) content bit by bit and the final result will store in the accumulator [A].

Addressing Mode ⇒

If R ≠ M  ⇒ Register Addressing Mode

If R = M ⇒ Indirect Addressing Mode

For example:

[A] = 29 H [D] = 56 H

ORA  D

[A] =  0 0 1 0    1 0 0 1 [D] =  0 1 0 1    0 1 1 0

——————————–

0 1 1 1      1 1 1 1 = 7F H

[D] = 56 H [A] = 7F H

4. ORI   8-bit data

Instruction word size  ⇒  2 Byte

Operation ⇒ When this instruction will execute the 8-bit data given in instruction will get OR operation with the accumulator (A) content bit by bit and the final result will store in the accumulator [A].

Addressing Mode ⇒ Immediate Addressing Mode

5. XRA  R

R ⇒ A, B, C, D, E, H, L, and M

Instruction word size  ⇒   1 Byte

Operation ⇒ When this instruction will execute the content of Register R will get Ex-OR operation with the accumulator (A) content bit by bit and the final result will store in the accumulator [A].

Addressing Mode ⇒

If R ≠ M  ⇒ Register Addressing Mode

If R = M ⇒ Indirect Addressing Mode

For example:

[A] = 26 H [D] = D1 H

XRA  D

[A] =  0 0 1 0    0 1 1 0 [D] =  1 1 0 1     0 0 0 1

——————————–

1 1 1 1      0 1 1 1 = F7 H

[D] = D1 H [A] = F7 H

6. XRI   8-bit data

Instruction word size  ⇒  2 Byte

Operation ⇒ When this instruction will execute the 8-bit data given in instruction will get Ex-OR operation with the accumulator (A) content bit by bit and the final result will store in the accumulator [A].

Addressing Mode ⇒ Immediate Addressing Mode

7. CMA   no operand

Instruction word size  ⇒   1 Byte

Operation ⇒ When this instruction will execute the content of accumulator (A) will get complement bit by bit and the final result will store in the accumulator [A].

Complement means 1 becomes 0 and 0 becomes 1.

Addressing Mode ⇒ Implicit Addressing Mode

For example:

[A] = 28 H

CMA

[A] =  0 0 1 0    1 0 0 0

——————————–

1 1 0 1      0 1 1 1 = D7 H

[A] = D7 H

Instruction Sign flag Zero flag Auxiliary  carry flag Parity flag Carry flag
ANA  ✔ 1 0
ANI 1 0
ORA 0 0
ORI 0 0
XRA 0 0
XRI 0 0
CMA

✔ ⇒ affect according to the result

✖ ⇒ Not affect

1 ⇒ SET

0 ⇒ RESET

Note:

1. CMA instruction will not affect the status of any flag.

2. ANA, ANI, ORA, ORI, XRA, XRI instructions will always reset the carry flag.

3. ANA, ANI instructions always SET the auxiliary carry flag.

4. ORA, ORI, XRA, XRI instructions will always reset the auxiliary carry flag.

5. ANA, ANI, ORA, ORI, XRA, XRI instructions affect other flags as per result.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.