Overview

The 8086 is a 16-bit microprocessor that was introduced by Intel in 1978. It is a general-purpose processor that can execute a wide range of tasks, from simple arithmetic operations to complex programs.

In order to perform these tasks, the 8086 microprocessor uses different addressing modes. Addressing modes are the ways in which the processor can access memory and data. The 8086 supports the following addressing modes:

  1. Implied – the data value/data address is implicitly associated with the instruction.
  2. Immediate addressing mode: In this mode, the operand is specified as a constant value within the instruction. For example, MOV AX, 1234H moves the immediate value 1234H into the AX register.
  3. Register addressing mode: In this mode, the operand is contained in a register. For example, MOV AX, BX moves the value in the BX register into the AX register.
  4. Memory addressing mode: In this mode, the operand is located in memory. The memory location is specified using a segment register and an offset value. For example, MOV AX, [DS:BX] moves the value at the memory location specified by the contents of the DS and BX registers into the AX register.
  5. Direct addressing mode: In this mode, the memory location is specified directly in the instruction. For example, MOV AX, [1234H] moves the value at memory location 1234H into the AX register.
  6. Indexed addressing mode: In this mode, the operand is located in memory, and the memory location is specified using an index register and an offset value. For example, MOV AX, [BX+SI] moves the value at the memory location specified by the sum of the contents of the BX and SI registers into the AX register.
  7. Base-indexed addressing mode: In this mode, the operand is located in memory, and the memory location is specified using a base register, an index register, and an offset value. For example, MOV AX, [BX+SI+1234H] moves the value at the memory location specified by the sum of the contents of the BX and SI registers plus the immediate value 1234H into the AX register.
  8. Based addressing mode: In this mode, the operand is located in memory, and the memory location is specified using a base register and an offset value. For example, MOV AX, [BX+1234H] moves the value at the memory location specified by the sum of the contents of the BX register plus the immediate value 1234H into the AX register.

These addressing modes allow the 8086 microprocessor to access and manipulate data in a flexible and efficient way, making it a powerful tool for a wide range of applications.

Implied addressing mode

Implied addressing mode is a type of addressing mode that does not require any explicit operand or address. In the case of 8086 microprocessor, there are several instructions that use implied addressing mode.

Implied addressing mode is used when the instruction does not require any additional data to perform its operation. The operand is implicit and understood based on the instruction.

The following are some examples of implied addressing mode in the 8086 microprocessor:

  1. CLC (Clear Carry Flag) instruction: This instruction clears the carry flag of the 8086 processor. It does not require any operands or memory addresses, so it uses the implied addressing mode.
  2. STC (Set Carry Flag) instruction: This instruction sets the carry flag of the 8086 processor. It also uses the implied addressing mode as it does not require any operands or memory addresses.
  3. CMC (Complement Carry Flag) instruction: This instruction complements the carry flag of the 8086 processor. Like the previous two instructions, it uses the implied addressing mode.
  4. RET (Return from Subroutine) instruction: This instruction returns control from a subroutine to the calling program. It uses the implied addressing mode because it does not require any operands or memory addresses.
  5. HLT (Halt) instruction: This instruction stops the execution of the 8086 processor. It uses the implied addressing mode because it does not require any operands or memory addresses.
  6. NOP (No Operation) instruction: This instruction does nothing and is used as a placeholder in programs. It uses the implied addressing mode because it does not require any operands or memory addresses.

The implied addressing mode is useful in situations where the instruction does not require any additional data to perform its operation. By using the implied addressing mode, the instruction can be executed more efficiently, as it does not have to access memory to retrieve an operand.

Register addressing mode

Register addressing mode is a type of addressing mode in the 8086 microprocessor where the operand is specified as the contents of a register. In this mode, the instruction operates directly on the contents of the specified register without accessing memory.

The 8086 microprocessor has eight general-purpose 16-bit registers, which can be used in register addressing mode:

  1. AX register (Accumulator register): It is the primary register used for arithmetic and logic operations. It can be divided into two 8-bit registers, AH and AL.
  2. BX register (Base register): It is used as a base register for memory addressing.
  3. CX register (Count register): It is used as a counter register for loops and string operations.
  4. DX register (Data register): It is used as a secondary accumulator and for I/O operations.
  5. BP register (Base Pointer register): It is used as a base pointer for stack operations.
  6. SP register (Stack Pointer register): It is used as a stack pointer for stack operations.
  7. SI register (Source Index register): It is used as a source index for string operations.
  8. DI register (Destination Index register): It is used as a destination index for string operations.

The following are some examples of register addressing mode in the 8086 microprocessor:

  1. MOV AX, BX: This instruction moves the contents of the BX register to the AX register.
  2. ADD CX, DX: This instruction adds the contents of the DX register to the CX register.
  3. XOR AL, AH: This instruction performs a bitwise XOR operation between the contents of the AH and AL registers and stores the result in the AL register.
  4. PUSH BP: This instruction pushes the contents of the BP register onto the stack.

Register addressing mode is useful for operations that involve small amounts of data, as it can be faster than memory addressing mode. Additionally, it is often used in programs that require frequent access to the same data, as storing data in registers can reduce memory access times.

Immediate addressing mode

Immediate addressing mode is a type of addressing mode in the 8086 microprocessor where the operand is specified as a constant value embedded in the instruction itself. In this mode, the operand value is included as part of the instruction and is not stored in memory or a register.

The following is an example of immediate addressing mode in the 8086 microprocessor:

MOV AX, 1234H

In this instruction, the value 1234H is the immediate operand, and it is moved into the AX register.

Another example is:

ADD BX, 5

In this instruction, the value 5 is the immediate operand, and it is added to the contents of the BX register.

Immediate addressing mode is useful for operations that require a constant value as an operand, such as initializing a register with a known value or performing arithmetic operations with a constant value. It is also useful in situations where the data to be processed is too small to be stored in memory or register.

The maximum value that can be used as an immediate operand in the 8086 microprocessor is FFFFH, which is a 16-bit hexadecimal value. If a larger value is needed, the data must be stored in memory, and the memory address is used as the operand.

Immediate addressing mode has a disadvantage in that it requires more memory to store the instruction than other addressing modes. However, it is still useful for small values that are used frequently in a program.

Memory addressing mode

Memory addressing mode is a type of addressing mode in the 8086 microprocessor where the operand is located in memory. In this mode, the instruction references the memory location where the operand is stored, and the operand is loaded into a register for processing.

The 8086 microprocessor uses a 20-bit address bus, which can access up to 1 MB of memory. Memory locations are identified by their memory address, which is a 20-bit value.

Memory addressing mode can be divided into several subtypes, depending on the way the effective address is computed. The following are some of the most common memory addressing modes in the 8086 microprocessor:

  1. Direct addressing mode: In direct addressing mode, the operand is specified by the memory address directly. The instruction references the memory location and retrieves the data from it. For example:
MOV AX, [1000H]

This instruction moves the contents of the memory location with the address 1000H into the AX register.

  1. Indirect addressing mode: In indirect addressing mode, the instruction specifies the memory address indirectly through a register or a memory location. For example:
MOV AX, [BX]

This instruction moves the contents of the memory location whose address is stored in the BX register into the AX register.

  1. Based addressing mode: In based addressing mode, the effective address is computed as the sum of a base address and an offset. The base address can be a register or a memory location, while the offset can be a constant or a register. For example:
MOV AX, [BX+SI]

This instruction moves the contents of the memory location whose address is the sum of the contents of the BX and SI registers into the AX register.

  1. Indexed addressing mode: In indexed addressing mode, the effective address is computed as the sum of a base address and an index register multiplied by a scale factor. The base address can be a register or a memory location, while the index register can be any of the general-purpose registers. For example:
MOV AX, [BX+DI*2]

This instruction moves the contents of the memory location whose address is the sum of the contents of the BX register and DI register multiplied by 2 into the AX register.

Memory addressing mode is useful for operations that require large amounts of data or data that is not known at compile-time. However, memory addressing mode requires memory access, which can slow down the performance of the program. To mitigate this, the 8086 microprocessor uses a cache to store frequently accessed memory locations.

The following are some examples of memory addressing mode in the 8086 microprocessor:

  1. MOV AX, [1234H] This instruction moves the contents of the memory location with the address 1234H into the AX register.
  2. ADD BX, [SI] This instruction adds the contents of the memory location whose address is stored in the SI register to the contents of the BX register.
  3. SUB [BX+SI], 10 This instruction subtracts the value 10 from the contents of the memory location whose address is the sum of the contents of the BX and SI registers.
  4. MOV [1000H], AL This instruction moves the contents of the AL register into the memory location with the address 1000H.
  5. CMP [DI+20H], BL This instruction compares the contents of the memory location whose address is the sum of the contents of the DI register and 20H with the contents of the BL register.

In the above examples, the memory location is specified using an effective address, which is a combination of a base address and an offset. The base address can be a register or a memory location, while the offset can be a constant or a register.

Memory addressing mode is useful for operations that require large amounts of data, as storing data in registers may not be feasible. It is also useful for accessing data that is not known at compile-time or data that is stored in an array or a data structure.