| <html lang="en"> |
| <head> |
| <title>MMIX-mmixal - Using as</title> |
| <meta http-equiv="Content-Type" content="text/html"> |
| <meta name="description" content="Using as"> |
| <meta name="generator" content="makeinfo 4.13"> |
| <link title="Top" rel="start" href="index.html#Top"> |
| <link rel="up" href="MMIX_002dDependent.html#MMIX_002dDependent" title="MMIX-Dependent"> |
| <link rel="prev" href="MMIX_002dSyntax.html#MMIX_002dSyntax" title="MMIX-Syntax"> |
| <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> |
| <!-- |
| This file documents the GNU Assembler "as". |
| |
| Copyright (C) 1991-2019 Free Software Foundation, Inc. |
| |
| Permission is granted to copy, distribute and/or modify this document |
| under the terms of the GNU Free Documentation License, Version 1.3 |
| or any later version published by the Free Software Foundation; |
| with no Invariant Sections, with no Front-Cover Texts, and with no |
| Back-Cover Texts. A copy of the license is included in the |
| section entitled ``GNU Free Documentation License''. |
| |
| --> |
| <meta http-equiv="Content-Style-Type" content="text/css"> |
| <style type="text/css"><!-- |
| pre.display { font-family:inherit } |
| pre.format { font-family:inherit } |
| pre.smalldisplay { font-family:inherit; font-size:smaller } |
| pre.smallformat { font-family:inherit; font-size:smaller } |
| pre.smallexample { font-size:smaller } |
| pre.smalllisp { font-size:smaller } |
| span.sc { font-variant:small-caps } |
| span.roman { font-family:serif; font-weight:normal; } |
| span.sansserif { font-family:sans-serif; font-weight:normal; } |
| --></style> |
| </head> |
| <body> |
| <div class="node"> |
| <a name="MMIX-mmixal"></a> |
| <a name="MMIX_002dmmixal"></a> |
| <p> |
| Previous: <a rel="previous" accesskey="p" href="MMIX_002dSyntax.html#MMIX_002dSyntax">MMIX-Syntax</a>, |
| Up: <a rel="up" accesskey="u" href="MMIX_002dDependent.html#MMIX_002dDependent">MMIX-Dependent</a> |
| <hr> |
| </div> |
| |
| <h4 class="subsection">9.28.4 Differences to <code>mmixal</code></h4> |
| |
| <p><a name="index-mmixal-differences-1733"></a><a name="index-differences_002c-mmixal-1734"></a> |
| The binutils <code>as</code> and <code>ld</code> combination has a few |
| differences in function compared to <code>mmixal</code> (see <a href="mmixsite.html#mmixsite">mmixsite</a>). |
| |
| <p>The replacement of a symbol with a GREG-allocated register |
| (see <a href="GREG_002dbase.html#GREG_002dbase">GREG-base</a>) is not handled the exactly same way in |
| <code>as</code> as in <code>mmixal</code>. This is apparent in the |
| <code>mmixal</code> example file <code>inout.mms</code>, where different registers |
| with different offsets, eventually yielding the same address, are used in |
| the first instruction. This type of difference should however not affect |
| the function of any program unless it has specific assumptions about the |
| allocated register number. |
| |
| <p>Line numbers (in the ‘<samp><span class="samp">mmo</span></samp>’ object format) are currently not |
| supported. |
| |
| <p>Expression operator precedence is not that of mmixal: operator precedence |
| is that of the C programming language. It's recommended to use |
| parentheses to explicitly specify wanted operator precedence whenever more |
| than one type of operators are used. |
| |
| <p>The serialize unary operator <code>&</code>, the fractional division operator |
| ‘<samp><span class="samp">//</span></samp>’, the logical not operator <code>!</code> and the modulus operator |
| ‘<samp><span class="samp">%</span></samp>’ are not available. |
| |
| <p>Symbols are not global by default, unless the option |
| ‘<samp><span class="samp">--globalize-symbols</span></samp>’ is passed. Use the ‘<samp><span class="samp">.global</span></samp>’ directive to |
| globalize symbols (see <a href="Global.html#Global">Global</a>). |
| |
| <p>Operand syntax is a bit stricter with <code>as</code> than |
| <code>mmixal</code>. For example, you can't say <code>addu 1,2,3</code>, instead you |
| must write <code>addu $1,$2,3</code>. |
| |
| <p>You can't LOC to a lower address than those already visited |
| (i.e., “backwards”). |
| |
| <p>A LOC directive must come before any emitted code. |
| |
| <p>Predefined symbols are visible as file-local symbols after use. (In the |
| ELF file, that is—the linked mmo file has no notion of a file-local |
| symbol.) |
| |
| <p>Some mapping of constant expressions to sections in LOC expressions is |
| attempted, but that functionality is easily confused and should be avoided |
| unless compatibility with <code>mmixal</code> is required. A LOC expression to |
| ‘<samp><span class="samp">0x2000000000000000</span></samp>’ or higher, maps to the ‘<samp><span class="samp">.data</span></samp>’ section and |
| lower addresses map to the ‘<samp><span class="samp">.text</span></samp>’ section (see <a href="MMIX_002dloc.html#MMIX_002dloc">MMIX-loc</a>). |
| |
| <p>The code and data areas are each contiguous. Sparse programs with |
| far-away LOC directives will take up the same amount of space as a |
| contiguous program with zeros filled in the gaps between the LOC |
| directives. If you need sparse programs, you might try and get the wanted |
| effect with a linker script and splitting up the code parts into sections |
| (see <a href="Section.html#Section">Section</a>). Assembly code for this, to be compatible with |
| <code>mmixal</code>, would look something like: |
| <pre class="smallexample"> .if 0 |
| LOC away_expression |
| .else |
| .section away,"ax" |
| .fi |
| </pre> |
| <p><code>as</code> will not execute the LOC directive and <code>mmixal</code> |
| ignores the lines with <code>.</code>. This construct can be used generally to |
| help compatibility. |
| |
| <p>Symbols can't be defined twice–not even to the same value. |
| |
| <p>Instruction mnemonics are recognized case-insensitive, though the |
| ‘<samp><span class="samp">IS</span></samp>’ and ‘<samp><span class="samp">GREG</span></samp>’ pseudo-operations must be specified in |
| upper-case characters. |
| |
| <p>There's no unicode support. |
| |
| <p>The following is a list of programs in ‘<samp><span class="samp">mmix.tar.gz</span></samp>’, available at |
| <a href="http://www-cs-faculty.stanford.edu/~knuth/mmix-news.html">http://www-cs-faculty.stanford.edu/~knuth/mmix-news.html</a>, last |
| checked with the version dated 2001-08-25 (md5sum |
| c393470cfc86fac040487d22d2bf0172) that assemble with <code>mmixal</code> but do |
| not assemble with <code>as</code>: |
| |
| <dl> |
| <dt><code>silly.mms</code><dd>LOC to a previous address. |
| <br><dt><code>sim.mms</code><dd>Redefines symbol ‘<samp><span class="samp">Done</span></samp>’. |
| <br><dt><code>test.mms</code><dd>Uses the serial operator ‘<samp><span class="samp">&</span></samp>’. |
| </dl> |
| |
| <!-- Copyright (C) 2002-2019 Free Software Foundation, Inc. --> |
| <!-- This is part of the GAS manual. --> |
| <!-- For copying conditions, see the file as.texinfo. --> |
| </body></html> |
| |