397 views

Which of the following is displacement addressing mode?

1. Relative
2. Indexed
3. Base
4. Immediate

@rahul sharma 5

example: a relative address might be B+15, B being the base address and 15 the distance (called the offset).

This qstn is about displacement addressing mode , Displacement Mode is similar to index mode, except instead of a index register a base register will be used.  So thats why the answer is base register addr mode.

Displacement Mode is similar to index mode, except instead of a index register a base register will be used.  So that's why the answer is base register addr mode."

Sir, is it about the base address in one case and base register in another? Have I highlighted the correct words above which differentiate both the modes and make index mode similar to displacement mode?

A register is used in index mode similar to displacement mode, so index mode is the answer,am I right?

Displacement is done by base register address + constant ( that offset value )

The difference between index mode and displacement mode is in the number of bits used to represent the constant. When the constant is represented a number of bits to access the memory, then we have index mode. Index mode is more appropriate for array accessing; displacement mode is more appropriate for structure (records) accessing.

CAN U COMMENT ABOUT RELATIVE ONE . WHY IT NOT B ?
by

But in  displacement addressing mode - Base register contains a pointer to a memory location. An integer value or constant is indicating as a displacement. The address of the operand is obtained by adding the contents of the base register plus the constant . So there is a base register.

This base register is missing in Relative mode.

so sir what is base index mode?

The based indexed addressing modes are  combinations of the register indirect addressing modes.

These addressing modes form the offset by  a base register (bx or bp) or an index register (si or di).

Example :

MOV BX, 100H
MOV SI, 200H

so we can say base index mode is a kind of register indirect addressing mode, which is option C here .

Displacement Mode

Similar to index mode, except instead of an index register a base register will be used. Base register contains a pointer to a memory location. An integer (constant) is also referred to as a displacement. The address of the operand is obtained by adding the contents of the base register plus the constant. The difference between index mode and displacement mode is in the number of bits used to represent the constant. When the constant is represented a number of bits to access the memory, then we have index mode. Index mode is more appropriate for array accessing; displacement mode is more appropriate for structure (records) accessing.

I have bolded up the important text.

As per that, displacement mode is when you use a base register instead of an index register.

=> In Indexed mode, the index (ie the shift) is stored in the register, while base is constant.

But in Displacement mode, the index (ie the shift) is a constant, while the base is present in the register.

Something like this:

The upper one is Indexed mode (Register acts as index) the lower one is Base Register mode (Register acts as base address) — also called the displacement mode.

1 vote