Assembly Language Equivalent; Cosmac Resident Assembler; Assembler Operation - RCA 1800 Operator's Manual

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

Advertisement

54 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ Operator Manual for the RCA CDS II CDP18S005
Assembly Language
Equivalent
Next to be discussed are the selection of the value
for n, the selection of the COUNT register, and the
"DUMMY" instruction. To get the maximum delay,
the original version of this program used a hex FF for
'the
immediate
byte.
The
assembly
language
statement LDI #FF will translate properly. This
,
selection provides an example of the fact that there
"
are still many places in a program where explicit
\
values are specified by the programmer. The "#"
_ indicates the presence of an explicit hex constant. One
can similarly explicitly identify the general register to
be used as the counter with statements such as PHIl,
DEC 1, etc., assuming R1 was chosen. Suppose,
however, that one wished to defer or later modify
register
assignments.
A convenient permissible
procedure is to continue to use the symbol as an
identifier (in this case not of a memory location but of
a general register) and to give the symbol a value with
a special statement called an EQUATE statement,
which has the form COUNT=l. In this case, all
occurrences of COUNT will be replaced with 1 by the
assembler. If, later, one wished lo reassign registers,
a change to COUNT=10, for example, would
automatically change all references to COUNT to hex
value #OA.
To generate a delay, one may use the NOP in-
struction or any other time-wasting instruction. The
hex program originally given merely repeated the
GHI 1 instruction three times. There are several ways
by which this instruction can be expressed to the
assembler. One in particular uses another form of
EQU A TE statement to give a value to a symbol. As
will be explained later, a comma may be used to
precede many kinds of
"constants", some
whose
values are explicitly stated and some whose values are
derived by the assembler. In particular, the statement
"DUMMY", for example, will cause a substitution of
the value for the symbol. Thus, if another statement
DUMMY =#91
is supplied, a means is again
provided by which all occurrences of DUMMY will
be replaced by a hex 91 (which is a GHI 1 in-
struction) .
Finally, the assembler begins assigning address
values starting with zero. A
special.
statement
is
provided to
cause
the assembler to change the present
value in its internal location
counter
if required. It is
called an ORG statement. The final form of one
assembly language equivalent of the hex program
started
with is then:
BEGIN:
LDI #FF
·
.INITIALIZE COUNTER
,
.REGISTER FOR
PHI
COUNT
·
.ABOUT 65000
PASSES.
LOOP:
DEC
COUNT
·
.REDUCE
#
PASSES
·
.REMAINING BY I.
,DUMMY
·
JUST TO WASTE TIM
E.
,DUMMY
·
.WASTE
MORE TIME
.
GHICOUNT
·
.SEE
IF
COUNT
HAS
·
,YET
REACHED
BNZ
LOOP
·
,ZERO.
LOOP IF NOT.
EXIT
:
IDL
·
.STOP AFTER TIME DELAY
.HAS
EXPIRED
COUNT
=
1
·
.REGISTER
I ASSIGNED AS
, .THE
COUNTER
DUMMY
=
#91
,
,NOP IS A REPEAT
OF
A
·
,
GHI
1 INSTRUCTION
.
END
·
.REQUIRED LAST
STATE
,
·
.
MENT IN EVERY PROGRAM.
COSMAC Resident Assembler
Assembler Operation
The COSMAC Resident Assembler (CRA) is a
program which provides for assembly of COSMAC
programs without the use of another computer. CRA
runs directly on the COSMAC Development System
itself in a stand-alone manner. It converts source
programs written in COSMAC Level I Assembly
Language into executable (hexadecimal) machine
code.
The use of an assembler permits the programmer to
write programs using convenient symbols and ex-
pressions. The input or source program consists of a
sequence of statements. A
statement
is normally
translated by the assembler into an equivalent
sequence of hexadecimal digits (a single machine
instruction or a data field of user-defined constants).
This code is then placed in its proper position (i.e.,
assembled) in an output or object file - which is the
executable
machine program. Some statements are
special control commands to the assembler. They are
called assembler directives. They are distinguished
by the fact that they do not directly cause output code
to be produced.
An assembly language program (as compared to its
0
machine code counterpart) is easier to write and to
understand. Each statement may be annotated with
user comments which are ignored by the assembler
(

Advertisement

Table of Contents
loading

Table of Contents