RCA CDPl8S693 User Manual page 33

Table of Contents

Advertisement

User Manual for Microboard Computer Development System CDP18S693 & CDP18S694
32
a one-byte constant. If it is longer, CRA will not
generate an error message, but will merely insert the
entire constant into the output stream, possibly
causing an error during program execution.
Data Lists
The typical program normally includes memory
areas which contain data values. Statements which
define initial data values are also code-producing
statements (although the code generated is normally
not "executable"). The data list is a special statement
provided for these purposes. It begins with either a
comma or the special mnemonic "DC" (which stands
for "Define Constant") and is followed by a sequence
of one or more constants separated by commas. Each
constant may be an absolute, explicit constant
(hexadecimal, binary, decimal, or text) or an address
constant or a symbol. For the last case, to be consistent
with the treatment of symbols as immediate data, CRA
substitutes the lower byte of the symbol's assigned
value. Thus, a constant in a data list is similar to an
immediate operand, but now a length greater than one
byte is entirelyjustifiable.
Examples:
DC X'ABCD',355
,#ABCDEF,TTEXT,BOir
Note: Any statement may be directly followed by a
data list without the intervening semicolon. For
example FDA 9,#300l.)
CRA Directives
The EQUATE DIRECTIVE (of the form SYM-
BOL=EXPRESSION) has already been discussed.
Three other directive statements are also recognized by
CRA:
ORG Statement: This statement is written "ORG"
followed by an expression. CRA executes this directive
by setting the location counter equal to the value of the
expression.
Example: ORG*+20 ..Reserve 20iobytes of space
PAGE statement: The PAGE directive, simply written
"PAGE", increases the value of the location counter to
that of the beginning of the next 256-byte page; i.e., the
upper byte of the location counter is incremented and
the lower byte is set equal to zero.
END statement: The END directive, written "END",
informs CRA to terminate the assembly. It should
appear only once, as the last statement in the source
program. The END directive is normally followed by a
DC3 character. The DC3 is produced bythe EDITOR
to signify an end of file.
Thus, in addition to recognizing all the instruction
operation mnemonics listed in Appendix E, CRA also
recognizes the special mnemonics "DC", "ORG",
"PAGE", and "END".
Additional Notes
1) As noted earlier, a space is not permitted within a
syntactic entity (symbol, mnemonic, constant, etc.). A
space is not permitted between a symbol being defined
and the following colon or equals sign. Note, however,
that a space within a text constant is permitted. It is
translated into its ASCII equivalent code. There is a
case where a space is required as a punctuation
character. In order to distinguish an operation
mnemonic (including ORG) from its following
operand (if present), CRA expects to find at least one
space.
2) An apostrophe may be included within a text
constant by preceding it with a "dummy apostrophe".
Thus, the string IT's is written as a text constant as
, r i r
s '
3) Special control characters (non-printing
characters, such as carriage return, line feed, etc.)
should not be placed within the quotes of a text
constant. Rather, they should be defined by splitting
the text constant into two successive text constants,
with the intervening control character represented
with a hex constant (using its ASCII code). For
example:
,T'LINEl',#0D0A,T'LINE2'
4) Several COSMAC instructions execute by
automatically advancing the pointer to an operand
byte after processing it. If the pointer to the operand
byte is the same as the current program counter (for
example, if X=P or if N=P), then the operand byte may
be considered an immediate operand (provided an
auto-increment occurs). A statement for such an
instruction (under the conditions specified) is most
conveniently followed by a comma followed by the
one-byte immediate constant. This sequence is
permissible because any statement may be im­
mediately followed by a data list - omitting the
intervening semicolon.
For example, assuming P=0, the sequence SEX 0;
OUT 5 ,X'52' outputs the immediate hex constant, #52,
to output port 5 and continues.
5) In general, any symbol may be referenced before it
is defined in a program (termed a "forward reference").
Only one restriction exists: A symbol on the right-hand
side of an EQUATE statement (i.e., in the expression)
must have been previously defined.
6) CRA uses the location counter value before a
statement is processed as the value for any "*"
occurring within the statement. Thus, for example, for
BR *+3, the value used for the * is the location where
the branch byte (hex 30) will be placed, not one byte
past that. Thus, BNI * will cause a program loop until
flag 1 goes true.
Code Examples and Review
Fig. 9 is a portion of a program illustrating examples
of various acceptable CRA statements. It contains a

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cdpl8s694

Table of Contents