KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q30386: .DATA Directive Causes _DATA Segment Not to Align Paragraph

Article: Q30386
Product(s): See article
Version(s): 5.10
Operating System(s): MS-DOS
Keyword(s): ENDUSER | | mspl13_masm
Last Modified: 23-MAY-1988

The .DATA directive word aligns the _DATA segment. The .MODEL
directive defines the _TEXT segment before the _DATA segment.
Therefore, when the simplified segment directives are used, _DATA does
not start at a paragraph boundary.

   The following sample code demonstrates this problem:

   .MODEL small
   .DATA
   org 0h
   t1 db "table 1"
   org 100h
   t2 db "table 2"
   .CODE
   mov  ax, dgroup
   mov  ds, ax
   mov  bx, offset t1
   mov  cx, offset t2
   end

   DGROUP begins at the previous paragraph boundary, but _DATA, the
first segment in DGROUP, actually starts at DGROUP:0006. Therefore,
the offset of t2 could evaluate to _DATA:0100h. This is equivalent to
DGROUP:0106h.

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.