Today, I have learned that the SEG operator in MASM by default returns the address of the GROUP and not the address of the SEGMENT of the expression in question, and that there are options and methods to override that.
Since I am currently doing a complex project in Open Watcom 1.9 / 16 bit DOS where C and assembly (inline and standalone) are mixed (actually, DOS is only needed for startup, then my own MINI-OS takes control), and since I know that WASM is somewhat MASM compatible, I have the following question:
When doing inline assembly and taking the segment of a variable, does the SEG operator return the GROUP or the SEGMENT which the variable is in?
Suppose there is a GROUP named MY_GROUP, a SEGMENT named MY_SEG which belongs to MY_GROUP, and a variable / label named MY_VAR which is placed in MY_SEG.
Then, if I do
_asm {
MOV AX, SEG MY_VAR
}
which value is loaded into AX? Is it the address of MY_GROUP or the address of MY_SEG (given that they are different)?
I did not find any command line switch which relates to that problem in inline assembly. I then tried the MASM syntax:
_asm {
MOV AX, SEG MY_GROUP:MY_VAR
MOV AX, SEG MY_SEG:MY_VAR
}
Both of the lines above lead to the following error: "Only segment or group label is allowed".
Please note that my problem only relates to inline assembly. Actually, I am using JWASM for the standalone assembly modules, and the syntax above works well and with the expected results there.
Could anybody tell me what the inline assembler does in this situation, and if there are means how I could control its respective behavior?
Thank you very much!