MMIX_002dmmixal.html 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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-2017 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 5.2, http://www.gnu.org/software/texinfo/ -->
  13. <head>
  14. <title>Using as: MMIX-mmixal</title>
  15. <meta name="description" content="Using as: MMIX-mmixal">
  16. <meta name="keywords" content="Using as: MMIX-mmixal">
  17. <meta name="resource-type" content="document">
  18. <meta name="distribution" content="global">
  19. <meta name="Generator" content="makeinfo">
  20. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  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.smallquotation {font-size: smaller}
  31. div.display {margin-left: 3.2em}
  32. div.example {margin-left: 3.2em}
  33. div.indentedblock {margin-left: 3.2em}
  34. div.lisp {margin-left: 3.2em}
  35. div.smalldisplay {margin-left: 3.2em}
  36. div.smallexample {margin-left: 3.2em}
  37. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  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.nocodebreak {white-space:nowrap}
  49. span.nolinebreak {white-space:nowrap}
  50. span.roman {font-family:serif; font-weight:normal}
  51. span.sansserif {font-family:sans-serif; font-weight:normal}
  52. ul.no-bullet {list-style: none}
  53. -->
  54. </style>
  55. </head>
  56. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  57. <a name="MMIX_002dmmixal"></a>
  58. <div class="header">
  59. <p>
  60. 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>
  61. </div>
  62. <hr>
  63. <a name="Differences-to-mmixal"></a>
  64. <h4 class="subsection">9.28.4 Differences to <code>mmixal</code></h4>
  65. <a name="index-mmixal-differences"></a>
  66. <a name="index-differences_002c-mmixal"></a>
  67. <p>The binutils <code>as</code> and <code>ld</code> combination has a few
  68. differences in function compared to <code>mmixal</code> (see <a href="MMIX_002dSyntax.html#mmixsite">mmixsite</a>).
  69. </p>
  70. <p>The replacement of a symbol with a GREG-allocated register
  71. (see <a href="MMIX_002dPseudos.html#GREG_002dbase">GREG-base</a>) is not handled the exactly same way in
  72. <code>as</code> as in <code>mmixal</code>. This is apparent in the
  73. <code>mmixal</code> example file <code>inout.mms</code>, where different registers
  74. with different offsets, eventually yielding the same address, are used in
  75. the first instruction. This type of difference should however not affect
  76. the function of any program unless it has specific assumptions about the
  77. allocated register number.
  78. </p>
  79. <p>Line numbers (in the &lsquo;<samp>mmo</samp>&rsquo; object format) are currently not
  80. supported.
  81. </p>
  82. <p>Expression operator precedence is not that of mmixal: operator precedence
  83. is that of the C programming language. It&rsquo;s recommended to use
  84. parentheses to explicitly specify wanted operator precedence whenever more
  85. than one type of operators are used.
  86. </p>
  87. <p>The serialize unary operator <code>&amp;</code>, the fractional division operator
  88. &lsquo;<samp>//</samp>&rsquo;, the logical not operator <code>!</code> and the modulus operator
  89. &lsquo;<samp>%</samp>&rsquo; are not available.
  90. </p>
  91. <p>Symbols are not global by default, unless the option
  92. &lsquo;<samp>--globalize-symbols</samp>&rsquo; is passed. Use the &lsquo;<samp>.global</samp>&rsquo; directive to
  93. globalize symbols (see <a href="Global.html#Global">Global</a>).
  94. </p>
  95. <p>Operand syntax is a bit stricter with <code>as</code> than
  96. <code>mmixal</code>. For example, you can&rsquo;t say <code>addu 1,2,3</code>, instead you
  97. must write <code>addu $1,$2,3</code>.
  98. </p>
  99. <p>You can&rsquo;t LOC to a lower address than those already visited
  100. (i.e., &ldquo;backwards&rdquo;).
  101. </p>
  102. <p>A LOC directive must come before any emitted code.
  103. </p>
  104. <p>Predefined symbols are visible as file-local symbols after use. (In the
  105. ELF file, that is&mdash;the linked mmo file has no notion of a file-local
  106. symbol.)
  107. </p>
  108. <p>Some mapping of constant expressions to sections in LOC expressions is
  109. attempted, but that functionality is easily confused and should be avoided
  110. unless compatibility with <code>mmixal</code> is required. A LOC expression to
  111. &lsquo;<samp>0x2000000000000000</samp>&rsquo; or higher, maps to the &lsquo;<samp>.data</samp>&rsquo; section and
  112. lower addresses map to the &lsquo;<samp>.text</samp>&rsquo; section (see <a href="MMIX_002dPseudos.html#MMIX_002dloc">MMIX-loc</a>).
  113. </p>
  114. <p>The code and data areas are each contiguous. Sparse programs with
  115. far-away LOC directives will take up the same amount of space as a
  116. contiguous program with zeros filled in the gaps between the LOC
  117. directives. If you need sparse programs, you might try and get the wanted
  118. effect with a linker script and splitting up the code parts into sections
  119. (see <a href="Section.html#Section">Section</a>). Assembly code for this, to be compatible with
  120. <code>mmixal</code>, would look something like:
  121. </p><div class="smallexample">
  122. <pre class="smallexample"> .if 0
  123. LOC away_expression
  124. .else
  125. .section away,&quot;ax&quot;
  126. .fi
  127. </pre></div>
  128. <p><code>as</code> will not execute the LOC directive and <code>mmixal</code>
  129. ignores the lines with <code>.</code>. This construct can be used generally to
  130. help compatibility.
  131. </p>
  132. <p>Symbols can&rsquo;t be defined twice&ndash;not even to the same value.
  133. </p>
  134. <p>Instruction mnemonics are recognized case-insensitive, though the
  135. &lsquo;<samp>IS</samp>&rsquo; and &lsquo;<samp>GREG</samp>&rsquo; pseudo-operations must be specified in
  136. upper-case characters.
  137. </p>
  138. <p>There&rsquo;s no unicode support.
  139. </p>
  140. <p>The following is a list of programs in &lsquo;<samp>mmix.tar.gz</samp>&rsquo;, available at
  141. <a href="http://www-cs-faculty.stanford.edu/~knuth/mmix-news.html">http://www-cs-faculty.stanford.edu/~knuth/mmix-news.html</a>, last
  142. checked with the version dated 2001-08-25 (md5sum
  143. c393470cfc86fac040487d22d2bf0172) that assemble with <code>mmixal</code> but do
  144. not assemble with <code>as</code>:
  145. </p>
  146. <dl compact="compact">
  147. <dt><code>silly.mms</code></dt>
  148. <dd><p>LOC to a previous address.
  149. </p></dd>
  150. <dt><code>sim.mms</code></dt>
  151. <dd><p>Redefines symbol &lsquo;<samp>Done</samp>&rsquo;.
  152. </p></dd>
  153. <dt><code>test.mms</code></dt>
  154. <dd><p>Uses the serial operator &lsquo;<samp>&amp;</samp>&rsquo;.
  155. </p></dd>
  156. </dl>
  157. <hr>
  158. <div class="header">
  159. <p>
  160. 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>
  161. </div>
  162. </body>
  163. </html>