Getting the Address of a Variable
There is LEA (Load Effective Address) instruction and alternative
OFFSET operator. Both OFFSET and LEA can be used to get the offset
address of the variable. LEA is more powerful because it also allows you
to get the address of an indexed variables. Getting the address of the
variable can be very useful in some situations, for example when you
need to pass parameters to a procedure.
Reminder:
In order to say the compiler about data type,
these prefixes should be used:
BYTE PTR - for byte.
WORD PTR - for word (two bytes).
For example:
BYTE PTR [BX] ; byte access.
or
WORD PTR [BX] ; word access.
MicroAsm supports shorter prefixes as well:
b. - for BYTE PTR
w. - for WORD PTR
sometimes compiler can calculate the data type automatically, but you may not and should not rely on that when one
of the operands is an immediate value.