You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

174 lines
7.9KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- This file documents the GNU Assembler "as".
  4. Copyright (C) 1991-2020 Free Software Foundation, Inc.
  5. Permission is granted to copy, distribute and/or modify this document
  6. under the terms of the GNU Free Documentation License, Version 1.3
  7. or any later version published by the Free Software Foundation;
  8. with no Invariant Sections, with no Front-Cover Texts, and with no
  9. Back-Cover Texts. A copy of the license is included in the
  10. section entitled "GNU Free Documentation License".
  11. -->
  12. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  13. <head>
  14. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  15. <title>MMIX-mmixal (Using as)</title>
  16. <meta name="description" content="MMIX-mmixal (Using as)">
  17. <meta name="keywords" content="MMIX-mmixal (Using as)">
  18. <meta name="resource-type" content="document">
  19. <meta name="distribution" content="global">
  20. <meta name="Generator" content="makeinfo">
  21. <link href="index.html#Top" rel="start" title="Top">
  22. <link href="AS-Index.html#AS-Index" rel="index" title="AS Index">
  23. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  24. <link href="MMIX_002dDependent.html#MMIX_002dDependent" rel="up" title="MMIX-Dependent">
  25. <link href="MSP430_002dDependent.html#MSP430_002dDependent" rel="next" title="MSP430-Dependent">
  26. <link href="MMIX_002dPseudos.html#MMIX_002dPseudos" rel="prev" title="MMIX-Pseudos">
  27. <style type="text/css">
  28. <!--
  29. a.summary-letter {text-decoration: none}
  30. blockquote.indentedblock {margin-right: 0em}
  31. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  32. blockquote.smallquotation {font-size: smaller}
  33. div.display {margin-left: 3.2em}
  34. div.example {margin-left: 3.2em}
  35. div.lisp {margin-left: 3.2em}
  36. div.smalldisplay {margin-left: 3.2em}
  37. div.smallexample {margin-left: 3.2em}
  38. div.smalllisp {margin-left: 3.2em}
  39. kbd {font-style: oblique}
  40. pre.display {font-family: inherit}
  41. pre.format {font-family: inherit}
  42. pre.menu-comment {font-family: serif}
  43. pre.menu-preformatted {font-family: serif}
  44. pre.smalldisplay {font-family: inherit; font-size: smaller}
  45. pre.smallexample {font-size: smaller}
  46. pre.smallformat {font-family: inherit; font-size: smaller}
  47. pre.smalllisp {font-size: smaller}
  48. span.nolinebreak {white-space: nowrap}
  49. span.roman {font-family: initial; font-weight: normal}
  50. span.sansserif {font-family: sans-serif; font-weight: normal}
  51. ul.no-bullet {list-style: none}
  52. -->
  53. </style>
  54. </head>
  55. <body lang="en">
  56. <a name="MMIX_002dmmixal"></a>
  57. <div class="header">
  58. <p>
  59. Previous: <a href="MMIX_002dSyntax.html#MMIX_002dSyntax" accesskey="p" rel="prev">MMIX-Syntax</a>, Up: <a href="MMIX_002dDependent.html#MMIX_002dDependent" accesskey="u" rel="up">MMIX-Dependent</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="AS-Index.html#AS-Index" title="Index" rel="index">Index</a>]</p>
  60. </div>
  61. <hr>
  62. <a name="Differences-to-mmixal"></a>
  63. <h4 class="subsection">9.28.4 Differences to <code>mmixal</code></h4>
  64. <a name="index-mmixal-differences"></a>
  65. <a name="index-differences_002c-mmixal"></a>
  66. <p>The binutils <code>as</code> and <code>ld</code> combination has a few
  67. differences in function compared to <code>mmixal</code> (see <a href="MMIX_002dSyntax.html#mmixsite">mmixsite</a>).
  68. </p>
  69. <p>The replacement of a symbol with a GREG-allocated register
  70. (see <a href="MMIX_002dPseudos.html#GREG_002dbase">GREG-base</a>) is not handled the exactly same way in
  71. <code>as</code> as in <code>mmixal</code>. This is apparent in the
  72. <code>mmixal</code> example file <code>inout.mms</code>, where different registers
  73. with different offsets, eventually yielding the same address, are used in
  74. the first instruction. This type of difference should however not affect
  75. the function of any program unless it has specific assumptions about the
  76. allocated register number.
  77. </p>
  78. <p>Line numbers (in the &lsquo;<samp>mmo</samp>&rsquo; object format) are currently not
  79. supported.
  80. </p>
  81. <p>Expression operator precedence is not that of mmixal: operator precedence
  82. is that of the C programming language. It&rsquo;s recommended to use
  83. parentheses to explicitly specify wanted operator precedence whenever more
  84. than one type of operators are used.
  85. </p>
  86. <p>The serialize unary operator <code>&amp;</code>, the fractional division operator
  87. &lsquo;<samp>//</samp>&rsquo;, the logical not operator <code>!</code> and the modulus operator
  88. &lsquo;<samp>%</samp>&rsquo; are not available.
  89. </p>
  90. <p>Symbols are not global by default, unless the option
  91. &lsquo;<samp>--globalize-symbols</samp>&rsquo; is passed. Use the &lsquo;<samp>.global</samp>&rsquo; directive to
  92. globalize symbols (see <a href="Global.html#Global">Global</a>).
  93. </p>
  94. <p>Operand syntax is a bit stricter with <code>as</code> than
  95. <code>mmixal</code>. For example, you can&rsquo;t say <code>addu 1,2,3</code>, instead you
  96. must write <code>addu $1,$2,3</code>.
  97. </p>
  98. <p>You can&rsquo;t LOC to a lower address than those already visited
  99. (i.e., &ldquo;backwards&rdquo;).
  100. </p>
  101. <p>A LOC directive must come before any emitted code.
  102. </p>
  103. <p>Predefined symbols are visible as file-local symbols after use. (In the
  104. ELF file, that is&mdash;the linked mmo file has no notion of a file-local
  105. symbol.)
  106. </p>
  107. <p>Some mapping of constant expressions to sections in LOC expressions is
  108. attempted, but that functionality is easily confused and should be avoided
  109. unless compatibility with <code>mmixal</code> is required. A LOC expression to
  110. &lsquo;<samp>0x2000000000000000</samp>&rsquo; or higher, maps to the &lsquo;<samp>.data</samp>&rsquo; section and
  111. lower addresses map to the &lsquo;<samp>.text</samp>&rsquo; section (see <a href="MMIX_002dPseudos.html#MMIX_002dloc">MMIX-loc</a>).
  112. </p>
  113. <p>The code and data areas are each contiguous. Sparse programs with
  114. far-away LOC directives will take up the same amount of space as a
  115. contiguous program with zeros filled in the gaps between the LOC
  116. directives. If you need sparse programs, you might try and get the wanted
  117. effect with a linker script and splitting up the code parts into sections
  118. (see <a href="Section.html#Section">Section</a>). Assembly code for this, to be compatible with
  119. <code>mmixal</code>, would look something like:
  120. </p><div class="smallexample">
  121. <pre class="smallexample"> .if 0
  122. LOC away_expression
  123. .else
  124. .section away,&quot;ax&quot;
  125. .fi
  126. </pre></div>
  127. <p><code>as</code> will not execute the LOC directive and <code>mmixal</code>
  128. ignores the lines with <code>.</code>. This construct can be used generally to
  129. help compatibility.
  130. </p>
  131. <p>Symbols can&rsquo;t be defined twice&ndash;not even to the same value.
  132. </p>
  133. <p>Instruction mnemonics are recognized case-insensitive, though the
  134. &lsquo;<samp>IS</samp>&rsquo; and &lsquo;<samp>GREG</samp>&rsquo; pseudo-operations must be specified in
  135. upper-case characters.
  136. </p>
  137. <p>There&rsquo;s no unicode support.
  138. </p>
  139. <p>The following is a list of programs in &lsquo;<samp>mmix.tar.gz</samp>&rsquo;, available at
  140. <a href="http://www-cs-faculty.stanford.edu/~knuth/mmix-news.html">http://www-cs-faculty.stanford.edu/~knuth/mmix-news.html</a>, last
  141. checked with the version dated 2001-08-25 (md5sum
  142. c393470cfc86fac040487d22d2bf0172) that assemble with <code>mmixal</code> but do
  143. not assemble with <code>as</code>:
  144. </p>
  145. <dl compact="compact">
  146. <dt><code>silly.mms</code></dt>
  147. <dd><p>LOC to a previous address.
  148. </p></dd>
  149. <dt><code>sim.mms</code></dt>
  150. <dd><p>Redefines symbol &lsquo;<samp>Done</samp>&rsquo;.
  151. </p></dd>
  152. <dt><code>test.mms</code></dt>
  153. <dd><p>Uses the serial operator &lsquo;<samp>&amp;</samp>&rsquo;.
  154. </p></dd>
  155. </dl>
  156. <hr>
  157. <div class="header">
  158. <p>
  159. Previous: <a href="MMIX_002dSyntax.html#MMIX_002dSyntax" accesskey="p" rel="prev">MMIX-Syntax</a>, Up: <a href="MMIX_002dDependent.html#MMIX_002dDependent" accesskey="u" rel="up">MMIX-Dependent</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="AS-Index.html#AS-Index" title="Index" rel="index">Index</a>]</p>
  160. </div>
  161. </body>
  162. </html>