operandi memoria assembly x86
-
11-10-2019 - |
Domanda
Ciao a tutti Ho una domanda relativa ai x86. Nel manuale di istruzioni Intel alcuni potrebbe richiedere diversi tipi di operandi di memoria. per esempio. IDIV r / M8 o IDIV r / m16 o IDIV r / M32 o IDIV r / m64 ora sono tutti IDIV c'è la possibilità di sapere se l'operando è M8, M16, M32 o M64? Stavo pensando se operando viene M8, allora è affrontato da un 8 bit del registro ad es. ax se 32 poi EAX, esp ... La mia ipotesi è corretta? Correggimi se sbaglio Eventuali suggerimenti di benvenuto Grazie
Soluzione
Yes, the register that is used as an operand resolves the ambiguity. (Note, however, that ax
is a 16-bit register, not an 8-bit register -- that would be ah
or al
for the high or low byte, respectively.)
If you're only referring to memory operands, you need to use a BYTE PTR
, WORD PTR
or DWORD PTR
specifier to resolve the ambiguity, like this:
mov dword ptr [eax], 0
This example sets the 32-bit quantity ("double word") at the address contained in eax
to 0.
Altri suggerimenti
Whether the operand is m8, m16 or m32, the register used to address the memory location can be 8, 16 or 32 bits - all are valid afaik.
To specify how many bits are to be read from memory, you need to use one of the size specifiers
byte
,word
ordword
before the address. For example:
idiv byte [bx] ; m8
idiv word [bx] ; m16
idiv dword [bx] ; m32