Arithmetic and Logical Operations of 8086 Microprocessor

Arithmetic and Logical Instruction Sets: In this tutorial, we will learn about the arithmetic and logical instructions/ operations of 8086 microprocessor. By Uma Dasgupta Last updated : May 15, 2023

Logical Operations / Instruction Sets

The following are the logical operations / instruction sets:

1. AND: Logical AND

Atleast one of the operant should be a register or a memory operant both the operant cannot be a memory location or immediate operant.

Arithmetic and Logical Operations of 8086 - AND

2. OR: Logical OR

Both inputs are low in this case

Arithmetic and Logical Operations of 8086 - OR

3. NOT: Logical Invert

Arithmetic and Logical Operations of 8086 - NOT

4. XOR: Logical Exclusive OR

Arithmetic and Logical Operations of 8086 - XOR

5. TEST: Logical Compare Instruction

It will do bit by bit AND operation on the operands. Each bit of the result is then said to be 1 if the corresponding bit else the result bit is said to zero.

Arithmetic and Logical Operations of 8086 - TEST

6. SHL: Logical Left-shift

It will shift the operant bit by bit to the left and insert the zero in the newly introduced least significant bits. Here operant is not an immediate data.

Arithmetic and Logical Operations of 8086 - SHL

7. SHR: Logical Right-shift

Arithmetic and Logical Operations of 8086 - SHR

8. SAR: Arithmetic Right-shift

Same as the logical shift but it inserts the most significant bit of the operand in the newly inserted position.

9. ROR: Rotate Right without Carry)

Arithmetic and Logical Operations of 8086 - ROR

10. ROL: Rotate Left without Carry

Arithmetic and Logical Operations of 8086 - ROL

11. RCR: Rotate Right through Carry

Arithmetic and Logical Operations of 8086 - RCR

12. RCL: Rotate Left through Carry

Arithmetic and Logical Operations of 8086 - RCL

Arithmetic Operations / Instruction Sets

The following are the arithmetic operations / instruction sets:

1. ADD

In this operation we perform sum of data in two different registers.

Memory to memory operation is not possible. Source and destination operant cannot be a memory location.

Also the content of segment register cannot be added.

2. ADC (Add with carry)

Same as add instruction, but adds the carry flag bit.

3. INC (Increment)

Increment the data by 1 and immediate data cannot be an operand here.

4. DEC (Decrement by 1)

Decreases data by 1 and immediate data cannot be an operand.

5. SUB

It will subtract source operand from destination and result is stored in destination.

Both operands may not be a memory operand and destination operand must not be an immediate data.

6. SBB (Subtract with borrow)

Borrow flag/ Carry flag is also subtracted.

7. CMP (Compare)

For comparison it subtract source operand from the destination, but result is not stored anywhere.

8. ASS (ASCII adjust AL after subtraction)

It converts the result of subtraction of two valid unpacked BCD digits to a single valid BCD no. and takes AL as implicit operand.

9. AAM (ASCII adjust after multiplication)

AAM converts the result of multiplication of two valid BCD digits to a single valid BCD no. takes AC as implicit operand.

It unpacks the result by dividing AX by 10 placing the quotient into AH and remainder in AL.

10. AAD (ASCII adjust before division)

It converts unpacked BCD digits in AH and AL register in a single binary number in AX register in preparation for a division operation.

Before executing AAD placed most significant BCD digit in the AH register and least significant digit in AL register. Then the two BCD digits are combined in a single binary number by setting.

11. DAA (Decimal adjust accumulator)

Used to convert the result of the addition of 2 packed BCD no. to valid BCD no. if lower nibble AL > 9.

12. DAS (Decimal address after subtraction)

It converts the result of subtraction of two packed number to a valid BCD no.

Conclusion

In this article I have discussed briefly about almost all arithmetic and logical instructions of 8086 microprocessor. I hope they have covered all we need to know about the operations performed by 8086 microprocessor if you have any further queries shoot them in the comment section below. See you in my next article till then stay healthy and keep learning!




Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.