what is the relative addressing mode is all about indirect i

what is the relative addressing mode is all about? indirect indexed mode?

Solution

Relative Addressing

Quite often a program only needs to jump a little bit in order to jump to the next instruction. May be just a few memory locations away from the current instruction.

A very efficient way of doing this is to just add a small offset to the current address in the program counter. (Remember that the program counter always points to the next instruction to be executed). This is called \'relative addressing\'.

Relative addressing means that the next instruction to be carried out is an offset number of locations away, relative to the address of the current instruction.

Consider this bit of pseudo-code

        jump +3 if accumulator == 2

      code executed if accumulator is NOT = 2

       jmp +5 (unconditional relative jump to avoid the next line of code)

acc:

        (code executed if accumulator is = 2)

carryon:

In the code snippet above, the first line of code is checking to see if the accumulator has the value of 2 in it. If it is has, then the next instruction is 3 lines away. This is called a conditional jump and it is making use of relative addressing.

Another example of relative addressing can be seen in the jmp +5 instruction. This is telling the CPU to effectively avoid the next instruction and go straight to the \'carryon\' point.

Indirect Addressing:

Memory cell pointed to by address field contains the address of (pointer to) the operand.

Displacement (Indexed) Addressing:

EA = A + (R)

Effective address=start address + displacement

Effective address=Offset + (Segment Register)

Use direct and register indirect.

Indexed Addressing:

A = base

R = displacement

Indirect Addressing:

Instruction includes 16 bit displacement to be added to base register (may be GP register)

Can replace base register content with new address

Indirect indexed Addressing:

                       Instruction references base register and index register (both may be GP)

EA is sum of contents

what is the relative addressing mode is all about? indirect indexed mode?SolutionRelative Addressing Quite often a program only needs to jump a little bit in or
what is the relative addressing mode is all about? indirect indexed mode?SolutionRelative Addressing Quite often a program only needs to jump a little bit in or

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site