addressing-mode-8086

Addressing Modes of 8086

Addressing mode in the 8086 microprocessor refers to the way in which operands are specified in machine instructions. The addressing mode determines where the data for the instruction is stored and how the processor retrieves it. The 8086 microprocessor supports several different addressing modes, including:

Immediate addressing mode:

Immediate addressing mode in the 8086 microprocessor is a type of addressing mode in which the data operand is directly specified within the instruction code. In this mode, the instruction specifies the constant data value that is to be used as an operand, instead of specifying a memory location where the data is stored.

For example, consider the instruction “MOV AX, 5” in 8086 Assembly language. In this instruction, 5 is an immediate value and AX is the destination register. The instruction will move the immediate value 5 into the AX register. The instruction can be executed faster because the data is immediately available and does not need to be fetched from memory.

Register addressing mode:

Register addressing mode in the 8086 microprocessor is a type of addressing mode in which the operand is stored in a processor register. In this mode, the instruction specifies the register that holds the operand, instead of specifying a memory location where the data is stored.

For example, consider the instruction “MOV BX, AX” in 8086 Assembly language. In this instruction, AX is the source register and BX is the destination register. The instruction will move the contents of the AX register into the BX register. This type of addressing mode is faster than other modes because the data is stored in a register and is immediately accessible to the processor without needing to be fetched from memory.

Direct addressing mode:

Direct addressing mode in the 8086 microprocessor is a type of addressing mode in which the operand is stored in memory, and the address of the operand is specified in the instruction. In this mode, the instruction includes a memory address that points to the location in the memory where the operand is stored.

For example, consider the instruction “MOV AX, [2000h]” in 8086 Assembly language. In this instruction, 2000h is the memory address that holds the operand and AX is the destination register. The instruction will move the contents of the memory location at the address 2000h into the AX register.

Direct addressing mode is used when the operand is stored in a known memory location, and the instruction needs to access that specific memory location. This type of addressing mode can be slower than other modes because the data must be fetched from memory, but it is still faster than accessing memory through indirect addressing modes, which require additional memory access to retrieve the memory address of the operand.

Register indirect addressing mode:

Register indirect addressing mode in the 8086 microprocessor is a type of addressing mode in which the operand is stored in memory, and the address of the operand is stored in a processor register. In this mode, the instruction specifies the register that holds the memory address of the operand, instead of specifying the memory address directly.

For example, consider the instruction “MOV AX, [BX]” in 8086 Assembly language. In this instruction, BX is the register that holds the memory address of the operand, and AX is the destination register. The instruction will move the contents of the memory location pointed to by the BX register into the AX register.

Register indirect addressing mode is useful for accessing arrays, linked lists, or other data structures that are stored in memory, where the memory address of the next item in the data structure is stored in a register. This type of addressing mode can be slower than other modes because it requires additional memory access to retrieve the memory address of the operand, but it is more flexible than other modes and allows for dynamic access to memory.

Based addressing mode:

Base addressing mode in the 8086 microprocessor is a type of addressing mode in which a base register holds the starting memory address of a data segment and an offset register holds the offset from that starting address to the desired memory location. In this mode, the instruction specifies the base register and the offset register, instead of specifying the memory address directly.

For example, consider the instruction “MOV AX, [BX + SI]” in 8086 Assembly language. In this instruction, BX is the base register that holds the starting memory address of a data segment, SI is the offset register that holds the offset from the starting address to the desired memory location, and AX is the destination register. The instruction will move the contents of the memory location pointed to by the sum of BX and SI into the AX register.

Base addressing mode is useful for accessing arrays, linked lists, or other data structures that are stored in memory, where the memory address of the next item in the data structure can be calculated by adding an offset to a base address. This type of addressing mode can be slower than other modes because it requires two memory accesses to calculate the memory address of the operand, but it is more flexible than other modes and allows for dynamic access to memory.

Indexed addressing mode:

Indexed addressing mode in the 8086 microprocessor is a type of addressing mode in which a base register holds the starting memory address of a data segment and an index register holds the offset from that starting address to the desired memory location. In this mode, the instruction specifies the base register and the index register, instead of specifying the memory address directly.

For example, consider the instruction “MOV AX, [BX + DI]” in 8086 Assembly language. In this instruction, BX is the base register that holds the starting memory address of a data segment, DI is the index register that holds the offset from the starting address to the desired memory location, and AX is the destination register. The instruction will move the contents of the memory location pointed to by the sum of BX and DI into the AX register.

Indexed addressing mode is useful for accessing arrays or other data structures stored in memory, where the memory address of the next item in the data structure can be calculated by adding an offset to a specified address. This type of addressing mode can be faster than other modes because it requires only one memory access to retrieve the operand, but it is less flexible than other modes and does not allow for dynamic access to memory.

Based index addressing mode:

Based Indexed addressing mode in the 8086 microprocessor is a type of addressing mode in which a base register holds the starting memory address of a data segment, and an index register holds the offset from that starting address to the desired memory location. In this mode, the instruction specifies the base register, the index register, and a displacement constant, instead of specifying the memory address directly.

For example, consider the instruction “MOV AX, [BX + DI + 10H]” in 8086 Assembly language. In this instruction, BX is the base register that holds the starting memory address of a data segment, DI is the index register that holds the offset from the starting address to the desired memory location, 10H is the displacement constant, and AX is the destination register. The instruction will move the contents of the memory location pointed to by the sum of BX, DI, and 10H into the AX register.

Based Indexed addressing mode is useful for accessing arrays or other data structures stored in memory, where the memory address of the next item in the data structure can be calculated by adding an offset to a base address. This type of addressing mode provides more flexibility than other modes, as it allows for dynamic access to memory and provides the ability to specify a constant offset. However, it can be slower than other modes because it requires two memory accesses to calculate the memory address of the operand.

String addressing mode:

String addressing mode in the 8086 microprocessor is a type of addressing mode that is used for string operations, such as copying, comparing, and setting the contents of a block of memory. In this mode, the instruction specifies two registers, the source and destination string pointers, which hold the memory addresses of the source and destination strings.

For example, consider the instruction “MOV CX, 100H” and “MOV SI, 2000H” and “MOV DI, 3000H” and “REP MOVSB” in 8086 Assembly language. In these instructions, CX is the count register that holds the number of bytes to be transferred, SI is the source index register that holds the memory address of the source string, DI is the destination index register that holds the memory address of the destination string, and REP MOVSB is the repeat prefix instruction that repeats the MOVSB (move string byte) instruction until the zero flag is set. The instruction will move 100H (256) bytes from the memory location pointed to by SI to the memory location pointed to by DI.

String addressing mode is useful for handling large amounts of data, such as character strings, arrays of data structures, and other blocks of data stored in memory. This type of addressing mode can be faster than other modes for certain operations, such as string copy, because it allows for efficient block transfers of data between memory locations.

Direct I/O port addressing mode:

Direct I/O port addressing mode in the 8086 microprocessor is a type of addressing mode that is used to access I/O ports directly. In this mode, the instruction specifies an I/O port address instead of a memory address.

For example, consider the instruction “IN AL, 60H” in 8086 Assembly language. In this instruction, AL is the destination register and 60H is the I/O port address. The instruction will input a byte from the I/O port with address 60H into the AL register.

Direct I/O port addressing mode is used to access peripheral devices, such as keyboard, mouse, and disk drives, that are connected to the computer via I/O ports. This type of addressing mode provides a direct and efficient way to communicate with these devices, without the need for intermediate memory storage. However, direct I/O port addressing is specific to the microprocessor architecture and may not be supported on other architectures.

Indirect I/O port addressing mode:

Indirect I/O port addressing mode in the 8086 microprocessor is a type of addressing mode that is used to access I/O ports indirectly. In this mode, the instruction specifies a memory location that holds the I/O port address, rather than specifying the I/O port address directly.

For example, consider the instruction “MOV DX, 60H” and “IN AL, [DX]” in 8086 Assembly language. In these instructions, DX is the memory location that holds the I/O port address, and AL is the destination register. The instruction will input a byte from the I/O port with address stored in DX into the AL register.

Indirect I/O port addressing mode provides more flexibility than direct I/O port addressing mode, as the I/O port address can be stored in memory and can be changed dynamically. This mode is useful for situations where the I/O port address is not known at compile time, or where the I/O port address is different for different devices or peripherals. However, indirect I/O port addressing may be slower than direct I/O port addressing because it requires an additional memory access to retrieve the I/O port address.

Relative addressing mode:

Relative addressing mode in the 8086 microprocessor is a type of addressing mode that is used for branches and jumps in the program. In this mode, the instruction specifies an offset from the current instruction pointer, rather than an absolute memory address.

For example, consider the instruction “JMP SHORT LOOP” in 8086 Assembly language. In this instruction, “SHORT” is the size specifier that indicates a short jump, and “LOOP” is the label for the target location in the program. The instruction will jump to the target location by adding the signed offset to the current instruction pointer.

Relative addressing mode is useful for controlling the flow of the program, as it allows instructions to jump to different parts of the program based on conditions or other inputs. This type of addressing mode can be faster and more efficient than absolute addressing mode, as it requires fewer bits to represent the target address and can be used to jump within a limited range of the current instruction pointer. However, relative addressing mode has limited range and can only jump to nearby locations in the program.

Implied addressing mode:

Implied addressing mode in the 8086 microprocessor is a type of addressing mode where the operand is implicit and not explicitly specified in the instruction. This means that the instruction does not require any additional operands or memory references to specify the source or destination of the data.

For example, consider the instruction “HLT” in 8086 Assembly language. This instruction is used to halt the execution of the program. In this instruction, the operand is implicit and there is no source or destination specified. The instruction simply stops the program execution.

Implied addressing mode is used for instructions that perform basic operations, such as incrementing or decrementing a register, changing the flags, or changing the stack pointer. This type of addressing mode can provide faster and more efficient execution, as it requires fewer bits to represent the operand and eliminates the need for additional memory accesses. However, implied addressing mode is limited to a small set of basic operations and cannot be used for more complex operations that require additional operands.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top