The information in this article applies to:
SUMMARY
An immediate operand is a constant value or expression. A direct memory
operand refers to data at a given address. An indirect memory operand also
refers to the contents of a given address, rather than the address itself,
but the address is calculated at run time by referring to the contents of
the specified register.
MORE INFORMATIONCase 1In the following code fragment, both mov instructions move dataitem into the ax register.
The results are the same because the assembler determines the addressing
mode based on the way that dataitem is declared. In both cases,
dataitem is a label, so the assembler will access the data located at the
label.
If you really want to access dataitem as a constant value, use the following syntax:
In this case, OFFSET tells the assembler to treat dataitem as a constant
value rather than as a data item that is located at a memory location.
Case 2In the following code fragment, both mov instructions move 0 into the ax register.
Again, the result is the same, because the assembler determines the
addressing mode based on the way datavalue is declared. In both cases,
datavalue is an equate, so the assembler will treat datavalue as a
constant value.
If you want to access datavalue as a data item located at a memory location, use the following syntax:
In this case, the segment override tells the assembler to treat datavalue
as a data item that is located at ds:datavalue, rather than treating
datavalue as a constant value.
Case 3On the other hand, with the following code fragment, the mov instructions have different results.
In the first case, we are moving what is in bx into ax. In the second
case, we are using bx as an offset and moving what is at that offset into
ax. The assembler determines what to do based on the brackets or lack of
brackets around the register. This is the only case where the brackets
have this effect.
Additional query words: 6.00 6.10 6.11
Keywords : |
Last Reviewed: January 6, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |