When can I use * in assembly language?

with this data

.data
tableD DWORD 10h, 20h, 30h, 40h, 50h, 60h
Rowsize = ($ - tableD)
DWORD 60h,70h,80h,90h,0A0h
DWORD 0B0h,0C0h,0D0h,0E0h,0F0h

      

I can use

.code
mov eax,tableD[ebx + esi*TYPE tableD]

      

but i can't use

mov eax,tableD[ebx*2 + esi*TYPE tableD]

      

but i can use

mov eax,tableD[ebx*2 + esi]

      

I can't use 2 * s there?

May I know the terms for these objects?

+3


source to share


1 answer


The x86 architecture supports a four-part addressing mode of the following form:

base + index * scale + displacement

      



where all four parts may be missing ( scale

present 1

if missing). This means that there can be only one scaled component in a memory operand; so yes, you can only use one *

.

In addition, the scaling factors are limited to 1, 2, 4, or 8; other scaling factors cannot be encoded.

+6


source







All Articles