ADDRESSING MODES
ADDRESSING MODE • Addressing modes are an aspect of the instruction set architecture in most central processing unit (U) designs. • The various addressing modes that are defined in a given instruction set architecture define how machine language instruction in that architecture identify the operand (or operands) of each instruction. • An addressing mode specifies how to calculate the effective memory address of an operand by using information held in s and/or constants contained within a machine instruction or elsewhere.
3 BASIC ADDRESSING MODES •
IMMEDIATE ADDRESSING - This is the simplest form of addressing. Here, the operand is given in the instruction itself. This mode is used to define a constant or set initial values of variables. EX. MOV AL,20h , MOV AX, 1234h
•
DIRECT ADDRESSING - effective address of the operand is given in the address field of the instruction. It requires one memory reference to read the operand from the given location and provides only a limited address space. It requires only one fetch operation to obtain an operand value. EX. MOV AL, [1234h]
•
INDIRECT ADDRESSING - the address field of the instruction refers to the address of a word in memory, which in turn contains the full length address of the operand. It requires two fetch operation to obtain an operand value. EX. MOV AX, [BX]
RELATIVE ADDRESSING •
•
•
One of the commonest address construction techniques is relative addressing, in which the operand field contains a relative address, also called an offset or displacement. The instruction also implicitly or explicitly identifies other storages locations R1, R2,. . .Rk (usually U s) containing additional addressing information. The effective address A of an operand is then some function ƒ(D,R1,R2…,Rk). In most cases of interest, each operand is associated with a single address R from a set of general-purpose s, and A is computed by adding D to the contents of R, that is, A := R + D
REASONS FOR USING RELATIVE ADDRESSING • •
•
Since all the address information need not to be included in the instructions, instruction length is reduced. By changing the contents of R, the processor can change the absolute addresses referred to by a block of instructions B. This address modification permits the processor to move(relocate) the entire block B from one region of main memory to another without invalidating the addresses in B. When used in this way, R may be referred to as a base and its contents as a base address. R can be used for storing indexes to facilitate the processing of indexed data. In this role R is called index .
DRAWBACKS OF RELATIVE ADDRESSING • EXTRA LOGIC CIRCUITS • PROCESSING TIME NEEDED TO COMPUTE ADDRESSES