Types of Addressing ModesEach instruction of a computer specifies an operation on certain data. The are various ways ofspecifying address of the data to be operated on. These different ways of specifying data arecalled the addressing modes. The most common addressing modes are: Immediate addressing mode Direct addressing mode Indirect addressing mode Register addressing mode Register indirect addressing mode Displacement addressing mode Stack addressing modeTo specify the addressing mode of an instruction several methods are used. Most often used are :a) Different operands will use different addressing modes.b) One or more bits in the instruction format can be used as mode field. The value of the modefield determines which addressing mode is to be used.The effective address will be either main memory address of a register.Immediate Addressing:This is the simplest form of addressing. Here, the operand is given in the instruction itself. Thismode is used to define a constant or set initial values of variables. The advantage of this mode isthat no memory reference other than instruction fetch is required to obtain operand. Thedisadvantage is that the size of the number is limited to the size of the address field, which mostinstruction sets is small compared to word length.INSTRUCTIONOPERANDDirect Addressing:In direct addressing mode, effective address of the operand is given in the address field of theinstruction. It requires one memory reference to read the operand from the given location andprovides only a limited address space. Length of the address field is usually less than the wordlength.Ex : Move P, Ro, Add Q, Ro P and Q are the address of operand.Indirect Addressing:
Indirect addressing mode, the address field of the instruction refers to the address of a word inmemory, which in turn contains the full length address of the operand. The advantage of thismode is that for the word length of N, an address space of 2N can be addressed. He disadvantageis that instruction execution requires two memory reference to fetch the operand Multilevel orcascaded indirect addressing can also be used.Register Addressing:Register addressing mode is similar to direct addressing. The only difference is that the addressfield of the instruction refers to a register rather than a memory location 3 or 4 bits are used asaddress field to reference 8 to 16 generate purpose registers. The advantages of registeraddressing are Small address field is needed in the instruction.Register Indirect Addressing:This mode is similar to indirect addressing. The address field of the instruction refers to aregister. The register contains the effective address of the operand. This mode uses one memoryreference to obtain the operand. The address space is limited to the width of the registersavailable to store the effective address.Displacement Addressing:In displacement addressing mode there are 3 types of addressing mode. They are :1) Relative addressing2) Base register addressing3) Indexing addressing.This is a combination of direct addressing and register indirect addressing. The value containedin one address field. A is used directly and the other address refers to a register whose contentsare added to A to produce the effective address.Stack Addressing:Stack is a linear array of locations referred to as last-in first out queue. The stack is a reservedblock of location, appended or deleted only at the top of the stack. Stack pointer is a registerwhich stores the address of top of stack location. This mode of addressing is also known asimplicit addressing.
1. Immediate Addressing Mode o Immediate addressing mode means that the value for a given instruction in assembly programming is directly specified. This means the value is constant and written immediately and immutably into the instruction.1. Common Format of Immediate Addressing o The following is an example of the format typically found with immediate addressing mode: Operator Target, Value In the example format, the value of the number Value is operated on the value stored in Target. Value is a constant value, which does not change no matter what occurs in the set of assembly instructions. o Direct Addressing Mode o Direct addressing mode means that the value for a given instruction in assembly programming is pointed to by a given value. This means the value is variable, based on what is stored in memory at a given address. Common Format of Direct Addressing o The following is an example of the format typically found with direct addressing mode: Operator Target, (Address) In the example format, the value at the memory location of Address is a variable value in memory, which can be written to and read from during the course of a program. The location in memory is directly specified with a number, which will never change over the course of instruction execution. Immediate addressing supplies the actual value and is normally prefixed with a #. LD Acc, #5 ;Load the actual value 5 into the accumulator Ax becomes 5. LD Acc, 5 ;Load the value in memory location 5 into the accumulator Ax becomes 3.
Indirect addressing uses the value as a memory location that points to the memorylocation that holds the value. In this case the number is usually enclosed with squarebrackets.LD Acc,  ;Load the value stored in the memory location pointed to by the operand into theaccumulatorMemory location 5 is accessed which contains 3. Memory location 3 is accessed which is 17.Ax becomes 17