📄 mmix-mmixal.html
字号:
<html lang="en">
<head>
<title>Using as</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Using as">
<meta name="generator" content="makeinfo 4.3">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home">
</head>
<body>
<div class="node">
<p>
Node:<a name="MMIX-mmixal">MMIX-mmixal</a>,
Previous:<a rel="previous" accesskey="p" href="MMIX-Syntax.html#MMIX-Syntax">MMIX-Syntax</a>,
Up:<a rel="up" accesskey="u" href="MMIX-Dependent.html#MMIX-Dependent">MMIX-Dependent</a>
<hr><br>
</div>
<h4 class="section">Differences to <code>mmixal</code></h4>
<p>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-base.html#GREG-base">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 <code>mmo</code> 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
<code>//</code>, the logical not operator <code>!</code> and the modulus operator
<code>%</code> are not available.
<p>Symbols are not global by default, unless the option
<code>--globalize-symbols</code> is passed. Use the <code>.global</code> 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
<code>0x2000000000000000</code> or higher, maps to the <code>.data</code> section and
lower addresses map to the <code>.text</code> section (see <a href="MMIX-loc.html#MMIX-loc">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>
<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
<code>IS</code> and <code>GREG</code> pseudo-operations must be specified in
upper-case characters.
<p>There's no unicode support.
<p>The following is a list of programs in <code>mmix.tar.gz</code>, available at
<<code>http://www-cs-faculty.stanford.edu/~knuth/mmix-news.html</code>>, 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 <code>Done</code>.
<br><dt><code>test.mms</code>
<dd>Uses the serial operator <code>&</code>.
</dl>
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -