IA32 addressing modes 1.Immediate 2.Direct memory 3.Register 4.Register indirect 5.Indexed 6.Based-indexed
addressing Opcode indicates what operation is to be performed. Operands specify the location of data. Example of addressing modes that we have already used: A=12 Bdword52 moveax, 1; immediate movebx, eax; register movecx, A; immediate movedx, B; direct memory
Register indirect Say B is located at memory location (address) 400. We load the address of B into a register. movebx, 400;load the address of B moveax, ebx;eax is now 400 moveax, [ebx];eax now equals 52 This is the register indirect addressing mode. The register does not contain the value but contains a reference to (pointer to/location of) the value in memory.
Indexed Used to: 1.reference memory at a constant offset from a register when register points to object and data member is a know offset from start of object 2.reference memory using a register as an additional offset when register is used as an offset to an array element
Indexed Adword592h, 50h, 60h, 70h, 80h, 90h moveax, 4 movebx, A[eax];what’s in ebx? movecx, [A+eax];what’s in ecx?
Indexed Adword592h, 50h, 60h, 70h, 80h, 90h moveax, 4 movebx, A[eax];what’s in ebx? movecx, [A+eax];what’s in ecx?
Based-indexed
Make a sum