Microsoft KB Archive/75276

= OFFSET Always Returns the END of a Segment Name =

Article ID: 75276

Article Last Modified on 10/29/2003

-

APPLIES TO


 * Microsoft Macro Assembler 6.0 Standard Edition
 * Microsoft Macro Assembler 6.0a
 * Microsoft Macro Assembler 6.0b

-



This article was previously published under Q75276



SUMMARY
With the release of the Microsoft Macro Assembler (MASM) version 6.0, the OFFSET operator applied to a segment name now returns the end of the segment relative to the start of the segment.

This is a change from MASM versions 5.x where &quot;OFFSET segname&quot; will return the beginning of the segment if it is declared class 'CODE'. If the segment is declared of some other class, &quot;OFFSET segname&quot; will return either the end of the segment relative to the beginning of a segment if full segment definitions are used, or the end of the segment relative to the start of the group the segment was contained in if simplified directives are used.



MORE INFORMATION
As part of defining the BNF for MASM 6.0, an attempt was made to remove any ambiguities in the language. This is one of those changes. In MASM 6.0, &quot;OFFSET segname&quot; will always return the end of the segment unless an explicit group or segment override is provided.

For example, _DATA segment para PUBLIC 'data' db   dup 100 _DATA ends

STACK segment para STACK 'stack' db   dup 100 (?) STACK ends

DGROUP group _DATA, STACK

TEXT segment para 'CODE' ORG  100

mov  sp, OFFSET STACK          ; mov's 100 into sp      mov   sp, OFFSET DGROUP:STACK   ; mov's 200 into sp

mov  ax, OFFSET TEXT           ; mov's size of TEXT into AX      mov   ax, OFFSET TEXT:0         ; mov's start of TEXT into AX For more information on the OFFSET operator, see the online Help.

Additional query words: kbinf 6.00 6.00a 6.00b

Keywords: KB75276

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.