Assembly Language Help (alang.hlp) (
Table of Contents;
Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
Return Segment or Group of Expression
◄Example► ◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
Syntax: SEG expression
See also: SEGMENT, OFFSET, LABEL, GROUP, ASSUME,
MASM 5.1 Compatibility
Description:
Returns the segment or group of <expression>. If <expression> does
not have an explicit segment or group, SEG returns the segment or
group of the SEG expression itself. If the SEG expression has no
segment or group, SEG returns the value of <expression>.
The <expression> is any label, variable, group name, or other
memory operand; it cannot be a constant.
In MASM 5.1, the SEG operator returns a label's segment address unless
the frame is explicitly specified, in which case it returns the segment
address of the frame. A statement such as SEG DGROUP:var always returns
DGROUP, whereas SEG var always returns the segment address of var.
OPTION M510 forces this same behavior in MASM 6.1. If you do not use
OPTION M510, the behavior of the SEG operator is determined by the
OPTION OFFSET directive
In MASM 6.1, the value returned by the SEG operator applied to a non-
external variable depends on compatibility mode. Without OPTION M510,
SEG returns the address of the frame (the segment, group, or the value
assumed to the segment register) if one has been explicitly set. With
OPTION M510, SEG returns the group if one has been specified. In the
absence of a defined group, SEG returns the segment where the variable
is defined.
-♦-