Give 5 addressing modes that will use the address given inside the instruction to access operands directly in any manner, this might include addressing modes that do not use addresses but direct operands. Give proper examples.
Immediate mode; In this mode, the operand is specified in the instruction itself. An immediate mode instruction has an operand field rather than the address field. For example: ADD 7, which says Add 7 to contents of accumulator. 7 is the operand here.
Register mode; in this mode the operand is stored in the register and this register is present in CPU. The instruction has the address of the Register where the operand is stored.
Stack mode; In this mode, operand is at the top of the stack. For example: ADD, this instruction will POP top two items from the stack, add them, and will then PUSH the result to the top of the stack.
Indirect mode; field of instruction gives the address where the effective address is stored in memory. This slows down the execution, as this includes multiple memory lookups to find the operand.
Displacement mode; In this the contents of the indexed register is added to the Address part of the instruction, to obtain the effective address of operand. EA = A + (R), In this the address field holds two values, A(which is the base value) and R(that holds the displacement), or vice versa.
Comments
Leave a comment