30.4. Differences to mmixal

The binutils as and ld combination has a few differences in function compared to mmixal.

The replacement of a symbol with a GREG-allocated register is not handled the exactly same way in as as in mmixal. This is apparent in the mmixal example file inout.mms, 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.

Line numbers (in the mmo object format) are currently not supported.

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.

The serialize unary operator &, the fractional division operator //, the logical not operator ! and the modulus operator % are not available.

Symbols are not global by default, unless the option -globalize-symbols is passed. Use the .global directive to globalize symbols (refer to Section 8.39 .global symbol, .globl symbol).

Operand syntax is a bit stricter with as than mmixal. For example, you can't say addu 1,2,3, instead you must write addu $1,$2,3.

You can't LOC to a lower address than those already visited (i.e. "backwards").

A LOC directive must come before any emitted code.

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.)

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 mmixal is required. A LOC expression to 0x2000000000000000 or higher, maps to the .data section and lower addresses map to the .text section.

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 (refer to Section 8.74 .section name). Assembly code for this, to be compatible with mmixal, would look something like:

 .if 0
 LOC away_expression
 .else
 .section away,"ax"
 .fi

as will not execute the LOC directive and mmixal ignores the lines with .. This construct can be used generally to help compatibility.

Symbols can't be defined twice-not even to the same value.

Instruction mnemonics are recognized case-insensitive, though the IS and GREG pseudo-operations must be specified in upper-case characters.

There's no unicode support.

The following is a list of programs in mmix.tar.gz, available at http://www-cs-faculty.stanford.edu/~knuth/mmix-news.html, last checked with the version dated 2001-08-25 (md5sum c393470cfc86fac040487d22d2bf0172) that assemble with mmixal but do not assemble with as:

silly.mms

LOC to a previous address.

sim.mms

Redefines symbol Done.

test.mms

Uses the serial operator &.