KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q42729: Direct Memory Addressing

Article: Q42729
Product(s): See article
Version(s): 4.x 5.00 5.10 | 5.10
Operating System(s): MS-DOS | OS/2
Keyword(s): ENDUSER | | mspl13_masm
Last Modified: 24-APR-1989

Question:

When I try to do a direct memory operation with the instruction MOV
AX,[1000], the Macro Assembler generates a move instruction with the
immediate value of 1000 rather than a direct memory access of the
location 1000. How can I do a direct memory access instruction?

Response:

A segment register must be specified for a direct memory operand that
contains a constant with no label, as in the following

   MOV AX,DS:[1000]

This example will not insert a segment override prefix into the
assemble code because the instruction uses the DS register by default.
Use of any segment register other than the default register would
insert the override prefix.

For more information, see Section 14.3.1 on Direct Memory Operands,
Page 276 in the MASM 5.10 programmer's guide.

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.