RCA COSMAC User manual

nOli
LSI Systems Design
2nd Draft, February 1975
Copyright 1974, 1975 RCA
~orporation
Operator's
Manual
Solid State Technology Centel
Somerville, N. J

I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
1-
nell
LSI Systems Design
2nd Draft, February 1975
Copyright 1974, 1975
RCA
Corporation
I
Operator's .
Manual
Solid State Technology Center
Somerville, N. J.

TABLE
OF
CONTEllTS
PAGE
INTRODUCTION
OPERATING
AND
PROGRAMMING
THE
MICROKIT
System
Overview
and
Initial
Operation......
2
Instruction
Set
and
Memory
Organization........
6
COSMAC
Instruction
Set...................
6
Memory
Organization......................
6
Introduction
to
Utility
Package
-
UT2..........
8
Machine
Language
Programming
.••••..•..•••••••.•
13
Programming
Interface
to
CSDP
••••••••.•••••••••
18
UT2
Features
and
Calling
Sequences
•••.•••.•••••
26
UT2
Read
and
Type
Routines
••••••.••••••.•
26
UT2
Register
Storage
Option
.•••.•••••••.•
31
MICROKIT
HARDWARE
STRUCTURE
AND
INTERFACING
System
Block
Diagram
•••••••••.••••....•••••••.•
32
Module
Descriptions
•....•
·
••••.••••.•...••...•••
34
CPU
Module...............................
34
Clock
and
Control
Module
••.••••..•.•...••
35
Address
Latch
Module
•••••••••.•.•••.•••..
37
5l2-Byte
RAM
Module
••..•••••..••.••••••..
38
5l2-Byte
PROM
Module
•••.••••.••••••.•••••
39
I/O
Decoder
Module
•••••••••••••••••••
~
•••
40
Bus
Separator
Module
•••••••••••••••.•••••
41
Byte
I/O
Module
•.•••••••••••.•••••••••••.
42
Terminal
Module
•.••••••••••••••••••••••••
43
Card
Nest
and
Signal-Naming
Conventions
.•••••••
44
Memory Module
Addressing
Details
•••••••••••••••
47
RCA
~1odules..............................
47
Example
A...........................
47
Example
B...........................
48
Custom Memory
Modules
••••••••••.••.••••••
49
Input/Output
Interfaces........................
Sl
Introduction.............................
51
The
Module-Enable
Philosophy
and
Two-Level
I/O
•••••••••••••••••••••••
Sl
Interfacing
Signals
••••••••••••.•••••••••
53
DMA.
Input................................
S5
DMA.
Output...............................
S6
Interrupt.
............................... 56
Interfacing
Examples.....................
57
Sample
Program
System
•••••••••.•••.•
57
Bit
Serial
Interface
-The
Terminal
Module..........
.60
Interfacing
Techniques
and
Precautions
•••
61
To
Use
External
Clocks
••••••••••••••
61
External
Flags
EFI
to
EF4
•••••••••••
61
Remote
Start/Stop
•••••••••••••••••..
62
Bus
Deseparator
•••••••••••••••••••••
62
Microkit
Dynamic
Characteristics
•••.
62
Troubleshooting
••
,8
••••
,.8.~.,
•.
~.~.
63
Hardware
i
Specifications
•••••••••••••••
1·······
..
64
I

TABLE
OF
CONTErnS
(cDtn'n)
PAGE
APPENDICES
A.
TELETYPE
HALF-TO-FULL
DUPLEX
CONVERSION
INSTRUCTIONS
.••.•
66
B.
UTZ
ASSEMBLY
LISTING
•••••.•...•••••••.••.••..•..
69
C.
TTY
-MODEM-MICROKIT
SWITCHBOX
.•••.••••••••••..•••
77
D.
BACKPLANE
WIRING
SCHEDULE
.•••.•••••••••••.•.•••.
79
E.
MODULE
LOGIC
AND
CIRCUIT
DIAGRAMS
..•••••..••••..
80-97
F.
COSMAC
INSTRUCTION
SUMMARy
.••••.••••••.••.•.....
98
G.
ASCII -
HEX
TABLE
•...•••.••...•.........•.....•.
99

TAB
LEO
F
FIGURE
NUMBER
TITLE
FIG
U
RES
PAGE
1
I/O
Typewriter
Cable
Connection
4
2
Elementary
Hexadecimal
Program
Example
15
3
Source
Code
for
Sample
Program
22
4,
Assembly
Listing
for
Sample
Program
23
5
Microkit
Block
Diagram
33
6
Block
Diagram
-
CPU
Module
34
7
Block
Diagram
-
Clock
and
Control
Module36
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Block
Diagram
-
Address
Latch
Module
Block
Diagram
-
5l2-Byte
RAM
Module
Block
Diagram
-
5l2-Byte
PROM
Module
Block
Diagram
-
I/O
Decoder
Module
Block
Diagram
-Bus
Separator
Module
Block
Diagram
-
Byte
I/O
Module
Block
Diagram
-
Terminal
Module
Custom
4K
RAM
Functional
Diagram
DMA
Input
Example
DMA
Output
Example
Sample
Program
Interface
Sample
Character
Waveform
Model 33
Teletype
Terminal
Strip
Detailed
Circuits
for
CPU
-
Terminal
Interface
(Full
Duplex
Mode)
TTY-MODEM-KIT
Switchbox
37
38
39
40
41
42
43
50
55
56
58
60
67
68
78

TAB
LES
TABLE
NUMBER
TITLE
PAGE
1
VT2
Register
Initialization
29
2
VT2
Calling
Sequences
30
3
Card
Nest
Hodule
Assingments
44
APPENDIX
D
Backplane
Wiring
Schedule
79
APPENDIX
F
COSMAC
Instruction
Summary 96
APPENDIX
GASCII -Hex
Table
97

I NT
ROD
UCT
ION
The
COS~~C
Microkit
and
the
COSMAC
Software
Development
Packages
comprise
an
environment
for
the
design
of
sys-
tems
based
~n
the
COSMAC
microprocessor.
While
the
Microkit
may
be
viewed
as
a
"stand-alone"
machine,
it
is
specially
structured
to
provide
a
testhed
in
which
hardware/software
prototypes
of
systems
containjng
the
COSMAC
microprocessor
may he
designed,
built
and
tested.
The
Microkit
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
for
common
peripheral
devices,
they
may
be
available
from
RCA
as
standard
optional
modules.
The
COSMAC
Software
Development
Package,
or
CSDP,
provides
a
fundamental
set
of
programming
aids
to
facilitate
the
coding
and
debugging
of
application
programs.
The.
Microkit
includes
means
to
transfer
program
material
from
the
CSDP
sys-
tem
to
the
Microkit
memory.
There
it
can
be
executed
by
the
COS~~C
microprocessor.
This
manual
is
designed
as
a
guide
for
the
Microkit
user.
It
includes
a
detailed
description
of
each
of
the
avail-
able
hardware
modules
as
well
as
a
complete
explanation
of
the
functions
available
from
utility
programs,
pre-written
into
a
programmable
read-only
memory (PROM),
which
is
part
of
the
Microkit.
- I -

OPERATING
AND
PROGRAMMING
THE
MICROKIT
SYSTEM
OVERVIEW
AND
INITIAL
OPERATION
The
nest
for
the
Microkit
consists
of
a
set
of
printed
circuit
board
connectors
with
associated
card
guides
and
a
built-in
power
supply
and
control
panel.
The
first
21
of
the
34
available
connector
positions
are
assigned
to
specific
module*
types.
Many
of
their
pins
are
pre-
wired
using
a
printed
circuit
(PC)
board
backplane
and
a
small
number
of
additional
wire-wrapped
connections.
(The
latter
were
specifically
made
removable
to
permit
possible
user
modifications.)
The
last
13
of
the
con-
nectors
are
available
for
.any
use.
Table
3
(p.44)
contains
a
list
defining
to
which
module
each
of
the
first
21
card
positions
is
assigned.
Eleven
of
these
positions
are
occupied
with
modules
supplied
in
the
minimal
Microkit,
as
indicated
in
the
list.
All
logic
functions
are
implemented
in
COS/MOS.
One
card
contains
the
two-chip
COSMAC
microprocessor
(the
CPU
--
"central
processing
unit").
Three
memory
cards
are
included
--
two
512-byte
RAM's
(random-access
memories)
and
one
512-byte
PROM
(programmable
read-only
memory)
containing
the
prewritten
UTILITY
PROGRAM,
henceforth
called
UT2. The
crystal-controlled
system
clock
and
the
control-pinel
interface
reside
on a
card.
Two
cards
are
used
to
provide
appropriate
data
routing
within
the
system.
An
additional
module
is
used
for
memory
address
latching.
Finally,
three
cards
provide
a
fundamental
I/O
(input/out-
put)
interface
(including
I/O
device
selection
decoding,
a
two-way
byte-parallel
I/O
port
and
an
I/O
typewriter
serial
interface).
It
should
be
emphasized
that
a
spec-
ific,
custom
COSMAC
controller
need
not
require
all
of
these
hardware
facilities,
if
it
is
sufficiently
simple.
Detailed
descriptions
of
each
of
the
available
modules
appear
elsewhere
in
this
manual.
The
supplied
UT2
program
includes
a
set
of
routines
pro-
viding
basic
functions
which
virtually
all
users
are
ex-
pected
to
need.
These
include
capabilities
to
load
memory,
to
read
memory and
to
initiate
program
execution.
Other
built-in
services
which
are
available
from
these
routines
will
be
described
later.
*
We
will
use
the
terms
"module",
"card",
or
"board"
inter-
changeably
--
to
represent
a
pluggable
unit.
It
is
in-
serted
into
the
nest
in
a
specified
"slot"
or
"numbered
position".
Each
such
slot
has
its
own
connector,
mounted
in
the
nest.
- 2 -

SYSTEM
OVERVIEW
AND
INITIAL
OPERATION
(cont'd)
The
control
panel
provides
an
extremely
simple
user
inter-
face.
Depressing
RESET
initializes
the
CPU.
Depressing
RUN
UTILITY
transfers
control
to
UTZ.
Depressing
RUN
PROGRAM
transfers
control
to
memory
location
I
(assuming
some
prev-
iously-loaded
user
program
begins
there).
The
RUN
indicator
is
illuminated
whenever
the
CPU
is
running.
The
LOAD
switch
is
used
to
initiate
byte-parallel
memory
loading
using
the
COSMAC
"load
mode"
(discussed
further
later).
This
feature
is
not
utilized
in
the
minimal
Microkit,
since
program
load-
ing
and
initiation
are
accomplished
via
standard
services
supplied
by
UTZ.
The
I/O
typewriter
interface
supplied
in
the
minimal
Microkit
is
designed
to
connect
directly
either
to
a
user-supplied
ASR33
Teletype*
or
to
a
user-supplied
Execuport**
terminal
(or
its
electrical
equivalent).
The
system
is
designed
to
adjust
to
a
variety
of
typewriter
speeds.
It
will
also
accommodate
either
FULL
DUPLEX
or
HALF
DUPLEX
terminal
oper-
ation.
(For
the
reader's
information,
Appendix
A
provides
instructions
for
converting
a
Teletype
from
half
duplex
to
full
duplex
operation.)
Two
I/O
typewriter
cables
are
supplied
with
the
Microkit
--
one
for
a
Teletype,
the
other
for
an
Execuport.
They
are
labeled
appropriately.
To
connect
the
terminal,
select
the
proper
cable
and
plug
its
receptacle
labeled
"PI"
into
the
appropriate
connector
mounted
directly
on
the
accessible
end
of
the
Terminal
board,
in
card
position
20
(see
Figure
1
below).
The two
connectors
on
the
Terminal
board
are
labeled
properly.
The
connector
on
the
other
end
of
the
cable
plugs
into
the
terminal.
For
a
Teletype,
remove
the
typewriter
cover
and
plug
the
cable
into
connector
position
2(32)
in
the
array
of
white
plastic
Molex
connectors
located
in
the
back
of
the
Teletype
unit.
For
an
Execuport,
plug
the
Cinch
connector
on
the
cable
into
the
"External
Device"
receptacle***
(the
bottom
one)
available
on
the
back
of
the
typewriter.
Figure
1,
below,
should
clarify
these
connections.
Note
that
the
plastic
tie-downs,
supplied
in
the
Microkit,
may
be
used
for
anchoring
the
I/O
typewriter
cable.
NOTE:
Due
to
specific
hardware
characteristics
of
the
r/o
typewriters
discussed
above
and
of
the
terminal
board,
the
Execuport
Terminal
should
be
operated
only
in
Half
Duplex
and
the
Teletype
only
in
Full
Duplex.
*
Registered
trademark,
Teletype
Corporation.
~*
Registered
trademark,
Computer
Transceiver
Systems,
Inc.
***
Models
310
and
up
only.
- 3 -

SYSTEM
OVERVIEW
AND
INITIAL
OPERATION
(cont'd)
TERMINAL
PLUG-IN
MODULE
(~LOT
.20)
MOUNTED
1/0
TYPEWRITER
CONNECTORS
WHITE PLASTIC
MOLEX
JACK
CABLE)
~
E
+-
rPil--L----__=___
P2
L..~
.LABELED
./
END
TELETYPE-
/
RECEPTACLE
END
COON(CT~
ACCESSIBLE
END
CINCH
CONNECTOR
Fig.
1:
I/O
Typewriter
Cable
Connection
(see
text
above)
WHITE PLASTIC
MOLEX JACK
INSIDE
TELETY~
IN POSITION
-2
d
(J21
-[t
'! EXTERNAL DEVICE·
CINCH
RECEPTACLE
ON
BACK
OF
EXECUPORT
TERMINAL
Once
the
I/O
typewriter
has
been
properly
connected
(with
the
Teletype
operating
in
LINE
mode,
or
the
Execuport
in
LOCAL
mode)
and
Microkit
power
switched
on
(after
the
supplied
power
cable
has
been
installed),
a
simple
test
can
verify
that
the
system
is
functioning
properly.
Depressing
RESET
causes
the
RUN
light
to
go
off
and
the
CPU
to
idle.
Following
this
by
a
depression
of
RUN
UTILITY
will
cause
the
RUN
indicator
to
light.
The
system
is
now
running,
with
UT2
(the
utility
program)
in
control.
This
program
begins
by
reading
the
first
keyboard
input
character
to
define
for
itself
the
terminal
character
rate
and
whether
or
not
it
should
"echo"
typed
information
to
the
typewriter
printer.
If
the
terminal
is
operating
in
the
FULL
DUPLEX
mode,
the
user
should
begin
by
hitting
the
RETURN
key
on
the
keyboard.
For
the
HALF
DUPLEX
mode,
he
should
hit
the
LINE
FEED
key
instead.
The
system
will
then
respond
with
the
'*'
prompt
character.
It
now
"knows"
the
essential
charact-
eristics
of
the
I/O
typewriter.
Reaching
this
simple
stage
already
verifies
that
most
of
the
hardware
is
operating
properly.
- 4 -

SYSTEM
OVERVIEW
AND
INITIAL
OPERATION
(cont'd)
Even
with
little
or
no
knowledge
of
the
COSMAC
command
repertoire,
the
user
can
further
verify
proper
system
operation
by
loading,
from
the
terminal,
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
!MI
F8FFBl219191913A0400
(CR)
The
system
will
reply
with
the
prompt
character.
One
can
verify
proper
loading
by
entering
?MltlA
(CR)
The
system
will
print
the
characters
just
entered
(after
the
memory
location
addressed
-
"0001",
in
this
case)
and
will
return
the
prompt
characxer
again.
The
time
out
program
can
then
be
run
either
by
entering
$PI
(CR)
or
by
depressing
RESET
followed
by
RUN
PROGRAM.
In
either
case,
the
RUN
indicator
should
go
off
after
an
elapsed
time
of
approximately
2.6
seconds.
This
establishes
that
the
read-write
memory
(RAM)
is
operational.
Having
verified
proper
operation
of
the
Microkit,
you
are
now
ready
to
use
the
system.
Some
of
the
prerequisites
for
this
are
discussed
next.
*
In
various
points
in
this
manual,
we
will
use
(CR)
or
CR
at
the
end
of
an
example
of
a
user
keyboard
input
to
denote
the
terminating
carriage
RETURN.
Spaces
in
an
input
line
will
be
denoted
by
blanks
in
the
example
or,
for
additional
emphasis,
by a
tl
symbol.
- 5 -

- 6 -
INSTRUCTION
SET
AND
MEMORY
ORGANIZATION
COS~~C
INSTRUCTION
SET
To
write
COSMAC
programs,
the
user
must
first
become
familiar
with
the
internal
logical
structure
and
command
repertoire
of
the
COS~~C
microprocessor.
It
is,
there-
fore,
essential
that
the
reader
study
first
the
inform-
ation
provided
in
the
COS~~C
MICROPROCESSOR
MANUAL
before
going
any
further
here.
That
document
addltionally
pro-
vides
detailed
information
on
the
interface
signals
of
the
COS~~C
CPU,
which
is
essential
to
an
understanding
of
the
logical
structure
of
the
Microkit.
It
further
provides
elementary
interfacing
examples
which
lead
the
reader
toward
a
comprehension
of
the
internal
interfaces
within
the
Microkit
system.
It
is
also
strongly
recommended
that
the
reader
follow
the
study
of
the
COSMAC
Microprocessor
Manual
with
a
reading
of
the
introductory
section
of
the
COS~~C
SOFTWARE
~~NUAL,
where
hardware
characteristics
of
the
CPU
are
summarized
and
reinforced.
We
proceed,
then,
assuming
the
reader
already
has
a
detailed
familiarity
with
the
COS~~C
CPU.
For
completeness,
the
Appendix
includes
a
COSMAC
INSTRUCTION
SUMMARY
and
a
table
relating
ASCII
characters
to
their
hexadecimal
representations.
MEMORY
ORGANIZATION
To
write
elementary
programs,
the
user
must
be
aware
of
which
portions
of
the
total
memory
address
space
in
the
Microkit
are
available
for
his
use.
We
cover
only
the
basic
principles
here.
Further
details
are
given
later.
The
total
directly-addressable
memory
space
(6S,S36
bytes)
may
be
considered
as
being
divided
into
16
blocks
of
4096
bytes
each,
in
which
case
we
can
divide
the
l6-bit
memory
address,
A[lS:O],*
into
two
fields:
A[lS:12]
defining
a
block
number
and
A[ll:O]
defining
the
byte
within
a
block.
Further,
a
block
may
be
considered
either
as
consisting
of
four
banks
of
1024
bytes
each
(in
which
case
A[ll:lO]
defines
a
bank
number
within
a
block
and
A[9:0]
is
the
address
of
a
byte
within
the
selected
bank)
or
as
eight
banks
of
S12
bytes
each
(A[11:9]
defining
the
bank
number
and
A[8:0]
identifying
the
byte
within
the
selected
bank).
*
We
use
the
notation
A[i:j]
to
denote
the
bit
string
Ai,A(i-l),
.•
~Aj.
Thus,
B[8:6]
represents
the
three-bit
field
B8,B7,B6.

MEMORY
ORGANIZATION
(cont'd)
Each
memory
plug-in
module
comprises
a
bank
of
memory.
When
inserted
in
a
given
plug-in
slot,
external
wiring
of
appropriate
pins
on
the
connector
in
that
position
defines
its
bank
number
(the
range
of
addresses
to
which
it
responds).
An
additional
pin
on
the
same
connector
receives
an
overriding
enable/disable
signal.
The
module
responds
only
when
it
is
enabled.
These
facilities
allow
users
to
define
abritary
address
ranges
for
the
memory
modules
they
use.
(Further
wiring
instructions
are
pre-
sented
later.)
The
standard
Microkit
is
supplied
with
two
S12-byte
RAM
banks
(using
plug-in
positions
11
and
12)
enabled
when
AlS=O
(the
most
significant
address
bit),
and
one
Sl2-byte
PROM
bank
(position
4)
enabled
when
AlS=l.
The two
RAM
banks
are
pre-wired
to
give
a
composite
lK
RAM
whose
bank
number
is
zero.
The
PROM
in
position
4
is
also
wired
to
give
it
a
bank
number
of
zero.
Thus,
the
RAM
will
respond
to
addresses
XOOO
to
X3FF,
where
X
is
0
to
7
(most
signif-
icant
bit
0),
while
the
PROM
will
respond
to
addresses
YOOO
to
YlFF,
where
Y
is
8
to
F.
(most
significant
bit
1).
Normally,
then,
the
RAM
address
range
is
0000
to
03FF
and
the
PROM
range
is
8000
to
81FF
(i.e.,
A[14:12]
is
normally
expected
to
be
zero).
Clearly,
proper
operation
of
programs
requires
generation
of
memory
addresses
within
those
ranges
occupied
by
the
physical
memory
modules
present.
The
supplied
PROM
bank
contains
the
pre-written
utility
program,
UT2.
Elementary
aspects
of
its
user
interface
are
described
next.
- 7 -

INTRODUCTION
TO
UTILITY
PACKAGE
-
UT2
The
COS~~C
Microkit
is
provided
with
a
fixed
PROM
program,
which
gives
immediate
access
to
all
memory
locations
and
allows
the
user
to
begin
program
execution
at
any
desired
point
in
memory.
This
program
is
known
as
UT2.
Capability
is
provided
to
load
a
program
from
an
external
source
such
as
the
Teletype
keyboard,
a
paper
tape,
or
a
timeshare
system.
Tapes
can
be
punched
and
used
subse~uently
to
reload
memory. The
various
operations
are
executed
through
the
Microkit
terminal,
using
three
basic
commands
--
"?M"
to
read
from
memory
and/or
to
punch
a
reloadable
paper
tape,
"!M"
to
modify
memory
contents
or
to
load
a
program
into
it,
and
"$P"
to
"proceed".
with
program
execution.
In
general,
after
the
kit
has
been
RESET,
the
user
has
two
choices:
pushing
RUN
PROGRAM
begins
execution
of
his
pro-
gram
at
location
0001,
while
pushing
RUN
UTILITY
begins
execution
of
UT2
(at
8001).
After
depressing
RUN
UTILITY,
the
user
next
types
either
a
LF
(line
feed)
or
a
CR
(carriage
return),
depending
upon
his
installation.
The
latter
is
used
for
FULL
DUPLEX,
the
former
for
llALF
DUPLEX.
Besides
establishing
the
need
to
echo,
UT2
uses
this
input
to
cal-
culate
the
timing
parameters
necessary
to
run
the
terminal,
thus
allowing
a
single
program
to
operate
with
wide
vari-
ations
in
clock
speed
or
terminal
speed.
When
UT2
is
ready
to
accept
acommand,
it
types
out
a
prompt
character
--
*.
To
interrogate
memory,
the
user
types
acommand
such
as
?M2FS
3
terminating
with
the
"CR"
--
carriage
return.
UT2
will
respond
by
printing
out
the
contents
of
memory
beginning
at
location
02FS,
printing
three
bytes
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
ending
in
semicolons.
The
user
may
enter
any
number
of
digits
to
specify
the
beginning
location
(leading
zeroes
are
implied,
if
necessary).
If
there
are
more
than
four,
then
only
the
last
four
are
used.
The
count
of
bytes
to
be
typed
out
is
in
hex.
Again,
if
more
than
four
digits
are
entered,
only
the
last
four
are
used.
This
feature
allows
the
user
to
correct
a
mistake.
He
simply
keeps
typing,
putting
in
the
correct
4-digit
values
(230024=24).
When
the
user
wants
to
punch
a
reloadable
paper
tape,
he
requests
amemory
type-out,
but
before
returning
the
carriage,
he
turns
on
his
tape
punch
and
punches
several
null
characters
as
a
header
for
the
tape
(using
the
REPEAT
key
and
CONTROL-
SHIFT-P).
UT2
will
ignore
the
nulls.
The
resulting
tape
can
be
used
with
the
!M
to
load
memory.
- 8 -

INTRODUCTION
TO
UTILITY
PACKAGE
-
UT2
(cont'd)
In
general,
to
enter
data
into
memory,
the
user
types
acommand
such
as
!M12F
434F534D4l43
which
enters
six
bytes
(two
hex
digits
each)
into
memory
beginning
at
location
l2F.
This
command
is
normally
ter-
minated
by a
CR.
Once
again,
the
starting
location
is
determined
by
the
last
four
digits
entered.
Data
is
en-
tered
into
memory
after
each
two
hex
digits
are
typed.
If
the
user
types
an
odd number
of
digits,
then
the
last
digit
is
ignored,
and
an
error
message
is
typed
out
('?').
This
command
provides
two
options
to
facilitate
memory
loads.
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
the
user
must
type
his
own
CR-LF
[carriage
return-line
feed]
to
begin
anew
line.)
Example:
!M23
56789ABC,
DEF0123456,
3047
enters
11
successive
bytes.
Between
successive
hex
pairs
while
data
is
being
entered,
any
non-hex
character
except
the
comma
(and
semicolon,
as
will
be
discussed)
is
ignored.
This
permits
arbitrary
LF's,
spaces
(for
readability),
nulls
(generated
by
the
utility
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
(and
aCR). 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
initial
"!M"
omitted.
This
option
provides
the
mechanism
for
reading
in
a
paper
tape
previously
punched
out
using
the
1M
command.
(Recall
the
format
of
multi-line
?M
outputs
as
discussed
earlier.)
The
user
types
in
"!M",
positions
the
paper
tape
in
its
header
section,
and
hits
TAPE
READ.
(The
utility
ignores
all
non-hex
characters
following
1M,
which
allows
the
CR,
LF
and
nulls
to
be
input
from
the
Teletype
without
disturbing
the
!M
command.)
Notice
also
that
the
semicolon
feature
on
input
allows
non-contiguous
memory
areas
to
be
loaded.
- 9 -
",

INTRODUCTION
TO
UTILITY
PACKAGE
-
UTZ
(cont'd)
The
third
utility
command
is
$P.
For
example
$P6C
starts
execution
at
location
6C
with
RO
as
the
program
counter*
(after
the
user
hits
CR
and
the
utility
program
provides
a
LF).
The
last-four-digits-in
rule
(pplies
to
the
address
typed
in.
In
summary,
the
user
has
the
following
options
after
the
prompt
character,
*.
He
may
type
?M[address]6[count]~
!M[non-hex]
[address]6[data]
[optional
,or;]~
(where
"data"
may
have
imbedded
non-hex
digits
between
each
hex
pair)
~
or
$P[address]CR
UTZ
ignores
initial
characters
until
it
detects
?,
!,
or
$.
Then,
inputs
which
are
not
compatible
with
the
above
for-
mats
will
result
in
an
error
message.
*$P
always
begins
with
RO
as
program
counter.
This
is
consistent
with
the
fact
that
p=o
after
the
COS~~C
CPU
is
RESET.
-10
-

INTRODUCTION
TO
UTILITY
PACKAGE
-
UTZ
(cont'd)
We
present
below
a
further
detailed
summary
of
in-
structions
for
use
of
UTZ,
repeating
the
information
just
presented
in
amore
concise
form.
1.
After
hitting
"RUN
UTILITY",
hit
either
CR
or
LF:
a.
For
Half
Duplex,
hit
LF.
b.
For
Full
Dupl~x.!hit·CR.
(This
sets
up
the
bit-serial
timing
and
specifies
echo
or
not.)
Z.
VTZ
will
return
*
as
a
prompt.
3.
Following
*,
VTZ
ignores
all
characters
until
one
of
?,
$,
or
!
is
typed
in.
Then:
4.
Following?
or
!
must
be
M.
Then
VTZ
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.
a.
For?M
addr
6 a
hex
count
must
follow
(again,
only
the
last
four
digits
are
kept),
and
the
command
is
terminated
by CR.
b.
For!M
addr
6
data
must
follow.
An
even
number
of
hex
dIgIts
IS
required.
Before
each
hex
pair
ar-
bitrary
garbage
is
allowed,
except
for
a
CR,
comma,
or
semicolon.
CR
terminates
the
command,
unless
immediately
preceded
by
comma
or
generally
preceded
by a
semicolon.
i.
In
case
of
comma
CR
the
user
should
insert
his
own
LF,
and
uTz
continues
to
accept
data.
This
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
again
should
provide
LF,
and
VTZ
continues
as
if
he
had
begun
anew command
with
!M
--
i.e.,
optional
garbage,
then
a
starting
address
must
follow,
then
a
space,
and
then
data.
iii.
The!M
command
can
use
as
many
continuation
lines
as
needed,
mixed
between
the
two
types
if
desired,
and
finally
terminating
with
a
CR
not
preceded
by
comma
or
semicolon.
S.
Following
$
must
be
P,
and
then
the
starting
address
(last
four
digits
used
if
more
than
four
typed
in).
(If
no
address
is
entered,
0
is
assumed.)
Program
execution
begins
at
this
location
using
RO
as
program
counter.
-
11
-

INTRODUCTION
TO
UTILITY
PACKAGE
-
UT2
(cont'd)
6.
When
a
!M
or
?M
command
is
accepted
and
completed,
UT2
types
another
prompt
chracter.
7.
When
UT2
sees
bad
syntax,
it
types
back
a?
and
returns
the
carriage.
If
a
mistake
is
maGe
when
entering
data
(by
typing
an
odd number
of
digits),
all
data
will
have
been
entered
except
the
last
hex
digit.
Note
that
the
"only-last-four
digits"
rule
allows
correction
of
an
error
without
retyping
the
whole
command.
(For
example,
a
mistaken
234
can
be
corrected
by
continuing
2340235=0235.)
A
bad
command
can
be
aborted
by
typing
any
illegal
character
(except
following
!M
or
?M
or
between
input
hex
digit
data
pairs
--
in
these
cases
type
any
hex
digit
and
then,
for
example,
a
period).
8.
To
punch
reloadable
paper
tape,
type
?M
addr
6
count,
then
a
header
of
nulls
(control-shift-P,
19nored
completely
by UT2),
then
CR.
When
it's
done,
punch
some more
nulls.
9.
To
load
such
a
paper
tape,
type
!M,
position
the
t~pe
reader
in
the
header,
and
turn
on
the
tape
reader.
-
12
-

MACHINE
LANGUAGE
PROGRAMMING
With
an
understanding
of
the
details
of
the
COS~~C
CPU
and
the
material
provided
thus
far,
the
reader
is
pre-
pared
to
begin
using
the
Microkit
in
an
elementary
way.
For
example,
it
is
now
possible
to
understand
and
pos-
sibly
modify
the
time-out
test
program
presented
earlier
in
this
document.
However,
virtually
any
hexadecimal
(machine
language)
test
program
which
the
user
may
want
to
write
will
require
some
I/O
facilities
(e.g.,
use
of
the
I/O
typewriter).
In
this
connection,
we
present
here
some
initial
examples
of
how
internal
features
of
UT2
can
be
utilized
to
reduce
the
user's
programming
burden.
Amore
detailed
description
of
the
calling
se-
quences
of
the
various
UT2
routines
which
may
be
of
use
to
the
user
are
provided
later.
To
read
a
character
from
the
I/O
typewriter,
the
user
program
should
transfer
control
to
READ*
(in
UT2),
at
location
813E,
making
sure
that
R2
is
pointing
at
a
free
RAM
location
(say,
0000).
After
the
typed
character
is
read,
the
UT2
routine
will
return
by
setting
P
to
5,
i.e.,
by
executing
the
instruction
D5
(making
it
most
convenient
if
the
P
of
the
calling
routine
were
5
to
begin
with).
The ASCII
code
for
the
input
character
(with
aa
parity
bit)
will
be
in
RF.I
and
also
in
D.
The memory
location
pointed
at
by
R2
as
well
as
registers
RE, RF, X
and
DF
will
have
been
changed
in
value
(not
preserved
over
the
call).
The
READ
routine
normally
uses
R3
as
its
program
counter,
so
it
is
most
convenient
to
branch
to
READ
via
a
D3
instruction.
R3.0
will
also
return
with
a
modified
value.
All
other
register
contents
will
not
be
changed
by
the
call.
Since
the
READ
routine
uses
the
values
in
registers
RC
and
RE
which
it
has
previously
initialized,
it
is
essential
that
the
user
refrain
from
using
these
registers.
To
cause
a
character
to
be
typed
onto
the
I/O
typewriter,
the
user
program
should
transfer
control,
to
TYPE5D
(in
UT2),
at
location
8l9C,
via
a
D3
instruction~
again
making
sure
that
R2
is
pointing
at
a
free
RAM
location.
As
discussed
earlier,
the
calling
P
value
should
be
5
and,
for
this
case,
the
ASCII
code
for
the
output
character
should
be
an
immediate
byte
(i.e.,
the
byte
after
the
D3
call).
After
typing
the
character,
UT2
will
advance
R5
past
the
argument
byte
and
again
return
vi~
a
D5
execution.
M(R2),
as
well
as
registers
RE, RF,
X,
D,
DF
and
R3.0
will
return
altered.
All
other
register
values
will
be
preserved.
(For
the
reasons
mentioned
earlier,
the
user
should
again
refrain
from
using
registers
RC
and
RE.)
*A
list
of
key
UT2
symbolic
locations
and
their
corresponding
absolute
memory
addresses
appears
in
Table
2on
p.30,
where
UT2
calling
sequences
are
discussed
in
greater
detail.
-13 -

MACHINE
LANGUAGE
PROGRAMMING
(cont'd)
The
instructions
given
above
are
examples
of
UTZ
"calling
sequences".
Only
the
simplest
information
sufficient
to
get
the
user
started
in
some
elementary
coding
has
been
presented
here.
To
intelligently
use
all
of
the
facilities
available
from
UTZ,
a
programmer
should
be
familiar
with
the
details
provided
n
pp.Z6-3l
("UTZ
Features
and
Calling
Sequences").
In
particular,
the
TYPE
linkage
described
above
is
not
necessarily
the
best
to
use.
Other
TYPE
linkages
which
result
in
a
higher
output
rate
and
which
use
arguments
passed
via
registers
are
discussed
in
the
section
cited
above.
Given
the
ability
to
execute
simple
typewriter
I/O
functions,
the
user
is
now
able
to
code
elementary
test
programs
to
further
exercise
the
Microkit.
As
a
simple
example,
consider
the
routine
described
in
the
COS~~C
Microprocessor
Manual
(p.40)
to
read
two
bytes,
compare
them
and
output
the
"larger"
of
the
two.
The
routine
given
there
must
be
modified
to
exhibit
register
usage
compatible
with
the
UTZ
READ
and
TYPE
calling
sequences.
Further,
the
I/O
instructions
of
that
program
must
be
replaced
with
calls
to
the
appropriate
UTZ
typewriter
interface
routines.
Figure
Z,
below,
gives
an
example
of
this
program
appropriately
modified.
-
14
-
Other manuals for COSMAC
1
Table of contents
Popular Microcontroller manuals by other brands

Conexant
Conexant AudioSmart quick start guide

Freescale Semiconductor
Freescale Semiconductor MC9S12DJ128E user guide

GOWIN
GOWIN DK Motor GW2A-LV55PG484C8I7 V3.0 user guide

STMicroelectronics
STMicroelectronics STM32F031F4 manual

HYCON
HYCON HY17M26 Series user manual

Ultrahaptics
Ultrahaptics STRATOSTM INSPIRE user manual