I am going through some example assembly code for 16-bit real mode.
I\'ve come across the lines:
mov bx, cs
mov ds, bx
mov si,
From MASM Programmer's Guide 6.1 (Microsoft Macro Assembler)
The OFFSET Operator
An address constant is a special type of immediate operand that consists of an offset or segment value. The OFFSET operator returns the offset of a memory location, as shown here:
mov bx, OFFSET var ; Load offset addressFor information on differences between MASM 5.1 behavior and MASM 6.1 behavior related to OFFSET, see Appendix A.
Since data in different modules may belong to a single segment, the assembler cannot know for each module the true offsets within a segment. Thus, the offset for var, although an immediate value, is not determined until link time.
If you read carefully, the final value is determined after you "link" your object code to create a DLL/EXE. Prior to linking, all you have is an immediate value which represents the offset from the segment's base address.