Hi,
I am confused about the concept of the Offset Operator
Here is an example from my textbook (suppose bVal was located at offset 00404000):
.data
bVal Byte ?
.code
mov esi, OFFSET bVal ; ESI = 00404000
From what I understand from this example is that OFFSET simply returns the address of any variable, such as bVal.
This is ok so far, but the next example shows that OFFSET does something else, which is confusing.
Example:
.data
byteVal BYTE 10h
.code
mov esi, OFFSET byteVal
mov al, [esi] ; AL = 10h
Why is al = 10h? shouldn't AL contain the address of bVal, according to the previous example?
Also, how is it possible that esi can be moved to al, which is a smaller size than esi?
What I have tried:
I have tried to understand what the textbook is saying but the examples show contradicting information.