I am very glad to find this forum and related wiki.
I got into a strange confusion about segment:offset notation in Real-Mode assembly. I read many references but couldn't find the exact answer.
What I know:
In real mode we have a 16bits segment selector and 16bits offset. To create an effective address, processor multiplies segment by 16 and adds offset to it.
We have CS, DS, SS, and ES as segment selectors available. CS is for Code segment and others are used for stack and data.
Now the confusion:
If I want to access a variable in seg 12h and offset 4Ah:
Code: Select all
mov ds, 12h
mov ax, [4Ah]
So when will I use ds:ax notation? Does the code below work?
Code: Select all
mov ax, [12:4A]
Do I have to change DS each time I want to access from another segment? Is that enough?