Addressing Modes
1. Immediate (literal) operand part of instruction limited operand magnitude useful for storing small constants no address calculation; no memory reference
2. Direct (absolute) address of operand part of the instruction limited address space, may have extension words no address calculation
memory Addressing Modes
3. Indirect (memory deferred) address of operand is in the memory location whose address appears in the instruction address retrieved from memory
instruction e.g. ADD (PTR),R1
memory Addressing Modes
3. Indirect (memory deferred) address space of 2**N if word length is N; however, number of effective addresses is limited to 2**K where K is the length of the address field in the machine code some machines allow multilevel or cascaded indirect addressing
registers Addressing Modes 5. Register Indirect (deferred) address of operand is in a register whose number appears in the instruction large address space
LFSR 0,LIST MOVF INDF0,W memory registers Addressing Modes
5. Register Indirect - Autoincrement/Autodecrement register indirect addressing where the address in the register is automatically incremented/decremented either before or after effective address calculations for postincrement/postdecrement
memory registers Addressing Modes
5. Register Indirect - Autoincrement/Autodecrement
for preincrement/predecrement (R) <-- (R) ± 1
memory registers Addressing Modes 6. Stack a) address of operand is in the stack pointer - variation of register indirect addressing
(b) Autoindexing automatically increment/decrement the index register before/after a data access
the increment/decrement may be 1 or a restricted set of values Addressing Modes 7. Displacement (c) Postindexing/Preindexing (typically only one)
combination of indirect addressing and indexing
if indexing is performed after the indirection, it is termed postindexing
if indexing is performed before the indirection, it is termed preindexing
7. Displacement (d) Relative the register, R, is the program counter, PC the operand is located a certain distance from the current position of the program counter
used most often in branch instructions instruction execution done after the PC has been incremented to point to the next instruction. Therefore, relative to the next instruction. Addressing Modes 7. Displacement (e) Base-Register the referenced register contains a memory address and the address field contains a displacement (opposite to indexing) in the simplest case, the base register is explicitly referenced in the instruction and is local to the instruction
e.g ADD.L 8(A0,D0),D3 ADD.L (8,A0,D0),D3
e.g. for Pentium, possible to do SEGMENT + BASE + (INDEX * SCALE) + DISPLACEMENT
can be effectively used to index through complex data structures