The original 8086 addressing modes are limited to the combinations in this chart:
(disp) (base) (offset)
mov [1234] + [bx] + [si], ax
[bp] + [di]
One must choose maximum of one item from each group (displacement, base and offset). No other combination is valid.
The 80386 addressing modes were extended towards more orthogonal:
mov al, byte ptr [12345] + [esp + 8 * eax];
Here the index registers are all 32-bit, esp can be used to point directly to stack variables, and the scaling term has legal values of 1,2,4 and 8. With this many combinations the instruction LEA
can be used to perform a single instruction orthogonal 3-parameter addition without changing flags: [reg1] = [reg2] + [reg3]; and to perform some other arithmetic, such as multiplying register by a factor of 3,5 or 9.
Without 32-bit addressing modes one has to emulate the scaling e.g. with
mov bx, (N-1)*2 // constant expression
a: mov ax, [bx + di]
adc ax, [bx + si]
sub bx, 2
jns a
See also purpose of LEA instruction.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…