Code Examples And Review; Error Messages - RCA 1800 Operator's Manual

Cosmac development system ii
Hide thumbs Also See for 1800:
Table of Contents

Advertisement

CDS Resident Software Development Aids _ _ _ _ _
__
_ _ _ _ _ _ _ _ _ _ _ _ _ _ 59
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
,T'IT"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',#ODOA,T'LINE_
2'
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 in-
tervening semicolon.
For example, assuming P=O, the sequence SEX
0; OUT 5 ,X'52' outputs the immediate hex constant,
#52, to output port 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 "*,, oc-
curring 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, BNl * will cause a program
loop until flag 1 goes true.
Code Examples and Review
Fig. 24 is a hypothetical program designed not to
do anything meaningful, but rather to present
examples of various acceptable CRA statements. It
contains
a
listing
of
the
program
and
the
corresponding output code generated. Fig. 25 con-
tains the symbol table for the program. Both were
generated by a typical CRA assembly run.
In Fig 24, the left-hand column gives the location
counter value before the line was processeq. The next
column give the output hex code generated at that
location by the line. (Terminating semicolons in this
column should be ignored. They are present to format
the output file properly for subsequent loading of the
object program. See later operating instructions.) The
next column gives a source program line number for
reference purposes, and Jinally the source code is
reproduced. The running comments in the source
program refer to the statement examples where they
appear.
By reading the source program in detail (paying
special attention to the running comments), one can
quickly review much of what has been said con-
cerning COSMAC Level I Assembly Language.
Output code values may be verified by referring to
Appendices E and F. In particular the reader should
verify the values assigned to the symbols in Fig. 25.
Error Messages
Whenever CRA detects a violation of its syntax
rules, it generates an error message. There are,
however, some possible program errors which will not
be detected by CR A because they do not result in
syntax rule violations. For example, R3=8; INC R3.
R3 is now a symbol, the value of which is 8, so
register 8 gets incremented.
When there is a syntactical error, CRA indicates it
first, by printing the line in violation using its
standard listing format (location counter, output
code, line sequence number, source line); second, by
inserting a
"?"
at the detection point in the source
line; and third, by printing an error code on the next
line. If the error is detected at the end of the line, the
"?"
may be omitted. In most cases, by looking up the
error code meaning in the listing which follows and by
noting the position of the inserted
"?",
the user can
easily determine the nature of the error.
It should be emphasized, however, that it is
possible that an error at one point in a source line may
be interpreted by CRA as an error at a different
point. For example, in T'TEXT ... COMMENT, a
single quote is missing after TEXT. It will not be
detected until the end of the line. (In fact, if the

Advertisement

Table of Contents
loading

Table of Contents