👤

Compare and contrast the three basic modes of addressing.​

Sagot :

Answer:

1.) Register Addressing

In this addressing mode, a register contains the operand. Depending upon the instruction, the register may be the first operand, the second operand or both.

For example,

MOV DX, TAX_RATE   ; Register in  the first operand

MOV COUNT, CX    ; Register in the second operand

MOV EAX, EBX    ; Both the operands are in registers

As processing data between registers does not involve memory, it provides the fastest processing of data.

2.) Immediate Addressing

An immediate operand has a constant value or an expression. When an instruction with two operands uses immediate addressing, the first operand may be a register or memory location, and the second operand is an immediate constant. The first operand defines the length of the data.

For example,

BYTE_VALUE  DB  150    ; A byte value is defined

WORD_VALUE  DW  300    ; A word value is defined

ADD  BYTE_VALUE, 65    ; An immediate operand 65 is added

MOV  AX, 45H           ; Immediate constant 45H is transferred to AX

3.) Direct Memory Addressing

When operands are specified in memory addressing mode, direct access to main memory, usually to the data segment, is required. This way of addressing results in slower processing of data. To locate the exact location of data in memory, we need the segment start address, which is typically found in the DS register and an offset value. This offset value is also called effective address.

In direct addressing mode, the offset value is specified directly as part of the instruction, usually indicated by the variable name. The assembler calculates the offset value and maintains a symbol table, which stores the offset values of all the variables used in the program.

In direct memory addressing, one of the operands refers to a memory location,and the other operand references a register.

For example,

ADD BYTE_VALUE, DL ; Adds the register in the memory location

MOV BX, WORD_VALUE ; Operand from the memory is added to the register

Explanation:

Addressing Modes

The term addressing modes refers to the way in which the operand of an instruction is specified. Information contained in the instruction code is the value of the operand or the address of the result/operand. Following are the main addressing modes that are used on various platforms and architectures.