I am rather confused by the concept OFFSET Operator. According to Kip R. Irvine's book Assembly Language for x86 Processors, he defines the Offset Operator as the operator that returns the distance of a variable from the beginning of its enclosing segment. He also says the Offset Operator returns the offset of a data label and that represents the distance (in bytes) of the label from the beginning of the data segment. What is the offset? What does he mean by the distance of the label from the beginning of the data segment? Also, did he come about to this result:
He declares three different types of variables:
.data
bVal BYTE ?
wVal WORD ?
dVal DWORD ?
dVal2 DWORD ?
If bVal were located at offset 00404000 (hexadecimal), the OFFSET operator would return the following values:
mov esi, OFFSET bVal ;ESI = 00404000h
mov esi, OFFSET wVal ;ESI = 00404001h
mov esi, OFFSET dVal ;ESI = 00404003h
mov esi, OFFSET dVal2 ;ESI = 00404007h
Where did he arrive at those values? Please help. Thank you so much!