neingeist
/
arduinisten
Archived
1
0
Fork 0
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

137 lines
6.4 KiB
HTML

<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.7">
<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, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001, 2002,
2006, 2007 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.1
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''.
man end-->
<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; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="MMIX_002dmmixal"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="MMIX_002dSyntax.html#MMIX_002dSyntax">MMIX-Syntax</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="MMIX_002dDependent.html#MMIX_002dDependent">MMIX-Dependent</a>
<hr><br>
</div>
<h4 class="subsection">9.23.4 Differences to <code>mmixal</code></h4>
<p><a name="index-mmixal-differences-1316"></a><a name="index-differences_002c-mmixal-1317"></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 <span class="samp">mmo</span> 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>&amp;</code>, the fractional division operator
<span class="samp">//</span>, the logical not operator <code>!</code> and the modulus operator
<span class="samp">%</span> are not available.
<p>Symbols are not global by default, unless the option
<span class="samp">--globalize-symbols</span> is passed. Use the <span class="samp">.global</span> 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., &ldquo;backwards&rdquo;).
<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&mdash;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
<span class="samp">0x2000000000000000</span> or higher, maps to the <span class="samp">.data</span> section and
lower addresses map to the <span class="samp">.text</span> 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&ndash;not even to the same value.
<p>Instruction mnemonics are recognized case-insensitive, though the
<span class="samp">IS</span> and <span class="samp">GREG</span> pseudo-operations must be specified in
upper-case characters.
<p>There's no unicode support.
<p>The following is a list of programs in <span class="samp">mmix.tar.gz</span>, 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 <span class="samp">Done</span>.
<br><dt><code>test.mms</code><dd>Uses the serial operator <span class="samp">&amp;</span>.
</dl>
<!-- Copyright 2002, 2004 Free Software Foundation, Inc. -->
<!-- This is part of the GAS manual. -->
<!-- For copying conditions, see the file as.texinfo. -->
</body></html>