In real address mode:
mov esi, OFFSET var ;esi 32 bit
In protected mode:
MOV si, OFFSET arr ;si 16 bit
; but MOV instructions works only if both the destination and source have same size
Please help me clear my concept I am beginner.
In real address mode:
mov esi, OFFSET var ;esi 32 bit
In protected mode:
MOV si, OFFSET arr ;si 16 bit
; but MOV instructions works only if both the destination and source have same size
Please help me clear my concept I am beginner.
MOV si, OFFSET arr
in 32-bit protected mode code will presumably truncate the address to 16 bit, giving you the low 16 bits of it.
mov esi, OFFSET var
in 16-bit real mode will give you the offset zero-extended to 32-bit, I expect.
That's what NASM does, for foo: mov esi, foo
in a file by itself.
You get 66 BE 00000000 mov esi,0x0
.
In MASM and TASM (and probably all other x86 assemblers supporting the OFFSET keyword), it gives the offset (surprise!) of something within the segment it belongs to.
The logical address is basically a far pointer, a pair of an offset and a segment selector.