RCA 1800 User manual

I
I
Operator
Manual
for
the
RCA
COSMAC
Development
System
II
CDP18S005
MPM-216 Suggested Price $10.00
RETURN
IU
ARK
L.
LEW

•
•
' .
.
:
.
~.
Operator
Manual
for
the
RCA
COSMAC
Development
System
II
CDP18S005
nell
Solid IBuenos
Aires'
Hamburg·
Liege'
Madrid'
Mexico
City·
Milan
Stat
Montreal'
Paris'
Sao
Paulo'
Somerville NJ •
Stockholm
e Sunbury·on·
Thames'
Taipei'
Tehran'
Tokyo

"
Information furnished by RCA is believed
to
be
accurate and reliable. However, no responsibility
is assumed
by
RCA for its use;
nor
for any in-
fringements
of
patents or
other
rights
of
third
parties which may result from its use.
No
license
is
granted
by
implication or otherwise
under any patent or patent rights
of
RCA.
Trademark(s) Registered ®
Marca(s) Registrada(s)
Copyright 1977
by
RCA Corporation
(All rights reserved under Pan-American Copyright Convention)
Printed
in
USA/I0-77
•
1
•

•
•
•
________
__________
__
______
____________________________________
3
Foreword
The
COSMAC
Development System CDP18S005 is a
prototyping
aid
for
the
design of
hardware
and
software systems
based
on
the
RCA
CDP1802
microprocessor.
The
COSMAC
Development
System is specially
structured
to provide a testbed
in which
hardware/software
prototypes of systems containing a
microprocessor
may
be designed, built,
and
tested.
In
small-
volume applications it
can
be
used as the
major
building block
for dedicated microcomputers.
This
Manual
is designed as a guide for the COS
MAC
Development System user.
It
includes a detailed description of
each of the available
hardware
modules as well as a complete
explanation of
the
functions available from
the
software sup-
plied with
the
system.
The
COSMAC
Development System (CDS) consists of a
card
nest with self-contained power supply,
an
easy-to-use control
panel,
and
a basic set of plug-in modules.
It
is packaged to
promote easy interfacing with external devices. These interfaces
may be custom-designed
by
the
user or, in
the
case of common
peripheral devices, are available from
RCA
as
standard
op-
tional modules,
and
include a floppy disk interface.
The
COSMAC
Resident
Software
Package
(which
runs
on
the
CDS
in a stand-alone
manner)
provides a means for
rapid
coding
and
debugging of
COSMAC
programs.
Many
of its
features are compatible with those of
the
COSMAC
Software
Development
Package
(CSDP)
timesharing program-
development aids. Additional software
and
firmware packages
are available from
RCA
including packages for floppy disk
hardware
and
multiple precision arithmetic.

4
_____________
___
_ Operator Manual for the
RCA
CDS
11
CDP18S005
,
,
•
I
•

•
•
•
•
__________________________________________________________________
5
Table of Contents
Foreword . . . . . . . . .
Operating and Programming the CDS
System Overview
Initial Operation . . . . . .
CDS Hookups
.....
.
CDS
Checkout
Program
Loading and
Outputting
Programs
Paper Tape Systems . . . .
Magnetic Tape Systems
Introduction
to
the Monitor Software UT20
Utility Commands
?M
Commands
!M
Commands
$U Commands
$P Commands
$L
Commands
?R
Commands
Summary
of
UT20 Ope]ating Instructions
Terminal
Interfacing.
. . . . . . .
ASCII Coding . . . . . . . . .
UT20 Read and Type
Routines.
. . .
Examples
of
UT20 Read and Type Usage
Additional Utility Routines
ASCII
to
Hex Conversion Routine .
Initialization Routines
Routine
to
Restart UT20 .
Additional Notes
on
UT20 .
Programming Methods
Machine Language Programming
Programming Interface
to
CSDP
Hardware
Structure
of
the CDS .
System Block Diagram
Module Description and Signal Mnemonics
Card Nest and Backplane . . . . .
CPU Module CDP18S102 . . . . .
Control Module CDP18S103 . . . .
Address
Latch
and Bank Select Module CDP18S206
I/O
Decode Module
CDP18S509.
. .
ROM/RAM Module
CDP18S401.
. .
4-Kilobyte RAM Module CDP18S205 .
Terminal Interface Module CDP18S507
Display Board . . . . . . . . .
Disk Interface Module
Option
CDP18S813
Microterminal
Option
CDP18S021
Power Supply Module . . . . . . .
Page
3
9
9,
10
10
10
11
11
11
12
12
12
12
13
13
13
13
14
15
15
15
18
19
19
19
20
20
20
20
22
27
27
29
29
30
31
32
33
34
34
35
36
37
37
38

6
--'----
--
- -
___
_____
Operator Manual for the RCA CDS
II
CDP18S005
Development System Signals
Memory Addressing
and
Expansion
Memory Organization
RCA Modules . . . .
Custom Memory Modules
Input/Output
Interfacing
.Module Enable Philosophy
Two-Level
I/O
........
.
~
.. Interfacing Signals
and
Custom
I/O
Modules
DMA
Input
DMA
Output.
. . . . .
Byte
I/O
. . . . . .
Interrupt
. .
Bit Serial Interface-The Terminal Interface Module
Interfacing Techniques and Precautions
Use
of
External Clock .
External Flags EF 1
to
EF4
. . . .
Adding I/O Devices
Adding
Remote
Control .
Development System Dynamic Characteristics
Troubleshooting .
...
. . .
Hardware Specifications .
CDS Resident Software Development Aids
CDS
I/O
Terminals .
Memory Space Requirements .
Informal
Introduction
to
the COSMAC Resident Assembler
Flow Chart
to
Operation Mnemonics
Addressing .
Assembly Language Equivalent
COSMAC Resident Assembler
Assembler Operation
The Location
Counter
The Symbol Table
Expression Evaluation
COSMAC Level I Assembly Language
Lines and
Comments
Symbol Definitions
Explicit Constants .
Address Constants .
Operation
Mnemonics
Instructions
and
Operands
Data Lists
CRA Directives .
Additional Notes
Code Examples
and
Review
Error Messages . . . .
CRA Operating Instructions
Summary
of
CRA
Operating Steps
RAM Considerations
Output
Options .
Prompt
Messages
Page
38
40
40
40
41
41
42
42
43
45
45
46
46
47
47
47
48
48
48
48
48
49
51
51
51
52
52
53
54
54
54
55
55
55
55
55
56
56
57
57
57
58
58
58
59
59
63
63
64
64
64
•

•
•
•
Table
of
Contents
____________________________
7
Informal
Introduction
to
the
COSMAC
Resident
Editor
COSMAC
Resident
Editor
CRE
Operating
Considerations
Memory
Space
Requirements
Input
and
Output
Files
Record
Formats
. . .
Buffer
Pointer
CRE
Command
Operation
Command
Strings
Command
Formats.
Punch
Procedure
Correcting
Command
Typing
Errors
Interrupting
CRE
Execution
Filled Work Space Warning
CRE
Command
s .
Single
Commands
.
Pointer
Control
Commands
Reading
the
Input
Tape .
Deletion
Commands
.
Text
Insertion
and Data Manipulation
Output
Commands
Summary
of
CRE
Commands
and
Control
Characters
Composite
Commands
and
Nesting
Horizontal Tabs
Additional
Note
Using
CRE
.
Loading
and
Operating
CRE
.
File
Development
and
Manipulation
Creating a File . .
Adding
to
a File
Deleting a Section in a File .
Moving a
Section
in a File .
Modifying a
Section
in
a File
Some
Command
Examples
Appendices
A.
CDS
18S005
Backplane Wiring
Schedule
B.
Instructions
for Converting a Model
33
Teletype
Terminal
from
Half-to-Full-Duplex
Operation
and
from
60-mA
to
20-mA
Operation
C. Adding
Teletype
Remote
Reader
Control
.
D. Module Logic
and
Circuit Diagrams
and
Layout
Diagrams.
.
E.
Instruction
Summary
for RCA
CDP1802
COSMAC
Microprocessor.
F ASCII -Hex Table
G.
UT20
Listing
H.
System
Checkout
Game
-
DEDUCE.
I. Conversion
to
Different
Operating
Voltages
J.
Connection
List for
Terminal
Interface
Cables
Page
65
66
66
66
66
66
68
69
69
69
70
70
70
70
70
71
71
71
71
71
72
72
72
74
74
75
75
75
75
75
76
76
76
77
79
79
81
82
83
95
99
100
121
123
123

8
_________________
Operator Manual
for
the RCA
CDS
II
CDP18S005 •
,
.
+

•
•
•
--
--------
----------------------------------------
____
____
__
____
__
9
Operating
and
Programming
the
CDS
System
Overview
The
CDP18S005
COSMAC
Development
System
(CDSl
consists of a power
supply,
control panel,
and
a set of connectors for
printed
circuit
boards.
Many
of
the
25 available positions
are
occupied
by
specific
module types. A
printed
circuit
backplane
distributes
common
signal lines
to
all
connector
positions.
There
are a small
number
of
additional
wire-wrapped
connections.
The
unassigned
connectors are available
for
user
expansion of
memory
and
I/O
function.
Supplied
modules
include
the
CDP1802
CPU
module,
an
address
latch
and
memory
bank
select
module,
a 4-kilobyte
RAM
module,
a
ROM/RAM
module
containing
the
Utility
program,
an
I/O
decode
module,
terminal
interface module,
and
a
control module.
The
position assignments of these
modules
are
given in
Table
III
in the
next
Section. All
logic functions are
implemented
in
CMOS
operating
at
+5 V.
The
control
panel
provides a simple
user
interface.
Depressing
the
RESET
switch initializes
the
system.
Depressing
the
RUNU
switch
starts
the
utility
program,
identified
as
UT20.
Depressing
RUNP,
on
the
Dther
hand,
will
start
program
execution from
memory
location 0,
the
normal
starting
location of a
user
program.
A
STEP/CONTINUOUS
switch
allows stepping one
machine
cycle
with
each
depression of
RUNU
or
RUNP.
A 4-digit display
on
the
front
panel
shows
the
current
address
and
a 2-
digit display shows
the
value of
the
data
.bus
or,
by
switch selection,
the
last
I/O
data
byte. Five
ad-
ditional
LED
indicators
monitor
the
State
Code,
WAIT,
CLEAR,
and
Q lines of
the
CPU
while a
sixth
LED
indicates when
the
machine
is
running.
This
RUN
indicator
will be
ON
whenever
the
CPU
is
running
and
not
in
the
IDLE
mode.
The
LOAD
switch is used
to
place
the
CPU
in
the
'load
mode'
in
which
the
DMA
channel
can
be
used
to
load
RAM.
See
The
User
Manual
for
the
CDPl802
COSMAC
Microprocessor,
MPM-201,
for a detailed
discussion of this
mode.
The
LOAD
switch is sup-
plied
as
a convenience for
the
user
designing his own
system interfaces
and
is
not
used
in
normal
CDS
operations.
The
supplied
programs
are
loaded using
the
Monitor
program
as discussed in
the
next
section.
The
CDS·
is designed
to
work
with
anyone
of
the
following terminals:
Il
An
ASR
33
Teletype'
terminal
(or its
electrical
equivalentl
which
should
include a
remote
reader
control circuit
to
permit
the
CDS
to
control
the
paper
tape
reader.
2l A
TI
"Silent
700"
terminal"',
Model
733
ASR
with
tape
cassettes
and
"Remote
Device
Control"
option.
This
terminal
uses
dual
program-controlled
magnetic
tape
cartridges as
storage
medium
and
prints
at
30
characters
per
seconds.
3l Any
terminal
conforming
to
the
EIA
RS232C
standard
interface
and
having
a
baud
rate
of 110, 300,
or
1200.
The
CDS
is designed
to
automatically
adjust
to
a
variety of
data
terminal
speeds
and
will
accommodate
either
full-
or
half-duplex operation.
Included
with
the
CDS
are
an
assembler
and
editor
program
for software development.
Loading
in-
structions for these
programs
are
given
in
the
next
subsection.
Details
on
operation of
the
Assembler
and
Editor
are
given
later
in this
manual.
If
a
Floppy
Disk
system is used
with
the
CDS,
refer
to
the
Floppy
Disk
Manual
for
operation
of
the
Assembler,
Editor,
and
other
programs.
, Registered Trademark, Teletype Corporation.
... Registered Trademark, Texas Instruments Corporation.

L111
("
I \ (
10
_________________
Operator Manual
for
the RCA CDS II CDP18S005
Initial
Operation
,
CDS Hookups
Two
I/O
data
terminal
cables
are
supplied with
the
Development
System -
one
for
terminals
using a 20-
mA
loop interface,
the
other
for
an
EIA
RS232C
data
terminal.
Each
cable
with
it
s
terminal
board
con-
nection is labeled.
To
connect the
data
terminal,
selei':'t
the
proper
cable
and
plug
its receptacle labeled
"fl"
into
the
appropriate
connector
mounted
directly
on
the
accessible
end
of
the
terminal
board,
as shown
in
Fig.
1.
For
a list of
terminal
interface cables
and
their functions, refer
to
Appendix
J.
MOUNTED
I/O
TYPEWRITER
CONNECTORS
CAB
LE
END
RECEPTACLE
CABLE
25-PIN
DELTA
CONNECTOR
LABELED
"
EIA
"
LABELED
tl
TTy
ll
END
CONNE
CTOR
MATING EIA
CONNECTOR
-0
-9
TERMINAL
PLUG
-IN
MODULE
(SLOT"
14) WHITE PLASTIC
MOLEX
CONNECTOR
WHITE
PLASTIC
MOLEX JACK INSIDE
TELETYPE
TERMINAL
IN POSITION "2"
(J2)
92
CS
-
28
210 RI
Fig. 1 - Cable connection
for
I/O
data terminals.
The
two connectors on
the
terminal
board
are
labeled
appropriately.
The
connector
on
the
other
end
of
the
cable plugs
into
the
terminal.
For
a
Teletype
terminal,
remove its cover
and
plug
the
cable into
connector position 2 (J2) in
the
array
of white plastic
Molex
connectors
located
in
the
back
of
the
unit.
For
an
EIA
terminal,
plug
the
EIA
connector
on
the
cable
into
the
receptacle on
the
back
of
the
data
terminal.
Fig. 1 shows these connections.
When
the
Silent 700
terminal
is used,
the
cable
supplied
with
that
device
should
be
connected
to
the
CDS
via
the
EIA
cable.
Put
the
terminal
in
the
Line
mode,
select
the
ap-
pr-;;pa
~
te
baud
rate
and
set for full-duplex operation
before
attempting
to
use any
terminal.
Appendix B gives instructions for converting a
TTY
from half-
to
full-duplex operation.
The
in-
terface
is
a 20-mA
current
loop.
Make
necessary
changes
per Appendix B to convert a
TTY
to 20-mA
operation.
If
a
TTY
is to
be
used
with
the assembler
program,
the
remote
reader
control circuit should
be
installed in accordance with
the
instructions
in
Appendix
C.
Once installed, its switch should
be
set
in the
MANUAL
position before continuing.
Install
the
power cable
and
switch power on.
Press
RESET
followed
by
R
UNU.
This
sequence will
cause
the
RUN
light
to
go
ON
and
the
system is.now
operating
with
UT20
in
control.
This
program
begins by
reading
the
first keyboard
input
character
to define for itself
the
terminal
character
rate
and
whether
it
should
"echo"
typed
information
to
the
data
terminal
printer.
If
th
e
terminal
is
operating
in
the full-duplex mode,
the
user
should begin by pressing the
RETURN
key on
the
keyboard.
For
the
half-duplex
mode,
the
user should
press
the
LINE
FEED
key instead.
The
system
then
responds with the
prompt
character
(*).
It
now
"knows"
the
essential characteristics of
the
I/ O
data
terminal.
Reaching
this stage verifies
that
most
of
th
e
hardware
is
operating
properly.
CDS Checkout Program
Even
with
little
or
no
knowledge of
the
COS
MAC
command
repertoire, the user
can
further
verify
proper
system
operation
by loading, from
the
ter-
minal,
an
elementary
test
program.
For
example, a •
simple time-out loop
can
be
run
in which
the
RUN
~
light goes off
after
a specific elapsed time from
the
initiation of execution.
Each
line of user
keyboard
input
is
terminated
by
a
depression of the
RETURN
key
on
the
keyboard
The
test time-out
program
can
be
loaded
into memory
by
typing
in
!
MO
L'lF8FFB1219191913A0300(CR)
The
system will reply with
the
prompt
character.
One
c
an
verify
proper
loading by
entering
?MOL'l
A(CR)
The
system will
print
the
characters
just
entered
(after the memory location
addressed,
"0000"
in this
case)
and
will
return
the
prompt
character
again.
The
time-out
program
can
then
be
run
either by entering
$PO(CR)
or
by depressing
RESET
followed
by
RUN.
In
either
case, the
RUN
indicator
s
hould
go off after ap-
proximately 2.6 seconds.
This
step
establishes
that
the
read-write
memory
(RAM)
is
operational.
• In this Manual, (CR)
at
th
e e
nd
of an example
of
a user
keyb
o ~rd
input
denotes
the
terminating carriage
RETURN.
Spaces
man
input
line will
be
denoted
by
bl
anks in the
example
or, for add,-
tio
nal
emphasis,
by
the symbol
6.
•
i
I

••
1
•
Operating and Programming
the
CDS _
______
_
______
__________
11
Loading and
Outputting Programs
Programs
may
be
enter
ed
manually
by
use of
the
!M
command,
just
described.
This
and
other
Monitor
commands
are
covered in detail in
the
next
~ection.
Ordinarily,
programs
will be loaded from
paper'tape via a
TTY,
from
magnetic
tape
cassettes
via the
TI
terminal,
or
from a floppy diskette via
the
Floppy
Disk
system.
The
latter is covered separately
ill.
:the
RCA
COSMAC
Floppy
Disk
System
CD-
{»18S805
Instruction
Manual
MPM-217.
RCA-
supplied
CDS
programs
are designed to
work
in
the
fllB-duplex mode.
Following
are
the
methods
used with
paper
tape
and
magnetic cartridges:
Paper Tape Systems
To
load a
paper
tape:
UPress
RESET,
followed
by
RUN
U.
21
Press
the
RETURN
key
(C-R)
on the
TTY.
Make
sure it is in
the
LINE
Mode
and
the
installed switch is in the
MANUAL
position.
31
UT20
will
return
the symbol *indicating it
is
ready
to
accept
commands.
41
Position the tape in
the
header
and
tum
on
the tape recorder.
51
When loading
is
complete,
UT20
will issue
another
*.
61
Start
the
program
by typing$UO(CR).
If
preferred, typing
can
be
suppressed
during
paper-tape loading by pressing the
LINE
FEED
key
in
stead of
CR
at
step 2.
In
this case, the user should
re-initialize the system
after
loading by pressing
HESET,
RUN
U,
and
CR
before
attempting
to
start
the loaded
program.
UT20
monitors
the
program
being loaded
and
will
issue a
'!
if a
format
error
is detected.
If
an
error
is
det
ected, stop
and
reload
the
tape
from the begin-
ning.
To
punch reloadable tape:
11
With
the
TTY
in
the
LOCAL
mode,
position
tape
in
the
punch,
tum
the
punch
ON,
and
make
a
header
of nulls (control-shift-
Pl.
.
21
Type
!
Maaaa
6 where
aaaa
is
the hex
address of where the
data
is to be reloaded
(normally location 00001.
31
Turn
the
punch
OFF
and
put
the
TTY
in
the
LINE
mode.
41
Initialize
the
CDS
with a
RESET,
RUNU,
followed by a
RETURN
(CRI.
51
Next, type
?Maaaa
6count,
where the
address
is
the
starting
address of
data
to be
read
from
memory,
and
count
is
the
number
of
hex bytes to
be
punched.
61
Turn
the
punch
ON
and
press
CR.
After
the
tape
is
punched,
some
more
nulls should
be
added
to its
end.
The
assembler
and
editor
programs
automatically
punch
reloadable
tape
as
described in
the Section titled CDS
Resident
Software
Development
Aids.
Magnetic Tape Systems
To
load a
magnetic
tape:
1) Press
RESET,
RUN
U,
then
CR.
2)
UT20
will
return
the
symbol
*.
3)
Mount
the
cassette.
Rewind
it
and
press
LOAD/FF
to
advance
to
the
first record.
Make
sure
the
drive
is
in
the
LINE
and
PLAYBACK
mode.
41
When loading is completed,
UT20
will issue
another
*.
Start
the
program
by typing
$UO(CR).
Typing
during
load
can be
suppressed
by
turning
the
printer
OFF.
If
a ?
is
typed
during
loading,
an
e
rror
has
been detected
and
the
tape should
be
reloaded.
To
record reloadable tape:
11
With
the
terminal in
the
LOCAL
and
RECORD
mode,
mount
a
blank
cartridge.
2)
Type
!Maaaa
6 where
aaaa
is
the
hex
address of where
data
is to
be
reloaded
(normally location 00001.
3) Switch
to
the
LINE
and
PLAYBACK
mode
and
initialize
the
CDS
with a
RESET,
RUN
U,
and
CR.

12
_____________
____
Operator Manual
for
the RCA CDS II CDP18S005
4)
Type
?Maaaa
6count,
where the
address
is
the
starting
address
of
the
data
to be
read
from
memory
and
count
is
the
number
of hex bytes
to
be
recorded.
5)
Tum
the
Record
Control
switch
ON
and
press
CR.
After
the
data
has
been
output,
UT20
will issue
another
*.
For'
another
system
checkout
program
using
the
supplied
"Deduce"
game,
refer
to
Appendix
H.
,
Introduction
to
the
Monitor
Software
UT20
Utility
Commands
The
CDP18S005
COSMAC
Development
System
includes a
Monitor
program,
known
as
UT20,
which
performs
commonly
required
functions
of
running
the
terminal
interface,
providing
a
means
of
reading
and
generating
reload
able
tape,
giving _access
to
all
memory
locations,
and
allows
the
user
to
start
program
at
a given location.
The
following
explains
in
detail
the
?M
and!
M
commands
already
mentioned,
plus
others
not yet discussed.
In
general,
after
the
system
has
been
RESET,
the
user
has
two choices: pressing
RUN
begins execution
of
his
program
at
location 0000, while pressing
RUN
U begins execution of
UT20
(at
8000). After pressing
RUN
U,
the
user
next
presses
either
a
LF
(line feed)
or
a
CR
(carriage
return)
key,
depending
upon
his
installation. A
CR
initiates
FULL
DUPLEX
operation,
an
LF,
HALF
DUPLEX.
Besides
establishing
the
need
to
echo,
UT20
uses
this
input
to
calculate
the
timing
parameters
necessary
to
run
the
terminal.
Thus,
a single
program
can
operate
with
wide
variations
in clock
speed
or
terminal
speed.
When
UT20
is
ready
to
accept
a
command,
it
types
out
an
asterisk (*)
as
a
prompt
character.
?M
Commands
To
interrogate
memory,
type
a
command
such
as
?M2F53(CR)
UT20
responds
by
printing
out
the
contents
of
memory
beginning
at
location
02F5:
three
bytes
are
printed
out
as
two
hex
digits
each.
Each
line of
output
begins
with
the
address,
and
data
is
grouped
in
2-byte
(4-digit) blocks.
When
necessary,
new
lines
are
begun
every 16
bytes,
with
the
previous lines
ending
in
semicolons.
The
user
may
enter
any
number
of digits
to
specify
the
beginning
location (leading zeroes
are
implied,
if
necessary).
If
more
than
four
digits
are
entered,
only
the
last
four
are
used.
The
number
of
bytes
to
be
typed
out
should
be
in
hex.
Again, if
more
than
four
digits
are
entered,
only
the
last
four
are
used.
This
feature allows
the
correction of a
mistake
simply by
continuing
the
type
and
,terminating
the
..,
~ypedffse~uelnce
OWoi2th4)theIfcorhrect
4-d
b
igit
vfalbues
(2300b
24
~
IS,
e ectlVe y, . t e
num
er
0 ytes
to
e
typed
is
not
specified, one byte is
assumed.
For
example:
?M2F5(CR)
would
result
in the
typeout
of
the
one
byte
at
location
02F5.
When
the
user
wants
to
punch
a reloadable
paper
tape,
he
requests
a
memory
type-out
as
previously
described.
!M
Commands
In
general,
data
is
entered
into
memory,
by
means
of a
command
such
as
!MI2F
434F534D4143(CR)
This
command
enters
six
bytes
(two hex digits
each)
into
memory
beginning
at
location
012F. Once
again,
the
starting
location is
determined
by
the
last
four
digits
entered.
Data
is
entered
into
memory
after
.,
each
two
hex
digits
are
typed.
If
the
user
types
an
odd
.,
number
of digits,
the
last
digit is ignored,
and
the
error
message
('?')
is
typed
out.
It
is therefore only
necessary
to
re-enter
the
last
byte.
1

•
•
1
1
•
Operating and Programming the CDS
_________
__
_____________
13
The
!M
command
provides two options
that
facilitate memory loading.
First,
a string of
data
can
be extended from line to line
by
typing in a
comma
just
before
the
normal
CR.
(In this case press
the
CR-
LF
(carriage return-line feed) keys before beginninga
new line.)
For
example,
!M23
56789ABC,(CR) (LF)
DEFOI23456,(CR)
(LF)
3047(CR)
: enters
11
successive bytes beginning
at
location 0023.
Between successive hex pairs while
data
is being
entered,
any
non-hex
character
except the
comma
land
semicolon, as will
be
discussed) is ignored.
This
arrangement
permits
arbitrary
LF's,
spaces (for
readability), nulls (generated by
the
utility
program
or
by a time-share system to give
the
carriage time to
return), etc.
As
a second optional form of
data
entry,
a
string of
input
data
can
be
terminated
by a semicolon
land
a
CR).
The
utility
program
then
expects
more
data
to follow
on
the next line,
but
preceded by a new
beginning address.
The
line
must
have
the
format
of
an
!M
command,
but
with
the
!M omitted.
This
option provides the mechanism
f~r
reading
in a
paper
tape previously
punched
out
as a result of
the
?M
command.
(Recall
the
format
of multiline
?M
out-
puts discussed above.)
The
utility
program
ignores all non-hex
characters
following !
M,
allowing
CR,
LF,
and
nulls
to be inserted in
the
tape
without
disturbing
the
!M
command.
The
semicolon
feature
allows non-
contiguous memory
areas
to
be
loaded.
$U
Commands
The
$U
command
is used to
start
program
execution.
For
example,
$U6C(CR)
starts
program
execution
at
location 006C with
P = X
=0.
This
command
will leave
the
terminal
interface
and
floppy disk interface (if installed) ac-
tive. Consequently, the user
program
should
not
use
I/O
commands
associated with these interfaces.
For
a
further
discussion of
the
terminal
interface
and
the
floppy disk interface, see the material
on
Module
Description
and
Signal
Mnemonics
in the
next
Section.
For
further
details on
the
$U
command,
refer
to "Two-Level
110"
under
Input/Output
Inter-
facing
in the
next
Section.
If
only
$U
(CR) is
typed
with
no
address
specified, execution will
start
at
location 0000.
If
more
than
4
address
digits
are
typed,
only the
last
4
will
be
used.
$P
Commands
The
$P
command
is similar to the $U
command.
~or
example:
$P6C(CR)
would also
start
program
execution
at
location 006C
with
P=X=O
except,
in
this case,
the
temiinal
and
floppy disk interfaces
may
be disabled.
This
feature is
a convenience for
the
user so
that
his
program
can use
I/O
commands
normally associated with these
peripherals.
If
no
address
is specified,
program
execution
starts from location 0000.
The
function
is
equivalent
to
pushing
the
RESET
then
RUN
P
buttons
on
the
control panel.
This
command
also obeys
the
'last-4-
digits' address rule.
For
further
details of this
command,
refer to
"Two-Level
I/O"
under
Input/Output
Interfacing
in the
next
Section.
$L
Commands
The
$L
command
is used in systems having a
floppy disk.
Typing
$L
causes
UT20
to type
READ?
asking for the
unit
and
track
number
of
the
diskette
file to be loaded.
For
a discussion of the disk loader
program,
refer to the
RCA
COSMAC
Floppy
Disk
System
II
CDP18S805
Instruction
Manual
MPM-
217.
If
a floppy disk system is
not
installed
and
this
command
is
accidentally activated, simply do a
CR
after the
READ?
interrogation.
UT20
will type
DRIVE
NOT
ON
and
issue an
*,
waiting for
another
command.
?R
Commands
When
UT20
is activated (via
RESET,
RUN
U),
one of
the
first things
it
Qoes
is save 13-112 of
the
16
'R'
registers of
the
CPU
in its
RAM
stack
located
at
address
8COO
for 32 bytes. Registers
RO,
RI,
and
R4.1 are altered,
but
the
states of the remaining
registers
are
preserved
at
the
time
when
UT20
was
activated.
This
feature provides a means of
examining most
CPU
registers for debugging
pur-
poses.

14
_________________
0perator
Manual
for
the RCA CDS II CDP18S005
The
?R
command
provides for
automatic
readback
of
the
stored register states with
X's
for registers
RO,
RI,
and
R4.I
to
indicate
that
they
have
not
been
preserved.
For
example,
RESET,
RUN
U,
CR
then
?R
gives this format:
XXXX XXXX
18D4 3821, XX33 B760 8A15 0017
t t
RO
R7
5518
tc':
1\8
0717 34AA
8197,
A401 6789 A825 01B9
t
RF
NOTE:
the
?R
must
be
the
first
command
given to
UT20
after
it
is
started,
because
UT20
uses
the
stack
itself
when
other
commands
are
issued.
Thus,
it
may
overwrite
the
preserved registers when executing any
command
other
than
?R.
Summary of UT20
Operating Instructions
In
summary,
after
receiving
the
prompt
character
'*'
the
user
may
type
?M(addressl
f.,
(optional count) (CRI
!M(addressl
f.,(datal
(Optional,
or;)
(CR)
(where
the
data
may
have
non-hex digits between
each hex pair)
$P
(optional
address
I
(CRI
$U (optional address)
(CRI
$L
'?R(CR)
UT20
ignores initial
characters
until
it
detects?,
!,
or
$,
Then
inputs which are
not
compatible with
the
above formats cause
an
error
message (?
I.
A
further
detailed
summary
of these
basic
operating
instructions is given below,
repeating
the
information
just
given in a more concise form.
1.
After pressing
"RUN
U",
the
user should press
CR
(for full-duplex
operation
I,
This
instruction
sets
up
the bit-serial
timing
and
specifies echo
or
not.
2.
UT20
will
return
*as a
prompt.
3. Following
*,
UT20
ignores all characters
until
one of '!,
$,
or
! is
typed
in.
4. Following
'~M
or
!M,
UT20
waits for a hex
character.
It
then
assembles
an
address.
If
more
than
four hex digits
are
typed, only the
last
four
are
used.
Next,
a space
is
required.
Note:
f.,
denotes a
space:
a.
For
'!M
addr
f.,
a hex
count
may
follow (aga\n,
only
the
last
four digits
are
kept),
and
the
command
is
terminated
by
CR.
If
no
count
is
entered,
one byte will
be
typed.
b.
For
!M
addr
f.,
data
must
follow. An even
number
of hex digits is
required,
Before each hex
pair
arbitrary
filler, except for a
CR.
comma,
or
semicolon.
is
allowed.
CR
terminates
the
command,
unless
it
is
immediately preceded by a
comma
or, as is generally
the
case, by a
semicolon.
i.
In
case of
comma
CR
the
user
must
insert
an
LF
for
UT20
to
continue
to
accept
data.
This
procedure is a form of line
continuation.
ii.
In
case of a
semicolon
all following
characters
are
ignored
until
the
CR
is
typed.
Then,
the
user
must
again provide
an
LF,
and
UT20
continues as if it
had
received optional
filler,
then
a
starting
address, then a space,
and
then
data.
iii.
The
!M
command
can
be followed by as
many
continuation
lines as needed, mixed
between
the
two types
if
desired,
and
is
finally
terminated
with a
CR
not
preceded
by
a
comma
or
semicolon.
5.
Commands
$P
or
$U
may
be
followed
by
a
starting
address.
The
last 4 digits are used
if
more
than
4 are
typed
in.
If
no
address
is
given, 0
is
assumed.
Program
execution begins
at
the
specified
location with
RO
as
the
program
counter·
.
The
$P
command
disables
the
terminal
and
floppy disk
interfaces whereas
$U
does
not.
6.
Command
$L
starts
the
floppy disk loader
program
which will issue the
prompt
READ?
A
proper
response is a 4-digit
number
requesting
unit
and
track
number,
followed
by
a
CR.
If
an
error
is detected
during
the
read
operation, a diagnostic message is
printed.
7.
Command
?R causes a
readout
of the 16 R
registers saved when
UT20
is initialized.
X's
are
written
for those registers
not
preserved.
• $P
and
$U
always begin with
RO
as program
counter.
This
arrangement is consistent
with
the fact that
P=O
and
X=O
after
the CPU is RESET. Refer to the CDP1802 data sheet
for
other
actions
of
RESET.

•
•
•
Operating and Programming
the
CDS
________________________
15
H.
When
a
!M,
·!M
or
!'R
command
is accepted
and
completed,
UT20
types
another
*
prompt.
9. When
UT20
detects
bad
syntax, it types
out
a ?
and
returns
the
carriage.
If
a
mistake
is
made
when
data
is
entered
(by
typing
in
an
odd
number
of
digitsl, all
data
will
have
been
entered
except
the
last hex digit.
Note
that
the
"only-Iast-four-digits"
tnl
'e in
the
address
field allows
the
user to
correct
an
address
error
without
retyping
the
whole com-
mand.
For
example,
a
mistaken
234
can
be
:corrected by
continuing.
Thus,
2340235 is, ef-
fectively, 0235. A
bad
command
can
be
aborted
by
typing in any illegal
character
except after
!M
or
·-
'!M
or
between
input
hex
data
pairs.
In
these cases,
the
user
should
type any
digit
and
then,
for
example, a period.
Terminal Interfacing
ASCII Coding
The
CDS
is designed
to
interface to a
data
terminal
via a serial
ASCII
code
using
either a 20-mA
current
loop
or
an
EIA
RS232C
standard
electrical
interface.
When
a key is
struck
on a
TTY
terminal,
'
the information
denoting
that
character
is
converted
to
its
ASCII
code
and
appears
On
the
output
ter-
minals as a serial
data-bit
stream.
The
serial
data
originating
at
the
TTY
for the letter
'M'
is shown in
Fig. 2.
The
character
is
framed
by
a
start
bit
Band
LOGIC
I
BFI
DI
DI
DI
~I
DI
D~
FI
F
ACTUAL
-
DATA
BITS
INTELLIGENCE BITS
7
DATA
BITS
PLUS I PARITY BIT
---I
B 1
COMPLETE CHARACTER
"M"
(4DI6)
....
=
ONE
BIT TIME P = PARITY BIT
B =START
BIT
D'
DATA
BIT
F =
STOP
BIT
---
=ASYNCHRONOUS TIME
BETWEEN CHARACTERS
92CS
-28100
Fig.
2 -
Data
terminal
bit
serial
output
for the
character
"M"
.
two stop bits
FF.
By convention two stop bits
are
used for
data
transmission
at
10
characters
per
second
although
1, I
liz,
or
2
are
also acceptable
outputs
from
various different
terminals.
A
parity
bit
P
is
also
shown.
For
even
parity,
the
parity
bit
would
be
a
'I'
only
if
the
7
data
bits
contain
an
odd
number
of '1
'so
Hence,
the total
number
of 1
's
in the eight intelligence
bits
is
always
an
even
number.
Some
data
terminals
may be set
up
to
generate
either
even
or
odd
parity.
UT?O ignores the
parity
bit, so
either
even or
odd
rarity
is acceptable.
Data
from
the
CDS
is
generated
with
the
same
format;
i.e.,
a
start
bit,
7
data
bits, a parity bit,
and
two
stop
bits.
Note
that
the
CDS
does
not
generate
parity -the parity
bit
is always a
'I'
regardless of
the
data
bits. Therefore, terminals interfacing to the
CDS
should ignore
the
parity
bit.
UT20 Read and Type Routines
The
UT20
read
and
type
routines
provide
the
basic software
mechanism
for
communication
be-
tween
the
CDS
and
data
terminal.
Several different
routines
are available to facilitate different types of
110
data
transfers.
These
routines
are
designed
to
allow adoption to
various
terminal
speeds
and
to
determine
whether
or
not
characters
read
in
should
be
"echoed"
(ie., typed
back
immediately
I.
For
these
purposes,
a 'sub-
subroutine'
called
DELA
Y is included which
provides
the
necessary
bit
timing delays to
the
read
and
type routines.
DELAY
uses
RC
as its
program
c
ounter,
which
must
be set-up to
point
to location
80EF.
UT20
does this
automatically
when it is
started.
Any user
program
using a read
or
type
routine
must
not
alter
RC,
or
must
restore it to
80EF
before calling a
read
or
type
routine.
Also,
the
upper
half of register
RE
(RE.I)
contains
a control con-
stant.
The
least significant
bit
specifies echo (0
denotes echo, 1
denotes
no
echol.
For
full-duplex
operation,
then,
this
bit
is a zero. Again, this is
automatically
set when
UT20
is
started
and
the
CR
or
LF
characters
received.
The
remainder
of
RE.l
constitutes a timing
parameter
(TPI.
TP
is calculated
as
follows:
~
.nterval
between two serial
bit~
•
TP=2
x 320 x
(CPU
clock period)
where
the
fraction is
rounded
to
the
nearest
integer.
For
example, because a
Teletype
Model
33 operates
at
10
characters
per
second
and
II
bits
per
character,
for
the
CDS
running
from
the
supplied
2.0-MHz
clock,
-The
factor
of
2 comes from the fact
that
the
input
serial wave-
form is sampled over
two
successive bit times. The factor
of
320
comes from the fact
that
the time between samples
is
20 instruc-
tion
times, with each instruction taking 16 clock periods.

16
_________________
0perator
Manual
for
the
RCA CDS II CDP18S005
1 s 1 char
--
x---
10
char
11
bits
TP
=2
x 320 x 1 s
2.0 x 106
=2 x 56.8 (rounded to
57)
=
11410 =
72
16
Because for
proper
operation
TP
must
be
less
tha.o:
255,
there
is a
bound
on
the
speed
of
terminals
s}:\pported
at
any
given clock
rate.
Faster
terminals
or
slower clocks
can
be
supported
to
the
extent
that
roundoff
errors
do
not
cause
bad
timing.
For
example,
at
2.0
MHz
and
30 lO-bit
characters
per
second,
~
J 1 J
3o
xlo
TP
=2 x =2(20.8) =4210 =2A16
320/2.0 x 106
and
the
round-off
error
is small (2100
instead
of 20.81.
On
the
other
hand,
at
2.0
MHz
with
baud
rates
above
1200, the round-off
error
would be too high.
The
utility
program
UT20
uses a
subroutine
"TIMALC"
to
generate
the
operating
time
constant,
using the first
character
typed
in
by
a user.
This
routine times
the
intervals
between
incoming bits to
calculate
TP
and
reads
one
bit
to
determine
whether
or
not
to echo. Specifically, if a
CR
is entered while
TIMALC
is
running,
then
echoes will be provided;
an
LF
suppresses echoes.
In
either
case,
RE.l
is
loaded
with
the
appropriate
constant.
TIMALC
also
loads
the
subroutine
pointer
for
the
DELAY
routine.
The
user
of
TYPE
and
READ
has
the
option of
calling
TIMALC
or
setting
up
RE.l
and
the
pointer
to
the
DELAY
routine
himself. As a convenience
to
the user,
UT20
leaves
RE.l
and
RC
properly ad-
justed
while
performing
a
$P
or
$U
operation
and
may
be used unless
they
have been altered
by
the
user.
All
read
and
type
routines
and
TIMALC
use
R3
as
their
program
counter,
and
return
to
the
caller
with
SEP
R5.
They
can
be
called directly
from
a
program
that
can
use
R5
as
its
program
counter,
or
they
may
be
called
through
the
Standard
Call
and
Return
Technique
(SCRTI
described
in
the
User
Manual
for
the
CDP1802
COS
MAC
Microprocessor,
MPM-201
in
the
Section
Programming
Techniques
under
"Subroutine
Techniques".
This
programming
technique
is
the
most
general
and
is
recommended.
RE.l
is
reserved for
the
operating
constant
(control
constant
0
or
1
added
to
the
timing
parameter
'1'P
Idiscussed above.
One byte of
RAM
is
needed
by
read
and
type
routines.
These
routines assume
that
R2
points
to
free
RAM
and
M(R(211
is
alt
e
red
by
them.
In
general~
the
user
can
set
R2
to
any
free
RAM
location.
UT20
uses
a
byte
in its
dedicated
RAM
for
this
purpose.
R
F.I
is
used
in
certain
cases
to
pass the byte
being
read
or
typed between
the
calling routine
and
these subroutines.
When
READ
is exited,
it
leaves
the
input
byte in
RF
.1. When
TYPE
is
entered
at
location 81A4,
the
byte
to
be
typed
is
taken
from
RF.l.
All rontines alter
RE.O
and
RF.O.
They
also
alter
D.
DF,
and
X.
The
READ
routine
leaves
the
input
byte
in 0
as
well
as
in
RF.l.
but
the
byte
in
D will be
destroyed if
the
Standard
Call
and
Return
Technique
is
used.
When
TIMALC
exits,
R3.1
is left holding
A.I
(READl
=
A.I
(TYPEI
= 81,
but
R3.0
is
meaningless. When
READ
exits,
R3
is
ready
for
entry
at
READAH
(see
Table
III.
When
TYPE
exits,
R3
is
ready
for
entry
at
TYPE5
(see same tablel. a
When
DELAY
exits,
RC
is
ready
for
another
call
to
~
DE LAY. When
the
Standard
Call
and
Return
Technique
is used,
R3
is
automatically
set
up.
The
READ
routine
has two
entry
points -
READ
and
READAH.
The
former acts as described above
and
has
no
other
side-effects.
The
latter
operates
just
as
READ
does,
but
with
the
following side-effect.
If
the
character
read
in is a hex
character
(0-9, A-FI
then
the
I6-bit
contents
of
RD
are shifted four bits to
the left.
and
the
4-bit
hex
equivalent
of
the
input
character
is entered
at
th
e right.
DF
is
then
set to 1 on
exiting.
If
the
input
character
is
not
a hex
character,
RD
is
not
affected,
but
DF
is
set
to
0 on exiting.
CAUTION:
A
READ
may
immediately
be followed
by
another
READ,
but
not
immediately
by
a
TYPE.
The
caller should
wait
1.5
bit
times
first, which he
can
do by entering
TYPE
at
TYPE5D
or
by calling
DELAY,
with
a
parameter
of 7
or
greater.
The
DELAY
subroutine
assumes
that
the calling
program
counter
is
R3.
It
uses
the
value,
n,
of
the
immediate
byte
at
M(R31 to
generate
a delay
equal
to
(20 +m (2n +
611
instruction
times
where m is
time
constant
in
RE
:I (see previous
discussion
I.
It
then
increments
R3
past
the
calling
parameter
and
returns
via a
SEP
R3.
1

•
•
•
Operating and Programming the
CDS
________________________
17
The
TYPE
routine
has
five different
entry
points.
Three
of
them
simply specify different places
to fetch the
character
from:
TYPE
types from
RF.l,
TYPE5
types from M(R51
and
increments
R5,
and
TYPE6
types from M(R61
and
increments
R6.
TYPE5D
is
an
entry which provides a lo5-bit delay
before going to
TYPE5.
The
purpose
of this delay is
to
let"
an
immediately preceding echoed
READ
process to completion before typing.
TYPE2
is
an
eritry which results in
RF.l
being typed
out
in hex
form as two hex digits.
Each
4-bit half
is
converted to
a,
ASCII
hex digit (0-9, A-Fl
and
separately
typed
.out.
Notice
that
the
READ
routines
are
designed to
facilitate
repeated
calls on
READAH,
while
the
TYPE
routines
are
designed for repeated calls
to
TYPE5.
In
order
to
output
a string of variable
data
characters
following a
READ,
given the
timing
restriction
mentioned
earlier.
it
is
most
logical to call
TYPE5D
first.
using
an
immediate
"punctuation"
byte (i.e.,
non-data
such as space, null, etc.Ito
get
the
required initial delay
and
to follow either with
repeated
calls on
TYPE
(with
the
output
variable
data
characters picked
up
from
RF.Il
or
repeated
calls on
TYPE5
using
immediate
data
characters.
This
procedure
permits
a
maximum
output
character
rate.
Another routine,
OSTRNG,
can
be
used
to
output
a string of characters.
OSTRNG
picks
up
the
character
string
pointed
to
by
R6
and
tests each
character
for zero.
The
characters
should
be
already
encoded in
ASCII.
If
a zero is found
(ASCII
'null'l,
the
program
terminates
and
returns
control to
the
user via a
SEP
R5.
If
the
character
is
not
a zero,
it
is
typed
out
to
the
terminal.
The
OSTRNG
routine
includes a delay
on
the
front
end
so
that
it
may
be
called
at
any
time -even following a
read.
Tables
I
and
II
summarize
the
functions
and
calling sequences
just
described.
TABLE
1-
UT20 REGISTER
UTILIZATION
Register
Name
PTER
CL
ST
SUB
PC
DELAY
ASL
AUX
CHAR
Notes
Register
Number
RO
J
R1
R2
R3
R5
RC
RD
RE
RF
Function
and
Comments
Alt.ered
b-y
UT20 while storing registers. R4.1
is
similarly
altered.
Pointer
to
RAM
"work"
byte.
UT20
uses R2 =
8COO.
Program
counter
for
all
routines
except
DE
LA
Y.
Program
counter
for
UT20
which calls
the
routines above.
Program
counter
for
the
DELAY
routine.
Points
to
DELAY1 in
memory.
Assembled
into
by
READAH
(input
hex
digits).
RE.1 holds
time
constant
and
echo
bit.
RE,O
is
used
by
all READ
and
TYPE routines and
by
TIMALC,
OSTRNG,
and CKHEX.
RF.1 holds
input/output
ASCII
character.
RF.O
is
used
by
all READ
and
TYPE routines and
by
TIMALC,
OSTRNG,
and
CKHEX.
TABLE
II -UT20 READ
AND
TYPE
CALLING
SEQUENCE
Entry
Absolute
Name Address
READ
813E
READAH
813B
TYPE5D
819C
TYPE5 81AO
TYPES
81A2
TYPE
81A4
TYPE2
a1AE
TIMALC
80FE
DELAY1
OSTRNG
80EF
83FO
Input
ASCII ~
RF.1,
0 (if non-standard linkage)
Same
as
READ.
If
hex
character,
DIGIT ~ RD (see
text)
1.5-bit delay. Then TYP
E5
function.
Output
ASCII
character
at
M(R5). Then
increment
R5.
Output
ASCII
character
at
M(RS). Then
increment
RS.
Output
ASCII
character
at
RF.1.
Output
hex digit pair in RF.1.
Read
input
character
and set
up
control
byte
in
RE.1.
Initialize RC
to
point
to
DELAY1.
Delay,
as
function
of
M(R3) (see
text).
Then R3 + 1.
Output
ASCII string
at
M(RS). Data
byte
00
ends
typeout
.
(1) All routines,
except
DE LA
Y,
use R3
as
program
counter,
exit
with
SEP5, and
alter
registers
X,D,
OF, RE, RF
and
location M(R2).
exits with
SEP3
after
incrementing
R3, and
alters registers
X,D,
OF,
and
RE.
(3) READ and READAH
exit
with R3 pointing
back
at
READAH.
(4) All five TYPE
routines
exit
with
R3 pointing
(2) DELAY
routine
uses RC as program
counter,
at
TYPE5.

18
__________________
Operator Manual
for
the
RCA
CDS II CDP18S005
Examples of UT20
Read and Type Usage
The
following examples should help clarify how
to use the
UT20
read
and
type subroutines.
Most
examples use
the
standard
subroutine
linkage which
require's
that
R2
point
at
a free
RAM
location.
: Read Routines
.This sample
program
will
read
four
ASCII
hex
characters
into register
RD
translating
them
from
~SCII
to hex in the process.
Reading
will
terminate
-<
when a carriage
return
is entered.
Entry
of a non-hex
digit
other
than
a carriage
return
will cause a
branch
to
an
error
program
which will type
out
a
"?".
This
sample
program
uses
the
standard
subroutine call
and
return
linkage.
READAH=#813B
LOOP:
SEP
R4,A(READAH)
..Call the hex
..
read
program
BDF
LOOP
..
As
long as
ASCII
hex
..digits are entered
..
Read
and
shift in
..Fall
through
if
not
hex
..
character
GHI
RF
..See
what
character
was last
.. entered
XRI
HOD
..
Was
it
carriage
return
BNZ
ERROR
..
If
not,
BR
to error
..
Characters
entered
are
now
..in
RD
The
READ
routine
(at 813E) could be used
similarly to
enter
characters;
however,
READ
only
enters
them
one
at
a time into
RF.I
(and
D)
writing
over the previous entry.
Note
that,
even
though
incoming
data
is
entered
into
D,
the subroutine
return
program
alters
D.
Therefore,
valid
data
will
only be found in
RF.I
(and
RD
when
READAH
is
used) if the
standard
subroutine call
and
return
programs
are
used. An alternative technique is to use
R5 as the main
program
counter
(since all
read
and
type routines
terminate
with a
SEP
RS)
and
call
the
program
with a
SEP
R3 (since
all
read
and
type
routines use
R3
as their
program
counter).
The
following example illustrates this technique.
Type Routines
EXAMPLE
1:
This
program
outputs
a single
c
haracter
using the
TYPES
routine.
It
uses RS as
the
program
counter.
LDI
#81
PHIR3
LDI
#AO
PLOR3
LDI
#FF
PLOR2
LDI
#3F
PHIR2
SEPR3
..Set R3 to
TYPES
routine
..Set
R2
to free
RAM
location
#:~FFF
..Call type
,T'R'
yy
..An
"R"
will be
typed
..
Next
instruction
The
TYPESD
routine is used in the
same
way,
EXAMPLE
2:
This
program
outputs
a
chara
cter
using the
TYPE6
routine.
Note
that
R6
should be the
program
counter for
the
program
calling
TYPE6
if
the
character
to
be
typed is
an
immediate byte
because
TYPE6
must
always be from
M(R6).
But,
because
TYPE6
exits with
SEP
S,
TYPE6
must
always be called using
standard
subroutine linkage
for typing
an
immediate
byte. An alternative is to use
RS as the main
program
counter
but
point
R6
at
the
memory location
containing
the byte to be typed.
This
example uses
standard
subroutine
linkage.
SEP
R4
..
Branch
to the call routine
,#8IA2 ..Address of
TYPE6
,
T'?'
..Byte to be typed
out
yy ..Next instruction
EXAMPLE
3:
The
TYPE
and
TYPE2
routines
pick
up
the
byte in
RF.I
for typing.
TYPE
simply
output
s
the
character,
whereas
TYPE2
considers
RF.I
a hex digit
pair
which
it
encodes in
ASCII
before typing.
This
example types
out
the hex digits
'DS',
and
uses
standard
subroutine
linkage.
LDI
#DS
PHIRF
SEP4
,
#8IAE
yy
..
Load
hex digits DS
..
IntoRF.1
..Call
TYPE2
..
Next
instruction
Note
that
all type routines, except
TYPE2,
expect the
character
they
pick
up
to be already en-
coded in
ASCII.
EXAMPLE
4: An entire message
can
be
typed
by using
the
OSTRNG
routine.
The
ASCII
bytes
pointed
to
by R6 will
be
typed.
When
a '00' byte
is
detected,
OSTRNG
returns
to the caller.
This
example will
output
the
string
RCACOSMAC
MICROPROCESSOR
The
standard
call
and
return
linkage
is
assumed.
I
I
r

•
•
•
Operating and Programming
the
CDS
______
_
________________
19
.
,:'
"
OSTRNG
= #83FO
SEP
R4,A(OSTRNG
I ..Call
OSTRNG
DC
T'RCA
COSMAC'
..1st Line
,#ODOA
..(CRI (LFI
,T'MICROPROCESSOR'
..
2nd
Line
,#00
..
End
of
Text
Additional
Utility Routines
ASCII to Hex
Conversion Routine
The
ASCII
to hex conversion,
CKHEX,
examines the
ASCII
character
in
RF.l.
If
this
chanl(;ter is
not
a hex digit,
CKHEX
returns
to
the
IIser Ivia
SEP
R:)I with
OF
=
O.
If
the
character
is
IIPx.
CKHEX
returns
with RE.O = hex digit,
OF
=
I
and
with the
digit
shifted into
the
least significant 4
bits of
~egister
RD.
CKHEX
uses the registers
dt's('rihed above
and.
as with
the
other
routines, is
most ft'adily
handled
via the
standard
call
and
return
lI'Chniques.
CKHEX
is located
at
83FC.
Initialization Routines
Two
routines
are
provided,
INITI
and
INIT2,
\\ hil'h initialize
CPU
registers for the
standard
call
and fPturn
technique.
These
routines set
up
registers
as follows:
R2 =
R(X
I - POIntIng to
the
last (highest)
available user
RAM
location
R3
R4
R')
(below 8000),
-will become
the
program
counter
on
return
-
pointing
to the call routine
in
UT20
-
pointing
to
the
return
routine
in
UT20
The
INIT
programs
examine
user
memory
area
(below address 80001
and
determine
how
much
nWlllory
is
present.
They
set
R2
to the highest
available
RAM
address,
which
is
03FF
for the
CDS
as supplied (with one 4-kilobyte
RAM
cardl.
The
only difference between
INITI
and
INIT2
is
the lo(;ation to which they
return.
INITI
returns
to
location 000:) with P =
:1,
while
INIT2
simply
rptllTns by sf'tting P =
:1
and
assumes
that
the user
has already set
R:1
pointing to the correct
return
point.
These
programs
are
intended
as a convenience
to !'n't' the IIser from
generating
the overhead code
n'<Jllin'd by the
standard
subroutine
technique.
They
llW)
also be used as
an
integral
part
of custom
support
programs
running
on
the
CDS.
Their
ab-
,;olllte addresses
are
INITl
=
83F3
and
-INIT2
~
B:W(I. Hefer to Appendix
G,
the
UT20
listing, for
the
absollltt' addresses of
CALL
and
RET,
which will
be
loaded into R4
and
R:) respectively.
Following
are
examples
of
the
use of these
prol-(rams:
EXAMPLE
1:
Using
INITl
INITl
= #83F3
Address
Code
Mnemonics
Comment
0000
0001
0002
0003
0004
00U5
71
00
CO
83
F:~
DIS,#OO ..
Disable
interrupts
LBR
INITI
..Initialize registers
USRPGM:--
..User
program
starts
here;
..P = 3
EXAMPLE
2:
Using
INIT2
INIT2
=
#83F6
Address
Code
1\1fl('moni('s
Comment
0000
71
0001 00
000:2
FH
oom
00
0004
B:3
000:) FS
OOO()
.')0
0007
A3
OOOS
CO
OOOfJ
~n
OOOA
Fe)
OOSU
])IS.#OO ..
Disable
interrupts
LDI
A.I
..Set
R:3
to
return
(STARTI
..
point
PHI
R:3
LDI
A.O
(STARTI
PLOR:1
LBR
INIT2
..Call
INIT2
START:--
..User
program
starts
here
..P
=3
Other manuals for 1800
1
Table of contents
Other RCA Computer Hardware manuals
Popular Computer Hardware manuals by other brands

EK-Quantum
EK-Quantum Vector Master RTX 4090 D-RGB user guide

JETWAY
JETWAY LI1BV Series user manual

Extron electronics
Extron electronics AXP 50 C AT Setup guide

ADLINK Technology
ADLINK Technology COM Express cExpress-BT2 user manual

Solid State Logic
Solid State Logic C300 HD installation guide

Cubix
Cubix Xpander Desktop Elite user guide