![RCA CDPl8S693 User Manual Download Page 31](http://html.mh-extra.com/html/rca/cdpl8s693/cdpl8s693_user-manual_334504031.webp)
User Manual for Microboard Computer Development System CDP18S693 & CDP18S694
30
Following is a more detailed definition of the syntax
which CRA is designed to recognize.
COSMAC Level I
Assembly Language
Lines and CommentsA
Each line or record in the source file is distinguished
by an ending carriage return character.
A line
may
consist only of a comment or of one or more
statements
optionally followed by a comment.
A comment
is any series of characters beginning
with two periods. It extends to the end of the line.
Thus, the occurrence of two periods at any point in a
line causes
CRA
to ignore the remainder of the line.
Statements within a line are normally separated by
sem icolons (with the last statem ent optionally
terminated by a semicolon). Within each statement,
spaces (blanks) may be used freely (except within
symbolics and mnemonics) in order to improve
readability.
CRA
will ignore them.
In all the examples which follow, a pair of square
brackets will be used to enclose an optional entity—
one which may or may not be included. Examples of
valid lines are then:
1) ..COMMENT
2
) STATEMENT1[;STATEMENT2; ...;
STATEMENTn][;] [...COMMENT]
Symbol Definitions
(Statement Labels and Equate Statements)
Any statement may optionally begin with a symbol
(called a “statement label”) immediately followed by a
colon. Under these conditions, the symbol is entered
into the symbol table and assigned the present location
counter value. A statement thus has the form:
[SYMBOL:] STATEMENT BODY
(For example, LOOP: INC R4)
A symbol is also defined when it appears as the left-
hand part of an EQUATE statement, which as the
form:
SYMBOL=EXPRESSION
(For example, READER=6)
In this case, the expression is evaluated and the
resulting two-byte value is assigned to the symbol in
the symbol table. (Acceptable forms for symbols and
expressions have already been explained.)
ANOTE:
All discussion regarding special CRA punctuation
characters (such as semicolon, colon, period, asterisk, parenthesis,
equals sign, number sign, apostrophe, etc.) refer to those which do
not appear within text constants (defined later). Any character
within a text constant has no special punctuation significance to
CRA.
Thus, a symbol definition is indicated to CRA by the
occurrence of “:” or “=” immediately after a leading
sequence of alphanumeric characters in a statement.
When a symbol is equated to a register number, only
a decimal or a hexadecimal number should appear on
the right side of the equation. For example:
COUNTR=7 is correct
COUNTR=#07 is correct
COUNTR=R7 is incorrect
DELAY=COUNTR is also correct
Explicit Constants
At numerous points in the source program, the
programmer desires to directly specify
explicit
constants
to CRA. Most often (but not always) the
hexadecimal equivalent of an explicit constant is
inserted directly into the output code stream at the
point where it appears in the source program. (For
example, initial data values and immediate arguments
may be explicitly defined this way.) CRA allows the
programmer the ability to specify absolute constants in
binary, hexadecimal, decimal, and alphanumeric
forms. The possible explicit constants are summarized
below.
Hexadecimal constants:
A hex constant is specified
with either of the following forms:
Example:
1) #hh...hh
#3E0F
2) X^h.-hh’
X3E0F’
where each h is a hex digit
(0
to F).
CRA requires that
an even number of hex digits be specified.
There are
further restrictions on hex constant lengths under
certain conditions.
Decimal constants:
A decimal constant is specified
with either of the following forms:
Example:
1) dd...dd
635
2) D ’dd...dd’
D‘635’
where each d is a decimal digit (0 to 9). Each such
constant is converted into hex, producing one or two
bytes, depending on the space required to represent it.
Decimal values greater than 65535 are converted to
hex but then truncated to two bytes (upper bytes
removed).
Expression constants:
An expression constant may be
either form of the hex constant or the first form of the
decimal constant. Because an expression translates to
two bytes, a hex expression constant should normally
be restricted to two or four digits in length.
Binary constants:
A binary constant is specified in the
form:
B*bb...bb’
(For example, B’OllOl’)
where each b is 0 or 1. Up to eight bits may be specified.
Each such constant is converted to one byte, with
leading CTs assumed.