Академический Документы
Профессиональный Документы
Культура Документы
COSMAC MICROPROCESSOR
D. B l o c k
Boon
Johnson
Nizet
Paradise
Pintaske
Shand
Strahler
H. T w e d d l e
PAGE
I n t r o d u c t i on
1 List of 1800 series devices
3 S p e c i a l i t i e s about 1800 series
4 Short d e s c r i p t i o n of CDP1802 CMOS m i c r o p r o c e s s o r
12 COSMAC i n s t r u c t i o n set
14 Static - What does it mean for your design
21 Oscillator design considerations
25 A m i n i m u m system
27 M i n i m u m CDP1802 key or switc h scan system
31 DMA-input - To read a paper tape
33 D M A - o u t p u t - Check the memory
34 I n t e r r u p t m e c h a n i s m in the CDP1802
38 8 l e v e l i n t e r r u p t v e c t o r i n g scheme
40 CDP1863 as a baud rate generator for the
CDP1854 UART
42 Synchronous s e r i a l o u t p u t for the CDP1802
44 I n t e r f a c i n g two C O S M A C systems u s i n g CDP1854 UART
46 Understanding the CDP1855 MDU
58 U s i n g the MDU
63 Memory m a p p i n g t h e M D U
64 Faster M D U t h r o u g h p u t u s i n g "DMA M E T H O D "
69 D i g i t a l filter u s i n g the CDP1855
73 M u l t i p l e i n t e r r u p t w i t h CDP1851
79 V I S - A c o m p l e t e v i d e o interfac e system
97 CDP1802 m i c r o p r o c e s s o r s in t e l e p h o n e s
101 Minimum i n t e l l i g e nt telephone
102 16 bit o u t p u t
103 LED interface
105 D-A c o n v e r t e r
106 A-D converter
108 CA3162 - a three d i g i t A/D interface for COSMAC
CONTENTS (cont'd) - (2) INTRODUCTION
PAGE
New and i n t e g r a t e d ci rcui ts, particularly m i c r o p r o c e s s o r s ,
are often t h o u g h t d i f f i c u l t to u n d e r s t a n d . T h i s is a
111 S i m p l e control interface for CDP1802
myth, not true, they are c o m p l e x but not d i f f i c u l t to
115 U n d e r s t a n d i n g the CDP1851 p r o g r a m m a b l e PIO
u n d e r s t a n d as they operate in a l o g i c a l way. Understan-
130 Subroutine programming techniques
d i n g m i c r o p r o c e s s o r s does r e q u i r e study, e x p l a n a t i o n s
138 Interpretive programming
and g u i d e l i n e s and the purpose of t h i s book is to p r o v i d e
140 Macro for BCD to b i n a r y c o n v e r s i o n
such i n f o r m a t i o n t o h e l p y o u become r e a l l y f a m i l i a r w i t h
141 D e t a i l e d program : a traffic light
these d e v i c e s and e s p e c i a l l y the CDP1802, a CMOS m i c r o -
148 Character search r o u t i n e
proces sor.
150 Memory move r o u t i n e
152 Data bus c o n t e n t i o n
Happy r e a d i n g a n d good l u c k .
153 W a t c h dog
154 UT4 ROM m o n i t o r program
174 O u t p u t r o u t i n e u s i n g UT4
177 I n t e r r u p t entry and e x i t
RCA A p p l i c a t i o n s T e a m - Europe.
181 Cassette i n t e r f a c e u s i n g UT4
183 Real t i m e c l o c k w i t h o u t h a r d w a r e
186 PROM p r o g r a m m e r for CDP18U42
191 CDP1802 system w i t h o u t RAM
193 D e b u g g i n g aid
O p t i m i z e a d d r e s s i n g modes
CDP 1869 CMOS V i d e o interface a d d r e s s and sound
CDP 1870 CMOS Arithmetic on program counters
V i d e o interface color generator
CDP 1871 CMOS A S C I I keyboard encoder S e v e r a l stack p o i n t e r s
M u l t i p l e data p o i n t e r s
CDP 1872 CMOS I n p u t port h i g h speed
CDP 1873 CMOS Some p r o g r a m c o u n t e r s for fast s u b r o u t i n e response
1 of 8 binary decoder h i g h speed
CDP 1874 CMOS Input port h i g h speed Easy to i m p l e m e n t interpreters
CDP 1875 CMOS O u t p u t port h i g h speed
S p e c i a l "macro i n s t r u c t i o n s " p o s s i b l e
7. The i n s t r u c t i o n to be executed is 8 bit l o n g ; 4 bit are 14. Interrupt is a needed feature, but the p r o b l e m is to define
N d e f i n i t i o n and the other 4 bit are the i n s t r u c t i o n , being how m u c h to put on the c h i p . The easiest way is to have one
l o a d e d i n t o an I register. l i n e w i t h a very fast response and to o p t i m i s e e x t e r n a l l y
with additional hardware, for example using the EF l i n e s to
8. The d i s a d v a n t a g e of always d e f i n i n g a register c o u l d be d i s t i n g u i s h between 4 interrupts for a less c o m p l e x system
overcome by d e f i n i n g and X-regi ster w i t h s p e c i a l i n s t r u c - already.
t i o n s u s i n g t h i s d e s i g n a t o r . T h i s X can be changed as
needed d u r i n g program flow.
19. T h i s structure leads to an i n c l u d e d DMA channel. As
15. The P register definition allows easily to have a fast the I/O transfer is directly to memory (or from),
interrupt response. This instruction is modified and register 0 is used to point to a memory location, and
a u t o m a t i c a l l y puts 1 in the P-register and 2 in the X- the DMA channe l works both ways (input and output).
register, then starting program execution from the loca-
tion where Rl p o i n t s to. U s i n g cycle s t e a l i n g , an S2 (DMA) cycle is inserted
between normal fetch and execution. DMA-IN means that the
16. To a l l o w or not a l l o w an i n t e r r u p t a l E - f 1 i p - f 1 op is byte on the data bus is stored at the location where
needed (interrupt enable). R0 points to and the pointer is incremented to be pre-
pared for the next DMA-IN. DMA-OUT takes the byte where
17. The very fast interrupt response changes the program R0 points to and puts it on the data bus to be stored
counter to 1 but it has to be remembered somehow, how X and in an output part, incrementing i t s e l f after the trans-
P were before the interrupt. This is done via the T- fer.
register. If an interrupt occurs, the contents of X,
P is automatically transferred into the T register, before (The DMA output feature is used together with the video
b e i n g changed to 2, 1. c o n t r o l l e r s CDP1861, CDP1864).
A save of the T-register on stack is n o r m a l l y the first 20. As all these l i n e s together add up to more than 40 l i n e s ,
instruction of the interrupt program. a reduction has to be made. The 16 l i n e s of the
address bus can be reduced to 8 l i n e s by s e n d i n g out
18. A Microprocessor has to communicate via I/O parts. If the the h i g h byte together w i t h a reference p u l s e and then
ports are in memory, even for a m i n i m u m system, d e c o d i n g the 1ow byte.
l o g i c is needed; as w e l l the transfer has to go through
the CPU (as it can only address one d e v i c e at the same T h i s s e q u e n t i a l addressing leads to the p o s s i b i l i t y of
time (memory - CPU - I/O). W i t h some s p e c i a l I/O l i n e s internal ROM address selection. As the w h o l e address
t h i s can be overcome and a direct transfer from memory to is on the address b u s , the h i g h byte can be l a t c h ed in
I/O is p o s s i b l e w i t h o u t i n v o l v i n g the CPU, except for the ROM and decoded. T h i s a l l o w s a 64K ROM system
addressing. Three lines (N0, Nl, N2) can address up to without any external decoding l o g i c . The mask for the
8 devices (8 x IN, 8 x OUT). For a s m a l l system 3 I/O on c h i p d e c o d i n g l o g i c defines the address area of each
devices can be selected d i r e c t l y , even w i t h o u t a d d i t i o n a l ROM.
logic.
F i g u r e 1 shows the p i n o u t of the CDP1802 and figure 4 the
internal structure. One a d v a n t a g e of t h i s Microprocessor is its f l e x i b i l i t y of
c h a n g i n g pointers and program counters w i t h just one instruc -
Some of the pin f u n c t i o n s need further e x p l a n a t i o n s : tion.
CLOCK (1) and )<TAL (39) form a crystal generator gate H i g h or low o p e r a t i n g speed is only dependent on the a p p l i -
TOTT (2) and CTTO (3) d e f i n e the mode of the CPU cation. As t h i s M i c r o p r o c e s s o r is d e s i g n e d in static CMOS
RUN is the normal mode of the CPU l o g i c , the user sets the clock frequency(up to 6.4MHz for
2. PAUSE means freeze the C P U , for e x a m p l e for slow e x a m p l e ) . But the low current c o n s u m p t i o n at low frequen-
memories or lower power consumption. cies m i g h t a l s o be important. This processor can e a s i l y
3. RESET to h a v e a defined start c o n d i t i o n modify its own c l o c k frequency, for e x a m p l e u s i n g the Q
(R(3 = 0000, X = 0, P = 0, Q = 0, IE = 1) output to decide between two clock frequencie s w i t h some
4. LOAD uses the DMA c h a n n e l to load data, but external d e v i c e s .
s t o p p i n g program e x e c u t i o n .
Q (4) is the f l i p - f l op under program control Figure 5 shows a b l o c k d i a g r a m of a CDP1802 system. Figure
SCI (5), SCO (6) represent the state of the CPU (See F i g . 3) 6 g i v e s the t i m i n g r e l a t i o n s .
MRD (7) memory read output
BUS 0-7 (8-15) - the data bus A p p e n d i x A shows the instruction set of the CDP1802.
VC|- (16) I/O v o l t a g e , separated from i n t e r n a l v o l t a g e V D D
N0-N2 (17-19) I/O address l i n e s For more information about CDP1802, see data sheet of CDP1802
or MPM201 user m a n u a l .
'SS (20) g r o u n d
["-rF~4 (21-24) i n p u t flag l i n e s to be tested under program
control
MAO-7 (25-32) m u l t i p l e x e d address bus
TPB (33) reference p u l s e for I/O transfer
TPA (34) reference p u l s e for h i g h order address byte
M W R (35) memory write
INT (36) i n t e r r u p t request l i n e
DMA OUT (37) DMA output p u l s e to get a byte from memory,
pointed to by R0
DMA I'M (38) DMA i n p u t p u l s e to store a byte into memory
pointed to by R0
'DD to (40) internal processor voltage, can be h i g h e r or e q u a l
work at h i g h e r frequency.
<CC
10
CLEAR WAIT MODE
11
L L Load
L H Reset CDP1802
H L Pause
H H Run Timing
Diagram
F i g u r e 2 : CDP1802 m o d e s
MAI MA3 MAS MAT CLEAR I XTAL CLOCK I TFT I ~ff4 W STERRuPtaJT SCO Sc
"5MA~
REQUEST
EF I-4
Figure 4 :
Internal Structure
of the CDP1802
Mi croprocessor
NOTES'
I. THIS TIMING DIAGRAM IS USED TO SHOW SIGNAL RELATIONSHIPS
ONLY AND DOES NOT REPRESENT ANY SPECIFIC MACHINE CYCLE
CDP1802 INSTRUCTION EXECUTION TIMES 2-Byte instructions also require 2 Machine Cycles: 1 Fetch,
1 Execute.
1-Byte instructions require 2 Machine Cycles: 1 Fetch, 3-Byte instructions require 3 Machine Cycles: 1 Fetch,
1 Execute. 2 Executes.
Typical CDP1800
System Figure 6 : CDP1802 T i m i n g Diagram
12 13
In order to better u n d e r s t a n d the i n s t r u c t i o n set of the 5. Branches are always w i t h i n a page , means they are a b s o l u t e ,
CDP1802, some e x p l a n a t i o n s are necessary (see APR. A) : it is not p o s s i b l e to branch over page boundaries.
1. As the CDP1802 has 16 registers, many i n s t r u c t i o n s exist 6. For jumps o u t s i d e a p a g e , l o n g b r a n c h e s are used.
16 t i m e s , for e x a m p l e the first i n s t r u c t i o n 0N means LOAD
via N, w i t h N = O...F. T h i s means that one of the 16 regis- 7. A s p e c i a l control i n s t r u c t i o n is IDL. T h i s stops the
ters (N) is used as pointe r (16 b i t ) to memory and the infor- program counter and it waits for DMA or I N T E R R U P T .
m a t i o n (data) at t h i s l o c a t i o n is loaded i n t o the D - r e g i s t e r .
T h i s "N" is v a l i d for 10 i n s t r u c t i o n s and so uses already 160 8. I/O transfer is always between memory and I/O, t h i s means :
of the 256 p o s s i b l e op-codes.
a) I n i t i a l i z e memory pointer
2. A second type of instructions is referenced to r e g i s t e r X. b) Set X to t h i s register
73 means STXD (store via X and decrement). Here the 4 bit c) O u t p u t or i n p u t
X - d e s i g n a t o r (0-F) p o i n t s to one of the 16 registers. The
contents of t h i s r e g i s t e r (16 b i t ) p o i n t s to one of the 65K 9. For further e x p l a n a t i o n s , see MPM-201 user m a n u a l .
addresses. At this location, the information of the D-
register is stored and afterwards t h i s r e g i s t e r is automa-
t i c a l l y decremented (stack o p e r a t i o n s ) to p o i n t a g a i n to a
free 1 o c a t i on.
T h i s g i v e s e a s y - t o - u s e counters :
a) I n i t i a l i z e regi ster
b) Decrement r e g i s t e r
c) Take h a l f of it i n D
d) Is it 00 ?
e) If 00 e x i t , if not back to decrement
CLOCK
INPUT A EF1
EF2
COSMAC OUT
INPUT B CLOCK CLOCK SYSTEM _n
REGULATION
DMA OUT
OUT 'B1
F i g u r e 1 : C O S M A C System R e g u l a t e d by C h a n g i n g C l o c k F i g u r e 2 : A u t o m a t i c Software C o u n t e r
I n t i m i n g a p p l i c a t i o n s t h e t e c h n i q u e is u s e f u l d u e t o C O S M A C ' S
i n s t r u c t i o n set - the majority of i n s t r u c t i o n s are two m a c h i n e
cycles 1 o n g . * After reset R0 is p r o g r a m counter and DMA pointer.
r CS1
Static c o n s u m p t i o n
The m a i n a d v a n t a g e of a static Microprocessor system however
i s i n power s a v i n g , i n power c r i t i c a l a p p l i c a t i o n s . AT 5V (max.) AT 2V (data re
The COSMAC range of Microprocesso r components can be incorpo- OSCILLATOR D E S I G N C O N S I D E R A T I O N S FOR THE CDP1802
rated in d e s i g n s u s i n g the t e c h n i q u e s a b o v e due to static pro-
perties of CMOS g i v i n g the Microprocessor user, in a d d i t i o n
Despite the w i d e s p r e a d use of crystal-control led o s c i l l a t o r s
to other CMOS features, an extremely powerful d e s i g n t o o l .
for Microprocessors, crystal selection may s t i l l pose pro-
b l e m s for many d e s i g n e r s . Most of these p r o b l e m s can be m i n i -
These' a d v a n t a g e s of the COSMAC f a m i l y h a v e led to its usage in
mized by an u n d e r s t a n d i n g of the v a r i o u s properties and speci -
many f i e l d s of M i c r o p r o c e s s o r a p p l i c a t i o n s - p o r t a b l e e q u i p - fications needed to define an o s c i l l a t o r c i r c u i t for the CDP1802
m e n t , fire hazard e q u i p m e n t , telecoms and a u t o m o t i v e - where
Microprocessor.
it is very s u c c e s s f u l in a p p l i c a t i o n s s u c h as i g n i t i o n c o n t r o l ,
i n f o r m a t i o n systems, t r a n s m i s s i o n control etc...
Clock frequency and accuracy
The o s c i l l a t o r circuit
f
\ citors C<- and C T p r o v i d e the r e q u i r e d c a p a c i t i v e l o a d i n g for
Figure 6 :
ROM CDP
ClEAT I D L E System S t o p p i n g
1802 the C l o c k 'u -
fll*1
1—1
« 1
Q Q N0
S •fr/f
R -J 1 4 «
1-
STAR T
I 1 k>J
&T* CDP1802
F i g u r e l : B a s i c Crystal O s c i l l a t o r
23
22
+ V DD
the crystal and act as high-frequency filters to avoid overtone CD4093
o s c i l l a t i o n s . The v a l u e s of C$ and CT can be calculated using Figure 3 :
the f o l l o w i n g equations found in ICAN-6086 : CD4093 as
4C, Cl ock O s c i 1 1 a t o r
and
- 5f
4C,
CS =
5f
LC type -- A p a r a l l e i - r e s o n a n t LC c i r c u i t may be used as the
R g is the e q u i v a l e n t resistance of the crystal. F i g u re 2 frequency d e t e r m i n i n g network for the CDP1802. (See F i g u r e 4)
shows the a p p r o x i m a t e r e l a t i o n of R g to frequency for AT The frequency and component v a l u e s have the f o l l o w i n g r e l a t i o n -
type crystals. ship :
„
Figure 2 :
E q u i v a l e n t Resistance
Versus Frequency
I ><
1 Y"..
CDP1802 Cl
^
CDP1802
FREQUENCY MHZ
~- T
A M I N I M U M SYSTEM
Crystal s p e c i f i c a t i o n s :
1
M;
OH
i
TPA —» A0.1 CDP1866
BYTE ")( LOW BYTE MEMORY ADDRESS
TPA
EF2 8 9
MINIMUM SYSTEM CIRCUIT DIAGRAM A B
Hardware for
EF3 4 5 6 7 Keyboard
Scan Matrix
EF4
0 1 2 3
28 29
scan software - flow chart
Key
I t i s p o s s i b l e b y u s i n g t h i s t e c h n i q u e , together w i t h some
16 scratch pad r e g i s t e r s as data storage of the 1802, to
construct a two c h i p s o l u t i o n for s i m p l e key or switch scan
a n d s e r i a l o u t p u t a p p l i c a t i o n , such a s remote p o r t a b l e data ,
control & m o n i t o r systems.
REPEAT
FOR ALL
KEY COLUMNS
(FLAG INPUTS)
where.
30
31
STATES SO SI SO SI j'sz SO SI
MEMORY
\^
MRD CPU
CDP1802 /2CD1013
D ••— V DD
L_
, '
v—
MIRIQ
-1 v
<£= i .
DATA B U S 0 7
STATES | SO | SI | SO 5 1 S O SI
I N T E R R U P T M E C H A N I S M IN THE CDP1802
tne i n t e r r u p t occurs, Rl is p r o g r a m counter and R2
x pointer. As t h i s r o u t i n e does not know if the stack
empty, at first it is decremented. A l l register s
The i n t e r r u p t m e c h a n i s m p e r m i t s an external s i g n a l to e e d e d , and only w h at is n e e d e d , i s saved (R7 m i g h t not be
interrupt normal program execution and transfer control necessary) and Q is set. There is a shorter v e r s i o n of
to a program d e s i g n e d to h a n d l e the i n t e r r u p t c o n d i t i o n .
t h i s program.
T h i s f u n c t i o n is e s p e c i a l l y needed at power down to save
data into the battery b a c k u p RAM or to respond very q u i c k l y
E X I T : RET
to an e x c e p t i o n a l event.
E N T R Y : DEC R2
SAV
Here the structure of the CDP1802 shows its a d v a n t a g e s . In
SEQ
its i n s t r u c t i o n set e x i s t s the SEP i n s t r u c t i o n to c h a n g e
BR E X I T
from the current program counter r e g i s t e r to any other.
T h i s i n s t r u c t i o n is just m o d i f i e d and g i v e s a very fast The reason for h a v i n g t h i s RET i n s t r u c t i o n in front of the
response. For an i n t e r r u p t , it is a SEP 1 i n s t r u c t i o n . rest of the p r o g r a m g i v e s the a d v a n t a g e that after the return
So a u t o m a t i c a l l y , register 1 becomes the new program t h i s r o u t i n e i s ready t o b e executed w i t h o u t b e i n g i n i t i a l i z e d
counter and registe r 2 stack p o i n t e r ; the next instruction again. The same k i n d of s u b r o u t i n e is used in SEP t e c h n i q u e .
is fetched from the location where Rl points to.
To t o g g l e the i n t e r r u p t e n a b l e f l i p f l o p , the RET and DIS
As the i n t e r r u p t program w o u l d not know w h i c h r e g i s t e r was
i n s t r u c t i o n are used.
the PC of the i n t e r r u p t e d p r o g r a m , the v a l u e s of X and P
are a u t o m a t i c a l l y s a v e d in a T-register and further inter- IE = 0 (means, i n t e r r u p t s are d i s a b l e d )
For e x a m p l e
rupts are i n h i b i t e d (interrupt e n a b l e is reset).
P = 1
X = 2
The first two i n s t r u c t i o n s of the i n t e r r u p t program normally
save the T-register on the stack and the D - r e g i s t e r as w e l l .
The sequence
—-L/
INTERRUPT
000b F801A15 0013 LDI 801; PLO R1 .REGISTER R1=0401
t
SC1
ACKNOWLEDGE
0008 F840B2; 0014 LDI 840; PHI R2 .AND AS UEI..L 'IHE
000B F8FFA2! 001S LDI 8EE; Pit) R2 .STACKPTR FOR IT
000E 7000; 0016 RET , 800 .ENABLE INTERRUPTS
0010 ; 0017
0010 7A; 0018 START: RED .RESET 0
0011 00; 001V IDE .UAH FUR INTERRUPT
0012 7B; 0020 Bt'tl .SEC (J
0013 00; 0021 IDE .WAIT FOP, INTERRUPT
0014 3014; 0022 STOP: BR SI OP .UA11 FOR RESET
0016 0023
0016 0024
0016 002B ..INiERRUPl ROUTINE
0016 0026
0016 0027 ORG 804H0
TYPICAL CIRCUIT FOR IMPLEMENTATION OF INTERRUPT OPERATION 0400 70; 0028 EXIT: REf .REHIRN II! MAIM
0401 22', 002V ENTRY: DEC R2 .PUINl 'ID FREE RAM
0402 78; 003('i SAV .SAVE 'I REGIS'I'ER
0403 22; 003'i DEC R2 .DECREMENT PUlN'lER
0404 73; 0032 S'l XD .SAVE D REGISTER
040b 76; 6033 SHRC • GET DE IN 1!
H406 73; 0034 SI XI) .AND SHIRE AUAY
0407 8773; BBSS GLII R7; SI XI) .SAVE REBIS'IFR R7
040V V7735 0036 GH1 K71 STXi)
040B ; 0037 H. .AND (JTHERS
040B ; 0033 .IF NEEDED
040B 7B; 803V SEW .SEI (J TO SHOU
040C ; 0040 .INTERRUPT HAPPENED
040C ; 0041 .START REST ORINO
040C 12", 0042 INC R2 .INCREMENT S'lACKPTR
040D 42B7! 0043 LDA R2; PHI R7 .(jET R7 BACK
040F 42A75 0044 LDA R2; PLO R7
0411 42FE1 004S LDA R2; SHI. .AS UELL DE
M413 42; 0046 LDA R2 .AND D
1414 3060; 0047 BR EXIT .BRANCH 10 EXIT
0416 ; 0048 END
0000
38 39
The more powerful I/O devices in the 1800 series, such DIS .. s w i t c h to service routine
INTGO
as the 1851 PIO and the 1854A UART, have i n t e r n a l inter- DEC 2 ; SAV .. p u s h X and P
ENTRY
rupt request latches and m a s k i n g l o g i c , w h i c h are under DEC 2 ; STXD .. p u s h D
software control. Therefore most m u l t i - l e v e l interrupt INP V E C T O R .. vector carries register number
tasks can be i m p l e m e n t e d efficiently without the need for BR INTGO .. p r e p a r e for next i n t e r r u p t
a sophisticated interrupt c o n t r o l l e r : a s i m p l e priority
encoder w i l l do the job. T h e h o u s e k e e p i n g software i s m i n i m a l . During initialization,
-J-VDO
Rl mus t be i n i t i a l i z e d to the a d d r e s s "ENTRY".
In response to the i n t e r r u p t the r o u t i n e f i r s t p u s h e s X, P
--,,- - E,
Eo
IMT
and D into the stack, then i n p u t s the vector code from the
on Am? r, CD4066
4532. After b r a n c h i n g to " I N T G O " to p r e s e r v e the Rl s t a r t i n g
address control is passed to the a p p r o p r i a t e r e g i s t e r via the
"DIS" i n s t r u c t i o n . This leaves interrupts d i s a b l e d to a l l o w
TxGATE the s e r v i c i n g r o u t i n e to c o m p l e t e any further housekeeping
SYNC. PRIORITY
C needed before r e - e n a b l i n g further r e q u e s t s w i t h a "RET".
LATCH ENCODER COP 1802
f
CLK
The software i n p u t s the word INP V E C T O R and it goes a u t o m a -
{
t i c a l l y on the stack .
TPB CK1
OUT
u TC
RC
TPB SD1 DATA IN
All rates are accurate e x c e p t for the 110 v a l u e , w h i c h
is a c t u a l l y 109.091, an error of 0.83%.
References :
I/O Port A s s i g n m e n t s
CDP1854A, d a t a s h e e t , f i l e 1193
OUT 2 Load U A R T t r a n s m i t register CDP1863 d a t a s h e e t , f i l e 1179
OUT 3 Load UART c o n t r o l registe r a p p l i c a t i o n note, ICAN 6632
INP 2 Read UART receive register
INP 3 R e a d U A R T status r e g i s t e r
OUT 4 Load 1863 count v a l u e
42 43
TPB
SEGMENT
CDP1802 N0 •» N?1
DRIVE
DATA BUS TPB CLK
ji ;
*i f
P/S
i
CLK
_ TPB
_
r
n nrv
DATA
Note that the 4011 and 4013 are not c o m p l e t e l y u t i l i z e d
arid the spare h a l v e s may be used to interface a second
4094 w i t h no a d d i t i o n a l components. Note a l s o that the
CD4014B SDO
4094 r e g i s t e r has 3 - s t a t e a b l e o u t p u t s and so may be used
to interface to another d a t a - b u s if r e q u i r e d .
854 k 185' A
RS EL
-E
RSEL
NO-N2 CS 1 CSI
—
NO-N2
'•—
cs 5 CS3
1802 MRO
•f — CS
RO WR
r
SDO SDI TO/WR
C55 -£
wRG
1802
-£
TOT IF- SDI SDO INT
EF 1-4
Tff
FE
PE OE
V
r* '— » CTS
THRE
FE
^1-4
PE/OE
DA cTs •*—
-j »— DA
BUS BUS
:uoc c CLO( K
i T R T
1
L_
BAUD
GENERATOR
^ _
BAUD
GENERATOR
J i
SET 5ET^
D Q -*• D Q 0 D •J
4013 t 013
—• a—
:LK CLK * Q CLK C LK
1 t t t
46 47
U N D E R S T A N D I N G THE CDP1855
. For more I / 0 , t w o l e v e l I/O or memory m a p p i n g . i s used. The X, Y, Z registers are loaded with the operands and
In memory, four memory l o c a t i o n s needed. via the control word the m u l t i p l y or d i v i d e is started.
, M u l t i p l y a l g o r i t h m : s h i f t right and add. At power on the device must be cleared to avoid data
bus problems. This also resets the interna.1 sequence
. D i v i d e a l g o r i t h m : s h i f t l e f t and subtract. counters and the shift p u l s e generator.
. Mul t i p l y time at 5V 5 jjS The first instruction has to load the control register
10V 2 , 5 u S with the number of MDU's to set up internal control l i n e s .
Y Z X Z
|0 1 1 111 1 I oTl C o n t r o l word » 7C
HEX
0 1 6 B 3 C =06 0 3
Y Z —— NOP REMAINDER
Reset registers 363 6 0 0 6 .03 DEC
One MDU
Reset sequence counters
Shift rate = clock frequency
2. Transfer d i v i d e n d 67 7C
Load MSB in Y 66 44
Load LSB in Z 65 ZZ
For d i v e
3. Transfer d i v i s o r in
Load in X 64 XX
4. Start the d i v i s i o n
5. Read results
Read q u o t i e n t in Z 6D ZZ
Read r e m a i n d e r in Y 6E YY
Read status 6F OX
50 51
4. M u l t i p l y operation
1. Reset counters
Specify number of MDU Using 3 MDU' s to multiply 20 IF 7C by 72 3C 0
Reset register
NOP
+ 0 3 in Y
5 0 X 0 6 = 360 + 3 = 363
52 53
Y Z 00 NOP
01 Multiply
10 Di vi de
11 I l l e g a l state
H i g h to reset the register
Number of MDU 00 four
01 three
10 two
§ 1 1 t
11 one
Reset sequence counters
0 shift rate e q u a l s clock frequency
1 one MDU shift clock H- 2 two MDU
Ul shift clock - 4
three or four MDU shift clock - 8
\
E
1U 5
IT &
r1 0 _J
(Figure 2) : Control Register Bit A s s i g n m e n t
2
c. £ <>
rp
:
5p-1-^ 1
L i
C
>
~^
j Status byte |0 0 0 O J O 0 0 X |
Z-REQIS
[ " If an overflow occurs d u r i n g d i v i d e 16 : 8 b i t , overflow = 1
ia
CO
T"
Q.
ONTROL RE Q
(Figure 3) : Status Byte
i U
CE 28 — V DD
CLEAR 27 — CN0
CTL 26 CN 1
MULTIP (TO./5T. -— 2 5 — CI
rt_ — 24 — YR
ZL 23 ZR
3MIFT-— 22 BUS 7
C L K —- 21 1 BUS 6
STB • 20 — aus s
RD/WE : 1 19 • BUS 4
RA2 1 18 — BUS 3
RA 1 ' 1 17 — BUS 2
RA0 • 1 16 • BUS 1
v ss —l 1 15 BUS 8
(Figure 4) : T e r m i n a l A s s i g n m e n t s
CE RA2 RA1 RA0 R/W STB REGISTER FUNCTION X FUNCTION -
0 X X X X X NO ACTION
X 0 X X X X BUS FLOATS
1 1 0 0 1 X X MULTIPLIKATOR DIVISOR 64 "
II
1 1 0 1 1 X Z LSB DIVIDEND 65
'TO MDU
1 1 1 0 1 X Y TO BE ADDED ! MSB D I V I D E N D 66
1 1 1 1 1 X CONTROL 67
1 1 0 0 0 1 X UNCHANGED UNCHANGED 6C "
1 1 0 1 0 1 Z LSB RESULT QUOTIENT 6D
•TO CPU
1 1 1 0 0 1 Y MSB RESULT REMAINDER 6E
1 1 1 1 0 1 STATUS 0000 OOOX 6F
t
1 1 X X 0 0 NO ACTION BUS FLOATS
Low l e v e l
Hi gh level
H i g h or Low l e v e l
(Figure 5) : Control Truth-Table
56 57
0052 8 X 8 DIVISION
0416 0053
8088 0801 8446
0054 USES THE FOLLOWING MEMORY LOCATIONS:
0002 0446
005S 480 DIVIDENT
0088 8883 3P RCA BXL 0146
0056 481 DIVISOR
0084 0446
0057 402 RESULT
8000 8885 0446
0058 403 REMAINDER
8000 8886 DEHOPROGRAH 48SS 0446
0059 404 OVERFLOW
0000 8887 MULTIPLY-DIVIDE-UNrr 0446
0446
0860 ..
0808 0064 OKG 80208
0889 8446
0200 00; 0062 8ACK2: SEP 0
8848 IT COKES BACK TO CDS AT 8885 0204 F804; 0863 LDI 884
8000 TO START UT28 PRESS CCR] 0203 BF; 0064 PHI F
8888 8842 TO UGRK WITH UT24 CHANGE TO LBR 88029 8204 F800; 0865 LDI 880
8843 0206 AF; 0066 PLO F
8814 0207 EE; 8067 SEX E
0000 0845 ORG fl88 0208 677C; 0068 OUT 7.B7C
0888 F801; 8846 LDI »04 020A EF; 0069 SEX F
8882 BE; 0847 PHI E 020B 65; 0878 OUT 5
0883 F801; 0048 LDI 881 020C 64; 0874 OUT 4
8885 AE; 8849 PLO E 0200 EE; 8872 SEX E
8886 6148; 8828 OUT 1,848 .. SET TUO LEVEL 10 020E 6772; 8873 OUT 7,872
8888 DE; 0024 SEP E 0210 EF; 0074 SEX F
8889 C888HS; 0022 LBR 88085 0244 6068; B87S INP 5;IRX
000C 0023 0243 6E60; 0076 INP 6;IRX
080C 0824 0245 6F; 0077 INP 7
000C 0025 MULTIPLY 8 X 8 0246 3008; 8078 BR BACK2
080C 8026 8218 0879 ..
088C 0827 USES THE FOLLOWING MEMORY LOCATIONS: 0248 0880 ..
000C 0028 488 4.mJLTIPLIKANT 0218 0884 .. 16 X 8 DIVISION
000C 0029 401 H.MULTIPLIKANT 8218 0082
800C 8030 402 RESULT HIGH BYTE 8218 0083 USES THE FOLLOWING MEMORY AREA:
900C 0834 403 RESULT LOU BYTE 0248 0084 400 DIVIDENT HIGH BYTE
308C 8832 0218 0085 401 DIVIDENT LOU BYTE
000C 0033 ORG 80400 0248 0086 402 DIVISOR
9108 00; 0034 BACK 4: SEP 0 0248 0087 403 RESULT
0104 F804; 0035 LDI 884 8248 8088 404 REMAINDER
0403 BF; 0036 PHI F 0248 0089 405 OVERFLOW
0104 F800; 0037 LDI B80 8218 0090 ..
0106 AF; 0038 PLQ F 0218 0894 ORG 80380
0107 EE; 0039 SEX E 8300 D0; 0092 BACK3 SEP 0
0108 6770; 0040 OUT 7,870 8301 F884; 8093 LDI 804
010A EF; 0044 SEX 0303 BF; 0894 PHI F
8188 64; 0042 OUT 8304 F800; 0095 LDI 800
010C 65; 0043 OUT S 8306 AF; 0096 PLO
0401) EE; 0844 SEX E 0307 EE; 8097 SEX
018E 6779; 8045 UUT 7,879 8308 677C; 8098 OUT 87C
9118 EF; 0046 SEX F 830A EF; 0099 SEX
0111 6E60; 0047 INP 6;IHX 830B 66; 0103 OUT
0143 6D; 8048 INP 5 838C 65; 0481 OUT
0114 3800; 0049 BR BACK4 830D 64; 0102 OUT
0116 8050 830E EE; 0403 SEX
8116 0054 830F 67/2; 0404 OUT 872
8311 EF; 0405 SEX
8342 6D60; 0106 INP IRX
8314 6E60; 0107 INP :IRX
8316 6F; 0408 INP
8317 3000; 8109 BR BACK3
8319 5 0110
58 59
U S I N G THE MDU
. re i shows the pin c o n n e c t i o n s for u s i n g the 1855 w i t h
the 1802/1804. A s u b r o u t i n e for p e r f o r m i n g an 8 x 8 m u l t i -
COSMAC systems u s i n g the CDP1855 MDU can perform an 8 bit 1 y is l i s t e d in program 2. The o v e r h e a d of r e g i s t e r i n i -
x 8 bit m u l t i p l y in 8% of the m a c h i n e t i m e r e q u i r e d by t ' a l i z i n g is about the same as in the 1st p r o g r a m , h o w e v e r ,
systems u s i n g a software m u l t i p l y a l g o r i t h m . Programs for the actual 13 i n s t r u c t i o n s u b r o u t i n e m u s t be executed o n l y
b o t h m e t h o d s are e x p l a i n e d b e l o w : once since t h e M D U does a l l t h e s h i f t i n g a n d a d d i n g .
YR
Multiply/
Divide Unit
w i t h F9 (11111001). Bit 3 resets register
and the code of 01 on b i t s 1 and 0 cause the m u l t i p l y
Y to zero
C ZL
o p e r a t i on to begi n .
1 1 _J
60 61
5. T h e MDU w i l l a u t o m a t i c a l l y perform t h e 8 x 8 m u l t i -
ply and store the most s i g n i f i c a n t h a l f of the 16 bit
answer in register Y and the lesser significant half PROGRAMJLJ- ASSEMBLY
in the Z register. The time required to perform the M ADDRESS. BYTE PROGRAM COMMENTS
-^v
6. Read the most s i g n i f i c a n t h a l f of the 16 bit answer 0202 DO SEP RO Return to main prog.
0203 F809 LDI 09
from register Y by executing an INP6 instruction. 0205 A6 PLO R6 R6 = Loop counter
0206 FE SHL Presets DF = 0
0207 40 LDA RO Load M'cand
7. Read the lesser s i g n i f i c a n t h a l f of the 16 bit answer
from register Z by executing an INP5 instruction. The 0208 58 SIR R8 into OOFF
0209 40 LDA RO Load M'lier
order of steps 6 and 7 can be interchanged is desired. 020A A7 PLO R7 into R7.0
020B E8 SEX R8 _
020C
Sub-
97 GHI R7
" routine
0200 76 SHRC Shift low byte
020E B7 PHI R7
020 F 87 GLO R7
0210 76 SHRC Shift high byte
0211 A7 PLO R7
0212 Loop
3B17 BNF 17 Branch if DF = 0
0214 > 9
97 GHI R7
times
0215
H91 c F4 ADD Add M'lier to R7.1
u<:16
091 ~t B7 PHI R7 Return sum to R7.1
Uc 1 7
26 •*DEC R6 Index loop count
0218
0219 86 GLO R6
021A
3202 BZ 02 Loop count = 9?
0218 A6 PLO R6
300 C BRO OC Continue looping J
62 63
M E M O R Y M A P P I N G THE MDU
PROGRAM # 2 The current CDP1855 data sheet does not currently show how
ASSEMBLY use the d e v i c e in a memory m a p p e d c o n f i g u r a t i o n ; however,
M ADDRESS BYTE PROGRAM COMMENTS it does mention the use of MWR for RE/WF, and address l i n e s
0000 F801 LDI 01 Load 0101 or functions of address l i n e s for RAO, 1 and 2. T h i s w i l l
0002 BE PHI E into
0003 AE PLO E RE of the CPU work p r o v i d e d certain non-memory operations, such as P H I ,
GLO, etc..., do not cause s p u r i o u s s e l e c t i o n of the MDU
when the contents of the i n t e r n a l registers appear on the
0004 DE SEP E Go to subroutine at 0101
0005 address bus .
Main program continues
0200
CLEAR
* CLEAR* +VDD
n
(data) 8 bit Multiplicand loaded in X Y
0201 (data) 8 bit Multiplier loaded in Z MAO
0202 (data) Storage space for result, high byte MAI
ruin _1
0203 (data) Storage sapce for result, low byte HIGH
1
MAy
LATCH
1802 1855
* Based on program examples submitted by 0. Pintaske, RCA Brussels. TO A t
MU/D ,1
MRD
CE CTL j
TD R
,1
BUS EF 4 C0 BUS ZL
1 1 1
64 65
TABLE 1
T a b l e 1 shows a c o m p a r i s o n of m u l t i p l y t i m e (not i n c l u d i n g
l o a d i n g and u n l o a d i n g the stack), and system throughput fre-
quency ( i n c l u d i n g l o a d i n g and u n l o a d i n g the stack) for 4
V a l u e s g i v e n are for system o p e r a t i o n at 5 v o l t s V DD and
different m u l t i p l y methods.
3 MHz c l o c k frequency.
Software program
TIMING DIAGRAM
The program starts by i n t i a l i z i n g register R3, d e s i g n a t i n g
it as the program counter, and freeing R0 for the DMA pointer.
RX is a l s o set to R0 so that the stack can be l o a d e d / u n l o a d e d
u s i n g INP/OUT i n s t r u c t i o n s .
ANSWER
IGH
TE
M CPU
BUS
m^
Figure 2
68 69
ASSEMBLY
M ADDRESS BYTE PROGRAM Figure 1 shows a simple low-pass f i l t e r c o m p o s e d of a
COMMENTS
0000 F800 LDI 00 i s t o r and a c a p a c i t o r . The o u t p u t v o l t a g e can be
RO = Prog. Counter
0002 B3 PHI R3 d e s c r i b e d by the d i f f e r e n t i a l e q u a t i o n :
0003 F807 LDI 07
0005 A3 PLO R3 R3 = 0007
0006 D3 SEP R3
0007 E3 SEX RO RO = RX
0008 F807 LDI 07 1. _VO + V0_[_t)= VI (t)
000 A AO PLO RO dt RC RC
OOOB F802 LDI 02
GOOD BO PHI RO
OOOE F8FC LDI FC
By u s i n g E u l e r ' s method of s a m p l i n g integration,
Put FC in Stack
0010 50 STR RO at 0207 equation 1 is transformed to :
0011 F803 LDI 03
0013 AO PLO RO
0014 F8F1 LDI Fl
0016
Put Fl in Stack 2. V 0(n) = k V I(n) V 0(n-l) ; w h e r e n 1s any
73 STXD at 0203
0017 F800 LDI 00 Put 00 in Stack
sample period,
0019 73 STXD at 0202
1 and m = 1
001A F801 LDI 01 k =
001C AO PLO RO 1 + RC/T 1 + T/RC
001D 69 INP 9 Port A data to Stack 0201
001E 20 DEC RO
001F 6A INP C
T is the s a m p l i n g time i n t e r v a l in seconds, R is in ohms,
Port B data to Stack 0200
0020 20 DEC RO and C i s i n farads.
0021 62 OUT 2 # Initiate DMA and multiply
0022 F805 LDI 05 action
0024 AO PLO RO
Equation 2 can be i m p l e m e n t e d w i th a recursive d i g i t a l filter
0025 61 OUT I that uses m u l t i p l y , a d d , and delay functions as shown in F i g u re
STACK 0205 to Port C
0026 64 OUT 4
0027 301A BR routine
Stack 0206 to Port D 2. Figure 3 shows two m u l t i p l y operations of the CDP1855. The
second operation adds the result of the first operation to its
01FF\0 i Product. The feedback delay is o b t a i n e d by a r e a d - i n and then
Dummy byte
Load X register read-out of a scratch pad memory c e l l .
0201 / Load Z register
0202 I STACK Load Y register
0203 /
Load control register The program l i s t i n g shows a routine used to do real time recur-
0204 \5 , Read X register sive d i g i t a l f i l t e r i n g , where t h e i n c o m i n g a n a l o g s i g n a l i s d i g v
Read Z register
0206 < Read Y register *ized by an A/D converter, processed by the d i g i t a l f i l t e r , and
0207 / Load control register re constructed by a D/A converter (Figure 4).
If the CPU clock is 3.2 MHz, the time required to complete vl(n)
one loop is 75 uSec, or a sampling frequency of about 13
»Vo(n)
KHz. Based on the Nyquist criterion of at least two samples
per cycle, the i n p u t s i g n a l frequency s h o u l d be l i m i t e d to
6.5 KHz.
Exampie
9ZCS-33I70
then 1 = .2 = .00110011 B i n a r y = 33 h e x ,
K (8 BIT)
k = Ix
1 + 300/75 (8 BIT) Z /^(MSD 8 BIT)
Vl(n)
and 1 3 = .11001100 Binary = CC h e x . (8 BIT) 1st OPERATION
1 + 75/300 Ix JY
Z./*v*sY (B BIT).
Assume now that the i n p u t s i g n a l goes from 0 to a f u l l scale
2nd OPERATION
v o l t a g e of 1 v o l t , and remains at 1 v o l t for 10 s a m p l e periods.
Vo(n-l) SCRATCH
U s i n g equation 2 the corresponding output v o l t a g e s are l i s t e d PAD
MEMORY
below, and if plotted w o u l d p r o d u c e a response curve s i m i l a r
to that of the a n a l o g RC c i r c u i t .
Figure 3
S a m p l e time n 0 1 2 3 4 5 6 7 8 9 10
Input voltage V , 0 1 1 1 1 1 1 1 1 1 1
ANALOG
Output v o l t a g e V Q 0 .20 .36 .49 .59 .67 . 74 .79 .83 .86 .90 ANALOG
OUTPUT
INPUT
Figure 4
72 73
Assembly
M. Address Byte Program
MULTIPLE INTERRUPT WITH CDP1851
0000 F8 04 LOI 04 RP - RO
0002 AB FLO RB
0003 F8 05 LDI 05 Introduction
0005 AA PLO RA
0006 F8 01 LDI 01
0008 BA PHI RA RA = 0105 The f l e x i b i l i t y of CDP1802 register d e s i g n a t i o n a l l o w s easy
0009 BB PHI RB RB = 0104
0 0 0A EA
i m p l e m e n t a t i o n of a vectored interrupt system.
SEX A RX - RA
0 0 0B F8 FD LDI FD Load data
0 0 0D 73 STXD in Stack 0105 By u s i n g software and the u n i q u e register d e s i g n a t i o n capa-
0 0 0E F8 00 LDI 00 Initialize storage space
0010 73 STXD
b i l i t i e s of the CDP1802 i n t e r r u p t , s e r v i c e routines can be
data to zero (0104)
0011 F8 CC LDI CC Load data p o s i t i o n e d at random in memory.
0013 73 STXD in stack 0103
0014 F8 F9 LDI F9 Load data
0016 73 STXD in stack 0102 In the CDP1802 the i n t e r r u p t m e c h a n i s m c o n s i s t s of X, P
0017 73 STXD Decrement RX again designators b e i n g saved in a temporary register T,these
0018 F8 33 LDI 33 Load data
0 0 1A 5A
designators b e i n g s u b s e q u e n t l y loaded by 2, 1 respectively .
STR A in stack 0100
0 0 1 B Routine 64
Interrupts are automatically d i s a b l e d .
OUT 4 Load X register 1
0 0 1C 69 INP 9 READ Vj. from A/D
0 0 1D 66 OUT 6 Load Z register
0 0 1E In an interrupt vectored system the interrupt routine pointed
67 OUT 7 Load control register
0 0 1F 7A REQ Dummy instruction during multiply to by Rl consists of software, w h i c h stacks the T-register and
0020 64 OUT 4 Load X register other registers w h i c h have to be p r e s e r v e d , and a software
0021 66 OUT 6 Load Z register
0022
vectored system.
67 OUT 7 Load control register
0023 7A REQ Dummy instruction during multiply
0024 6A INP A READ Y register A software vectoring system is one w h i c h computes, with I/O
0025 5B STR B STORE in stack at 0104
0026
interrupt status i n f o r m a t i o n , the address of the i n t e r r u p t
61 OUT 1 Load D/A with same data
0027 F8 00 LDI 00 routi ne.
0029 AA PLO RA Set RX back to 0100
0 0 2A 30 IB BR Routine Branch to "Routine"
This status i n f o r m a t i o n in a m i n i m a l software system is obtained
from an i n p u t port such as the CDP1851.
A » ^=
CDP1802 CDP1851 A5
T h i s system a l l o w s for 16 i n t e r r u p t s . A system w h i c h cas- DATA BUS"
P R I O RITY E N C O D E R S
CDP1804 PIO
cades CD4532's can be i m p l e m e n t e d but more c i r c u i t e l e m e n t s
are r e q u i r e d t h a n the before m e n t i o n e d 16 l e v e l system.
B7 CD 5= 8 levels
4532
Alternative systems i nterrupt
1802 1804
BXL EXTINT .. Test if ext. - int.
LDXA RLXA .. D e s t a c k i n t e r r u p t
p L O RN
RET RET . . R e t u r n to
.. I n t e r r u p t r o u t i n e
MAIN PROGRAM 78 79
VIS - A COMPLETE V I D E O INTERFACE SYSTEM
X = 2
P = 1 INTRODUCTION
1.
SAVE T
STACK R(N).0 RCA's 1800 series is a f u l l y CMOS Microprocessor
LOAD R(N).0 family c o n s i s t i n g of CPUs, R A M s , ROMs, E P R O M s , P I O ,
SEP R(N) UART, MDU .interface c h i p s and low resolution v i d eo
Get old R(N) .0 controllers.
and return
As the need for d i s p l a y i n g data increases, RCA adds
to this l i n e a h i g h r e s o l u t i o n Video Interface
System (VIS). This system consists of CDP1869 and
CDP1870, two CMOS LSI d e v i c e s to generate all the
necessary s i g n a l s needed for v i s u a l i s a t i o n on the
screen; in a d d i t i o n a sound generator and white
Different interrupt noise are i n c l u d e d w i t h v o l u m e control on the c h i p .
service routines.
Each up to This set of d e v i c e s interfaces d i r e c t l y w i t h m i n i -
32 bytes l o n g mum a d d i t i o n a l hardware to the CPU CDP1802 but is
designed as a completely independent I/O. No refresh
s i g n a l s are needed that m i g h t stop the processor for
synchronisation d u r i n g d i s p l a y time. "Predisplay"
s i g n a l s the CPU this,one d i s p l a y l i n e before the
refresh starts and no further access to VIS memories
is possible until the d i s p l a y of a frame has been
f i n i s h e d . Then a g a i n i n t e r n a l m u l t i p l e x e r s allow
access to the VIS memories in order to change charac-
ter memory - dot and c o l o u r i n f o r m a t i o n or page memory -
I N T E R R U P T N E S T I N G FOR 1 L E V E L OF I N T E R R U P T character a l l o c a t i o n on the screen. D u r i n g d i s p l a y t i m e
the processor is c o m p l e t e l y free for other I/O or com-
puti ng .
4FF4 X M , HM
4FF3 R 1(N) .0
4FF2 2, 1
4FF1 R 2(N) .0
4FFO 2, 1
4FEF R3(N) .0
I
b) Envelope generator for sound
The address m u l t i p l e x e r (3) decides which information
goes to the address lines of the page memory. During A 4 bit R - 2R - ladder network with a latch
defines the a m p l i t u d e of the sound s i g n a l .
i
d i s p l a y time it selects the character positions on
the screen (PMA 0...9) and scans the character lines
(CMA 0...2). During n o n - d i s p l ay time the CPU memory c) Noise generator
bus is directly connected to the page memory and it
appears as an extension on the CPU memory fixed at E i g h t ranges of white noise are provided. The
F800 to FFFF. As only 960 bytes of t h i s memory result is an e x p l o s i o n type sound effect useful
are used (max 40 x 24) in a IK system 64 bytes are i n TV game systems.
free for stack or other purposes.
d) E n v e l o p e generator for noise
The address counter (4), either defines the p o s i t i o n s on
A 4 bit R - 2R - ladder network w i t h a latch
m
the screen,or is used for character RAM l o a d i n g during
n o n - d i s p l a y time. defines the a m p l i t u d e of the noise s i g n a l .
Sound and noise s i g n a l s can be m i x e d as needed.
The home address register (5) defines the leftmost
character of the first l i n e on the screen. If it CDP1870 (see figure 2) video s i g n a l generation
5.2.
is set to 0000 the d i s p l a y shows an unshifted image
of the page memory contents. Loaded w i t h m u l t i p l e s The control section (1) p r o v i d e s s i g n a l s for the
of 40 it a l l o w s l i n e by l i n e s c r o l l i n g . In the low data bus m u l t i p l e x e r to a l l o w character memory
resolution (20 x 12) it w o u l d a l l o w the d i s p l a y of access from the C P U , latc h s i g n a l s for the control
4 different pages on the screen. i n s t r u c t i o n , and s p e c i a l s i g n a l s to synchronize
CDP1869 and CDP1870.
The sound and noise generator (6) consists of 4
different parts : One i n p u t is used to switch the internal l o g i c
from PAL standard to NTSC s t a n d a r d .
a) Sound generator
The data bus m u l t i p l e x e r (2) is needed for character
It is d e s i g n e d as a three bit prescale r and memory access, if it is in R A M . It has an 8 bit w i d e
a seven bit down counter that are loaded via i n p u t . Six bits (CDB 0...5) are used for character
a command byte from the output s i g n a l and are (dot) information (a character l i n e is 6 dots long).
a u t o m a t i c a l l y loaded w i t h the same byte a g a i n . The next two bits (CCBO, CCB1) are used for charac-
The r e s o l u t i o n is 3 octaves and 128 different ter c o l o u r bit information.
frequencies w i t h i n each octave.
^
89
W i t h these,4 colours out of 8 are defined per COMPSYNC, L U M I N A N C E and C H R O M I N A N C E are combined
character l i n e . Another i n p u t l i n e (PCS) is outside the c h i p and g i v e a complete v i d e o s i g n a l .
the page c o l o u r bit and expands the colour
c a p a b i l i t i e s to 8 c o l o u r s and is n o r m a l l y There are two bond options of the CDP1870. For
connected to the page memory (see figure 3). a t e r m i n a l or b u i l t in TV game it would be useless
to h a ve the complete colour v i d e o s i g n a l and sepa-
If character memory is in R A M , it has to be rate it afterwards. In t h i s case the CDP1876 should
i n i t i a l i z e d after power o n. W i t h t h i s m u l t i p l e x e r be used, colour l u m i n a n c e and c h r o m i n a n c e are repla-
the character memory is switched to the CPU d u r i n g
ced by RED G R E EN and BLUE.
non-di splay time .
6. EXAMPLE OF A CRT T E R M I N A L
The dot o s c i l l a t o r (3) p r o v i d e s the clock for the
t i m i n g generator (4). Here nearly all the s i g n a l s
A complete system w h i c h could be a game or a terminal is
for synchronisation are generated. A special
shown in figure 3. It uses a CDP1804 (1) as processor, a
s i g n a l ( P r e d i s p l a y ) t e l l s t h e C P U that o n e d i s p l a y
one c h i p d e v i c e with RAM and ROM on it,or is replaced by a
l i n e later the m u l t i p l e x e r s are switched and a
CDP1802 w i t h seperate RAM and ROM. The CDP1869 creates
refresh cycle starts. Connected to the interrupt
sound and noise through the a m p l i f i e r (3) and addresses
s i g n a l it can d e c i d e between u p d a t i n g the VIS and the page memory (4) with PMA0...9 (character p o s i t i o n on
w o r k i n g on other parts of the program. In t h i s way the screen), scans the l i n e s of the character memory with
the CPU does not waste time in w a i t i n g for the end
CMA0...2, and generates some s i g n a l s for buffer or RAM
of the d i s p l a y refresh. selection; also it gets s i g n a l s for synchronization from
CDP1870 (7).
Some other s i g n a l s are needed to synchronize the
two c h i p s , for e x a m p l e , increment page memory counter.
The page memory (4) is l o a d e d and read t h r o u g h the buffer/
The dot frequency is about 5.6 MHz. T h i s s i g n a l is
separator (5) .
d e v i d e d by two and may be used as c l o c k frequency for
the CPU. The character RAM (6) feeds character data bits (CDB) and
colour bits (CCB) to the CDP1870 where the colour and sync
V e r t i c a l and horizontal t i m i n g appears on COMPSYNC.
s i g n a l s are generated.
The p a r a l l e l to s e r i a l shift register (5) latches One crystal is needed for dot generation (DOT) and provides
one l i n e of a character and shifts it out to the the clock for the CPU. P r e d i s p l a y s i g n a l s if VIS refreshes
l u m i n a n c e and chrominance l o g i c (6) where the dot
the screen or CPU can t a l k to VIS memories.
information i's combined with the colour information
of the character.
The second crystal is used for the colour burst.
90
91
C h r o m i n a n c e , l u m i n a n c e and synch p u l s e s are c o m b i n e d
and t h i s s i g n a l is connected to a, m o n i t o r or a m o d u l a t o r .
OUT 5 programs
Another d e v i c e , the CDP1871,a keyboard encoder .scans the
key contacts and is used as i n p u t .
W h i t e noise range
W h i t e noise a m p l i t u d e
7. INSTRUCTIONS TO CONTROL CDP1869 AND CDP1870
R e s o l u t i o n (12 or 24 l i n e s )
Page length (960 or 1920 characters)
The CDP1802 CPU has a special feature to output i n f o r m a t i o n .
R e s o l u t i o n (6 x 8, 6 x 16 in NTSC, 6 x 9 in PAL)
An i n t e r n a l register is specified and loaded with the address NTSC or PAL system
of the byte to be sent. This feature is used to programme
the VIS devices.
OUT 6 selects
8. SOFTWARE SUPPORT
One i n s t r u c t i o n (OUT 3) controls the COP1870 (8 bits) for
The most time-consuminq after-design task is n o r m a l l y to
o Resolution (20 or 40 characters)
set up a l l the necessary software m o d u l e s to m a n i p u l a t e
o Character colour control the data on the screen.
o Character format control
o D i s p l a y on or off
For this reason RCA provides a VIS I N T E R P R E T E R . It consists
o Background colour d e f i n i t i o n
of a 3K program w i t h 86 different s u b r o u t i n e s that can be
c a l l e d via a one byte instruction. It i n c l u d e s memory
Three instructions (OUT 4...7) control the CDP1869
m a n i p u l a t i o n as well as colour definition, setting of
OUT 4 sets sound and noise p l u s all other control i n s t r u c t i o n s. In
a d d i t i o n the interpreter permits interruption for the
o Octave execution of m a c h i n e code subroutines.
o Frequency w i t h i n the octave
9- H A R D W A R E SUPPORT
o Sound a m p l i t u d e
o Sound on and off
RCA produces a l i n e of "MICROBOARDS" - board - level micro-
computer products.
CD -«. fD
o 3
fD CD fD « -a
—' "O l/i T3
—< -s
<<
_•. 0.0
rt
^-
n>
CU ft) Q.
CD O t/>
—• o
92CM-31906
FIGURE 1
DOT_
BUS 0-BUS 7 \L XTAL
©-© \>
i <<^CDBO — CDB5)
CDB50 DOT
CCBO©) /I DATA A—
< CCBO CCBIJ) BUS
CCBI0 MUX ^l
' . »
PCS (? ) ' r>
CMSELffi r' 1 I— DBO— OB7
||
¥ CHROMINANCE NTSC CHROM(BLUE)*
CIRCUITS
\E AND . ^-*@ PAL CHROM(GREEN)*
VDO-6S
*RGB BOND-OUT OPTION
92CM-3I9IIRI
FIGURE 2
92CM-3I907RI
FIGURE 3
97
96
CDP1802 M I C R O P R O C E S S O R IN TELEPHONES
A timer d e v i c e , the CD4536, is u t i l i z e d in the clock or cost- a) Program length 600 bytes
of-call function : it s i m p l y generates an interrupt with the
appropriate time period which activates' a programmed clock b) RAM size 128 bytes
routi ne.
c) O p e r a t i n g frequency 1MHz n o m i n a l
This system can be further extended by a d d i t i o n a l I/O and Can be reduced to 50KHz
memory d e v i c e s to perform extra functions such as intercom. in i d l e c o n d i t i o n (off
hook)
d) Power c o n s u m p t i o n 2 mA at 5V/lMHz
200 m i c r o a m p s at 5V/50KHz
LED I N T E R F A C E
The CDP1802 transfers the address as two bytes : h i g h To have a LED interface to the Microprocessor system,
byte and low byte. T h i s feature a l l o w s a 16 bit data many p o s s i b i l i t i e s can be used. One e s p e c i a l l y easy
transfer from register to a 16 bit o u t p u t port. In to use is h a v i n g a shift register as one output port.
t h i s case not the data is used as i n f o r m a t i o n but the As the data is transferred from memory directly to I/O
address,or better the contents of one of the registers. only a sequence of output instruction s are necessary to
transfer any number of data to t h i s output.
It is done via an o u t p u t i n s t r u c t i o n .
Connected to d r i v e r s any segment c o n f i g u r a t i o n can be
N o r m a l l y , the CDP1802 addresses the memory via the d i s p l a y e d . Each byte can be connected to decoder c i r -
X-register and the data stored at t h i s l o c a t i o n is cuits to use each byte as two d i g i t s .
stored in one of 7 o u t p u t d e v i c e s .
With 4 CD4015, 4 LED d i s p l a y s can be addressed d i r e c t l y .
But in t h i s case, the port on the data bus does not e x i s t . This c h a i n can be expanded to any number and h a s , compared
O n l y the a d d r e s s bus is l a t c h e d means h i g h byte u s i n g TPA with m u l t i p l e x i n g , the advantage that once transferred the
and low byte u s i n g TPB. As ' c h i p e n a b l e ' the N l i n e s are data i s stabl e.
used together w i t h MM. REF. ICAN-6562 "Register Based O u t p u t "
CDP1802
r
CL CJT CS2 CL TT5T CS2 CL CS2
MODE MODE MODE
1 2
CDP1852 CDP1852 CDP1852 L O G I C D I A G R A M OF CD4015
IT
A D D R E S S BUS
HIGH B Y T E
ADDRESS BUS DATA BUS
LOW BYTE OUTPUT
105
104
D-A-CONVERSION
"DD
KFSTT
tt
2 Very often a s i m p l e a n a l o g o u t p u t is needed and the reso-
l u t i o n of 5 % w i l l be e n o u q h . In a lot of the cases even
speed is not the most i m p o r t a n t feature . U n d e r these
c o n d i t i o n s , a very cheap a n a l o g interface is p o s s i b l e ,
DB7 c o m p l e t e l y i n CMOS.
CD4015
One CD4508 8 bit l a t c h or 2 CD4076 4 bit l a t c h together
OB6
with some resistors are needed.
N Q7
CLOCK
CD4508 Q6
DBS TPB
or Q5
CD4015 2 x ANALOG
OB4 CD4076 Q4 OUTPUT
DATA or
CDP1852
Q3
Q2
SIMPLE D/A C O N V E R T E R
DB3 Ql WITH
CD4015
VOLTAGE FOLLOWER
OJ
O U T P U T C I R C U I T S FOR A 4 D I G I T LED D I S P L A Y U S I N G ONE OUTPUT If this 8 bit converter is "expanded" to a 9 bit converter,
I N S T R U C T I O N A N D SHIFT R E G I S T E R S where the highes t bit never changes, the output v o l t a g e changes
between 0V and VQ D . 2 ,this means even s i n g l e supply is possible .
106 107
A-D-CONVERSION
2. UP-DOWN-COUNTER
ETT 0
ADD * ~ ^^-il- a. Set output to half scale 1000 0000
ANALOG
• • "ET2 e b. If b i g g e r , store in a r e g i s t e r . otherwise substract
ROM INPUTS c. Try w i t h 0100 0000
CDP1833 Wfe FFI e
^*.^*L d. Then w i t h 0010 0000
e e. 0001 0000
3ATA EF4
^^th f. 0000 1000
CPU LATCH
CDP1802 ™j AND g-
h.
0000 0100
0000 0010
D/A
k. 0000 0001
1. COUNTER
CA3162
Another approach would be to connect the CA3162 completely
A three d i g i t A/D interface for COSMAC to the data bus via an i n p u t port CDP1852.
T h i s c i r c u i t , together w i t h one CD4016 quad transmission
gate lets the CDP1802 understand a n a l o g i n p u t s w i t h an ROM RAM CPU INPUT A/D
accurracy of 3 d i g i t and a conversion rate up to 96Hz. PORT
ADDRESS CDP CA
The i n p u t range is +999mV to -99mV and an extra o v e r r a n ge 1852 3162 ANALOG
indication is b u i l t in. DATA INPUT
•• S E R I A L OUT
_L
TPA ^
ANALOG
ADD FFI INPUT
CPU S U B R O U T I N E TO I N P U T DATA IN M E M O R Y
ROM CDP1802
CDP1833 MTJ CD CA return to c a l l i n q program
4066 3162 set up memory pointer
for i n p u t of data
4FFO
F i g u r e 1 : M i n i m u m Interface
set X pointer to 8
get d i g i t
select MSD
wai t for 1ow
LSD comes next
so 2 x INC
i:•|j i :j i
ri i nput
select bi t
w a i t for it
-<3> point to NSD now
get word
look for b i t
w a i t for bit
p o i n t to
a free l o c a t i o n
9ICL- JMtSRI
EXIT go to E X I T
COMPLETE PANELMETER
FOR I N T E R F A C E WITH uP
110 Ill
The informatio n is stored in R7, R8, R9. If the C L E A R and WAIT l i n e s are both h e l d low, the m a c h i n e
enters the load mode. T h i s mode a l l o w s i n p u t bytes to be
This subroutin e exits with a SEP5 i n s t r u c t i o n , means it s e q u e n t i a l l y loaded i n t o memory b e g i n n i n a at M(OOOO). I n p u t
can be c a l l e d via SCRT. bytes can be s u p p l i e d from a keyboard, tape reader, etc...
by way of the DMA f a c i l i t y . T h i s feature p e r m i t s d i r e c t
The memory l o c a t i o n s used are : program l o a d i n g w i t h o u t the use of external "bootstrap "
programs in R O M ' s .
4FFO MSD
4FF1 NSD If the W A I T l i n e is b r o u g h t low (with CLEAR h i g h ) , the CPU
4FF2 LSD stops operation cleanly on the next negative-going transi-
tion of the c l o c k (Pause mode). O u t p u t s i g n a l s are h e l d at
For more i n f o r m a t i o n see data sheet CA3162. t h e i r v a l u e s i n d e f i n i t e l y . T h i s state is u s e f u l for several
Purposes .
112 113
Qyervi ew
The CPU transfers data bytes to and from each port by asser-
ting codes S, T, U or V, g i v e n in T a b l e 1. Modes may be
combined so that their functional d e f i n i t i o n can be tailored
wv—o to almost any I/O requirement.
b. B i - D i r e c t i o n a l Mode
3. The TFT l i n e is set low s i g n a l l i n g the CPU to read Data w i l l be read from memory and placed on the bus and
the data. latched into the port buffers on the t r a i l i n g edge of
the TPB. The READY l i n e is also set at t h i s time. The
The A and B TIT l i n e s of the PIO may be wired to the TWT peripheral w i l l transmit a strobe p u l s e i n d i c a t i n g the
pin on the CPU to s i g n a l program i n t e r r u p t s, or they can reading process is completed. The r i s i n g edge of the
be wired to separate IT p i n s where p e r i o d i c p o l l i n g of the strobe p u l s e causes the READY s i g n a l to reset, and the
FF p i n s is required to check for service requests. f a l l i n g edge sets the interrupt request s i g n a l l i n g the
CPU to output another data byte.
In either case, the program w i l l branch to a subroutin e
and execute an i n p u t i n s t r u c t i o n (INP6 or INP7, see codes Data Transfer, B i t - P r o g r a m m a b l e Mode
S & T, T a b l e 1) w h i c h w i l l assert the proper code on the
RAO, R A 1 , and CS p i n s of the PIO. The PIO w i l l p l a c e data The CPU loads a data byte to the 8 bit port as in the
onto the system bus so it can be used by the CPU and/or normal output mode. I/O l i n e s programmed as outouts
written into memory. w i l l accept and latch data b i t s , however, I/O l i n e s
programmed as i n p u t s w i l l ignore the l o a d e d data (See
The TPB p u l s e that occurs d u r i n g the WR~ p u l s e terminates code H, U, and V of T a b l e 1).
the interrupt request and sets the R E A DY l i n e , i n d i c a t i n g
to the p e r i p h e r a l that the PIO is ready to accept a new The CPU reads the 8 bit port as in the normal i n p u t mode.
data byte. I/O l i n e s are n o n - l a t c h i n g and therefore i n p u t data must
be stabl e w h i l e the CPU reads. All 8 I/O l i n e s are read
whether they are programmed as i n p u t l i n e s or outout l i n e s .
Data read from the l i n e s programmed as outputs w i l l be
data b i t s l a t c h e d d u r i n g the l a s t outpu t cycle (See codes
H, S, & T, T a b l e 1).
120 121
3. Code H control byte must be l o a d e d , T h i s byte determines NOTE that A INT and B INT l i n e s are wired (OR'd together
w h i c h b i t s are input/output. (See Fi gure 2) .
4. Code I control byte must be loaded w h i c h determines the 13. Several d e c i s i o n s w i l l be made based on the i n f o r m a t i o n
l o g i c a l c o n d i t i o n of b i t s required to generate an interrupt contained in the status register.
request from port B (in t h i s case a NOR c o n d i t i o n ) .
14. To read port A the CPU must output the proper N - l i n e code S.
5. Code J control byte must be l o a d e d . T h i s byte t e l l s w h i c h
of the 8 b i t s in port B are monitored and w h i c h are masked 15. To load port A w i t h data the CPU must output the proper
for interrupt generation. (In t h i s case a l l of the i n p u t N - l i n e code, and p l a c e the 8 bit data word on the bus
l i n e s B4, B5, B6 and B7 w i l l be monitored). (See T a b l e 1).
6. Now port A is set to b i - d i r e c t i o n a l mode by l o a d i n g code 16. To load port B (bits BO, Bl, B2 and B3) w i t h data the CPU
E control byte. must output the proper N - l i n e code, and p l a c e the 4 bit
data on the bus (See Table 1).
7. Port A interrup t l i n e is enabled by l o a d i n g the control
register with code L control byte. 17, Once the interrupt subrouti nes are completed the CPU returns
to the m a i n program and the interrupt e n a b l e (CPU) is acti-
vated.
124 125
*
CLEAR
NO
CLEAR
*
INPUT PORT SEQUENTIAL TIMING* RAO A RDY XMIT ENABLE
N1 RA1 A STROB XMIT STROBE
N2 CS
f 8 *T~PERIPHERAL
TPA
MRD RD/WE AO _J(^ DATA A
TPB
u
•—» WR/RE
TPB
A;y
B RDY
B STROB
8 8
DATA READY
SAMPLE AK
VDD
1802 1851
BO
1
<10K -RECVR
2
3 .,., —. ^
J I J I
SYSTEM DATA BUS J
TO MEMORY
[NORMAL PROG)C-* READ PORT- -)( NORMAL PROG •
STROBE
READY
TPA n1 / n n„
TPA ». CLOCK AO
8 •«
A
MRD RD/WE A7
'MRD | " TPB . . _ „ . . . j_. fc WR/RE
MRD 'MRD
VDD ^ TPB
MWR 1802
1851
Fi gure 2 : H a r d w a r e For E x a m p l e 2
126 127
F L O W C H A R T FOR E X A M P L E 1
F L O W C H A R T FOR E X A M P L E 2
START
CLEAR
PROGRAM PORT B
TO BIT MODE
SET PORT B TO
OUTPUT MODE
DEFINE WHICH BITS
ARE IN/OUT
MASK BITS
PROGRAM PORT A
TO BIDIRECTIONAL
ENABLE A INT
READ PORT A
(IGNORE DATA)
ENABLE B INT
MAIN
PROGRAM
READ PORT B
128 129
TABLE 1
CO
P R O G R A M M I N G CODES cn
CO
4-1
•H O CO ft
PH 4-1
ca cu 0) E>. 3
00 >-. .a oo rH O
G Td O G "^J T3 ^t
CM t-> •H Cd VH a> co
o
PL, cO
<U 4-1
Crf O]
QJ
OH cn
4-J ^
cd M
4-J
i 3
§ T)
O
DATA BUS 4-1^0 « -H cn
3 cc
i- o ^ ~-~ cn 3 cfl PJ H >
ft "~0 00 -H 3
CODE DESIRED ACTION u a 2i 1 07 De 05 04 03 D2 DI Do G 0 T3 ft
A SET PORT A TO INPUT MODE 1 0 1 O 1 0 O X O 1 X I 1 W o pa P-. -H •rH
G M CO 3
1 1 AND •rt O CO ft
1 PH 4J
J SET MASK ING OF BITS I 0 1 O 1 (0 = MONITORED. 1 = MASKED) >• 3
< 00 QJ D OO i—I O
(PRECEEDED BY CODE 1) G E^,^ 4-J G < 13 rH
4-1 •H -5"0 T3 0 3 -H QJ cd
K SET RDY AND /OR STROBE LINES 1 O 1 O 1 D7 D6 D5 D4 03 D2 D! 0 CN cO In CO VH ft X -*-1 o
O cd 0) 4J Q) 4-J G CO VH
TO I/O LINES (BIT - MODE ONLY) erf cn M ,£ o cd -H CO
CO cn PH 4J
(Dl) O = PORT A, 1 = PORT B (D5) STROBE LINE OUTPUT DATA TO BE LOADED -a 00 -H 3
G o -a ft
(D2) O = NO CHANGE TO RDY LINE (De) RDY LINE USED AS cd G
FUNCTION, 0 = INPUT LINE EC M CM -H •H
P QJ "O 00 -H 3
P DISABLE B INT OUTPUT I O I O I O X X X 1 O 0 o ft
a *-< C 1H C C
R READ STATUS REGISTER 1 O 1 1 O 07 De 05 D4 03 02 Dl DO
H -H CM •!-* •H
0000 0001
0000 8002 ..EXAMPLE PROGRAM
000 'i ..STANDARD CALL AND RETURN 0000 0003 ..STANDARD CALL AND
0002 ..SUBROUTINES 0000 0004 ..RETURN RUUflNE TECHNIQUE
0000 0003 ..THEY USE SOME REGISTERS 0000 000S . .
DETAILED PROGRAM E X A M P L E
MACRO FOR BCD TO B I N A R Y C O N V E R S I O N
Showing a Traffic L i g h t
In typical Microprocessor systems numerical i n p u t s are This program shows how to use part of the instruction set.
often presented in BCD.but m a n i p u l a t i n g such data can It uses a CDP1852 8-bit output port to switch LED's ON and
be done more efficiently if they are converted to binary and OFF. Two EF flag l i n e s g i v e priority to either m a i n
form. The following short routine for the 1802 performs or secondary road, and the Q l i n e i n d i c a t e s in w h i c h state
a 2 - d i g i t BCD i n p u t from a port and converts the data to the program is :
b i n a r y l e a v i n g the result both in D and on the stack. It
is presented as a macro d e f i n i t i o n w h i c h functions in exactly
a) Normal
the same way as the standard " I N P " i n s t r u c t i o n except that b) A d v a n t a g e (longer green) m a i n road
one of the CPU registers ("WKG") is used for temporary sto-
rage . The i n s t r u c t i o n s used in t h i s program are :
MACRO
B C D I N P %PORT macro name LDI l o a d i m m e d i a t e next byte in D register
INP %PORT i n p u t to D and M (R(X)) PHI RN transfer from D to h i g h byte of RN
A N I 0F;PLO W K G save low d i g i t PLO RN transfer from D to low byte of RN
L D X ; A N I F0;SHR hi d i g i t x 8 GHI RN get h i g h byte of RN and put it in D
STXD;SHR;SHR hi d i g i t x 2 GLO RN get low byte of RN and put it in D
IRX;ADD;STXD hi d i g i t x 10 SEX RN set X pointer to RN (for output)
GLO WKG;IRX;ADD bi nary i n D OUT N o u t p u t from X where RC p o i n t s to OUT N
STXD;IRX and on stack SEP N set P pointer to N (subroutine c a l l )
MEND DEC N decrement register N
WKG = w o r k i n g RAM SEQ set the Q o u t p u t h i g h
PORT = i n p u t port REQ set the Q output low
BR BEGIN branch i m m e d i a t e
BQ LGREEN b r a n c h if Q is set
The o v e r h e a d of t h i s c o n v e r s i o n is 18 bytes of memory p l u s BN1 TEST2 branch if EF1 is not a c t i v e
51.2 uS (at 5MHz c l o c k ) e x e c u t i o n time. If the v a l u e of X BN2 TIMER branch if EF2 is not a c t i v e
is known in a d v a n c e the o v e r h e a d can be reduced to 15 bytes BNZ LOOP b r a n c h if D register is not 00
and 41.6 uS by r e p l a c i n g the "STXD , I R X " p a i r s w i t h s i n g l e
"STR" i n s t r u c t i o n s . D e p e n d i n g on the state of the Q f l i p - f l o p (LED) the program
flow is c h a n g ed between normal green and l o n g green. T h i s
If the program c o n t a i n s many of these c o n v e r s i o n - i n p u t s , the program is not o p t i m i z e d ; its i n t e n t i o n is to show s u b r o u -
r o u t i n e s h o u l d be rewritten as a "SEP"-type s u b r o u t i n e to tine c a l l s , software timers use of f l a g l i n e s , o u t p u t to exter-
save ROM space. In t h i s case the memory overhea d w i l l be nal d e v i c e s . Here one s p e c i a l output -the output i m m e d i a t e - i s
o n l y one byte per c a l l (the SEP i n s t r u c t i o n i t s e l f ) . used. As in t h i s program X and P are the same, the byte just
T h i s is a good i l l u s t r a t i o n of the memory economy o b t a i n a b l e following the output instruction is transferred to the CDP1852.
by use of the 1802's r e g i s t e r - s w i t c h i n q feature.
142
ItC/fl State
PC-0
Set
RA 8F.OO
RB 60.00
RC 10.00 Sat:
RD 8F.OO Normal Green Main Road
RE FF.OO Red Secondary Road
RF 00.00
Sat: Put RD-»R9
R8 - Add Subr.
Go to Subr. Delay
Sat:
Rod Main Road Branch to Amber
Main Road
Green Secondary Road
Go to Subr. Delay
PutRE-»R9
Set:
Red Main Road Go to Subr. Delay
Amber Secondary Road
Set:
PutRB _»R9 Amber Main Road
Red Secondary Road
Put RC-»R9
Go to Subr. Delay
_L
Go to Subr. Delay
Branch to Start
145
nc/i?oiid
State
Traffic Detectors
DO
LEO
-M-
-A a
i
n
ROM EF 1 Q N Lines > I/O
< Ad. Bui
TPB
TPA C.P.U.
MWR 1852
1802
Data Bus
146 147
A table pointer is set up and the contents of this memory A.1 (TABLE)—»-PNTR.1
location is compared with a byte on the parameter stack A.0 (TABLE)—»-PNTR.(J INITIALIZE
SEX PARSTK USE PARAMETER STACK
u s i n g the XOR i n s t r u c t i o n . The new character is loaded @ PNTRI.XOR.O GET AND COMPARE
via PNTR in D-register and XORed with the byte on the BZ FINISH END IF MATCH
parameter stack, therefore, the SEX PARSTC is necessary. PNTR. 0. XOR. A (TABLE + LENGTH) TABLE OVER?
BNZ NWCHAR IF NOT, BRANCH
If it was the searched character, branch to F I N I S H , other- ERROR: PHIPNTR IF SO, FLAG ERROR
wise compare with the end of the t a b l e . If not yet reached, FINISH: DEC PNTR RESET PNTR
SEP RETURN GO BACK
go to N W C H A R , E R R O R means that the end of the tabl e has been END
found but not the character, so the h i g h byte of PNTR is modi-
f i e d , then the r e g i s t e r PNTR is decremented followed by a re-
turn to the c a l l i n g orogram. T h i s program is written for SCRT,as
the return is at the end of the program and the PC for t h i s
s u b r o u t i n e has to be i n i t i a l i z e d , before it can be c a l l e d .
150 151
A. H i r i n g MRD to a spare i n p u t
DUAL M O N O S T A B L E FOR UATCH DOG F U N C T I O N
o CDP1834 (CS1 or CS2) - only if they are " a c t i v e low"
o 2716, 2732, 1758 (Ol)
The same function c o u l d be a c h i e v e d w i t h counter t i m e r
c i r c u i t s to a v o i d any c a p a c i t o r , u s i n g clock s i g n a l
B. G a t i n g MRTJ e x t e r n a l l y w i t h the c h i p - s e l e c t function
of the processor system (e.g. CD4020).
—l
f H tO.MAI >MA2> A3 |
1
TPA
r
HR6 MET) MAI
| ROM/EPROM
-551 1
MA2.MA3-I
^ess I
-en l
1 I/O J
\7 1
ROU(COPie!!/5l2.»
EPROM <2708/IK«8)
154 155
UT4 CMOS ROM M O N I T O R P R O G R A M
A g a i n , if more than four d i g i t s are e n t e r e d , o n l y the l a s t
four are used. T h i s feature a l l o w s the user to correct a
A CMOS ROM m o n i t o r program is necessary for a p r o t o t y p i n g mistake. He s i m p l y keeps t y p i n g , p u t t i n g in the correct
system to have an easy p o s s i b i l i t y to load programs, verify 4 - d i g i t v a l u e s (230024 is e f f e c t i v e l y 0024).
and start e x e c u t i o n .
!M C o m m a n d
One external f l a g and the Q o u t p u t are used for t h i s i n t e r -
face. For a d d i t i o n a l h a r d w a r e , see F i g u r e 1 and F i g u r e 2 , In g e n e r a l , data is entered i n t o memory by m e a n s of a
command such as
it assumes a clock frequency of 2MHz for 100 and 300bd. T h i s
m o n i t o r program does not need any R A M .
!M2F 434F534D4143
It starts at 8000 ( h i g h e s t address bit h i g h ) means after
reset t h i s l i n e has to be set h i g h e x t e r n a l l y to start the T h i s command enters six bytes (two hex d i g i t s each) i n t o
monitor program. (See e v a l u a t i o n kit manual MPM203 or MPM memory b e g i n n i n g at location 2F. It is normally termina-
224, as w e l l M i c r o b o a r d brochures). ted by a CR. Once a g a i n , the s t a r t i n g l o c a t i o n is deter-
m i n e d by the l a s t four d i g i t s e n t e r e d . Data is entered
After b e i n g entered it i n i t i a l i z e s i t s e l f and w a i t s for CR into memory after each two hex d i g i t s are typed. If the
or LF. C a r r i a g e return sets it to f u l l d u p l e x and l i n e feed user types a n od d n u m b e r o f d i g i t s , th e l a s t d i g i t i s
to h a l f d u p l e x . The answer is the UT4 prompt. T h i s u t i l i t y i g n o r e d , and the error message ('?') is typed out.
program can even work t o g e t h er w i t h a p a p e r tape reader or
punch. For a d d i t i o n a l i n f o r m a t i o n , see MPM224, MPM203. The !M command p r o v i d e s two o p t i o n s that f a c i l i t a t e memory
loading. F i r s t , a s t r i n g of d a t a can be e x t e n d e d from l i n e
?M C o m m a n d to l i n e by t y p i n g in a comma just before the n o r m a l CR.
(In t h i s case the user m u s t type C R - L F (carriage return-
To interrogate memory, the user types a command such as l i n e feed) before he can b e g i n a new l i n e ) . For e x a m p l e :
DEF0123456,(CR) (LF)
and t e r m i n a t e s it w i t h C R ( c a r r i a g e return). UT4 responds
3047 (CR)
by p r i n t i n g out the contents of memory b e g i n n i n g at loca-
tion OOFS: three bytes are p r i n t e d out as two hex d i g i t s
enters 11 s u c c e s s i v e bytes b e g i n n i n g at l o c a t i o n 0023.
each. Each l i n e of o u t p u t b e g i n s w i t h the a d d r e s s , and
Between s u c c e s s i v e h e x p a i r s w h i l e data i s b e i n g e n t e r e d ,
data is g r o u p e d in 2-byte (4-digit) b l o c k s . W h e n neces-
any n o n - h e x character except the comma (and s e m i c o l o n , as
sary, new l i n e s are begun every 16 bytes, with the pre-
w i l l be discussed) is ignored. T h i s a r r a n g e m e n t permits
v i o u s l i n e s e n d i n g in s e m i c o l o n s . The user may enter any
arbitrary LF's, spaces (for readability), n u l l s (generated
n u m b e r of d i g i t s to specify the b e g i n n i n g l o c a t i o n ( l e a d i n g
by the u t i l i t y program or by a time-share system to give
zeroes are i m p l i e d , if necessary). If more than four d i g i t s
the c a r r i a g e time to return), etc...
are entered, only the l a s t four are used. The n u m b e r of
bytes to be typed out s h o u l d be in hex.
156 157
7. When UT4 detects bad syntax, it types out a ? and returns The serial t e r m i n a l i n t e r f a c e is an e x a m p l e of m i n i m i z i n g
the carriage. If a mistake is made when data is entered hardware c o m p l e x i t y by the use of software. F u r t h e r , it
(by typing in an odd number of d i g i t s ) , all data w i l l i l l u s t r a t e s the increased f l e x i b i l i t y that can be more
have been entered except the last hex d i g i t . Note that readily a c h i e v e d by software. The CPU receives serial data
the " o n l y - l a s t - f o u r - d i g i t s " r u l e in the address f i e l d by s a m p l i n g ET4. It t r a n s m i t s serial data via its Q output.
allows the user to correct an error without retyping Details on the electrical I/O interface are given in the
the w h o l e command. For e x a m p l e , a m i s t a k e n 234 can be A p p l i c a t i o n Note e n t i t l e d "Data T e r m i n a l Interface C o n s i -
corrected by c o n t i n u i n g 2340235=0235. A bad command derations for RCA Microprocessor E v a l u a t i o n Kit CDP18S020.
can be aborted by typing in any i l l e g a l character except
after !M or ?M or between i n p u t hex data p a i r s . In
these cases, the user s h o u l d type any d i g i t and then,
for e x a m p l e , a period.
160 161
The f l e x i b i l i t y o b t a i n a b l e w i t h software is demonstrated by The EIA RS232 Serial Data Interface For
the a b i l i t y of the p r o g r a m UT4 to s a m p l e a character s t r i n g C o n n e c t i n g TI S i l e n t 700 Data T e r m i n a l
and adjust its t i m i n g so as to cope w i t h t e r m i n a l s of d i f -
ferent, even n o n - s t a n d a r d , character rates. However, it
s h o u l d be noted that w h i l e a p r o g r am is t i m i n g e i t h e r i n p u t
or output in this manner (i.e., by counting instruction exe-
c u t i o n s ) , it is c o m p l e t e l y d e d i c a t e d to that task and cannot
be interrupted except for an occasional DMA service.
R0 Rl R4.1
7M8COO 20/ / s/
8COO DODO 8202 2222 3333 9444 5555 6666 7777;
8C10 8888 9999 AAAA BBBB CCCC DDDD E E E E FFFF
Figure 4 :
Data Terminal Bit
Serial O u t p u t For
INTELLIGENCE BITS The Character "M"
- 7 DATA BITS »
PLUS I PARITY BIT
_ COMPLETE CHARACTER _
"M" (40|6>
!h
0000 0001 OkG #8000 •T 6004 0048
8000 0002 .. UT4 IS A UTILITY PROGRAM TO ALTER 8004 0049 . . THE FOLLOWING WR
8000 0003 .. MEMORY, DUMP MEMORY, AND BEGIN PROGRAM 8004 0050
.. EXECUTION AT A G I V E N LOCATION. THE COMMANDS . . 8COO-8C1F IF IT
8000 0004
8000 0005 .. ACCEPTED ARE SPHHKH (BEGIN EXECUTION AT THE 8004 0051 . . TO BE RAM ( ELSE
8000 0006 .. SPECIFIED LOCATION WITH RO AS PROGRAM 8004 F88CB1 ; 0052 LDI #8C ;PHI CL . .CL IS CLOBBERED
8000 0007 .. COUNTER), 1MHHHH DATA (POT DATA AT SPECIFIED 8007 0053 . .BY THIS ROUTIINE
8007 81EA1 ; 0054 LDI *1E ;PLO CL . .SET UP WHERE RF.O
oOOO 0008 . . LOCATION), AND ?MHHHh HHHH (OUTPUT DATA 8 0.0 A 00 5 5
. . FROM SPECIFIED LOCATION FOR SPECIFIC COUNT) . . IS TO GO, MINUS 1
BOUO 0009 800A F8AOb4; 0056 LDI #AO ;PHI R4
. . AT THE B E G I N N I N G OF A C O M M A N D ALL C H A R A C T E R S ..R4.1 STORES A MODIFIED
8000 0010 600D 0057 . .INSTRUCTION
800D El ; 0058 SEX CL
8000 0011 .. ARE IGNORED U N T I L A ? , ! , O R S IS 800E F8D051; 0059 LOOP2: LDI #DO ;STR CL ..SET UP SEP INSTRUCTION
6000 0012 .. E N C O U N T E R E D . IN THE ?M AND !M C O M M A N D S WON
8000 0013 .. HEX CHARACTERS ARE IGNORED AFTER M UNTIL A 8011 ; 0060 . .FOR RETURN
8000 0014 .. HEX IS READ, THEM THE FIRST NON HEX 8011 F3; 0061 XOR
.. CHARACTER MUST BE A SPACE . NON HEX . . C H E C K THAT IT WROTE
8000 0015 8012 3A29 ; 0062 BNZ UT4
8000 0016 .. C H A R A C T E R S B E T W E E N HEX PAIRS OF THE DATA IN 8014 21 ; 0063 DEC CL
.. THE !h COMMAND ARE IGNORED EXCEPT FOR CR, ..PREPARE FOR MODIFIED
8000 0017 6015 ; 0064 . . INSTRUCTION
dOOO 0018 .. S E M I C O L O N , AND COMMA. 8015 94FC70j 0065 GHI R4 ;ADI#70 . . S E E IF IT IS IN THE 90°S
sooo 0019 .. THE BAUD RATE OF UT4 IS DEPENDENT UPON THE
sooo 0020 .. T E R M I N A L BEING USED. A CR OR LF IS E N T E R E D 8018 331C; 0066 BDF *+#04
8000 0021 .. AT THE B E G I N N I N G TO SPECIFY THE A P P R O P R I A T E 601A FC21 ; 0067 ADI#21
.. DELAY B E T W E E N BITS. UT4 W I L L ECHO . . IF N 0 . 8 N BECOME S 9N
oOOO 0022 6 0 1C FC 7 F; 0068 AD 1*7 f
.. CnARACI'ERS IF A CK IS CHOOSEN AS THE . . I F Y E S , 9N BECOMES 8 ( N - 1)
8000 0023
8000 0024 .. TIMING C H A R A C T E R . ECHOING WILL NOT TAKE 601E B451; 0069 PHI R4 ;STR CL
.. PLACE IF A LF IS INPUT AS THE TIMING . . SET M O D I F I E D INSTR
SOOO 0023 6020 ; 0070
.. CHARACTER. . . INTO RAM
8000 0026 8020 F3; 0071 X(jR
.. UI4, AT INITIATION, STORES, ALL REGISTERS . CK THAT IT WROTE
8000 0027 8021 3A29 ; 0072 BNZ UT4
8000 0028 .. B E T W E E N 8COO AND 8C1F IF IT F I N D S RAM T H E R E 8023 01; 0073 SEP CL . .GO TO E X E C U T E INSTR
8000 0029 .. (BUT RO, R l , AND R4.1 ARE CLOBBERED). 6024 ; 0074 . . (80-9F)
8000 0030 PTER=*00 . . A U X I L I A R Y FOR MAIN R O U T I N E 6024 51 ; 0075 3TR CL ..STORE R E S U L T IN RAM
8000 0031 CL=*01 ..CLOBBERED 6 0 2 5 2 1 2 1 ; .. 0076 DEC CL ;DEC CL . .BACK UP FOR NEXT BYTE
8000 0032 ST-*02 ..STACK POINTER-ONLY 8027 300E; 0077 BR LOOP2
8000 0033 . . R E F E R E N C E TO RAM 8029 ; 0078
8000 OJ34 SUB=#03 . . S U B R O U T I N E PC 6029 90B5B3; 0079 UI4:GHI RO ;PHI PC ;PHI SUB ..#SO-tPC.1
8000 0035 PC=*U5 ..MAIN PROGRAM C O U N T E R 602C ; 0080 ..AND SUB.1
8000 OOJ6 SwITCt! = CL . . D I S T I N G U S H E S B E T W E E N ?M AND !h 602C F830A5; 0081 LDI A.O(UT4A) JPLO PC
8000 0037 D6LAY = ffOC . .DELA* ROUTINE PROGRAM COUNTER 802F D5; 0082 SEP PC
8000 0038 ASL=lfOD ..HEX A S S Y M B L ^ REG ON INPUT , 6030 E5; 0083 UT4A:3EX PC
6000 0039 ..AUx FOR HEX OUTPUT • 6031 7 1 5 5 ; 0084 D1S, #5 5 NOTE PC-5 ASSUMED
8000 0040 CENTER=ASL ..USED TO C O U N T OUTPUT BYTES • 6033 ; 0085 HERE!
8000 0041 AUX=*OE ..AUX. l HOLDS BIT-TIME CONSTANT • 8033 6101 ; 0086 OUT 1 ,#01 . .SELECT
S RCA GROUP
oOOO 0042 CHAR=*OF ..CKAR.l HOLDS I/O BYTE • 8035 F8FEA3; 0087 LDI A.O(TIMALC) ;PLO SUB ..READ ONE
8000 0043 • 8038 ; 0088 ..TO SET TIMER
8000 0044 .. ENTER IN RO • 8038 D3; 0089 SEP SUB
8000 0045 NOP • 8039 ; 0090
8001 F880BO; 0046 LDI A.KUT4) ;PHI RO ..SET PC WHILE • 8039 ; . 0091 . . . INITIATION NOW D
8004 0047 . . FINGER IS ON • 6039 ; 0092
• 8039 F89CA3; 0093 STAKT:LDI A.O(TYPESD) ;P
164 165
803C 0094 SEP SUB; ,#OD . . CR-CARRIAGE RETURN 8077 F89CA3; 0141 LUI A.O(TYPE5D) ;PLO SUB . .TYPE
D30D;
803E D30A; 0095 ST2:SEP SUB; ,#OA .LF-L1NE FEED 807A 8 DAI; 0142 GLO ASL ;PLO SWITCH
8040 D32A; 0096 SEP SUB; ,#2A ..* AS PROMPT CHARACTER 807C 9DB1; 0143 GHI ASL ;PHI SWITCH
8042 F800ADBD; 0097 ICNORE:LDI #00;PLO ASL;PHI ASL ..PREPARE TO 807E D30A; 0144 LINE:SEP SUB; ,#OA . .LF
8046 0098 . . INPUT HEX I 8080 90BF; 0145 LINE1:GHI PTER ;PHI CHAR ..PREPARE LINE
8046 ! 0099 . . DIGITS, CLEAR ASL 1 8082 ; 0146 . .HEADING
8046 F83BA3; 0100 LDI A.O(READAH) ;PLO SUB 5 8082 F8AEA3; 0147 LDI A.O(TYPE2) ;PLO SUB
8049 D3; 0101 SEP SUB . . INPUT COMMAND 8085 03; 0148 SEP SUB . .TYPE 2 HEX DIGIT
804A FB24 ; 0102 XRI #24 . . IS IT $ ? .S
804C 32D6; 0103 BZ DOLLAR I 8086 80BF; 0149 GLO PTER ;PHI CHAR
804E FB05 ; 0104 XRI #05 . . IS IT ! ? (TEST WITH S.XOR. ! ) 1 8088 F8AEA3; 0150 LDI A.O(TYPE2) ;PLO SUB
I 8081) D3; 0151 SEP SUB . .TYPE
8050 Al ; 0105 PLO SWITCH . .AND SAVE RESULT 1 808C D320; 0152 SEP SUB; ,#20 . .SPACE
8051 CE; 0106 LSZ . .EQIV. TO BR RDARGS 1 808E ; 0153
8052 FB1E; 0107 XRI #1E . . IS IT ? 808E 40BF ; 0154 TLOOP:LDA PTER ;PHI CHAR . .FETCH 1 BYTE FOR
8054 0108 ..?(TEST WITH $.XOR. ! .XOR.?)
8090 ; 0155 . .TYPING
8054 3A42; 0109 BNZ IGNORE . .IGNORE ALL UNTIL A COMMAND IS 8090 F8AEA3 ; 0156 LDI A.O(TYPE2) ;PLO SUB
8056 0110 READ 8093 D3; 0157 SEP SUB TYPE 2 HEX
8056 0111 8094 21 • 0158 DEC SWITCH
8056 0112 . . THE FOLLOWING IS COMMON FOR ?M AND IM 8095 81 ; 0159 GLO SWITCH
8056 Oil 3 . .(SWITCH. 0 -0 FOR THE LATTER) 8096 3A9B ; 0160 BNZ TL3 B R A N C H IF NOT DONE YET
8056 0114 8098 91 ; 0161 GHI S W I T C H
8056 D3; 0115 RDAKGS:SEP SUB ..NOTE SUB AT READAH. NOW 6099 3239 ; 0162 BZ START B R A N C H IF DONE
8057 0116 . . READ HEX ARCS 809ii 80FAOF ; 0163 TL3 :GLO PTER ;ANI#OF . .IS PTER DIV BY 16
8057 FB4U; 0117 XRI #4D . . SHOULD BE M 809E 3AA6; 0164 BNZ TL2
8059 3ACA; 0118 BNZ S Y N E R R 80AO D33B; 0165 SEP SUB; ,#3B . .IF YES TYPE ; THEN
805B D3; 0119 RD1:SEP SUb 80A2 D30D; 0166 SEP SUB; , # 0 D ..CR AND
805C 3B5B ; 0120 BNF * -#01 ..IGNORE NON HEX CHARS. 80A4 307E ; 0167 BR LINE
805E 0121 . .AFTER M. 80A6 F6; 0168 IL2 :SHR DIV BY 2?
805E D3; 0122 SEP SUb BOA7 338E; 0169 BUF TLOOP IF NO LOOP B A C K , ELSE
805F 335E; 0123 BDF *-#01 . . READ IN FIRST ARC 80A9 30BC ; 0170 BK TLOOP -#02 . . AND THEN LOOP BACK
8061 U124 ..(LOCATIONN IN MEMORY) 80AB 0171
3061 FB20; 0125 XRI #20 ..NEXT CHAR SHOULD BE A SPACE • 80AB 0172 ..THE FOLLOWING DOES(!h LOC DATA) COMMAND
80AB 0173 . .ENTER AT EX1
S063 3ACA; 0126 BNZ SYNERR 80AB 0174
8065 9DBO; 0127 Gril ASL ;PHI PTER 80AB 0175 .'.EFFECT OF THE FOLLOWING IS TO READ IN HEX
8067 8UAO; 0128 GLO ASL ;PLO PTER ..PTER NOW POINTS INTO 8 CAB 0176 . . T E R M I N A T I N G WITH A CR, IGNORING NON-HEX CHARS.
8069 0129 . .USER MEMORY
8069 81 ; 0130 GLO SWITCH . . LOOK AT SWITCH 80AB 0177 . . PAIRS ; EXCEPTIONS: A COMMA BEFORE A CR ALLOWS
806A 32B4; 0131 BZ EX1 . . IF 0 IT WAS !
806C ; 0132 . .OTHERWISE IT WAS ? SOAIi 0178 ..THE INPUT TO CONTINUE ON THE NEXT LINE AND A
806C ; 0133 . .THE FOLLOWING DOES (?M LOC COUNT) COMMAND 80AB 0179 . . SEMICOLON ALLOWS AN !M COMMAN D TO
806C ; 0134 80AB 0180 . .BE ASSUMED.
806C F800ADBD; 0135 LDI #00 ;PLO ASL ;PHI ASL ..CLEAR ASL 80AB 0181
8070 03; 0136 RD2:SEP SUB 80AB D3 ; 0182 EX3:SEP SUB . . INPUT UNTIL A HEX IS READ
8071 3370; 0137 BDF RD2 . . READ IN SECOND ARC
8073 0138 . . (NUMBER OF BYTES) 80AC 3BAB; 0183 BNF EX3
8073 FBOD; 0139 XRI #OD . .NEXT CK FOR CR 80AE ; 0184
8075 3ACA; 0140 BNZ S Y N E R R 80AE D3; 0185 EX2:SEP SUB . .LOOKING FOR SECOND HEX
166 167
NEXT:REQ ..OUTPUT THE STOP BIT 81 A6 FBOA; 0427 XR1#OA . . I S IT LINE FEE D ?
8178 7A; 0377 81A8 3ABF; 0428 BNZ TY2
8179 3243 0378 BZ READ2 ..BR IF D=0, =tCHAR.l
. . I S A NULL 81AA F88B; 0429 LDI#8B . . ( # OF B I T S ) + ( # O F NULLS
817B 0379 81AC
GLO CHAR . .CK ENTRY FLAG 0430 . . T O FOLLOW LF+1)
817B 8F ; 0380 81AC 30C1; 0431
BNZ REXIT . . BR IF ENTRY WAS VIA READ BR TY3
817C 3A39 0381 8 1 AE Qy r
IT ;
• 0432 TYPE2.-GHI CHAR
0382 GHI CHAR ..014 ENTRY
SUE 9F ; 81AF F6F6F6F6 0433 TY4.-SHR ;SHR
817F FF41 0383 SMI#41 ..CK FOR ASCII HEX ;SHR ;SHR ..SHIFT FIRST
BNF CKDEC ..(AT TOP OF ROUTINE) 81B3 i 0434 ..HEX TO RIGHT
8181 3B2F 0384 81B3 FCF6;
SMI#06 . . CK FOR A THRU F 0435 ADI*F6 ..CONVERT TO HEX
8183 FF06 0385 81B5 3BB9;
0386 BDF NFND 0436 BNF *+#04 ..IF A OR MORE
8185 3337 81B7 FC07 ; 0437
0387 ADI#07 ..ADD NET 37
8187 81B9 FFC6AE; 0438 SMI*C6 ; PLO AUX
ft O o O ..ELSE ADD NET 30
8187 U J OO
81BC F81B; 0439 LDIflB
FEFEFEFE; 0389 FNDrSHL ;SHL ;SHL ;SHL ..10+(* OF BITS)
8187 81BE C8 ; 0440 LSKP .EQUIV. TO BR TY3
818B FC08FE; 0390 ADI#08 ;SHL
FND1:PLO AUX ..READY TO SHIFT INTO RD 81BF 0441
818E AE ; 0391 81BF F80B; 0442 TY2.-LDHFOB
818F 8D7EAD; 0392 GLO ASL ;SHLC ;PLO ASL ..SHIFT ..(* OF BITS TO OUTPUT)
. .LOW HALF 81C1 AF; 0443 TY3:PLO CHAR ..SAVE MAIN TALLY VALUE
8192 0393
8192 9D7EBD; 0394 GHI ASL ;SHLC ;PHI ASL ..SHIFT 81C2 ; 0444
0395 . .HIGH HALF ; 81 C 2 ; 0445
8195 81C2 7B; 0446 BEGIN:SEQ . . S
8195 8EFE; 0396 GLO AUX ;SHL
BNZ FND1 ..BR IF NOT FINISHED 81C3 8E; 0447 GLO AOX ..GET CHAR TO BE TYPED
8197 3A8E ; 0397
0398 BR REXIT 81C4 AD; 0448 PLO RD ..SAVE THE CHAR.
8199 3039; 81C5 ; 0449
819B 0399 ..TYPE ROUTINE — TYPES 1 BYTE FROM @R5!,(3R6!, ..(AOX.O CLOBBERED)
..OR C H A R . 1, OR TYPES A BYTE AS TWO HEX DIGITS 81C5 DC07 ; 0450 PREBIT:SEP RC ; ,t 17 . .WAIT ONE BIT TIME
819B 0400
..FROM CHAR.l FOLLOWS A LINE FEED BY SIX NULLS. 81C7 ; 0451 . .RETUR I FROM DELAY WITH D«0
819B 0401
0402 ..USES 2 A U X I L I A R Y REGS-AUX AND CHAR-PLUS 1 81C7 2F ; 0452 DEC CHAR ..DEC THE BIT COUNTER
819B ' 81C8 F 5; 0453
0403 ..RAM LOCATION @ST. EXITS READY TO TYPE 1 BYTE SD . . SIT DF-1
819B f 81C9 8 D 76 AD ;
0404 . .FROM @R5! . EXITS TO R5 0454 . GLO RD ;SHRC ; ;PLO RD ..SHIFT
819B f 81CC ;
0405 ..WHEN ENTERED AT TYPES D , PAUSE S TO ALLOW AN 0455 ..OUTPUT CHAR
819B 81CC 33D1 ;
0406 ..EARLIER READ TO COMPLETE. 0456 BDF OUT1B .. BR IF THE BIT IS A 1
819B
0407 81CE 7B ; 0457 SEO .ELSE SET Q TO ZERO
819B | 81CF 30D3;
0408 ..AUX.O HOLDS OUTPUT CHAR (AT FIRST), THEN 0458 BR OUT1B-H? 2
819B \ 1 D 1 7A;
0409 ..THE DELAY CONSTANT BETWEEN BITS. CHAR.O HOLDS 0459 OUTIB:REQ . . S T 0 TO 1
819B | 81D2C4;
0410 ..THE N U M B E R OF BITS (11) IN ITS LOWER DIGIT, 0460 NOP EL AY
819B
041 1 ..AND IN ITS UPPER DIGIT HOLDS A CODE-- 81D3 8FFAOF; 0461 GLO CHAR ;ANI*OF ..FINISHED TYPING ?
819B
04 1 2 0 FOR BYTE OUTPUT 81D6 C4C4; 0462 NOP ;NOP ..DEIAYU4 INSTR.LOOP)
819B
0413 1 FOR FIRST HEX OUTPUT 81D8 3 A C 5 ; 0463 BNZ PREBIT ..BR IF NOT FINISHED
819B 8 IDA 8 F F C F B ;
04 14 2 FOR LST NULL OUTPUT 0464 NXCHAR:GLO CHAR ;ADIfFB
819B
0415 8 FOR LF OUTPUT 81DD AF ; 0465 PLO CHAR ..SET UP FOR NEXT CHAR
819B
041 6 SIDE 3B9F; 0466 BNF TEXIT ..BUT EXIT IF NO MORE
819B
0417 ORG *819C 81EO F F 1 B ; 0467 SMI*1B ..TEST FOR ALTERNATIVES
819B
819C DC17 ; 0418 TYPE5D:SEP RC ; ,#17 ..3 BIT TIME DELAY ' 81E2 329F; 0468 BZ TEXIT ..IF JUST TYPED LSI NULL
819E 38 ; 0419 SKP , . SKP TO TYPE5D 81E4 3BEA; 0469 BNF HEX2 ..IF JUST TYPED FIRST HEX
819F D5; 0420 T E X I T r S E P R5 81E6 ; 0470 ..JUST TYPED LF OR NULL—
81AO 4538 ; 0421 TYPE5:LDA R5 ;SKP ..ENTRY FOR UT4 81E6 F800; 0471 LDIfOO ..PREPARE TO TYPE NULL
81A2 0422 . . SKIP TO TYPE ' 81E8 30F5; 0472 BR HX22
81A2 4638 ; 0423 TYPE6:LDA R6 ;SKP ..ENTRY FOR G.P. 81EA ; 0473
0424 . . IMMED TH 81EA 9FFAOF; 0474 HEX2:GHI CHAR ;.
;ANI#OF ..GET 2ND HEX DIGIT
81A4 I 81ED
81A4 0425 TYPE:GHI CHAR FCF6; 0475 ADI*F6 ..CONVERT TO HEX
0426 TY1:PLO AUX ..SAVE BYTE FOR LATER 81EF 3BF3; 0476 BNF *+#04 . . IF A MORE
81A5
172 173
TABLE 2
ABSOLUTE
81F1 FC07 ; 0477 ADI#07 ..ADD NET 37 ADDRESS FUNCTION and COMMENTS
81F3 FFC6 ; 0478 SMI#C6 . .ELSE ALL NET 30
81F5 AE; 0479 HX22 :PLO AUX ..STORE
.S' CHAR A W A Y
READ 813E Input ASCII •* CHAR.l, D (if non-
81F6 30C2 ; 0480 BR B E G I N
. standard linkage).
81F8 0481
81F8 B30A; 0482 F S Y N E R T S E P SUB; ,ffOA
81FA D33F ; 0483 SEP S U B ; ,#3F READAH 813B Same as READ. If hex character, DIGIT ->-
81FC C08039 ; 0484 LBR S T A R T ASL (see text).
81FF J 0485 END
0000 TTYRED 8140 Same as READ. Controls paper tape reader
(see text).
AUX RE AUX.l holds time constant and echo bit. 3. READ and READAH exit with R3 pointing back at READAH.
AUX.O is used by all READ and TYPE routines
and by TIMALC. 4. All five TYPE routines exit with R3 pointing at TYPES.
CHAR RF CHAR.l holds input/output ASCII character. 5. As indicated in Table 3-1, ASL = RD, AUX = RE, and CHAR = RF.
CHAR.0 is used by all READ and TYPE routines
and by TIMALC.
174 175
The monitor program UT4 i n c l u d e s all the software to use 10. If it is not#00, do a SEP 3 and c a l l the TYPE r o u t i n e
the "software" U A R T w i t h EF4 and Q l i n e , n o t only for the (30).
monitor program, but as w e l l these subroutines can be
c a l l e d by user programs. T h i s is very u s e f u l , f o r e x a m p l e , 11. TYPE exits w i t h a SEP 5 w h i c h m e a n s the program c o n t i -
to send messages to the terminal d u r i n g program execution. nues at location #0028 and branches back to OUTPUT
(31).
Description of the program :
12. If the s t r i n g has been sent a d e l a y r o u t i n e is i n i t i a -
1. At the first instruction,interrupts have to be d i s a b l e d l i z e d and when it has f i n i s h e d , the same string is sent
as the w h o l e t i m i n g is via counters that cannot be again.
i nterrupted (line 9).
C o m p a t i b l e w i t h SCRT
8000 5 (400 1 .. EXAMPLE PROGRAM • I n t e r r u p t Entry
000B 5 0802 ,.
,„
OUTPUT A STRING
UB.CNG LIT 4 ROUTINES
Ht ' :
•
0('!0H 5 00(53
8000 5 0004 • :
^Bi'
W h e n the 1802 re'ponds to an i n t e r r u p t , X and P are set
0000 5 B00S CONST 1--880EF
0000 5 00B6 CONST 2~B2B06 to 2 and 1 r e s p e c t i v e l y . T h u s , the interrupt h a n d l e r
00BB 5
8000 "
00B7
0008 ORG ti0tiB8
K
•
• always starts at the l o c a t i o n l o a d e d into Rl d u r i n g
0000 X1005 0009 INl'f! DIS.KBB ..DISABLE INTERRUPTS initialization. It is c o n v e n i e n t for most purposes
0002
8('i0b
FH00BS
FBB9A5
0010
0011
LDI A.liURITEiiPHI Rb
LLH A . K C U R I T E J l P L U RS
..LOAD MAIN PC Rb
..U1TH START ADDRESS
• to use Rl to execute a short housekeeping routine
0008
80(19
Db;
•
0012
0013
SEP Rb ..CHANGE PC FROM (>> TO S • w h i c h is a n a l o g o u s to the " C A L L " r o u t i n e of SCRT.
Such a r o u t i n e is shown in F i g . 1.
8809
0fi0C
FBB0BC
FBEFAC
8814 WRITE:
00 Ib
LDI A.1(CONSTi:i5PHI RC
LDI rt. HI CONST 1;);PL(J RC
. .1NI.T DELAY POINTER
I
1
080F
860H
5
F828BE
8016
0017 LDI A.1(C(iNST2:i;PHl RF .,.(N1T T1HE CONSTANT •
1
U s i n g R2 as stack p o i n t e r , the h a n d l e r first p u s h e s
0012 FB0(-iAl:. 00 IB LDI A.K(ClJNST2T;PUJ RE ...AND ECHO BIT X, P, D, DF and R3 onto the stack. It is a l s o neces-
00 1b
00 ib
5
FB00BA
00i 9
0020 LDI A. 1! TEXT J5PHI R6 ..PREPARE TEXT POINTER
• sary to save R4 and R5, since an i n t e r r u p t may occur
0018 F836A6 0021 LDI A. 01 TEXT] 5 PL .0 R6 1
• d u r i n g s u b r o u t i n e c a l l s or returns, when one of these
001B
0018
5
F881B3
0022
0023 1.1)1 IftM'iPHl KG ..LOAD R3 UITH 819C TO
I
I
r e g i s t e r s is a c t i v e . To reduce i n t e r r u p t respons e
00 1E FS9CA8 0024 LDI ti9C5PI.O R3 ..DO A TYPE'S!) FIRST time o n l y the low bytes of R4 and R5 are s a v e d , t h u s
0021 1)300; 002b SEP R3,80H ..EXECUTE ("YPFbD •
I a s s u m i n g t h a t the C A L L and E X I T r o u t i n e s do not cross
0023
0023
5
F8A4A3';
0026
B827 OUTPUT: LDI fJA4',PLU R3 ..PREPARE R8 FUR TYPE I t
page b o u n d a r i e s . (This r e q u i r e m e n t i s a l r e a d y s a t i s -
0026 46BF! 0828 LDA K65PHI RF ..GET BYTE IN RF.1 AND D :S fied by SCRT, because of the use of short branches in
802B
002A
322D5
D35
0029
0030
67 DELAY
SEP R3
..IF IT IS 00 GO TO DELAY
..OTHERWISE SEND IT
f
} the CALL and EXIT routines - a g a i n to reduce execution
802B 30235 0031 BR OUTPUT ..BACK AGAIN time).
002D 5 0032
8B2D E8PF5 0033 DELAY: LDI BEE ..LOAD DELAY CONSTANT
002F B75 0034 PHI R7 : ..IN R7 It is not necessary to save R6, s i n c e t h i s r e g i s t e r
0030 275 003b LOOP: DEC R7 ..DEC (HIS REGISTER
0031 975 0036 GHI RX '• • ' ..GET R7.1 IN D-REGISTER ( " l i n k " ) w i l l b e saved a u t o m a t i c a l l y b y a n y SCRT s u b -
0032 3A3H5 0037 BNZ LOOP ..IE NOT 00 DEC AGAIN t r o u t i n e c a l l used i n t h e i n t e r r u p t s e r v i c e r o u t i n e .
0034 30095 0038 BR URITF ..GO TO NEXT CHARACTER
0036 5 0039 In fact, the information in R6 is very u s e f u l in debug -
8036 0D0AS2434 12042 50040 TEXT: ,X'0D0A' ,T'RCA BRUSSELS' g i n g s i n c e by r e a d i ng R6 the p r o g r a m m e r can e a s i l y
003D
0044
b2bbS3b34b4Cb3 50040
0l)0Ab3b4b2494E 5004-f ,X'0D0A' /('STRING OUTPUT '
\ idetify not o n l y w h i c h s u b r o u t i n e was a c t i v e at the
004B 47204FSbb4b"0SS 50041 I time of the interrupt but also the l o c a t i o n of the
00S2
00S3
b45 0041
0D0Abbb'3494E4X 50042 ,X'0D0A' ,'T'USING UT4 ROUTINES'
I
1 c a l l to that s u b r o u t i n e .
,00bA 20bbb43420b24F 50042
0061 5bb4494E4b"S35 0042
..END OF STRING
•
[
•
0067 005 8843 ,X'HB'
0068 5 8844 END •M
0080 • I
1'
1 r.
I
1•
178 179
B. Interrupt E x i t
To a l l o w use of SCRT s u b r o u t i n e s d u r i n g i n t e r r u p t s , R4
and R5 are r e - i n i t i a l i z e d and f i n a l l y the s t a r t i n g ad-
At the end of any interrupt s e r v i c e , the m a c h i n e status
dressof the s e r v i c e r o u t i n e i t s e l f is l o a d e d into R 3 ,
m u s t be restored for return to the interrupte d oroqram.
w h i c h becomes p r o g r a m counter after e x e c u t i o n of the
T h i s is done by a r o u t i n e a n a l o g o u s to the "EXIT" of
SEP 3 i n s t r u c t i o n .
SCRT. T h i s r o u t i n e needs a d e d i c a t e d p o i n t e r , and it
is often c o n v e n i e n t to use R0 for t h i s task in a p p l i -
After p a s s i n g control to R3, Rl is l e f t reset to the
c a t i o n s not u s i n g DMA. H o w e v e r , for g e n e r a l i t y it is
i n t e r r u p t entry p o i n t (by the " b r a n c h - t o - s t o p " i n s t r u c -
suggested that the next " a v a i l a b l e " register , R7,
tion). S i n c e i n t e r r u p t s are a u t o m a t i c a l l y d i s a b l e d on
s h o u l d be used for the r e t u r n - f r o m - i n t e r r u p t f u n c t i o n
i n t e r r u p t r e s p o n s e, t h e i n t e r r u p t h a n d l e r c a n n e v e r
in F i g u r e 1.
b e i n t e r r u p t e d , a n d interrupts r e m a i n d i s a b l e d u n t i l
t h e s e r v i c e r o u t i n e i t s e l f r e - e n a b l e s them.
The r o u t i n e shown assumes that X = 2 on entry and t h a t
i n t e r r u p t s are d i s a b l e d d u r i n g its o p e r a t i o n . It res-
Total e x e c u t i o n t i m e of the entry r o u t i n e is 78.4 uS
tores R5, R4, R3, DF and D and then branches to the
w i t h a 5MHz clock.
RET i n s t r u c t i o n , w h i c h restores X and P and r e - e n a b l e s
i nterrupts.
SEX 3 ; D I S , # 27
CASSETTE I N T E R F A C E U S I N G UT4
Software i m p l i c a t i o n s :
1. I n s t r u c t i o n e x e c u t i o n time is d e g r a d e d by a factor of
1,5 because i n s t r u c t i o n s effectivel y take 3 cycles
(fetch - execute - DMA).
1 — OD— 7^
NOP (DMA) f;
f'
!
GHI R0 Load register i ; XTAL CLOCK SECONDS
NOP (DMA)
i JL
PHI R3 R3 w i t h
*
1
• *
<^'
W*-I
NO ^XMir^orE^X.
^%E L A, p 5 E O^X^
NOP (DMA)
LDI #0B The start l o c a t i o n
NOP (DMA) | 6P\A"|
UPDATE
MIMUTES
PLO R3 Of the m a i n program !' COP 1802 •-'
I
NOP (DMA)
? ' '
MOUCS
After execution of this instruction another DMA is done. *
JL
;
T h i s means that o n l y odd i n s t r u c t i o n s are executed as F i g u r e 1 : H a r d w a r e For '"
l o n g as R0 is DMA p o i n t e r and PC. Here NOP was chosen
as f i l l e r , but any other i n s t r u c t i o n works as w e l l .
Real Time Clock \T )
|
i
< '
MIN10:
BDFMIN10
SMI 246
STR STACK
CHECK FOR CARRY
IF NO CARRY ADD 1
AND STORE
' r 9 CLOCK. ANDJ>F^ .. GET MSD MINUTES
BNFMINFIN IF NO DF DONE
ADI 176
BDFMINFIN CHECK FOR CARRY
SMI 160 - CARRY
IF NO - ADD 1
MINFIN: S OR. 9—*f CLOCK .. COMBINE AND STORE
, ' BNF EXTCLK IF NO DF DONE
HOURS: INC CLOCK POINT TO HOURS
' P CLOCK + 221
BDF EXTCLK IF MIDNIGHT EXIT
: BR MINUTE USE SAME CODE
END
186 187
PROM P R O G R A M M E R FOR CDP18U42
To program a l o c a t i o n , i n p u t
!MXX YY (CR)
The CMOS EPROM CDP18U42 is the first of a series of UV
erasable CMOS PROMS for the COSMAC microprocessor. and to verify, type
The content is 2K b i t s o r g a n i z ed as 256 x 8 b i t . N o r -
m a l l y these E P R O M S are programmed u s i n g the f a c i l i t i e s ?MXX YY (CR)
of the d e v e l o p m e n t system. Its programmer package per-
forms sophisticated program and verify functions in In this circuit, the location of the EPROM is programmed
a d d i t i o n to s a v i n g data f i l e s and p r i n t i n g program l i s t s . di rectly.
Til
o
o:
Verify Cycle
The problem can be solved if one page of ROM is a v a i l a b l e
for use as a l o o k u p t a b l e . W i t h t h i s m e t h o d , one r e g i s t e r
-*J 9OOn« !•*-
o p e r a n d becomes t h e lower order t a b l e p o i n t e r a d d r e s s , w h i l e
the other operand is transferred to D. The l o o k u p t a b l e
c o n t a i n s s e q u e n t i a l bytes from 00 to F F , and w h e n the a r i t h -
m e t i c or ALU operation is performed, the t a b l e contents and
D are operated u p o n , w i t h the r e s u l t in the D register.
[-»- 500 n* —*
CD4098 g. -— Smt-^T
COP18OZ WITT, CDPI8U42P5H
-f VALID DATA
PROGRAM CYCLE
93CM- 32?9I
Program Cycle
192 193
DEBUGGING AID
EXAMPLE
As t h i s is a p r o g r a m as w e l l , it needs a p r o g r a m counter
if R(9).l = AA and R(B).0 = FF
and a data p o i n t e r .
then R(7) w o u l d p o i n t to a d d r e s s 03AA
C o n t e n t s of 03AA = AA
M(R(X)) + D = AA + FF = AA It has to h a v e a "har d b r e a k " . T h i s means that it has
D w i l l contain AA when operation is complete to be p o s s i b l e to get out of a l o o p . The e a s i e s t way is
to R E S E T the microprocessor .
As data p o i n t e r R8 is c h o s e n .
i.
0880 08H2 ..THIS SHORT DEBOG PROGRAM i 003S 8183
0000 0853 ..SAVES AND RESTORES PART OF THE 0035 0104 ..AS R8 AND KB HAVE NOT BEEN
8000 8854 ..CDF 1802 STATE USING ! 0835 010S ..CHANGED HOPEFULLY, A SEP 0
0008 0055 ..D0 AS SOFTWARE BREAKPOINT 1 0835 8106 ..IN THE USER PROGRAM WILL
8000 0056 ! 8835 0107 ..START THE SAVE ROUTINE
8088 0057 ORB 80000 BBSS 0108 ..WITH R8 POINTING TCI 84FF 1 :
0000 C0003S; 00S8 LBR SAVE ..THIS IS AN ENTRY AFTER RESET I 0835 0109
0083 0059 ..OR HARD BRAKE | 0035 E0; 0110 SAW.! SEX R0 ..X TO IMMEDIATE
0803 0068 ..RESTORE REGISTERS AND START EXECUTION | 0036 7180; 0111 DIS, 880 ..HI DIS INTERRUPTS
0083 0061 ..OF USER PROGRAM WITH $P3tCR) W 8838 585 0112 STR R8 ..SAVE D
0083 0062 ..UITH X,P FROM LOCATION B4FE0 •1 0039 88; 0113 GLO R8 ..CHECK DATA POINTER
0003 0063 IB 803A FBE1; • ' 0114 XRI 8E1
0003 K8085 0064 LDI 808 ..A SHORT DELAY H 003C 3A43; 0115 BN7. REPAIR ..IF CHANGED GO TO REPAIR
0085 B8! 0065 PHI R3 n 003E 98; 0116 GHI R8
0006 28; 0066 LOOP « DEC R8 •t 888K FB4F; 0117 XRi H4K
0007 98'i 0067 GHI R8 : W 0041 324C; 0118 B7. DOK
0088 3A06; 0068 BNZ LOOP BE 8843 ; 0119
088A 0069 H 0043 F84FB85 0120 REPAIR; LDI 84FSPH1 R8 ..SET' DATA POINTER
000A F84FB8! 0070 LDI K4F5PHI R8 ..LOAD DATA POINTER •f 0046 F8HBA85 '", 0121 I...DI BF85PLG H8 "
008D F8E2A8J 0071 LDI «E2;PLO R8 ..R8 WITH 84HE2 K 0B49 58; 0122 SIR R8 ..STORE l:0 AT DF
0010 0072 : SEX R8 ' ..SET X TO 8 •f 004A 3052; 0123 BR SDF
0811 0073 Kg' 884C 5 0124 >•
MB 11 72B -i; LDXA5PHI R1 .. RESTORE REGISTERS BE 804C F8F0A8; 0125 DDK: LDI 8F05PLU R8 ..SET R8 TO DF LOCATION
0013 72A1; 0075 LDXA;PLi! R1 ..R1 10 R7 • 004F F880S8; 8126 LDI 800 5 SIR R8 ..STORE D IS UK
0815 72B25 0076 LDXA5PH1 R2 •I 8852 ; 0127
0017 72A25 0077 LDXA5PLO R2 H 8052 E85 0128 SDF; SEX R8
0019 72B35 8878 LDXA;PHI R3 •ft 8053 7EF 1 5 0129 SHLC50R ..SAVE DF
00 IB 72A3; 0879 LDXA5PLO R3 ' . ' , • 0055' 73; 0130 8TXD
001D 72B41 8080 LDXA5FHI R4 •K 8056 ; 0131
0011- 72A45 8081 LDXA5PLO R4 mm 0066 8773; 8132 GLO R7",STXD ..SAVE R1 TO K?
0B21 72B5; 0082 LDXAIPHJ R5 •1 0058 9773; B133 GHI R75STXD
0023 72A5! 0083 LDXA'PLO RS HI 805A 8673'i 8134 GLU R6",STXD
0025 72B6; 0084 Ll)XA;PHI R6 ','•,: H: 005C 9673; B135 GHI R65STXD
0027 72AA; 0085 LDXA;PL(J H6 '''... . H; 005E 85735 0136 GLO R55STXD ,
72R7; 0086 LDXA',PHI R7 ;. •E 0060 95735 0137 GHI R55S1XD
002B 72 A 7; 0087 LDXA5PLO H7 :' ' - ', H 0062 84735 0138 GLO R4;STXIJ
082D 0088 mf 8864 94735 0139 GUI R45SIXD
0B2D F076; 0889 LDXlSHRt: ..GET DF BACK • 0066 8373; 8140 GLO R35STXD
002F 0898 B 0068 9373; 0141 GHI R35STXD
002F F8E.1A8; 089 1 LD) 6K15PLO R8 ..SET ADD OF D K 006A 8273; 0142 GLO H25STXD
0032 Fti1, 8892 L.DX ..A HI.) LOAD •I 006C 92735 0143 GHI R25S1XD
0033 0093 •[ 006E 8173; 0144 GLO R1",SIXD
8033 28; 8894 DtC HB ..POINT TO X,P K 0078 91735 0145 GHI R15STXD
0034 70; 8095 REI' ..DIS TO DISABLE INTERRUPTS •1 8072 0146
00'JS 8096 W 0072 080H0; 0147 fiONI'l: LBR 88080 ..BRANCH TO M808H
0085 8897 ..NOW THE USER PROGRAM IS RUNNING 8875 0148 ..U14 WAITS FOR CK OR LF
0036 889i:i ..WITH THE SUGGESTED X,P FROM 4FEH 0R75 8149
0035 8899 ..II COMES HACK TO DEBUG VIA A SEP 0 007S 0150 ..NOW ?I1 AND !M CAN BE USED TO MODIFY
0085 8188 ..IT STORES PAR! OH THE 1802 REGISTERS 0B7S 8151 ..MEMORY AND WHEN USER PROGRAM IS S T A R T E D ,
0036 8181 ..AND BRANCHES 10 88806 8075 8152 ..THESE VALUES WILL Bt TRANSFERRED
0035 0102 ..1114 WAITS NOW FOR CR OR LF 0875 0153 ..INTO THE CDP1802
198 199
APPENDIX A
Microprocessor Products 8
Solid State CDP1802D *
007S 0154 Division
0155 ..IF THE EXIT 10 UI4 CDP1802CD I
06175 01S6 ..IS CHANUtD A LFITLE BIT
007S ..THE STATE IS DISPLAYED
007S 0158 ..IHMtUIATELY AFTER A D0 IN USER PROGRAM
007S 0159 COSMAC Microprocessor
007S 0160
007b "880BC 0161 LDI 880',PHI RC .SET DELAY POINTER Features:
0078 8LFAC 0162 LI)I 8EF5PI.O RC • Instruction fetch-execute time of 2.5 or 3.75 jus
at VDD = 10 V; 5.0 or 7.5 /^s at VDD = 5 V
8B7B 0163
• Static silicon-gate CMOS circuitry - no minimum
0BXB 0164 LDI HiiSlPHI RE .TIME CONSTANT clock frequency
H07E 800AF. 0165 LU1 B005PLU RE .AND ECHO BIT • Full military temperature range (-55 to +125°C)
HH81 0166 » High noise immunity, wide operating-voltage range
0081 F H167 LDI K815HHI R3 .PREPARE FOR TYPESD • Single voltage supply • Low power
LDI 8005PH) Rl) .TO TYPE • Single-phase clock; optional on-chip « TTL compatible
0B84 f "800BD 0168
40-Lud Dual In- crystal-controlled oscillator • On-chip DMA
0087 h 8 11 AD 0169 LDI HI-ilPLi) Rl! .17 BYTES Lina Ceramic • Simple control of reset, run, and pause
008A 017(4 Packaje ID) • 8-bit parallel organization with bidirectional data bus
KH00B1 LDI fiMkilPHI Rl .TELL n IS A CDP1002D • Any combination of standard RAM and ROM
008D 0172 LDI «11',PLU R1 .?M SEUUENCF CDP1802CD • Memory addressing up to 65,536 bytes
• Flexible programmed I/O mode
00V0 0173
0090 F80HB5; 0174 LUI fietnPHl Rb .PREPARE R5 The RCA-CDP1802 is an LSI COS/MOS • Program interrupt mode
8-bit register-oriented central-processing unit • Four I/O flag inputs directly tested by
0093 K896A5; 01/b LDI A . t l l B A L K J i P L O Rb branch instructions
(CPU) designed for use as a general-purpose
0896 0176 • Programmable output port
SEP Rb .USE R5 AS PC computing or control element in a wide • 91 easy-to-use instructions
0096 0177 BACK:
range of stored-program systems or products. • 16 x 16 matrix of registers for use as
069? U1/8 multiple program counters, data
0179 LDI. B4MPHI Mi .LOAD DISPLAY POINTER The CDP1802 includes alt of the circuits re- pointers, or data registers
0180 LDI fiE0;PLi) RB quired for fetching, interpreting, and exe-
cuting instructions which have been stored controllers. Further, the I/O interface is
009I.) 0181
in standard types of memories. Extensive
0091) 018i' LBR «8H8E .ENi'ER UT4 capable of supporting devices operating in
input/output (I/O) control features are also polled, interrupt-driven, or direct memory-
00A9 0183
provided to facilitate system design.
END access modes.
8184
The COSMAC architecture is designed with The CDP1802D and CDP1802CD are func-
0000
emphasis on the total microcomputer sys- tionally identical. They differ in that the
tem as an integral entity so that systems CDP18020 has a recommended operating
having maximum flexibility and minimum voltage range of 4-12 volts, and the CDP
cost can be realized. The COSMAC CPU 1802CD, a recommended operating voltage
also provides a synchronous interface to range of 4-6 volts. These types are supplied
memories and external controllers for I/O in 40-lead dual-in-line ceramic packages
devices, and minimizes the cost of interface (D suffix).
The Preliminary Data are intended for Information lurmshed by RCA is believed Printed in USA/2-78
guidance purposes m evaluating the de- to be accurate and reliable. However, no
vice for equipment design. The device responsibility is assumed by RCA for its
is now being designed for inclusion m use; nor for any infringements of patents Trademarks! Registered®
our standard line of commercially avail- or other rights of third parties which may Marcals) Registrada(s)
able products. For current information result from its use. No license is granted
on the status of this program, please by implication or otherwise under Supersedes preliminary
contact your RCA Sales Office. patent or patent rights of RCA. data issued 8/77
200 201
5 5 400 400
CONDITIONS LIMITS AT INDICATED TEMPERATURES (°C)
CHARACTER- Maximum DMA Transfer Rate 5 10 500 - KBvtes/sec
VCC. UNITS
ISTIC
vo VIN VDD VALUES +25 10 10 800 -
(V) (V) (V) -55 -40 +85 +125 Min. Typ. Max.
5 5 DC - 3 . 2 DC -3. 2
Quiescent Device - - 5 - - - - - 1 100 Maximum Clock Input Frequency,
5 10 DC - 4 - MHz
Current, I L Max. - - 10 - - - - - 10 500
<CL3
MA 10 10 DC - 6.4 -
CDP1802D - - 15 - - - - - - 1000
CDP1802CD - - 5 - - - - - - 500 NOTES:
1: VCC ^V DD ; for CDP1802CD, V DD = VQQ = 5 volts.
Output Low Drive 2. Equals 2 machine cycles — one Fetch and one Execute operation for all instructions except Long Branch and
(Sink) Current, 0.4 0,5 5 1.98 1.89 1.14 0.90 1.5 2.2 -
'OL Min. 3. Lo
mA
(Except XTAL) 0.5 0,10 10 3.70 3.53 2.13 1.68 2.8 5.2 -
XTAL Output
0.4 5 5 132 126 76 60 100 - - fiA
IOL Min.
XTAL Output
lOH Min. 4.6 0 5 -66 -63 -38 -30 -50 _ — MA
Output Voltage - 0,5 5 0.05 - 0 0.05
Low-Level 0,10 10 0.05 0.05
- - 0
VQL Max.
_ V
Output Voltage 0,5 5 4.95 4.95 _
5
High Level,
- 0,10 10 9.95 9.95 10 - Fig. 2 — Typical output high (source) current
VQH Min.
characteristics. Fig. 3 - Typical output low (sink) current
characteristics.
Input Low 0.5,4.5 - 5 1.5 - - 1.5
Voltage 0.5,4.5 - 5,10 1 - - 1
V|LMax. 10
1.9 - 3 - - 3
V
Input High 0.5,4.5 - 5 3.5 3.5 _ _
Voltage 0.5,4.5 - 5,10 4 4 - -
V| L Min.
1,9 - 10 7 7 - -
Input Leakage
Any
Current 0,15 15 +1 - +1 MA
Input -
I IN Max
3-State Output
Leakage Current 0,15 0,15 15 ±1 ±1 ±12 ±12 - ±10-* +1 MA
'OUT Max. flLOAD CAPACITANCE (4CL)-
LOAD CAPACITANCE (Ci_l — EXCEPT
Fig. 4 — Typical translation time vs. load Fig. 5 — Typical change in propagation delay as a
capacitance. function of a change in load capacitance.
202 203
File No. 1023. .CDP1802D, CDP1802CD CDP1802D, CDP1802CD. .File No. 1023
t t
VDD
NOTE:
Fig. 11 - Input leakage current test circuit. Fig. 12 - Three-state output leakage (data bus)
IDLE-"00**T M(OOOO) test circuit.
BRANCH • " 370? AT M 18107)
Fig. 6 — Typical maximum clock frequency as a
function of temperature. Fig. 7 — Typical power dissipation as a function of
clock frequency for BRANCH instruction
and IDLE instruction for CDP1802D.
«ooo c
-OCK * /(CL" T
S
'AC MEMORY
UP)
.? .
300C
x « ?'*^ 2
t^&s
^*.'t*
/
«:£§ i
•4 ^ 4 " CC'1 v v D ' v
o ^ *L £ ' S -
~*&£.ll_ x? iS 5V
1 ^j3
S
s t ^ ^
52 ?
t ^
f 't
a
s ^^
IOCC
f 1
^
,/» '^
J
2
4.
C L O C K INPUT T R E O U E N C Y (fCL)-MHl
NOTES:
1 THIS TIMING DIAGRAM IS USED TO SHOW SIGNAL RELATIONSHIPS
ONLY AND DOES NOT REPRESENT ANY SPECIFIC MACHINE CYCLE
2 ALL MEASUREMENTS ARE REFERENCED TO 5O% POINT OF THE
WAVEFORMS
NOTE 1 S SHADED AREAS INDICATE "DON'T CARE" OR UNDEFINED STATE ;
TEST ANY ONE INPUT WITH ALL OTHER MULTIPLE TRANSITIONS MAY OCCUR DURING THIS PERIOD
INPUTS AT "NOISE" VOLTAGE LEVELS.
Fig. 9 — Noise immunity test circuit. Fig. 10— Quiescent-device leakage current test circuit. Fig. 13 - Timing waveforms.
204 205
File No. 1023. -CDP1802D,CDP1802CD CDP1802D, CDP1802CD. .File No. 1023
5 5 _ 400 600 5 0
Clock to State Code 5
10
10
10
-
-
200
150
400
300
ns EF 1-4 Set Up 5
10
5
10
10
100
125
150
25
50
-
ns
5 5 _ 300 700 5 5 250 150
Clock to Q 5
10
10
10
-
-
150
100
400
300
ns EF1-4Hold 5
10
10
10
200
150
100
75
-
Clock to NIO-2), tPLH
5
5
5
10
_
-
450
300
800
600 ns
Pulse Width, t WL 5 5 600 300 -
10 10 - 200 400 CLEAR Pulse Width
10 10 300 50 -
High-Order Memory Address Byte 5 10 0 „ _ 5 5 160 - _
_
f= 4 MHz
CLOCK Pulse Width, t WL 5 10 125 - ns
SetUp,t s u f = 6.4 MHz 10 10 -bO - -
b bC 10 10 80
(See Note) f=
f=
2 MHz
5 MHz
5
10 10 30
-
-
-
-
-
-
Typical Total Power Dissipation
Idle "00" at M(OOOO), C L = 50 pF
f =
f=
2 MHz
4 MHz
5
10
5
10
- 4
60
- mW
High-Order Memory-Address Byte Hold f = 4 MHz 5 10 120
tH f = 6.4 MHz
f = 2 MHz
10
5
10
5
75
200
-
-
-
-
ns Effective Input Capacitance, CIN
Any Input - 5 - pF
ARCHITECTURE tion is to be fetched. When the instruction is 5. indicate the value to be loaded into X fer, R(0) is incremented by one so that the
read out from the memory, the higher-order to designate a new register to be used processor is ready to act upon the next DMA
The COSMAC block diagram is shown in
4 bits of the instruction byte are loaded into as data pointer R(X). byte transfer request. This feature in the
Fig. 14. The principal feature of this system is
the I register and the lower-order 4 bits into COSMAC architecture saves a substantial
a register array (R) consisting of sixteen 16- The registers in R can be assigned by a pro-
the N register. The content of the program amount of logic when fast exchanges of
bit scratchpad registers. Individual registers grammer in three different ways: as program
counter is automatically incremented by one blocks of data are required, such as with
in the array (R) are designated (selected) by a counters, as data pointers, or as scratchpad
so that R(P) is now "pointing" to the next magnetic discs or during CRT-display-refresh
4-bit binary code from one of the 4-bit locations (data registers) to hold two bytes
registers labeled N, P, and X. The contents of byte in the memory. cycles.
of data.
any register can be directed to any one of the The X designator selects one of the 16 regis- A program load facility, using the DMA-ln
following three paths: ters R(X) to "point" to the memory for an Program Counters channel, is provided to enable users to load
1. the external memory (multiplexed, operand (or data) in certain ALU or I/O programs into the memory. This facility pro-
higher-order byte first, on to 8 memory operations. Any register can be the main program
counter; the address of the selected register vides a simple, one-step means for initially
address lines); The N designator can perform the following entering programs into the microprocessor
2. the D register (either of the two bytes is held in the P designator. Other registers in
five functions depending on the type of R can be used as subroutine program counters. system and eliminates the requirement for
can be gated to D); instruction fetched: specialized "bootstrap" ROM's.
3. the increment/decrement circuit where By a single instruction the contents of the P
it is increased or decreased by one and 1. designate one of the 16 registers in R register can be changed to effect a "call" to a Data Registers
stored back in the selected 16-bit to be acted upon during register opera- subroutine. When interrupts are being ser- When registers in R are used to store bytes of
register. tions; viced, register R(1) is used as the program data, four instructions are provided which
The three paths, depending on the nature of 2. indicate to the I/O devices a command counter for the user's interrupt servicing rou- allow D to receive from or write into either
the instruction, may operate independently code or device-selection code for peri- tine. After reset, and during a DMA oper- the higher-order- or lower-order-byte portions
or in various combinations in the same pherals; ation, R (0) is used as the program counter. of the register designated by N. By this
machine cycle. 3. indicate the specific operation to be At all other times the register designated as mechanism (together with loading by data
executed during the ALU instructions, program counter is at the discretion of the immediate) program pointer and data pointer
With two exceptions, COSMAC instructions user.
consist of two 8-clock-pulse machine cycles. types of tests to be performed during designations are initialized. Also, this tech-
The first cycle is the fetch cycle, and the the Branch instructions, or the specific Data Pointers nique allows scratchpad registers in R to be
second-and third, if necessary—are execute operation required in a class of mis- The registers in R may be used as data used to hold general data. By employing
cycles. During the fetch cycle the four bits cellaneous instructions (70-73 and 78- pointers to indicate a location in memory. increment or decrement instructions, such
in the P designator select one of the 16 regis- 7B); The register designated by X (i.e., R { X ) ) registers may be used as loop counters.
ters R(P) as the current program counter. The 4. indicate the value to be loaded into P points to memory for the following instruc- The Q Flip Flop
selected register R(P) contains the address of to designate a new register to be used tions (see Table I):
as the program counter R(P); An internal flip flop, Q, can beset or reset by
the memory location from which the instruc- 1. ALU operations F1-F5,F7, 74, 75, 77;
2. output instructions 61 through 67; instruction and can be sensed by conditional
3. input instructions 69 through 6F; branch instructions. The output of Q is also
MEMORV ADDRESS
4. certain miscellaneous instructions—70- available as a microprocessor output.
73, 78.60, FO. Interrupt Servicing
The register designated by N (i.e., R(N)) Register R(1) is always used as the program
points to memory for the "load D from counter whenever interrupt servicing is ini-
memory" instructions ON and 4N and the tiated. When an interrupt request comes in
"Store D" instruction 5N. The register and the interrupt is allowed by the program
designated by P (i.e., the program counter) is (again, nothing takes place until the comple-
used as the data pointer for ALU instructions tion of the current instruction) the contents
F8-FD, FF, 7C, 7D, 7F. During these instruc- of the X and P registers are stored in the
tion executions, the operation is referred to temporary register T, and X and Pare set to
as "data immediate". new values; hex digit 2 in X and hex digit 1
Another important use of R as a data pointer in P. Interrupt enable is automatically de-
supports the built-in Direct-Memory-Access activated to inhibit further interruptions. The
(DMA) function. When a DMA-ln or DMA- user's interrupt routine is now in control; the
Out request is received, one machine cycle is contents of T may be saved by means of a
"stolen". This operation occurs at the end of single instruction (78) in the memory location
the execute machine cycle in the current pointed to by R (X). At the conclusion of the
instruction. Register R{0) is always used as interrupt, the user's routine may restore the
the data pointer during the DMA operation, pre-interrupted value of X and P with a single
The data is read from (DMA-Out) or written instruction (70 or 71). The interrupt-enable
into (DMA-ln) the memory location pointed flip-ftop can be activated to permit further
to by the R(Q) register. At the end of the trans- interrupts or can be disabled to prevent them.
SIGNAL DESCRIPTIONS MWR (Write Pulse) A negative pulse appearing .in a memory-write cycle, after
BUS 0 to BUS 7 8-bit directional DATA BUS lines. These lines are used for the address lines have stabilized.
(Data Bus) transferring data between the memory, the microprocessor, MRD (Read Level) A low level on MRD indicates a memory read cycle. It can
and I/O devices. be used to control three-state outputs from the addressed
NO to N2 (I/O Lines) Activated by an I/O instruction to signal the t/O control logic memory which may have a common data input and output
bus. If a memory does not have a three-state high-impedance
of a data transfer between memory and I/O interface. These
lines can be used to issue command codes or device selection output, MRD is useful for driving memory/bus separator
codes to the I/O devices (independently or combined with gates. It is also used to indicate the direction of data trans-
the memory byte on the data bus when an I/O instruction fer during an I/O instruction. For additional information see
is being executed). The N bits are low at all times except Table I.
when an I/O instruction is being executed. During this time Q Single bit output from the CPU which can be set or reset
their state is the same as the corresponding bits in the N under program control. During SEQ or REO instruction
register. execution, Q is set or reset between the trailing edge of
The direction of data flow is defined in the I/O instruction TPA and the leading edge of TPB.
by bit N3 (internally) and is indicated by the level of the CLOCK Input for externally generated single-phase clock. A typical
MRD signal. clock frequency is 6.4 MHz at V cc = V D D = 10 volts.
MRD = V c c : Data from I/O to CPU and Memory The clock is counted down internally to 8 clock pulses per
MRD = V ss : Data from Memory to I/O machine cycle.
EF1 to EF4 These inputs enable the I/O controllers to transfer status Connection to be used with clock input terminal, for an
XTAL
(4 Flags) information to the processor. The levels can be tested by external crystal, if the on-chip oscillator is utilized. The
the conditional branch instructions. They can be used in crystal is connected between terminals 1 and 39 (CLOCK
conjunction with the INTERRUPT request line to establish and XTAL) in parallel with a resistance (10 megohms typ.).
interrupt priorities. These flags can also be used by I/O Frequency trimming capacitors may be required at terminals
devices to "call the attention" of the processor, in which
1 and 39. For additional information see ICAN-6565.
case the program must routinely test the status of these
flag(s). The flag(s) are sampled at the beginning of every S1 WAIT, CLEAR Provide four control modes as listed in the following truth
cycle. (2 Control Lines) table:
CLEAR WAIT MODE
INTERRUPT, DMA-IN, These inputs are sampled by the CDP1802 during the
L L Load
DMA-OUT interval between the leading edge of TPB and the leading
(3 I/O Requests) L H Reset
edge of TPA.
H L Pause
Interrupt Action: X and P are stored in T after executing
current instruction; designator X is set to 2; designator.P is H H Run
set to 1; interrupt enable is reset to 0 (inhibit); and instruc- The function of the modes are defined as follows:
tion execution is resumed. The interrupt action requires one Load
machine cycle (S3).
DMA Action: Finish executing current instruction; R(0) Holds the CPU in the IDLE execution state and allows an
points to memory area for data transfer; data is loaded into I/O device to load the memory without the need for a
or read out of memory; and increment R{0). "bootstrap" loader. It modifies the IDLE condition so that
DMA-IN operation does not force execution of the next
Note: In the event of concurrent DMA and INTERRUPT
instruction.
requests, DMA-IN has priority followed by DMA-OUT and
then INTERRUPT. Reset
SCO, SCI, Registers I, N, Q are reset, IE is set and O's (Vgg) are placed
(2 State Code Lines) These outputs indicate that the CPU is: 1 fetching an instruc-
tion, or 2) executing an instruction, or 3) processing a DMA on the data bus. TPA and TPB are suppressed while reset is
request, or 4) acknowledging an interrupt request. The levels held and the CPU is placed in S1. The first machine cycle
of state code are tabulated below. All states are valid at TPA. after termination of reset is an initialization cycle which
H = V CO L = V S S . requires 9 clock pulses. During this cycle the CPU remains
in S1 and registers X, P, and R(0) are reset. Interrupt and
State Code Lines DMA servicingare suppressed during the initialization cycle.
State Type
SC1 SCO The next cycle is an SO, S1, or an S2 but never an S3. With
SO (Fetch) L L the use of a 71 instruction followed by 00 at memory
S1 (Execute) L H locations 0000 and 0001, this feature may be used to reset
S2 (DMA) H L IE, so as to preclude interrupts until ready for them. Power-
S3 (Interrupt) H H up reset can be realized by connecting a buffered RC net:
work to CLEAR. For additional information see ICAN-
TPA, TPB Positive pulses that occur once in each machine cycle (TPB 6581.
(2 Timing Pulses) follows TPA). They are used by I/O controllers to interpret
Pause
codes and to -time interaction with the data bus. The
Stops the internal CPU timing generator on the first negative
trailing edge of TPA is used by the memory system to latch
high-to-low transition of the input clock. The oscillator
the higher-order byte of the 16-bit memory address. TPA is
continues to operate, but subsequent clock transitions are
suppressed in IDLE when the CPU is in the load mode.
ignored.
MAO to MA7 Run
The higher-order byte of a 16-bit COSMAC memory address
(8 Memory Address Lines) May be initiated from the Pause or Reset mode functions.
appears on the memory address lines MAO-7 first. Those
bits required by the memory system can be strobed into ex- If initiated from Pause, the CPU resumes operation on the
ternal address latches by timing pulse TPA. The low-order first negative high-to-low transition of the input clock.
When initiated from the Reset operation, the first machine
byte of the 16-bit address appears on the address lines
after the termination of TPA. Latching of all 8 higher-order cycle following Reset is always the initialization cycle. The
initialization cycle is then followed by a DMA (S2) cycle or
address bits would permit a memory system of 64K bytes.
fetch (SO) from location 0000 in memory.
214 215
CDP1802D, CDP1802CD. .File No. 1023
File No. 1023 CDP1802D, CDP1802CD
Vrjrj, Vgg, VQC The internal voltage supply VQQ is isolated from the Input/ 0 1 2 3 5 6 7 0 2 3 4 5 6
(Power Levels) Output voltage supply Vcc so that the processor may
operate at maximum speed while interfacing with various
external circuit technologies, including T^L at 5 volts. VQQ
must be less than or equal to VQQ, All outputs swing from TPB | | | |
Vgs to VCQ. The recommended input voltage swing is
MACHINE CYCLE j CYCLE n | CYCLE In * 11 |
V S S t o V CC-
RUN-MODE STATE TRANSITIONS
INSTRUCTION [ FETCH (SO) | EXECUTE (S1I |
The CDP1802 and CDP1802C CPU state
transitions when in the RUN, RESET, and
MRD | I
LOAD modes are shown in Fig. 15, Each
machine cycle requires the same period of NO-N2 / N - 9- F \R
time, Sclockpulses, except the initialization
cycle, which requires 9 clock pulses. The
execution of an instruction requires either
two or three machine cycles, SO followed by
» 4 ^^^ ' '
a single S1 cycle or two 51 cycles. S2 is the ALLOWABLE MEMORY ACCESS
response to a DMA request and S3 is the
interrupt response. Table II shows the con-
Fig. 15— CDP1802 microprocessor state
ditions on Data Bus and Memory-Address transitions (Run Mode).
lines during all machine states. WRITE CYCLE
HIGH ADD ] LOW ADDRESS ^»IGH ADDj LOW AODHfSS ^IGH*OOJ LOW ADO CSS ^IGHADO) LOWAODHESS ^ICHADOJ
fEICH <») [ EXECUIt (ill | HtCM ISO! | ExtCUlE 1511 1 FtTCH <K1I
^MEMOHV R f A D C Y C L E —-*^^_ NO- ME-OBV C VCU —K-«"">BV "*" CVCL ( 4. NONMeWORVCVCLt—4- f^"V
] | C CL
1 1 1
CLOCK
TPA
N 1- 7
DATA STROBE'
IMRD • TPB- N|
92CS-29602
TABLE II. CONDITIONS ON DATA BUS AND MEMORY ADDRESS LINES DURING ALL MACHINE STATES
DATA MEMORV
STATE 1 N MNEMONIC INSTRUCTION OPERATION BUS ADDRESS MRD NOTES0
R(0|
SI RESET JAM:I,N,Q,X,P-0 IE = 1 0 1 A
UNDEFINED
F RST CYCLE AFTER RESET RiO) t
INITIALIZE 0 B
NOT PROGRAMMER ACCESSIBLE UNDEFINED
MSJI iFETCmSOl SO FETCH M(R(P))-»I.N RIPH-1 M(R(P)1 R(P) 0 C
0 IDL IDLE
[Load = 0 (Program Idle)] M(R(0» R (0) 0 D,3
0 M(R(0)) PREVIOUS
[Load- 1 (Load Mode)]
0 E,3
ADDRESS
MWR " N*0 LDN LOADD V I A N M(R(N))--D M(R(N)) R(N) 0 3
MEMORY , 1 N INC INCREMENT R(N)+1 FLOAT R(N) 1 1
2 N DEC DECREMENT jjKNPj FLOAT R(N) 1 1
L VALID OUT! SHORT (BRANCH NOT TAKEN] M(R(P)) RIP} 0
N - 3
3
BRANCH (BRANCH TAKEN] M(R(P)) R(P) 0
4 N LDA LOAD ADVANCE M(R(N))->D RINI+1 M(R(N)} R(NI 0 3
5 N STR STORE VIA N D-"M(R(N|t D R(N) 1 3
0 IRX INC REG X R(X)+1 M(R(XI) RIX) 0 3
NON ME N4ORY CYCLE
6 N-1-7 OUTN OUTPUT M(RIX)HBUS R(X|+1 M|R(XH R(XI 0 6
I/O
92CS-29603 N=9-F INP N INPUT BUS-MIR(XI), D RIX) 1 5
DEVICE
S1
A REQ RESET Q Q =0 FLOAT R(PI 1 1
X.P-T. 0-IE 1
S3 INTERRUPT FLOAT RIN) 9
2-X, 1-P
NOTES:
92CM-29603 A. IE = 1;TPA,TPB suppressed, stale -* SI E. Suppress TPA, wait for DMA
B. 8US = 0 for entire cycle F. IN REQUEST hai priority over OUT REQUEST
Fig. 21 — Timing diagram for machine cycle type No. 9. C. Next state always SI G. Numbers rsfar to machine cycles types -
D. Wait for DMAor INTERRUPT to timing diagrams, Figs. 16 through 20.
218 219
File No. 1023. . CDP1802D, CDP1802CD CDP1802D, CDP1802CD. .File No. 1023
DIMENSIONAL OUTLINE
SIQNAL NAME JdGMkNA-ME.
Dimensions and pad layout fofCDP1802 2 Oiimmran ' L" roctflMiof ItMlimlwn locm*dpw*tW
3 Wh«<i ih.i dcvic* 11 tupplwd iota* dipped, ih« rrwuimum
l**d Ihiukrwii (nwrow portion) mill not **cwd 0.013 in.
(0 33 mm)
220 221
APPENDIX B
CDP1834 CDP1852 CDP1855
1024 x 8 ROM Byte I/O 8-Bit Programmable
Terminal Assignment Diagrams Multiply/Divide Unit
vss
NO 9 22 EF3
EF4 CDP1835 CDP1853 CDP1856
TAP WIFW
2048 X 8 ROM N-Bit Decoder Bus Buffer (Memory)
92CS-29S 4 CDP1823 CDP1832 Separator
128 x 8 RAM 512 x 8 ROM (
1
v. /
24
1
VDD
:f.
CDP1804 MA6
MAS
2
3
23 — TPA
22 CEI -j ^ ft
i— VDD
COSMAC MA3 5 20 — CS2
CLOCK A
NO 2 5 — CLOCK B
DIG
ort —
~i
2
w i?" — VDD
IS — cs
Microcomputer BUS 0 — ^ ZA —VDD A7 — ~i ^ 24 — VDD MA2 6 i9 MRO
Nl
OUT 0
3
4 3
4 — N2 DOO
DOI
3
4
14
13
— DBO
— DBI
5,QN_AL_NAME ftQHH . NAME, BUS I — 21 — MAO A6 — 23 A8 1 OUT I 5 2 — OUT 4 DO2 5 12 — OB 2
_i ^ si BUS — 22 — MAI A5 — 22 NC BUSQ OUT 2 6 1 — OUT 5 DOS — 6 11 — DB3
BUS — 2 — MA2 NC 9 16 BUS6
CONTROL/ WAIT — 39 — XTSL —* A4 — 21 OUT 3 — 7 10 — OUT 6
Bgs 1 • 10 15 DI2 — 7 10 — KRTJ
* 1 ctTAft — 36 — DUA H 1 i/o BUS — 2C — MA3 A3 20 — C5 BUSS
WflnJOT r REQUESTS BUS — 19 — MA4 BUS2 1 14 BUS4 vss — 8 9 — OUT 7
vss — 8 9 — DI3
r
~\ —
- 19
37 A2 TOP VIEW
CODK - sc 56 — TTTTuJpr) BUS — 18 — MAS 18 • NC 2 13 BUSi TOP VIEW
4. >s SCO — 35 — kIWR > BUS — 17 — MA6 17 i BUS 8 92CS-287Z6
BUSO — TOP VIEW
WKfi — 34 TPA - PULSES CSI — 16 — MWR 92CS-28097
BUS I — 16 — BUS 7 CDPI83S 92CS-383T6
'BUS — 33 — TP CsT — 1 IS — Tlffrj
BUS — 32 MA 7155
BUS 3 — II 14 • BUSS
DATA eus — 30 MA vss — 1 1 3 — CS4
12 13 i BUS 4
BUS OP VIEW «CJ-Z«TQJ
*-*
BUS
BUS
—
—
29 — MA
2B ~
. MEMORY
ADDRESS
TOP V I E W
NO NO CONNECTION
CDP1851 CDP1854A CDP1857
eus —
4
eus —
Z"r MA
26 — MA
»ICS^7S7*RI
Programmable UART I/O Bus Buffer
— tBT — ZS MAO
24 ETT I/O Interface , , Mode 0
i ~~
I/O ETZ J/0
COMMANDS
N —
rpj* FLAGS
^ __
v ss — 20 21 — 4
—^_/~-—i VDD —j T CLOCK
TOP VIEW CLOCK » 40 VDD MODE(VSS) — 39 EPE
9 CDP1824 CDP1833 CS » 39 RD/WE vss — 38 WLSI
•JO A
\j£.v \J
H RAM
lir^lvl 1024 x 8 ROM
1 v/t*t A U 1 ivy IVI
RAO
RAI
»
»
38
37 « TPB
RRD
BUS 7 —
37 WLS 2
36 — SBS
BUSO 4—* 36 4—»A ROY BUS 6 — 35 — PI
RD- »DO
I 24 -VOD MAO — 1 18 -v DD 01, - 018
RESET — 2 23 - R LUM
MAI — Z 17 —CLOCK DO,—
C0~fi - 3 2 2 -G LUM
CLOCK I 1 MA2 — 3 16 — CEI
B CHR- 4 2 I -GD
MAO —
ENABLE
|, MA2 B LUM — 5 20 -8LG LUM MA3 — 4 15 — CE2
MAI 006
cso — i; MA3 8KG- 6 19 -G CHR MRD- 5 14 -CE3 01,
CSI I — CTD
LD CLK- 7 ! 8 -R CHR MWR — 6 13 -CSO 005
CS2 — CTT
CS3 1 — CTZ STP — 8 I 7 -BKGCHR
A8 — 7 12 -csi
vss — CE3 CLK OUT - 9 16 - BO
A9 8 M Cli2
TOP VIEW 57SC - 0 15 - B U R S T
LUM IN - I 14 -7TAL V SS~
9 tO — CS3 *ADDftSTB
TOP VIEW
.;,':•: .
CONNECTIONS
CLOCK — ]DEBOUNCE
sc 35
DMA REQ — 2. 23 — CLEAft 1 EFXB
MR 34 TPB MAO —I ^ iel— Vnn
INT REQ — 3 22 — CONTROL A BUS 33 i EVS MAI — 7 — CLOCK 3 Tpg_
] EFXA
SYNC REF 4 21 — CONTROL S BUS V SYNC MA 2 6 — CFT
CDPI864C ] 6US7
LOAD — 5 20 — DI7 BUS 3 MA 3 — 5
COMP SYNC 6 19 — DI6 • BUS 30 CSYNC BUT? — 4 — CT7 ] BUS 6
] BUSS
VIDEO — 7 18 — 015 BUS 29 RED HWR — 3 — CTO
RESET IN — 6 7 — DI4 A8 — ) BUS 4
BUS 28 BLUE 12 — CTT
DISP-STATUS — 9 16 — DI3 BUS 27 GREEN A9 1BUS3
— 012 BUS 26 BCK GW) — CS3 1 BUS 2
OISP ON — 10 5 Vss — 10
DISPOFF — 11 14 — DIf CO 25 BURST
TOP VIEW
isusi
— DIO N2 24 . ALT IBUSffl
vss — Z 13
EF 23 i R DATA JMRO
TOP VIEW
NO 19 22 i B DATA 1NXC
20 2t i 0 DATA ] NXB
vss
]NXA
TOP VIEW
92CS-3I699
RCA CDP1802 CODIN G F O R M
NAME : . . . . PROGRAM : DATE PAGE
ADDRESS Dl D2 LN LABEL : MNEMONIC OPERAND COMMENTS
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
l/l (/> C/> (/>
ro ro ro ro ix> r o r o r o r o r o r o r o r o r o r o r o r o r o ro no ro ro co
cr> m -&> ro no c o o j r o r o r o t — » i — ' » — * * — * o o o o
O O O O O ro >—* -^ co ro Oo *--i CT\o "-^j cr^ ro »—*
O O -•• O -•- C) —• O =J O O O -•-
C/> o
O 2 *-« —i. —i ro —•- i _-.._..
fD lO fD i—i 3 "S
- • - o n
— 3
CD CD
fD 13 -<• CO Q)
O CXI —•
LO O O
o.
(0
226 227
APPENDIX E
BELGIUM UJ<
RCA Ltd
RCA S.A. TEL : 02/720.89.80
L i n c o l n Way, TEL : 093.27.85511
M e r c u r e Center TWX : 61566
W i n d m i l l Road, TWX : 24246
rue de 1 a Fusee 100
SUNBURY-ON-THAMES
1130 BRUXELLES
M I D D L E S E X TW16 7HW,
UK
FRANCE
WEST G E R M A N Y
RCA S.A. TEL : 01/603.87.87
rue Fessart 32 TWX : 200144 RCA GmbH
P f i n s t r o s e n s t r a s s e 29 TEL : 08971/43047-049
92100 BOULOGNE TWX : 05-29051
8000 M U N C H E N 70
France W. Germany
ITALY RCA G m b H
J u s t u s - v o n - L i e b i g - R i n g 10 TEL : 04106/2001
RCA SpA TEL : 02/65.97.048-051 TWX : 02-11582
2085 QUICKBORN
Pi azza San M a r c o 1 TWX : 310637
W. Germany
20 122 MILANO
RCA G m b H
Italy
Z e p p e l i n s t r a s s e 35 TEL : 071145/4001-04
TWX : 07-23838
SWEDEN 7302 OSTFILDERN 4
(KENMAT)
RCA I n t e r n a t i o n a l Ltd TEL : 08/83.42.25 W. Germany
Box 3047 TWX : 11485
Hagalundsgatan 8
17103 SOLNA 3
Sweden
228 229
APPENDIX F
F - 92310 SEVRES
AUSTRIA
B A C H E R E L E K T R O N I S C H E GER'ATE GmbH WEST G E R M A N Y
TEL : 0222/83.56.460
Rotenmllhlgasse 26 TWX : 131532 A L F R E D N E Y E E N A T E C H N I K GmbH TEL : 04106/6121
Schi 11 erstrasse 14 TWX : 02-13590
A - 1120 VIENNA
2085 QUICKBORN
BELGIUM
G U S T A V B E C K KG TEL : 0911/34961-66
INELCO ( B E L G I U M ) S.A, TEL : 02/216.01.60
E l t e r s d o r f e r Strasse 7 TWX : 06-22334
Avenue des Croix de Guerre 94 TWX : 25441
1120 8500 N U R N B E R G 15
BRUXELLES
T E L E R C A S OY TEL : 90/821.655
SASCO GmbH TEL : 089/46111
P.O. Box 2 TWX : 12-1111 TWX : 05-29829
H e r m a n n - O b e r t h - S t r a s s e 16
SF - 01511 V A N T A A 51
8011 P U T Z B R U N N bei M U N C H E N
J
m
230 231
HOLLANj)
INELCO Nederland BV TEL : 02977/2.88.55
T u r f s t e k e r s t r a a t 63 T W X : 14693
N - 1431 GD A A L S M E E R
N A T I O N A L ELEKTR O A/S TEL : 02/22.19.00
VEKANO BV TEL : 40/81.09.75 U l v e n v e i e n 75 TWX : 11265
P o s t b u s 6115 TWX : 51804
O K E R N - OSLO 5
N - 5600 HC E I N D H O V E N
PORTUGAL
ICELAND
T E L E C T R A SARL TEL : 68.60.72-75
GEOR6 A M U N D A S O N TEL : 81180 R u a R o d r i g o do F o n s e c a , 103 TWX : 12598
P.O.Box 698 TWX 2108
LISBON 1 -
REYKJAVIK - Iceland
SOUTH AFRICA
ITALY
A L L I E D E L E C T R I C (PTY) L t d TEL : 011/892.1001
E L E D R A 35 SpA TEL : 02/349751 Components Division TWX : 87823
Vi ale E l v e z i a 18 TWX : 332.332 P . O . B o x 6090, D U N S W A R T
I - 20154 MILANO 1508
I - 20146 MILANO
232 233
SWEDEN
I.T.T. E L E C T R O N I C S E R V I C E S TEL : H a r l o w 0279/26777
FERNER Electronics AB TEL 08/80.25.40 E d i n b u r g h Way TWX : 81525
Snb'rmakarvagen 35 TWX 10312 Harlow
P.O.Box 125 E s s e x , CM20 2DE
161 26 BROMMA
STOCKHOLM JERMYN DISTRIBUTION TEL : Sevenoaks 0732/50144
Vestry Industrial Estate TWX : 95142
LAGERCRANTZ ELEKTRONIK AB TEL 0760-861.20 Sevenoaks
Kanalvagen 5 TWX 11275 Kent
P.O.Box 48
MACRO M A R K E T I N G Ltd TEL : B u r n h a m 06286/4422
19401 UPPLANDS VASBY
396 Bath Road TWX : 847945
SIough
SWITZERLAND
Berks
BAERLOCHER AG TEL 01/42.99.00
P.O.Box 485 TWX 53118 SEMICOMPS NORTHER N Ltd TEL : K e l s o 05732/2366
CH - 8021 ZURICH E a s t B o w m o n t Street TWX : 72692
Kelso
TURKEY R o x b u r g h s h i re
Sco 11 and
TEKNIM COMPANY Ltd TEL 27.58.00
Riza Sah P e h l e v i C a d d e s i 7 TWX 42155
YUGOSLAVIA
KAVAKLIDERE ANKARA
AVTOTEHNA TEL : 317.044
P.O.Box 593 TWX : 31223
UK
Titova 36-X1
C R E L L O N E L E C T R O N I C SL t d . TEL Burnham 06286/4434
L J U B L J A N A 61000
380 B a t h Road TWX 84571
SIough
EGYPT
B e r k s , SL1 6JE
SAKRCO ENTERPRISES TEL : 744440
VSI E L E C T R O N I C S Ltd. P.O.Box 1133 TWX : 93146 SKRCO UN
TEL : H a r l o w 0279/29666
R o y d o n b u r y I n d u s t r i a l Park TWX : 81387 37 Kasr el N i l Street
Horsecroft R o a d Apt. 5
Harlow CAIRO - Egypt
Essex, CM19 5BY