SEG A
:
Assigns the content held in segment register corresponding to the segment in which A resides to the operand.
I guess that means that if A
lies in Data Segment, SEG A
is the same as DS
.
Since DS
holds the base address of the Data Segment, does
MOV AX, LEA A
MOV DX, SEG A
MOV AX, [AX + DX]
copy the physical address of A
to AX
?
It copies the content of AX + DX address (which is A) to AX.
Correct, if DS points to Data Segment.
The last instruction is invalid, it does not exist in any of x86 CPUs. As such, this code does nothing at all. If anything, it just sits in an .asm file waiting to be corrected and assembled.
SEG provides the operand segment. If the variable segment is referenced by no segment register, you can use SEG. But otherwise you should use LEA, LDS. example:
var db ? .code x db ?
start: ...
for var SEG is DS and for x SEG is CS, their segment addresses.