.\" Copyright (c) 1982 Regents of the University of California
.\" @(#)asdocs2.me 1.6 %G%
A source program is composed of a sequence of
Statements are separated either by new-lines
There are two kinds of statements: null statements
Either kind of statement may be preceded by
.SH 2 "Named Global Labels"
A global label consists of a name followed
The effect of a name label is to assign the current
value and type of the location counter
An error is indicated in pass 1 if the
an error is indicated in pass 2 if the
value assigned changes the definition
A global label is referenced by its name.
Global labels beginning with a
.SH 2 "Numeric Local Labels"
A numeric label consists of a digit $0$ to $9$
Such a label serves to define temporary symbols of the form
is the digit of the label.
As in the case of name labels,
the current value and type of the location counter
However, several numeric labels with the same digit
may be used within the same assembly.
References to symbols of the form
refer to the first numeric label
symbols refer to the first numeric label
Such numeric labels conserve the inventive powers
turns local labels into labels of the form
$roman L n roman ".\*(DL" m$.
these generated labels may conflict
with programmer defined labels.
A null statement is an empty statement ignored by the assembler.
A null statement may be labeled, however.
.SH 2 "Keyword statements"
A keyword statement begins with one of the many predefined
the syntax of the remainder of the statement depends
All instruction opcodes are keywords.
The remaining keywords are assembler pseudo-operations,
The pseudo-operations are listed in \(sc8,
together with the syntax they require.
An expression is a sequence of symbols representing a value.
Its constituents are identifiers,
Each expression has a type.
All operators in expressions are fundamentally binary in
Arithmetic is two's complement and has 32 bits of precision.
can not do arithmetic on floating point numbers, quad or octal
precision scalar numbers.
There are four levels of precedence,
lowest precedence level to highest:
binary \fI\(bv\fP\|, $&$, $italic "^"$, $!$
All operators of the same precedence are evaluated strictly left to right,
except for the evaluation order enforced by parenthesis.
.SH 2 "Expression Operators"
$-$ (unary) 2's complement
$italic "^"$ bitwise exclusive or
$italic "~"$ bitwise 1's complement
Expressions may be grouped by use of parentheses,
The assembler manipulates several different
The types likely to be met explicitly are:
.nr ii \w'undefined\ \ 'u
each symbol is undefined.
It may become undefined if it is assigned an undefined expression.
It is an error to attempt to assemble an undefined
certain keywords require operands which are not undefined).
.ip "undefined\ external"
A symbol which is declared
in the current assembly is an undefined external.
If such a symbol is declared,
must be used to load the assembler's output with
another routine that defines the undefined reference.
An absolute symbol is defined ultimately from a constant.
Its value is unaffected by any possible future applications
of the link-editor to the output file.
The value of a text symbol is measured
with respect to the beginning of the text segment of the program.
If the assembler output is link-edited,
its text symbols may change in value
not be the first in the link editor's output.
Most text symbols are defined by appearing as labels.
At the start of an assembly,
The value of a data symbol is measured
with respect to the origin of the data segment of a program.
the value of a data symbol may change
during a subsequent link-editor run since previously
loaded programs may have data segments.
The value of a bss symbol is measured from
the beginning of the bss segment of a program.
Like text and data symbols,
the value of a bss symbol
may change during a subsequent link-editor run,
since previously loaded programs may have bss segments.
.ip "external\ absolute,\ text,\ data,\ or\ bss"
but defined within an assembly as absolute,
symbols may be used exactly as if they were not
however, their value and type are available
to the link editor so that the program may be loaded with others
that reference these symbols.
.b "r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15"
operator converts the following absolute expression whose
value is between 0 and 15 into a register reference.
Each keyword known to the assembler has a type which
is used to select the routine which processes
the associated keyword statement.
The behavior of such symbols
when not used as keywords is the same as if they were absolute.
.SH 2 "Type Propagation in Expressions"
When operands are combined by expression operators,
the result has a type which depends on the types
of the operands and on the operator.
The rules involved are complex to state but
were intended to be sensible and predictable.
For purposes of expression evaluation the
The combination rules are then
If one of the operands is undefined,
If both operands are absolute,
If an absolute is combined with one of the
the result has the other type.
combined with an explicitly
discussed type other than absolute
it acts like an absolute.
Further rules applying to particular operators are:
If one operand is text-, data-, or bss-segment
relocatable, or is an undefined external,
the result has the postulated type and the other operand
If the first operand is a relocatable
text-, data-, or bss-segment symbol, the second operand
may be absolute (in which case the result has the
type of the first operand);
or the second operand may have the same type
as the first (in which case the result is absolute).
If the first operand is external undefined,
the second must be absolute.
All other combinations are illegal.
It is illegal to apply these operators to any but absolute symbols.