Professional Documents
Culture Documents
W r i t t e n by: Y a n 3 / G o o d m a n /' M a t h y s
R e v i s i o n I 1*1
Date Released: 1 0-MAY-82
T h i s d o c u m e n t is s u b m i t t e d w i t h the u n d e r s t a n d i n g t h a t
it contains information which is confidential in
n a t u r e and is n ot to be r e v e a l e d to anyone without
w r i t t e n p e r m i s s i o n f r o m M OS T e c h n o l o g y f Inc.
Table of Contents
1*0 Introduction* * * * * * * * * ♦ * * * * * ♦ * * ** * 12
1*3 Terminology* * * * * * * * * * * * * * * * * * *♦ * 14
1*3*1 Introduction ** * * * * * * * * * * * ♦ * * * ♦ 14
1*3*3 Op Code* * * * * * * * * * * * * * * * * * * * * 15
1*3*4 Operand* * * * * * * * * * * * * * * * * * ** * 15
1*3*5 Instruction* ** * * * * * * * * * * * * * * * * 15
1*3*7 Ordinal ** * * * * * * * * * * * * * * * ** * 16
1*3*9 Ph y s ic a l Address * * ** * * * * * * * * * * * * 16
2*1 Introduction* * ** * * * * * * * * * * * * * * * * 22
3.1 Introduction . .. .. . . . . * . . . . • . * * * *
4 *0 S o f t w a r e 30
4 30
4 30
30
30
31
31
31
4*2*6 Top 31
31
4*2*7* 1 32
4 * 2 *7 *2 32
4 *2 * 7 * 3 32
4 * 2 *7 *4 32
4 *2 * 7 * 5 32
4 *2 * 7 * 6 “
O7n
A_
4 * 2 *7 * 7 *7
>n
>-
4 * 2 * 7 *3 32
4*2*7*? 33
33
4 *3 P r o c e s s 35
35
35
35
35
36
4*3*5* 1 36
4 * 3 * 5 *2 36
4*4*1 Introduction * * * * * * ** * * * * * ♦ ♦ ♦ ♦ ♦ 37
4*4*2*1 Introduction * * ♦ ♦ * * ♦ ♦ ♦ ♦ ♦ ♦ ♦ * ♦ * 37
4 * 4 * 2 *5 P r o c e s s Link * ** * * ** ♦ ♦ * ♦ ♦ ♦ ♦ ♦ ♦ 38
4 ♦ 4 *3 ♦4 ♦ 1 I n t r o d u c t i o n * * * ** * ♦ ♦ * * * * * ♦ 42
4 * 4 * 3 * 4 * 2 S e r v i c i n g e x c e p t i o n s w i t h i n the
current process * ♦ ♦ ♦ * ♦ ♦ ♦ * ♦ ♦ * ♦ ♦ ♦ ♦ 42
4 * 4 * 4 E x c e p t i o n V e c t o r s w i t h i n the
M C S 6 5 E 4 P r o c e s s ** .................... * ............ * * 47
4 ♦ 4 ♦4 ♦ 1 I n t r o d u c t i o n ** * * * ** * * * * * * * * * 47
4 * 4 ♦4 ♦ 6 0 ve r f l'o w ♦ * * * .......... * * ♦ * * ♦ ♦ ♦♦ 48
4 * 4 * 4 *7 O t h e r Arithmetic Error ♦* ♦ ♦ ♦ * ♦ * ♦ ♦♦ 48
4 * 4 * 4 *9 I n s t r u c t i o n Access Trap* * * * ♦ * ♦ ♦ ♦ ♦♦ 49
4*4*4*16 B us Error * * * * * * * * * * * * * * * ** 49
4*5*1 Introduction * * * * * * * * ♦ * * ♦ * * ♦ * ♦* 50
4 *5 ♦ 2 * 1 I n t r o d u c t i o n * * * * * * * * * * * * * * ** 53
4 *5 *3 * 1 I n t r o d u c t i o n .......... * * * * * * * * * * * 55
4*6*1 Introduction * * * * ** * ♦ * ♦ * ♦ ♦ ♦ ♦ + ♦ f 63
4 *6 *3♦1 Introduction * * ** * * * * * * * * * * * * 63
4 * 6 * 3 *2 * 1 I n t r o d u c t i o n ** * * * * * * * * * * * * 68
4 * 6 *3 *2 *2 T r a p Bit * * * * ............................ 68
4 * 6 ♦ 3 ♦ 2 *3 * 1 A t t a c h e d * * * * * ............. * * * 69
4 ♦6 ♦ 4♦1 Introduction * ** * * * * * * * * * * * * * 74
4*6»4*4 Record ♦ ♦ * ♦ ♦ * ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ * ♦ ♦ ♦ 32
4*6*6 A p p l i c a t i o n of the M C S 6 5 E 4 D a t a
Accessing Mechanisms * * * * ♦ * ♦ ♦ ♦ * ♦ ♦ ♦ ♦ S3
4 *6 *6♦1 Introduction * * * * ♦ ♦ * * ♦ ♦ * ♦ * * ♦ ♦ 33
4*6*6*2 A c c e s s i n g D a t a in M u l t i - D i m e n s i o n a l
Arrays * * * * * * * * * * * * * * * * * * * 38
4 * 6 * 6 * 3 E x a m p l e of A c c e s s i n g a mu 1 1 i - d i m e n s i o n a 1
array * * * * * * * * * * * * * * * * * * * * * * 94
4 * 6 * 6 * 4 E x a m p l e of A c c e s s i n g D a t a in a C o m p l e x
Record Structure* ♦ * * * « * * > . * » * * « * * * 99
4 * 6 * 6 *5 * 1 I n t r o d u c t i o n * * * * * * * * * * * * * * 104
4 * 6 * 6 *5 *3 E x a m p l e of Attached Address
Descriptor Format * ♦ * ♦ * ♦ * ♦ * * * * * * ♦ 105
4 *7 * 3 * 1 I n t r o d u c t i o n * * * * * * * * * * * * * * * * 109
4 * 7 *3 * 3 S U B T R A C T * * * * * * * * * * * ............... 112
4 * 7 *3 * 4 MUL* * * * * * * * * * * * * * * * * * * * * 113
4 * 7 *3 * 8 E 0 R * * * * * * * * * * * * ........... * * * * 119
4 *7 * 3 * 9 MOD* * * * * * * * * * * * * * * * * * * * * 121
1*0 Introduction
This s p e c i f i c a t i o n c o n t a i n s a d e t a i l e d d e s c r i p t i o n of all a s p e c t s
of the MCS65E4 microprocessor d e v e l o p merit p r o j e c t ? b e g i n n i n g in
Section 1 w i t h a r e v i e w of the p r o j e c t g o a l s arid a d i s c u s s i o n of
the m a r k e t toward which this c h i p is d i r e c t e d * It is h o p e d t h a t
these discussions will lead to g r e a t e r u n d e r s t a n d i n g of the g o a l s
of the p r o j e c t on the p a r t of e v e r y o n e i n v o l v e d *
S e c t i o n 2' c o n t a i n s a d e s c r i p t i o n of the M C S 6 5 E 4 i n t e r f a c e * T h i s is
f o l l o w e d by s d e s c r i p t i o n of the i n t e r n a l a r c h i t e c t u r e of the
MC S 6 5 E 4 (Section 3 )? i n c l u d i n g the r e g i s t e r organization? the
internal buses a n d the o r g a n i z a t i o n of the c o n t r o l s t o r e * S e c t i o n
4 contains a detailed description of the MCS65E4 software
a r c h i t e c t u r e ( a d d r e s s i n g m o d e s ? i n s t r u c t i o n set? e t c * ) *
A l t h o u g h t he M C S 6 5 E 4 is e q u i p p e d w i t h a " c o m p a t i b l e ' m o d e in w h i c h
it is c a p a b l e of executing software w h i c h was w r i t t e n for the
MCS6502? the M C S 6 5 E 4 is not d e s i g n e d to be u p w a r d c o m p a t i b l e w i t h
the 6502 f a m i l y of 3 - b i t m i c r o p r o c e s s o r s * T h e p r i m a r y r e a s o n for
t h i s is that the b a s i c design considerations behind the 6502
processor differ greatly from those described below for the
M C S 6 5 E 4 p r o c e s s o r * T h i s is t r u e in s p i t e of the f a c t t h a t the 6 5 0 2
h as r e a c h e d a d o m i n a n t p o s i t i o n in the m i c r o c o m p u t e r m a r k e t ? one
of the t a r g e t m a r k e t s fo r the M C S 6 5 E 4 *
In a d d i t i o n to the a b o v e ? it is a s s u m e d t h a t m o s t m i c r o c o m p u t e r
programming will involve the use of a high-level language*
Therefore? the s o f t w a r e a r c h i t e c t u r e of the p r oce ssor must be
d e s i g n e d to m i n i m i z e the tim e r e q u i r e d for b o t h c o m p i l a t i o n arid
e x e c u t i o n of s u c h l a n g u a g e s *
^-3 ♦ E r r o r D e t e c t i o n arid c o r r e c t i o n *
b* Virtual memory*
c* P r i o r i t i z e d and v e c t o r e d i n t e r r u p t s *
d♦ F l o a t i n g point data types*
e* D e c i m a l (BCD) d a t a t y p e s *
1*3 Terminology
1*3*1 Introduction
1*3*2 F'rocess
W i t h i n t h i s s p e c i f i c a t i o n ? the t e r m s “K e r n e l p r o c e s s 1 will be u s e d
to r e f e r to p r o c e s s leve l 1 in w h i c h b o t h the K e r n e l fl a g a nd the
U s e r / S u p e r v i s o r flag 3re set* The t e r m “O p e r a t i n g S y s t e m P r o c e s s
will refer to those higher level processes in which the
Us e r / S u p e r v i s o r flag is set b ut the K e r n e l f l s g is c l e a r e d * T h i s
can be s u m m a r i z e d as f o l l o w s *
Kernel User/Supervisor
Process Flag Flag
Kernel 1 1
Operating System 0 1
User 0 0
1*3*3 Op Code
1*3*4 Operand
1*3*5 Instruction
1*3*6 Descriptor
1♦ D e s c r i p t o r H e a d e r *
2 * Address Reference Information*
3♦ A u x i l i a r y I n f o r m a t i o n *
1*3*7 Ordinal
One of th e m o s t i m p o r t a n t a s p e c t s of the s t a n d - a l o n e n a t u r e of a
p r o c e s s is that all a d d r e s s i n g w i t h i n the process software is
s e l f - c o n t a i n e d and is completely independent of the physical
memory locations in which the p r o c e s s resides* All a d d r e s s e s
generated during e x e c u t i o n of the p r o c e s s s o f t w a r e are a s s u m e d to
be offsets from the address contained in the Process Base
register* For e x a m p l e ? if 3 p r o c e s s w h o s e b a s e a d d r e s s is 0 4 4 B 0 0
(HEX) w e r e to s p e c i f y an a d d r e s s of 0177 (HEX)? the p h y s i c a l
address which w o u l d be a c c e s s e d is 0 4 4 C 7 7 w h i c h is o b t a i n e d by
a d d i n g 0 1 7 7 to 0 4 4 B 0 0 *
T h i s c h a r a c t e r i s t i c of a d d r e s s i n g w i t h i n the M C S 6 5 E 4 b r i n g s u p the
c o n c e p t of the l o g i c a l a d d r e s s * In t h i s d o c u m e n t ? the ter m l o g i c a l
a d d r e s s will be u s e d to r e f e r to the p o s i t i o n of a m e m o r y l o c a t i o n
w i t h i n the address s p a c e of a process* In the a b o v e example?
To a s s u r e a c c u r a c y ? t h i s d o c u m e n t wi ll u t i l i z e the p h r a s e “w i t h i n
process (process name)* w h e n e v e r a l o g i c a l a d d r e s s is s p e c i f i e d *
Als o ? a memory location which is o u t s i d e of the l i m i t s of a
p r o c e s s is a s s u m e d to h a v e no l o g i c a l a d d r e s s w i t h i n t h a t p r o c e s s ?
i* e*? t he l o g i c a l a d d r e s s is a s s u m e d not to e x i s t *
1* O p c o d e s are e i g h t b i t s wi d e *
2* The m i n i m u m a d d r e s s a b l e d a t a f i e l d is e i g h t b i t s wide*
3* O f f s e t a d d r e s s e s can be zero? e i g h t ? s i x t e e n or 24 b its*
4* B o t h the b a s e and l i m i t for a p r o c e s s are s p e c i f i e d
in 2 5 6 - b y t e i n c r e m e n t s *
All d a t a a d d r e s s i n g w i t h i n the M C S 6 5 E 4 is a c c o m p l i s h e d by a d d i n g a
d i s p l a c e m e n t to a memory address* T h i s can be d i v i d e d into two
specific forms of addressing* T h e s e are Offset Addressing 3 nd
Relative Addressing* T h e s e t wo d i f f e r p r i m a r i l y in the m a n n e r in
w h i c h the m e m o r y a d d r e s s arid t he d i s p l a c e m e n t are s p e c i f i e d *
To a s s u r e a c c u r a c y ? t h i s d o c u m e n t will u t i l i z e the p h r a s e “o f f s e t
from register (register name)' w h e n e v e r an O f f s e t Address is
specified* In a d d i t i o n ? w h e n e v e r an e x t e r n a l base register is
e s t a b l i s h e d in the p r o c e s s B a s e Pa se? t h i s b a s e r e g i s t e r wi l l be
i d e n t i f i e d as “EXT (n ) “ ? w h e r e n is the p a g e a d d r e s s of the s t a r t
of the base register* For e x a m p l e ? if a d d r e s s e s 1 5 - 1 7 on the
process Base P a g e are to be t r e a t e d as an e x t e r n a l b a s e r e g i s t e r ?
t h i s b a s e will be i d e n t i f i e d as E X T 15 ♦ F i n a l l y ? it wi l l be a s s u m e d
th a t a memory location w h i c h c a n n o t be accessed through a base
register has no o f f s e t address relative to t h a t register* This
wi l l be t r ue? of c o u r s e ? for any m e m o r y l o c a t i o n o u t s i d e of the
process* E v e n m o r e i m p o r t a n t ? it will a l s o be t r u e f o r all m e m o r y
l o c a t i o n s w i t h a l o w e r p h y s i c a l a d d r e s s t h a n t h a t c o n t a i n e d in the
register since n e g a t i v e o f f s e t s are not p e r m i t t e d w h i l e a c c e s s i n g
d a t a via b a s e r e g i s t e r s *
In a d d i t i o n to O f f s e t A d d r e s s i n g ? t he M C S 6 5 E 4 u t i l i z e s a s i m i l a r
addre s s i n g mode in w h i c h the m e m o r y a d d r e s s is not c o n t a i n e d in 3
base register and in which both negative and positive
d i s p l a c e m e n t s are p e r m i t t e d * T h i s is t e r m e d “R e l a t i v e A d d r e s s i n g ' *
Within Relative Addressing operations the m e m o r y a d d r e s s can be
either, the c o n t e n t s of the p r o g r a m c o u n t e r or the a d d r e s s of a
data descriptor* T h i s is d e s c r i b e d in d e t a i l in S e c t i o n 4 of t h i s
specification*
Operating
System Us e r
Physical Kernel Process Process Registers
Address Address Address Address
Space Space Space Space Contents Name
FFFFFF FFFFFF
0E00FF
i
1 1 0 3 0 1 FF 0 3 0 1 XX LMT
I 1 1
i 1 1
1 1 1
1 1 1
1 1 1
1 1 I
1 1 1
028000
1 1 1 1 1 1 1 I
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 I
1 I I 1 1 1 1 E
1 i 1 1 1 1 D 1
I ! 1 1 1 1 ! 1
1 1 1 1 1 C 1 1
1 1 1 1 1 1 I --------- 0 2 4 7 0 0 EXT*
i! i1 l1 oD l 1 l 1 i1
1 1 1 1 1 ! ------------------- 0235A0 T03
1
1 |I II Il lI }!
i i i i i -------------------------------0 2 3 5 9 0 F'RM
1 A i i i
1 1 i i i
i 1 i i i 001 2 0 0 EXT*
i! I1 1
1 I1 1
1
1 1 1 ----- 0 2 3 5 0 0 0235XX BAS
1 1
I| >I
l I
t i 1 * B a s e F ‘ag e A d d r e s s e s 1 0 - 1 2 a r e
l l 1 a s s u m e d to c o n t a i n 0 0 1 2 0 0 . T h i s
-“ -010000 set of m e m o r y l o c a t i o n s will be
\ t r e a t e d as an e x t e r n a l b a s e
i r e g i s t e r p o i n t i n g to p h y s i c a l
I a d d r e s s 0 2 4 7 0 0 (BAS + 0 0 1 2 0 0 ) *
000000 000000
* * * * * * * * * C O N F I D EN TI AL ? MOS T E C H N O L O G Y ? I N C ** * * * * * * * * Page- 20
Final D e si gn Specification for the MC365 E 4 Microprocessor
It s h o u l d be n o t e d t h a t all m e m o r y l o c a t i o n s o u t s i d e the l i m i t s of
a p r o c e s s h a v e no l o g i c a l a d d r e s s e s w i t h i n t h a t p r o c e s s * L i k e w i s e ?
m e m o r y l o c a t i o n s o u t s i d e of a p r o c e s s w h i c h is b e i n g e x e c u t e d h a v e
no O f f s e t Address relative to the i n t e r n a l or external base
registers since these locations cannot be accessed by these
registers*
2♦1 Introduction
Function t of pins
1* A d d r e s s B u s M i d d l e / A d d r e s s Bus Low
(A 9 / A 1 - A 1 6 / A 8 ) 3
2. A d d r e s s Bus H i 3 h / D a t e Bus Lo
(A 1 6 / D B 0 - A 2 3 / D B 7 ) 8
3. Bus S t a t u s / D a t a B u s H i 2 h
(I A C K / D B 8 - M I C / D B 1 5 ) 3
4. R o w A d d r e s s S t r o b e (RAS) 1
5. C o l u m n A d d r e s s S t r o b e (CAS) 1
6. C h i p p o w e r (V D D rV S S ) 9
7. O s c i 1 lat o r o
8. Bus C l o c k (B C L K ) 1
10. M e m o r y R e a d y (RDY) 1
11 ♦ I n t e r r u p t I n p u t (INT) 1
12. R e s e t (RES) 1
13 . W r i t e E n a b l e s (WEL> W E H ) 9
14. Bus E r r o r (BERR) 1
15. H o l d (HLD) 1
16. I n s t r u c t i o n I n t e r c e p t (II) 1
TOTAL 40
B it Status Function
51 Interrupt Acknowledge ( IA C K )
52 Hold A c k n o w l e d g e ( H 0 L D A )
53 Last I n s t r u c t i o n Cycle C L I O
54 I/O Reset (IORES)
55 Pr o c e s s o r I n s t r u c t i o n Fetch (INST)
56 F'rocessor Data Fetch (DAT)
57 Ref r e s h Cycle (REF)
SS E x ternal M i c r o c o d e Fetch (MIC)
T he IACK bi t g o e s h i g h to s i g n a l the I n t e r r u p t C o n t r o l l e r t h a t it
can place the active interrupt reauest information on the low
order eight b i t s of the d a t a bus* T h i s o p e r a t i o n is d e s c r i b e d in
d e t a i l in S e c t i o n 4 * 4 * 4 * 1 3 *
T he C o l u m n A d d r e s s S t r o b e is p r i m a r i l y used to l a t c h the c o l u m n
a d d r e s s e s (low order eight a d d r e s s b its ) into e x t e r n a l l a t c h e s *
T h i s s i g n a l is a l s o u s e d to i n d i c a t e t h a t v a l i d d a t a is p r e s e n t on
the d a t a lines during a memory write o p e r a t i o n and to e n a b l e the
memory output d r i v e r s d u r i n g a m e m o r y read o p e r a t i o n * Thi s s i g n a l
is s y n c h r o n o u s w i t h the B C L K s i g n a l * The CAS s i g n a l is h e l d low by
RDY but will c o n t i n u e r u n n i n g d u r i n g a H O L D o p e r a t i o n *
T i m i n g f or the W r i t e c y c l e is v e r y s i m i l a r to t h a t d e s c r i b e d a b o v e
for the Read cycle* The W r i t e E n a b l e S i g n a l s (WEL* WEH) will go
low i m m e d i a t e l y a f t e r t h e b e g i n n i n g of the c y c l e ( c o i n c i d e n t w i t h
A 9 - A 16 going valid)* I m m e d i a t e l y a f t e r RAS g o e s low* the d a t a to
be w r i t t e n into m e m o r y is p l a c e d on the D B 0 - D B 1 5 lines* If R DY is
p u l l e d low d u ring this cycle* the R AS and C A S s i g n a l s r e m a i n low
arid the p r o c e s s o r o u t p u t d a t a wil l r e m a i n on the D B 0 - D B 1 5 lines*
T he W r i t e E n a b l e l i n e s w i l l go h i g h c o i n c i d e n t w i t h the t r a i l i n g
e d g e of the B C L K p u l s e d u r i n g w h i c h th e RDY l ine r e t u r n s high *
T he p r o c e s s o r ca n be r e s e t by a p p l y i n g a low s i g n a l to t h i s input*
For p o w e r - o n reset* t h i s ca n be a c c o m p l i s h e d by c o n n e c t i n g an R - C
c i r c u i t to the R E S pin* P o s i t i v e c o n t r o l of the r e s e t f u n c t i o n in
the p e r i p h e r a l d e v i c e s can be a c c o m p l i s h e d by c o n n e c t i n g these
d e v i c e s to the I O R E S Bus S t a t u s bit* As long as the r e s e t i n p u t
s t a y s low* the p r o c e s s o r will n o t p e r f o r m any w r i t e o p e r a t i o n s *
The I n s t r u c t i o n I n t e r c e p t c an be u s e d to c a n c e l th e e x e c u t i o n of
an i n s t r u c t i o n w i t h i n the M C S 6 5 E 4 * If t h i s lin e is p u l l e d low? the
current instruction execution terminates immediately* The
p r o c e s s o r then t r e a t s t he n e x t b y t e in p r o g r a m s e q u e n c e as 3n O p
C o d e snd i m m e d i 3t e 1 y e n t e r s the a p p r o p r i a t e execution sequence*
T h i s pin is u s e d p r i m a r i l y by A u x i l i a r y A r i t h m e t i c P r o c e s s o r s to
c a n c e l the e x e c u t i o n of i n t e r c e p t e d i n s t r u c t i o n s *
3 *1 I n t r o d u c t i o n
It s h o u l d be n o t e d t h a t the d e v i c e d e s c r i b e d b e l o w is o n l y the
first implementation of the architecture described in this
document* T h i s i m p l e m e n t a t i o n t r i e s to a c h i e v e a balance between
c h i p s i z e an d c a p a b i l i t y w i t h a s t r o n g e m p h a s i s on m i n i m i z i n g c h i p
cost* It is assumed that future implementations of this
a r c h i t e c t u t e w ill result in devices with increased capability
t h r o u g h l a r g e r c o n t r o l ROMS? t h r o u g h the i n t e g r a t i o n of a d d i t i o n a l
system functions (keyboard interface* etc*) o n t o the p r o c e s s o r *
and u l t i m a t e l y * by e x p a n d i n g the i n t e r n a l o r g a n i z a t i o n f r o m 8 to
32 bits* All of t h e s e c o n f i g u r a t i o n s will be upward compatible
w i t h the e a r l i e r d e v i c e s *
The c o m p l e t e r e g i s t e r a r r a y is c o n t a i n e d in a m a t r i x of d y n a m i c
R AM c e l l s * The t r a d i t i o n a l 3-2-2 dynamic R AM cel l has been
e x p a n d e d to a l l o w two R E A D b u s e s and o ne W R I T E bus* The r e g i s t e r
refresh operation is h a n d l e d by a combination of h a r d w a r e arid
s o f t w a r e in a m a n n e r w h i c h is t o t a l l y t r a n s p a r e n t to the user*
* * * * * * * * * C O N F ID EN TI AL * MOS T E CH N OL O GY * I N C * * ** * ** * * * Page- 27
Final D e sign Specification for the MC S65 E 4 Microprocessor
1 * ‘ Da t a s h i f t i n g
2* A d d r e s s l i m i t c h e c k i n g
3* 2's c o m p l e m e n t b i n a r y a d d i t i o n and s u b t r a c t i o n
4* P a c k e d BCD a d d i t i o n ancT s u b t r a c t i o n
5* L o g i c AND
6* L o g i c OR
7* L o g i c E OR
1* P r o g r a m C o u n t e r H i g h
2* Eiata L a t c h Low and H i g h
3* A d d r e s s R e g i s t e r 1 H i g h
4* A d d r e s s R e g i s t e r 2 H i g h
5 * Address Register 3 high
All of t h e r e g i s t e r s n e e d e d to a s s u r e p r o p e r i n s t r u c t i o n e x e c u t i o n
are c o n t a i n e d in the Control Register Section* These registers
perform such operations as storing execution control flags?
selecting registers w i t h i n the r e g i s t e r a r r a y ? c o u n t i n g e x e c u t i o n
c y c l e s and a d d r e s s i n g the m i c r o c o d e a r r a y *
4*1 Introduction
4*2*1 Introduction
1* P r o c e s s B a s e R e g i s t e r (BAS)
2* P r o c e s s L i m i t R e g i s t e r (LMT)
3* P r o c e s s P r o g r a m C o u n t e r (PPC)
4* P r i m a r y B a s e R e g i s t e r (PRM)
5* T o p of Stack-. R e g i s t e r (TQS)
6* P r o c e s s C o n t r o l R e g i s t e r (P C R )
It s h o u l d be n o t e d t h a t for s p e e d p u r p o s e s ? the i n t e r n a l p r o c e s s
r e g i s t e r s (PRM* TOS* LMT* and PPC) contain physical addresses
during process execution* H o w e v e r * the M C S 6 5 E 4 u s e r d o e s n o t see
these physical addresses since t h e y are converted to logical
addresses whenever the c o n t e n t s of one of t h e s e registers is
t r a n s f e r r e d into memory* T h i s is a c c o m p l i s h e d by s u b t r a c t i n g the
c o n t e n t s of the P r o c e s s B a s e R e g i s t e r (BAS) f r o m the a d d r e s s b e i n g
transferred into memory* Similarly* the logical addresses
c o n t a i n e d in m e m o r y are c o n v e r t e d to p h y s i c a l a d d r e s s e s w h e n the
i n t e r n a l p r o c e s s r e g i s t e r s are l o a d e d *
Th e P r o c e s s B a s e R e g i s t e r s e t s the l o w e r l i m i t of the m e m o r y s p a c e
in w h i c h the p r o c e s s m u s t e x e c u t e * T h i s m e m o r y s p a c e s t a r t s at the
first byte of the p a g e w h o s e a d d r e s s is c o n t a i n e d in BAS* i*e**
the BAS r e g i s t e r c o n t a i n s the p a g e n u m b e r of the p h y s i c a l a d d r e s s
at w h i c h the p r o c e s s starts* F or e x a m p l e * if the BAS register
c o n t a i n s 0 4 E7* the lowest address w h i c h is available to the
process is 04E700*
The P r i m a r y B a s e r e g i s t e r is p r o v i d e d to c o n t r o l the a c c e s s i n g of
data during instruction execution*Address offsets c o n t a i n e d in
the M C S 6 5 E 4 i n s t r u c t i o n s are a d d e d to the P RM r e g i s t e r to o b t a i n
the p h y s i c a l a d d r e s s of t h e d ats*
Bit Designstion
0 K -
K e r n e l M o d e F 1 3g
1 U - U s e r / S u p e r v i s o r Mode
9
I - I n t e r r u p t Inhibit Flag
3 E - E n e b l e Exterr»3l M e m o r y R e f r e s h
4 P - Enable Periodic Interrupt
5 S - Eneble St3ck Bound3ry Check
6 D - Debug Mode
7 T - D i s 3 b l e All T r 3p s
8-11 M - Microcode Select
12-15 R - R e f r e s h R 31e
4 ♦ 2 *7 ♦2 U s e r / S u p e r v i s o r Mode (U)
T he U s e r / S u p e r v i s o r f l a g is se t to 3 l o g i c 1 to e n a b l e e x e c u t i o n
of 3 number of privileged instructions which are normally
available only to the operating system* This flag is set
a u t o m s t i c s l l y by the R e s e t i n p u t or w h e n the p r o c e s s o r e x i t s fr o m
3 U s e r p r o c e s s * It is c l e 3 r e d w h e n a U s e r p r o c e s s is i n v o k e d *
The D e b u g f l a g ca n be s et to a l l o w s i n g l e - i n s t r u c t i o n e x e c u t i o n of
3 User process* E s c h t i m e the p r o c e s s o r e n t e r s 3 U s e r p r o c e s s it
will e x e c u t e a s i n g l e i n s t r u c t i o n a nd will t h e n t r a p b a c k to the
o p erating system? a l l o w i n g the o p e r a t i n g s y s t e m to d i s p l a y the
effects of e a c h i n s t r u c t i o n e x e c u t i o n for d e b u g p u r p o s e s *
4 * 2 *7 * 9 M i c r o c o d e Select (M)
* * * * * * * * * C O N F I D E N T I A L t MOS T E C H N OL O G Y ?I N C * * ** * ** * * * Page- 33
Final Design Specification for the MCS65E 4 Microprocessor
K e rn e 1 R e s e t V e c t o r
Process Software
Process Stack
Dy n am ic
Memo ry Free Memory
Static Data
Global Data
Base Page I
Inter-process Control*
4* 3 Process Struetu re
4 .>3*1 Introduction
1* The v e c t o r s a s s o c i s t e d w i t h the p r o c e s s i n g of i n t e r r u p t s ?
s yst e m calls? etc* are l o c a t e d in the L i m i t p age? i* e*?
in high order memory* This g enerally dictates that
p r o g r a m m e m o ry be at the u p p e r l i m i t of the a d d r e s s s p a c e
a l l o c a t e d to the p r o c e s s *
2* The a v a i l a b i l i t y of s h o r t o f f s e t s f r o m the P r o c e s s B a s e
Register would s e e m to d i c t a t e t h a t R e a d / W r i t e m e m o r y be
l o c a t e d in the low order portion of the address space
a l l o c a t e d to a process* In a d d i t i o n ? the f i r s t t h r e e
b y t e s of m e m o r y w i t h i n the K e r n e l p r o c e s s arid w i t h i n any
O p e r a t i n g S y s t e m p r o c e s s m u s t be r e a d / w r i t e m e m o r y *
4 v 3♦5 Dynamic M e m c ry
4* 3 *5 *2 F r e e Memory
4 * 3 * 5 *3 P r o c e s s Stack
In the Kernel Process? the high order four bytes of m emory are
reserved for s t orin g the Kernel Reset Ve c t o r ♦ This is used by the
p r o c e s s o r duri ng the system reset o perati on* The Reset Ve ctor is
stored in the same format as the exception vectors*
4 * 4 * 1 -Introduct i o n
The r e g i s t e r s d e s c r i b e d in S e c t i o n 5 * 2 * 1 are d e s i g n e d to s u p p o r t
the execution of a hierarchy of processes in a multi-task
e n v i r o n m e n t ijnder the c o n t r o 1 of a s o p h i s t i c a t e d o p e r a t i n g s y s t e m *
One of the key a s p e c t s of t h i s a r c h i t e c t u r e is s u p p o r t f r o m the
p r o c e s s o r to i n i t i a t e a n e w p r o c e s s ? to e x i t f r o m a p r o c e s s in the
e v e n t of a fault or i n t e r r u p t ? and to r e t u r n to an i n t e r r u p t e d
process* All of t h e s e i n t e r - p r o c e s s o p e r a t i o n s are d e s c r i b e d in
this s e c t i o n *
4 * 4 *2 * 1 I n t r o d u c t i o n
1 * List Size
This eight-bit p a r a m e t e r s p e c i f i e s th e n u m b e r of b y t e s of
data contained in the li s t (not i n c l u d i n g the L i s t S i z e
parameter)*
T he P r o c e s s B a s e A d d r e s s p a r a m e t e r s p e c i f i e s the l o g i c a l
page address of the B a s e P a g e of the new p r o c e s s w i t h i n
the c a l l e r ' s address space*
3* Process Size
This 16 - b it p a r a m e t e r s p e c i f i e s the l o g i c a l p a g e a d d r e s s
of the L i m i t P a g e w i t h i n the new p r o c e s s ? it e *7 the p a g e
address relative to the new p r o c e s s ' s base? not to the
caller's base * T h i s d a t a is u s e d by the M C S 6 5 E 4 to load
the P r o c e s s L i m i t R e g i s t e r d u r i n g p r o c e s s i n i t i a l i z a t i o n *
4* Program En t ry Address
4 * 4 *2 *5 P r o c e s s L i nk
For O p e r a t i n g S y s t e m p r o c e s s e s it is n e c e s s a r y t h a t t he M C S 6 5 E 4 be
a b l e to e x i t to b o t h l o w e r lev el and h i g h e r level p r o c e s s e s * The
P o i n t e r to C u r r e n t C a l l e r d e s c r i b e d p r e v i o u s l y s t o r e s the p h y s i c a l
a d d r e s s of the c a l l e r ' s top of s t a c k ? a l l o w i n g a p r o c e s s to r e t u r n
to its c a l l e r at a ny t i me* H o w e v e r ? w h e n a h i g h e r level p r o c e s s is
invoked? it ui l l be n e c e s s a r y to s t o r e t h i s p o i n t e r in a m a n n e r
which assures t h a t it w il l be a v a i l a b l e w h e n the MCS65E4 exits
f roiTi the higher l e vel process and b e 3 in s executing the
i n t e r m e d i a t e l evel p rocess once sgain * T h i s is a c c o m p l i s h e d by
s t o r i n g 'the i n f o r m a t i o n c o n t a i n e d in the P o i n t e r to C u r r e n t Ca 11 er
into the first three bytes of the i n t e r m e d i a t e process (logical
addresses 000000 through 000002) before exiting to the higher
level p r o c e s s * T h e s e t h r e e l o g i c a l a d d r e s s e s will be r e f e r r e d to
as the P r o c e s s L i n k *
4 ♦ 4 ♦ 2 +6 P r o c e s s Stack
4 * 4 *3 * 1 I n t r o d u c t i o n
The m a n n e r in w h i c h e a c h of t h e s e a r c h i t e c t u r a l e l e m e n t s is u s e d
in a s y s t e m can be d e s c r i b e d m o s t effectively through a detailed
d i s c u s s i o n of the p r i m a r y i n t e r - p r o c e s s o p e r a t i o n s t h a t m u s t t a k e
place during the operation of a full scale multi-task
m i c r o c o m p u t e r * S p e c i f i c a l l y ? t h e s e o p e r a t i o n s are!
1* System Reset*
2* Invoking hig her level proce sses*
3* E x i t i n g from a p r oces s in the event of an interrupt?
system call? or bus error*
4* R e t u r n i n g to a p r o cess after an interrupt? sy stem call 7
or bus error*
4 ♦4 *3 ♦2 System Reset
Bit 0 ( K ) 1
Bit 1 ( U ) 1
Bit 2 ( I ) 0
B it 3 ( 0
B it 4 ( P 0
B i t 5 ( S 0
B it 6 ( D 0
Bit
A.* It 7
/ \ U 0
B i t s 8 -11 ( M 0
Bits 12-15 ( R 0 (2 M S E C R e f r e s h rate)
The processor then fetches a 2 4 -bit address utilizing the
information stored in the R e s e t V e c t o r ( a d d r e s s e s F F F F F F C t h r o u g h
FFFFFFF) arid b e g i n s e x e c u t i n g the i n s t r u c t i o n s l o c a t e d at this
address* The m a n n e r in w h i c h the Reset Vector information is
u t i l i z e d to d e t e r m i n e the K e r n e l s t a r t i n g a d d r e s s is d e s c r i b e d in
P a r a g r a p h 4*7 *6*2*
M e m o ry
Location Contents
T h e r e are s e v e r a l i t e m s w o r t h n o t i n g in the p r e c e e d i n g o p e r a t i o n s *
T h e f i r s t is t h a t the a d d r e s s e s w h i c h are p l a c e d o n t o the c a l l e r ' s
sta ck from the i n t e r n a l p r o c e s s r e g i s t e r s are p h y s i c a l a d d r e s s e s *
No a t t e m p t is m a d e to c o n v e r t t h e s e p h y s i c a l a d d r e s s e s to l o g i c a l
addresses. In a d d i t i o n ? the p r o c e s s o r d o e s no t a 11 e m p t to f o r m a t
this data in a manner which would facilitate subsequent
manipulation through the n o r m a l p r o c e s s o r s o f t w a r e * B o t h of t h e s e
are m a d e p o s s i b l e by the b a s i c n a t u r e of p r o c e s s e x e c u t i o n wi t h i n
the M C S 6 5 E 4 architecture* In p a r t i c u l a r ? it is a s s u m e d t h a t the
limits within w h i c h the new p r o c e s s wil l e x e c u t e will not i n c l u d e
that po rtion of m e m o r y in w h i c h the c a l l e r ' s s t a c k is l o c a t e d and
t h a t it wil l not i n c l u d e the c a l l e r ' s B a s e P a g e or L i m i t P ag e*
Therefore? it wil l be i m p o s s i b l e for any h i g h e r level p r o c e s s to
access this data* S i m i l a r l y ? th e use of p h y s i c a l a d d r e s s e s on the
c a l l e r ' s s t a c k is m a d e p o s s i b l e by the f a c t t h a t the c a l l e r c a n n o t
be m o v e d w i t h i n the p h y s i c a l address space while a h i g h e r l evel
p r o c e s s is b e i n g e x e c u t e d *
4 * 4 *3 * 4 E x c e p t i o n Processing
4 * 4 *3 *4 * 1 I n t r o d u c t i o n
The M C S 6 5 E 4 e x c e p t i o n s ca n be d i v i d e d into 3 n u m b e r of c l a s s e s *
The f i r s t are t h o s e ' p r i v i l e g e d * e x c e p t i o n s w h i c h m u s t be s e r v i c e d
by the o p e r a t i n g s y s t e m (by a S u p e r v i s o r M o d e p r o c e s s ) * The s e c o n d
c o n s i s t s of t h o s e w h i c h c an be s e r v i c e d w i t h i n a U s e r p r o c e s s * In
addition? a n u m b e r of e x c e p t i o n s are r e c o g n i z e d at the en d of an
i n s t r u c t i o n e x e c u t i o n s e q u e n c e w h i l e o t h e r s m u s t be r e c o g n i z e d and
processed immediately* As s h o w n in the d i s c u s s i o n b e l o w ? e a c h of
t h e s e e x c e p t i o n g r o u p s is h a n d l e d d i f f e r e n t l y *
All e x c e p t i o n s ? r e g a r d l e s s of ty pe? 3 r e s e r v i c e d u n d e r c o n t r o l of
an e x c e p t i o n vector located in a r e s e r v e d p o r t i o n of the L i m i t
Page* W i t h i n the U s e r p r o c e s s ? h o w e v e r ? t h e r e is no p r o v i s i o n for
storing vectors for the privileged exceptions* These exceptions
are s e r v i c e d by r e t u r n i n g i m m e d i a t e l y to the c u r r e n t process's
caller* F o r t h i s r e a s o n ? the U s e r p r o c e s s v e c t o r s are a s u b s e t of
those which must be stored in the Supervisor Mode processes
(Operating System and Kernel)* All of these exceptions are
d e s c r i b e d in d e t a i l in S e c t i o n 4 * 4 * 4 * The E x c e p t i o n V e c t o r f o r m a t
a nd the m a n n e r in w h i c h the M C S 6 5 E 4 u t i l i z e s the e x c e p t i o n v e c t o r
M e m o ry
Location Contents
TGS + 2 PP C 7 B i t s 16-23
TOS+1 PPC? B i t s 8-15
TOS PPC? B i t s 0-7
* * * * * * * * * C Q N F I D E N T I A L ? MOS T E C H N O L O G Y ?INC ** * * * * * * * * P 3g e - 43
F i n a 1 De sign Specif i Cot i on for the MCS6 5E 4 Microprocessor
d e s c r i b e d * T h i s is c a u s e d by the f a c t t h a t it wil l be n e c e s s a r y to
r e t u r n to the m i d d l e of an i n s t r u c t i o n e x e c u t i o n sequence after
exception processing is c o m p l e t e * T h i s is a c c o m p l i s h e d by p 1a c i n g
the c o n t e n t s of all of the internal registers o n t o the stack?
i n c l u d i n g all of the P r o c e s s r e g i s t e r s ( e x c e p t the P r o c e s s Base
R e g i s t e r and the P r o c e s s Limit Register)? all of the t e m p o r a r y
data registers used d uring i ns t r u c t i o n e x e c u t i o n and all of the
various latches? registers? etc* w h i c h c o n t r o l the i n s t r u c t i o n
execution sequences* This sequence of operations proceeds as
followst
Memory
Location C on ten ts
TOS+26
TOS + 25
TOS+24
TGS+23
TOS+22
TOS+21
T0S+20
TOS+1?
TOS+18 P RM y B i t s 1 6 - 2 3
TOS+17 * ? Bits 8-15
TOS+16 Bi t s 0-7
TOS+15 PPC; B i t s 1 6 - 2 3
TOS+14 1 t Bits 8-15
TQS+13 1 ? B i t s 0-7
TOS+12 Literal Register
TOS+11
T0S+10 Internal Control Registers
TOS + 9
TOS + 8
TOS + 7
TOS + 6
TOS + 5
TOS + 4
TOS + 3 Data Input Latch? Bits 8-15
TOS + 2 > B i t s 0-7
TOS + 1 Data O u t p u t Latch? Bits 8-15
TOS ? Bits 0-7
2* If the p r o c e s s o r is r e t u r n i n g to an O p e r a t i n g S y s t e m
process? the d a t a in the P r o c e s s L i n k is t h e n m o v e d into
the P o i n t e r to C u r r e n t C a l l e r *
4* B e f o r e e x e c u t i n g the e x c e p t i o n h a n d l e r w i t h i n the c a l l e r ?
the p r o c e s s o r first p u s h e s the information which will
allow returning to th e p r o c e s s w h i c h was i n t e r r u p t e d by
the e x c e p t i o n * T h i s is a c c o m p l i s h e d by f i r s t c a l c u l a t i n g
the l o g i c a l a d d r e s s w i t h i n the c a l l e r of the T o p of S t a c k
for the i n t e r r u p t e d p r o c e s s by s u b t r a c t i n g the p h y s i c a l
a d d r e s s of the C a l l e r ' s b a s e f r o m the p h y s i c a l a d d r e s s of
the T o p of S t a c k for the h i g h e r level process* This
i n f o r m a t i o n is t h e n p u s h e d o n t o the c a l l e r ' s s t a c k *
6 * The p r o c e s s o r t h e n f e t c h e s the a p p r o p r i a t e e x c e p t i o n
v ector from the L i m i t P a g e of the c a l l e r * The l o g i c a l
a d d r e s s r e f e r e n c e d by t h i s v e c t o r is t r a n s f e r r e d int o the
Process Program Counter* The MCS65E4 then begins
e x e c u t i n g the s o f t w a r e l o c a t e d at t h i s a d d r e s s *
The p r o c e d u r e s w h i c h a l l o w r e t u r n i n g to a p r o c e s s w h i c h h ad b e e n
s u s p e n d e d by the o c c u r r a n c e of an e x c e p t i o n a r e e x a c t l y the sam e
as t h o s e w h i c h are u t i l i z e d for e n t e r i n g the p r o c e s s for the f i r s t
t i me * T h i s is m a d e p o s s i b l e by the f a c t t h a t the p r o c e s s o r c r e a t e d
a Process P a rameter List on t he s t a c k of the suspended process
before exiting* W h e n r e t u r n i n g to the p r o c e s s ? the s i n g l e o p e r a n d
4 *4 *4 *1 I n t r o d u c t i o n
1 Un d e f i n e d O p Code
* F8-FB
Ur;defined d a t a ty p e F4-F7
Subscript out-of-limits F0-F3
4 * O p e r a t o r arid O p e r a n d no t compatible EC-EF
r
r
U * Overflow E8-EB
6* Other arithmetic error (divide by zero; etc* E4-E7
7* N o n - c o n f o r m a b l e data types E0-E3
8* In st r u c t i o n Acce ss Trap DC-DF
? * Data A c c e s s Trap D8-DB
10 * Stack P3ge B o u nd a ry Trap D4-D7
I n t e r r u p t R e q u e s t ( IRQ) D0-D3
S y s t e m Call CC-CF
S y s t e m Call w i t h m e s s a g e C3-CB
4 * C h a n n e l Trap; C h a n n e l A C4-C7
5* C h a n n e l Trap; C h a n n e l B C0-C3
6* B us E r r o r BC-BF
7* A c c e s s o u t - o f - l i m i t B8-BB
3* D e b u g T r a p B4-B7
E a c h of t h e s e is d e s c r i b e d in d e t a i l b e l o w * N o t e t h a t w i t h i n the
U s e r p r o c e s s ; a d d r e s s e s D4 t h r o u g h FB are r e s e r v e d for the s t o r a g e
of e x c e p t i o n vectors* A d d r e s s e s B4 t h r o u g h It3 are a v a i l a b l e for
general data s t o r a g e * In the S u p e r v i s o r M o d e p r o c e s s e s ; a d d r e s s e s
A8 t h r o u g h FB a re r e s e r v e d arid s h o u l d not be u s e d for g e n e r a l d a t a
storage* A d d r e s s e s FC through FF are u s e d within the Kernel
p r o c e s s to s t o r e t he K e r n e l R e s e t Vector* Addresses FC-FF cannot
be u s e d for g e n e r a l d a t a s t o r a g e in e i t h e r the S u p e r v i s o r or U s e r
Modes ♦
The e x c e p t i o n v e c t o r s a re 2 4 - b i t p o i n t e r s s t o r e d in m e m o r y in a
format which is c o m p a t i b l e w i t h the d a t a d e s c r i p t o r d e s c r i b e d in
S e c t i o n 4*7* W i t h i n the e x c e p t i o n v e c t o r d e s c r i p t o r h e a d e r ; the
T R A P bit is u s e d to i n d i c a t e w h e n the e x c e p t i o n is to be s e r v i c e d
* * * * * * * * * C 0 N F I D E N T I A L ; MOS T E C H N OL O G Y ?I N C * * * ** * ** * * P ag e- 47
Final Desi gn Specification for the MCS65E 4 Microprocessor
4 * 4 ♦ 4 *2 U n d e f i n e d Op Code Trap
4 * 4 *4 *4 S u b s c r i p t out-of-limits Trap
4*4*4*6 Overflow
1* Divide-by-zero*
2* S a u a r e ro ot of n e g a t i v e number*
4 ♦ 4 * 4 *9 In s t r u c t i o n Access Trap
4*5*1 Introduction
1* In the i n t e r n a l p r o c e s s o r r e g i s t e r s *
2* In the i n s t r u c t i o n s w h i c h f o r m the p r o c e s s s o f t w a r e *
3* In the d a t a s t o r a g e a r e a of the p r o c e s s a d d r e s s s p ace*
The M C S 6 5 E 4 o p e r a n d s t r u c t u r e c o n t a i n s p r o v i s i o n s for r e f e r e n c i n g
d a t a in e a c h of t h e s e l o c a t i o n s * R e f e r e n c i n g d a t a in the i n t e r n a l
r e g i s t e r s is a c c o m p l i s h e d by s p e c i f y i n g the r e g i s t e r in the f i r s t
b y t e of the o p e r a n d * I m m e d i a t e d a t a cart be s p e c i f i e d e i t h e r in the
first byte of the o p e r a n d ( s h o r t f o r m i m m e d i a t e a d d r e s s i n g ) or in
t he o p e r a n d e x t e n s i o n b y t e s (lo n g f o r m i m m e d i a t e a d d r e s s i n g ) * All
other data r e f e r e n c e s are a c c o m p l i s h e d by a d d i n g the v a l u e of an
offset contained in the i n s t r u c t i o n to the c o n t e n t s of a base
register* This base register c 3 n be e i t h e r o n e of the i n t e r n a l
r e g i s t e r s or any three-byte location in th e Base P 3 g e of the
process*
BIT
1 7 6 5 4 3 2 1 0 1 R e m a rk s
1 1 1 Internal
I 0 1 1 0 1 1 Register Register
I 1 Addressing
i 1 i I iti m e d i a t e
1 0 1 1 1 1 Immediate Data Data
1 I 1 Short Form
1 1 BAS O f f s e t
1 1 0 1 Offset from BAS Addressing
1 1 Short Form
1 1 PR M O f f s e t
1 1 1 1 0ffset from P RM Addressing
1 I Short Form
4 * 5 * 2♦1 Introduction
The a d d r e s s i n g i n f o r m a t i o n p r o v i d e d in t h i s g r o u p c an be d i v i d e d
int o three fields* The f i r s t group specifies which of the
r e g i s t e r s is to be u t i l i z e d as the base register* The s e c o n d
s p e c i f i e s the number of b y t e s of addressing information which
f o l l o w s the A d d r e s s i n g C o n t r o l Byte? arid the t h i r d s p e c i f i e s the
f o r m a t of the d a t a acauisttion* E a c h of t h e s e is d e s c r i b e d in
detail below*
As d e s c r i b e d p r e v i o u s l y ? the p h y s i c a l a d d r e s s of the d a t a w h i c h is
to a c c e s s e d is d e t e r m i n e d by a d d i n g t he o f f s e t c o n t a i n e d in the
i n s t r u c t i o n to the r e g i s t e r s e l e c t e d by t h i s f i e l d * If E x t e r n a l
Base Addressing is s e l e c t e d ? the a d d r e s s of t h i s base register
( w i t h i n the P r o c e s s B a s e Pa ge) is s p e c i f i e d by the b y t e f o l l o w i n g
the O p e r a n d C o n t r o l Byte*
0 0 Descriptor Access
The a d d r e s s in the i n s t r u c t i o n is a s s u m e d to
be that of a d e s c r i p t o r w h i c h c o n t a i n s all
of the i n fo r m a t i o n required to properly
m a n i p u l a t e the d e s i r e d d a t a f i e l d *
Th e a d d r e s s c o n t a i n e d in the i n s t r u c t i o n is
assumed to be that of a single byte of
u n s i g n e d i n t e g e r data*
The a d d r e s s c o n t a i n e d in the i n s t r u c t i o n is
a s s u m e d to be t h a t of a s i x t e e n - b i t w o r d of
2' s c o m p l e m e n t i n t e g e r d a t a * Lo w o r d e r d a t a
is a s s u m e d to be l o c a t e d in the low o r d e r
add r e s s *
The a d d r e s s c o n t a i n e d in the i n s t r u c t i o n is
a s s u m e d to be t h a t of a 24 bit o r d i n a l data
field* Low o r d e r d a t a is a s s u m e d to be in
the low o r d e r a d d r e s s *
4 * 5 * 2 *4 N u m b e r of Extension Bytes
The N u m b e r of E x t e n s i o n B y t e s f i e l d s p e c i f i e s the n u m b e r of b y t e s
of o f f s e t i n f o r m a t i o n w h i c h f o l l o w s the O p e r a n d C o n t r o l Byte* T h i s
is s p e c i f i e d as f o l l o w s !
N u m b e r of
B it 3 Bit 2 Addressing Bytes
4 *5 ♦3 * 1 In t rc d u c t io n
In a d d i t i o n to t h e s e p r i m a r y a d d r e s s i n g m o d e s ? t h e r e 3 re s e v e r a l
a d d r e s s i n g m o d e s w i t h i n the M C 3 6 5 E 4 s o f t w a r e a r c h i t e c t u r e w h i c h do
n ot r e a u i r e the f l e x i b i l i t y w h i c h is i n h e r e n t in the a d d r e s s i n g
d e s c r i b e d in the p r e v i o u s p a r a d r a p h * T h i s is tru e for L i m i t P a 3 e
addressing (utilizing the LMT Resister as b ase) s i n c e th i s
operation never requires more than 3 single byte of offset*
Similarly? the P U S H arid POP operations do not require any
addressing information s i n c e the d a t a is p l a c e d d i r e c t l y o n t o the
process s t a c k without offset* F i n a l l y ? the I m m e d i a t e A d d r e s s i n g
requires only t h a t the s i z e of the i m m e d i a t e o p e r a n d be s p e c i f i e d
s i n c e the data f o l l o w s d i r e c t l y a f t e r the O p e r a n d C o n t r o l Byte*
T h e s e address!rig m o d e s are s e l e c t e d by the A d d r e s s i n g M o d e S e l e c t
f i e l d as F o l l o w s :
4 *5 * 3 *2 L i m i t P a ge Addressing
As d e s c r i b e d previously? the L i m i t P a g e w i t h i n a p r o c e s s is u s e d
to store the vectors which are used in the servicing of
interrupts? system calls? etc* during process execution* These
v e c t o r s can be manipulated directly by the process whenever
a p p r o p r i a t e * L i m i t P a g e a d d r e s s i n g p r o v i d e s an e f f i c i e n t m e t h o d of
a ccessing these vectors* W h e n L i m i t P a g e a d d r e s s i n g is s e l e c t e d ?
the A u x i l i a r y D a t a F i e l d (bits 0 and 1) s p e c i f i e s the D a t a A c c e s s
F o r m a t in e x a c t l y the s a m e m a n n e r as that d e s c r i b e d a b o v e (See
P a r a g r a p h 5 ♦ 6 ♦ 2 *3) ♦
The result of the add operation w ill be pushed onto the stack as a
Da t a
Field Byte
*2
Address or
Data Da ta
Field
*1
D ata
Field
*2
< --- C o n t e n t s of TOS
Register
Free Memory
Free Memory
Figure 2*1D - Memory and TOS register contents after PPHW (PUSH)
Data I
Field I
£3 I < --- C o n t e n t s of TOS
Register
Free Memory
0 0 U n s i g n e d B yte* Assumed to be
positive *
Not Used
0 " 4) * T h i s a l l o w s i m m e d i a t e v a l u e s b e t w e e n - 1 6 arid + 15 t o be
s p ec i f i ed w i t h i n t h e O p e r a n d c o n t r o 1 B y t e *
4 * 5 * 6 P r o c e s s B ase A d d r e s s i n g ? S h o r t Form
The s h o r t fo r m o f BAS o f f s e t a d d r e s s i n g a l l o w s u p to 6 b i t s o f
o f f s e t i n f o r m a t i o n to be i n c l u d e d in t h e O p e r a n d C o n t r o l B y t e ( i n
b i t s 0 - 5 ) * T h i s a l l o w s t h e O p e r a n d C o n t r o l B y te to d i r e c t l y
s p e c i f y d a t a f i e l d s w h ic h a r e a c c e s s e d t h r o u g h d e s c r i p t o r s l o c a t e d
in t h e f i r s t 64 b y t e s o f t h e B ase P a g e *
4 * 5 * 6 P r i m a r y B ase A d d r e s s i n g S h o r t Form
The s h o r t fo r m o f PRM o f f s e t a d d r e s s i n g a l l o w s u p to 6 b i t s o f
a d d r e s s i n g i n f o r m a t i o n to be i n c l u d e d in t h e A d d r e s s i n g C o n t r o l
B y t e ( i n b i t s 0 - 5 ) * T h i s a l l o w s t h e O p e r a n d C o n t r o l B y t e to
d i r e c t l y c o n t r o l a c c e s s t o d a t a f i e l d s w h ic h a r e a c c e s s e d t h r o u g h
d e s c r i p t o r s l o c a t e d in t h e f i r s t 6 4 b y t e s a b o v e t h a t memory
l o c a t i o n w hose a d d r e s s i s c o n t a i n e d in t h e P r i m a r y B ase R e g i s t e r *
F i g u r e 4 * 6 A arid 4 * 6 B b e lo w s u m m a r i z e s t h e a d d r e s s i n g modes f o r th e
M C S 6 5 E 4 *
Program I
>
V
instruction i
SYNTAX DIAGRAM
1
ructio ._ N/j v: ODerand Operand
Operand
OP-Code
V 1
"7»
OP-Code B Oicerand
OP-Code ! B aw
.Ficrare 5.6a
- (BASE) t of fs e t
Figure 5.6b
Final De s i gn Specification for the MC S65 E 4 Microprocessor
4♦6 * 1 I n tr o d u c t i o n
N o w h e r e is the “h i g h level* a p p r o a c h to a r c h i t e c t u r e m o r e a p p a r e n t
t h a n in the m a n n e r in w h i c h d a t a is s t o r e d and a c c e s s e d w i t h i n an
M C 3 6 5 E 4 s y s t e m * T h i s w as i n t r o d u c e d in S e c t i o n 4 * 5 w h i c h d i s c u s s e s
the o rgan i za t i on of the ope r a n d * S e c t i o n 4*6 c o n t a i n s a d e t a i l e d
d e s c r i p t i o n of the remaining a s p e c t s of these data accessing
m e c h a n i s m s a l o n g w i t h a d e s c r i p t i o n of the m a n n e r in w h i c h d a t a is
s t o r e d w i t h i n the M C S 6 5 E 4 s y s t e m *
All d a t a m a n i p u l a t i o n i n s t r u c t i o n s w i t h i n the M C S 6 5 E 4 c o n s i s t of
an O p C o d e and u p to three operands* The Op C o d e s s p e c i f y the
o p e r a t i o n to be p e r f o r m e d w h i l e the o p e r a n d s s p e c i f y the l o c a t i o n
of the d a t a to be m a n i p u l a t e d * T h i s d a t a can be a c c e s s e d d i r e c t l y
or it c an be l o c a t e d in one of the c o m p l e x data structures
d e s c r i b e d below* In all c a s e s ? h o w e v e r ? p r o c e s s i n g of the o p e r a n d
must result in the g e n e r a t i o n of the a d d r e s s of a basic data
element since all d a t a m a n i p u l a t i o n o p e r a t i o n s are p e r f o r m e d o n l y
on t h e s e e l e m e n t s *
(HW)j
'riois
lyte (T3)
■iord (W)
31
Double
'lord (DW)
53 0
u
! »
iord (LW) 1 • u
79
n-3yte / I
3tring(n3
8n-l o
-Data Tyoe Meaning Size
* * * * * * * * * C G N F I D E N T I A L ? MOS T E C H N O L O G Y ? I N C * ** * * ** * * * Pa g e - 68
A
Is!
li~30 23 22
A+7
8R
63 52 52
A+9
10R
Is e______ J____
79 73 5*+ 53 52
At 3
M-D
n I digit
31--- T T
A+7
3D n 15 disit
63
A+n-1
---------------- ---------------------------------------------------- _
n Byte String I „ | ,
>Y ,
n byres
s = sign
e - exponent
f - fraction
K - key
M - message
j - 1-bit integer part
n = siqn 0000
1111
<21 >
<ORD >
<-ur>,OR> ,<>D>
< 10R>
4 * 6 ♦3 * 1 I n t r o d u c t i o n
1* D e s c r i p t o r H e a d e r
2 * A d d r es sing Information (optional)
3* A u x i l i a r y i n f o r m a t i o n ( o p t i o n a l )
4 * 6 *3 *2 * 1 I n t r o d u c t i o n
7 6 5 4 3 2 1 0
4 *6 ♦ 3 ♦ 2 *2 T r a p Bit (Bit 7)
The tr a p b it in th e d e s c r i p t o r c an be set to c a u s e a D a t a A c c e s s
T r a p to occur w h e n the processor attempts to a c c e s s the data
field* W i t h i n the E x c e p t i o n V e c t o r f i e l d ? the T R A P b it is u s e d to
specify that the exception will be serviced in the current
process's c a 11e r *
The Access Mode field specifies the manner in which the location
F i e l d D e s c r i p t o r or
B it 1 Bi t 0 Descriptor Element Descriptor
4*6*3*2*3*1 Attached
If the A t t a c h e d A c c e s s M o d e is s p e c i f i e d ? t he v a r i a b l e d e s c r i p t o r
c o n s i s t s of a d e s c r i p t o r h e a d e r and? if a p p r o p i a t e ? an a u x i l i a r y
data field* No a d d r e s s i n g i n f o r m a t i o n is r e q u i r e d s i n c e the d a t a
f i e l d is l o c a t e d in m e m o r y i m m e d i a t e l y f o l l o w i n g the d e s c r i p t o r *
4 ♦ 6 * 3 *2 * 3 * 2 A t t a c h e d Relocatable
4 * 6 * 3 *2 *3 *3 S h o r t Rel3tive
If the s h o r t r e l a t i v e a c c e s s m o d e is s p e c i f i e d ? the d a t a f i e l d is
l o c a t e d at a s p e c i f i e d o f f s e t f r o m the a d d r e s s of the d e s c r i p t o r *
The o f f s e t is c o n t a i n e d in a s i n g l e b y t e of a d d r e s s i n g i n f o r m a t i o n
immediately following the d e s c r i p t o r header* The d a 1 3 f i e l d c 3 n
t h e r e f o r e be l o c s t e d w i t h i n the r 3 n g e of - 1 2 3 to + 1 2 7 b y t e s f r o m
the address of the descriptor* If a u x i l i a r y information is
required for s c c e s s i n g the data field? this in for m a t i o n follows
i mmediate ly after the s i n g l e b y t e of o f f s e t * ( r e f e r to d e s c r i p t o r
flowchart)
4 * 6 * 3 * 2 * 3 *5 L o n g Relative
4 * 6 * 3 *2 * 3 * 6 Long Relocatable
4 ♦ 6 ♦ 3 ♦2 ♦ 3 ♦ 7 Logical Addressing
If L o g i c a l A d d r e s s i n g is s p e c i f i e d ? the d e s c r i p t o r h e a d e r will be
f o l l o w e d by s t h r e e - b y t e o r d i n a l w h i c h is the l o g i c a l a d d r e s s of
the d a t a field* T h i s l o g i c a l a d d r e s s is a d d e d to the c o n t e n t s of
the BAS r e g i s t e r to d e t e r m i n e the p h y s i c a l a d d r e s s of the d a t a
field* T h i s 3 l l o w s the d a t a f i e l d to be p l a c e d a n y w h e r e in the
a d d r e s s s p a c e of the p r o c e s s * As b e f o r e ? any a u x i l i a r y i n f o r m a t i o n
w h i c h is required will follow the t h r e e bytes of addressing
i n f o r m a t i o n * ( R e f e r to d e s c r i p t o r f l o w c h a r t )
* * * * * * * * * C O NF I D E N T I A L ? MOS T E C H N O L O G Y ?I N C ** * * * * * * * * Page- 72
T ' n
1 1 / attacnec Field
Discriptar x Attached
!
__ s,. snort ;3 u> Header 3
Element !Relocatable
! V relative I J ( Discriiotor
! r
j |
o<s a r ’ •jS k
jHwy / Short
7 Relative
Long
HB '
i /
A
Logical
-^scalar Address
i^. viiiiLidcs
(initiate a reicn
fetch or
of rieia.
field select. ^J ,
byte in the instruction) [Discriptor
Tpr
array maximum
lement |
structure
with limit
check
i
Final Design Specification for the M C S 65 E 4 Microprocessor
* * * * Bit * * * *
5 4 3 9 Data Ty p e
1 1 0 0 Deferred Descriptor/Record
1 1 0 1 Array Structure
i through 1- 1------------------------------ 1
1 String 1 1 1 Array Access 1
i — 1— — 1— — —— 1
1 1 0 i No R a n g e C h e c k i n g i
1 Array 1-- „ 1------------------------------ |
1 Structure ! 1 1 P e r f o r m R a n g e C h e c k in g i
1 _ _ 1— . — _ —
1 —
1 _ ______ _ — __ _
—_ _
—_ __ 1
1
1 Deferred 1 0 1 R e c 0r d 1
1 Descriptor !-- 1------------------------------ |
I or r e c o r d I 1 I Deferred Descriptor 1
1----------------- 1-- „ 1------------------------------ j
1* Th e p r o c e s s o r a c c e s s e s the d e s c r i p t o r block.
t h r o u g h any of the M C S 6 5 E 4 a d d r e s s i n g m o d e (see s e c t i o n
_____ .)* Set Y = the address f o l l o w i n g the addressing
information*
2* A c h e c k is m a d e to d e t e r m i n e w h e t h e r t he d e s c r i p t o r
i n d i c a t e s an b a s i c d a t a type* If it is not? the p r o c e s s o r
c o n t i n u e s to d e t e r m i n e the d e s e c r i p t o r ' s type*
4 * The a d d r e s s i n g i n f o r m a t i o n and t he a c c e s s m o d e b i t s
together determine the s t a r t i n g a d d r e s s of the raw data*
(In the f l o w d i a g r a m ? t h i s c a l c u l a t e d a d d r e s s is s a v e d in
v a r i a b l e Y - an i n t e r n a l r e g i s t e r * F o r a t t a c h e d mode? Y =
Y + 0* For r e l o c a t a b l e mo de? Y = Y + r e l a t i v e * For
l o g i c a l mode? Y = the p h y s i c a l a d d r e s s * )
10* A c h e c k is m a d e to d e t e r m i n e if the b a s i c
d a t a is of t y p e s t r i n g * If it is? the n e x t two b y t e s are
fetched from the i n s t r u c t i o n and are u s e d as the string
length*
(i0s)
Final Design Specification for the M CS 6 5 E 4 Microprocessor
4 * 6 *4*1 I n t r o d u c t i o i"j
1* Single-dimension arrays
2* Array Structures
3* Records
In a d d i t i o n ? t h e s e s t r u c t u r e s can be o r g a n i z e d into c o m p l e x d a t a
s t r u c t u r e s such as m u l t i - d i m e n s i o n a l arrays? a r r a y s of r e c o r d s ?
etc* The s i m p l e d a t a s t r u c t u r e s are d e s c r i b e d in t h i s s e c t i o n * The
m a n n e r in w h i c h t h e s e s i m p l e d a t a s t r u c t u r e s c a n be u s e d to b u i l d
the c o m p l e x d a t a s t r u c t u r e s is b e s t i l l u s t r a t e d by e x a m p l e *
The s i n g l e - d i m e n s i o n a r r a y is the s i m p l e s t of th e d a t a s t r u c t u r e s
w h i c h are d i r e c t l y s u p p o r t e d by the M C S 6 5 E 4 * T h i s is s e l e c t e d by
s e t t i n g the F L A G b it in the v a r i a b l e d e s c r i p t o r to a l o g i c 1* The
p r o c e s s o r then a s s u m e s t h a t the s c a l a r or s t r i n g w h i c h is to be
m a n i p u l a t e d by the i n s t r u c t i o n is an e l e m e n t of an ar r a y * To
a c c e s s this element? the p r o c e s s o r f e t c h e s an i n d e x from the
instruction*
2* A c h e c k is m a d e to d e t e r m i n e w h e t h e r t he d e s c r i p t o r
indicates single dimesion array* If it is not? the
p r o c e s s o r c o n t i n u e s to d e t e r m i n e the d e s e c r i p t o r ' s t ype *
3* If the d e s c r i p t o r i n d i c a t e s s i n g l e d i m e n s i o n a r r a y ( F L A G = 1 ) ?
t he M C S 6 5 E 4 gets the addressing information from the
descriptor block *
4* The a d d r e s s i n g i n f o r m a t i o n a n d the a c c e s s m o d e b i t s
together determine the s t a r t i n g a d d r e s s of the raw da t a
for the f i r s t e l e m e n t of the a r r a y (In the f l o w d i a g r a m ?
this calculated address is s a v e d in variable Y - an
internal register* Fo r a t t a c h e d m ode ? Y = Y + 0* For
r e l o c a t a b l e mo d e ? Y = Y i r e l a t i v e * For l o g i c a l mode? Y =
the p h y s i c a l a d d r e s s * )
5* To d e t e r m i n e w h i c h e l e m e n t in the a r r a y to a c c e s s ?
the p r o c e s s o r fetches the d a t a specified by the next
11* If the b a s i c d a t a t y p e is n o t t y p e s t r i n g
the l e n g t h is d e t e r m i n e d by the d a t a typ e * The length can be
e i t h e r 1? 2? 3? 4? 8? or 10 b y t e s *
CONTINUE TO \
DETERMINE SINGLE '
DESCRIPTOR DIMENSION sC 2
rTTV D ‘P
ADDRESSING /'T
INFO FROM
DESCRIPTOR!
jPOINT TO
jBEGINNING 1
OF NEW
^ATA
SET NEXT
3YTE FRCM
ENSTRUCTI:
cn
■OR INDEX
S .
GET NEXT 2
BYTES FOR
LENGTH BUILT STRING LENGTH
INTO DATA TYPE
CAN BE EITHER:
1,2,3,4,8 or 10
BYTES
POINT TO RAW
DATA BY
Y=Y+I*EL
---------
EONE
Final D e sign Specification for the MCS65E4 Hicroprocessor
-----j
I i i I
(T)1 1 I 1 1 0 1 1 (M) I -- Descriptor Header
1 I 1 I
i
1
Addressing I
Information 1
1
----- j 1
Element* 1 I#
Length i A n*
---- - j u F
Maximu m ! x 0
In d e x 1 i r
----- j 1 m
1 i a
Element 1 a t
Discriptor 1 r i
1 y o
1 n
— ---I 1
----- I
i S 1 1
(T)1 0 1 1 1 0 1 1 (M) i < -- — Descriptor Header
! I I i
-----i
Addressing
Information
1 Element i !
1 Length I 1
... 1 i
1 Auxiliary
1 Element 1 I n f 0 r m a t i 0n
I Descriptor ! 1
1 1
1 i
1* The p r o c e s s o r a c c e s s e s the a r r a y d e s c r i p t o r b l o c k (A D B )
t h r o u d h any of the M C S 6 5 E 4 a d d r e s s i n d mode* Set Y = the
a d d r e s s f o l l o w i n d the a d d r e s s i n d i n f o r m a t i o n *
2* A check, is m a d e to d e t e r m i n e w h e t h e r t he d e s c r i p t o r
i n d i c a t e s an a r r a y s t r u c t u r e * If it is not? t he p r o c e s s o r
c o n t i n u e s to d e t e r m i n e the d e s e c r i p t o r ' s t y pe*
3* If the d e s c r i p t o r i n d i c a t e s a r r a y s t r u c t u r e ? the M C S 6 5 E 4
dets the addressind information from the descriptor
block.*
4* The a d d r e s s i n d i n f o r m a t i o n and t h e a c c e s s m o d e b i t s
todether determine the s t a r t i n d a d d r e s s of the raw d a t a
f or the f i r s t e l e m e n t of the a r r a y (In the f l o w d i a d r a m ?
this c a l c u l a t e d address is s a v e d in variable Y - an
internal redister* F o r a t t a c h e d mode? Y = Y + 0* For
r e l o c a t a b l e m ode? Y = Y + r e l a t i v e * F o r l o d i c a l mode ? Y =
the p h y s i c a l a d d r e s s * ) )♦ N o t e t h a t the a t t a c h e d m o d e is
n ot v a l i d for an array structure s i n c e the a c t u a l raw
d a t a d o e s not f o l l o w the d e s c r i p t o r h e a d e r *
5 * To d e t e r m i n e w h i c h e l e m e n t in the a r r a y to a c c e s s ?
the p r o c e s s o r fetches the d a t a specified by the next
o p e r a n d in the i n s t r u c t i o n * T h i s d a t a is t r e a t e d as the
i n d e x (In the flow diag ra m this value is r e f e r r e d as
variable I ) *
6 * H o w e v e r ? b e f o r e the e l e m e n t is a c c e s s e d ? the M C S 6 5 E 4
d e t e r m i n e s if the i n d e x v a l u e is g r e a t e r t h a n or e a u a l to
z e r o and less t h a n or e a u a l to the maximum index value
c o n t a i n e d in the a r r a y d e s c r i p t o r * The check, w ill n ot be
p e r f o r m e d if F L A G e a u a l s z e r o (see s e c t i o n 4 * 6 * 3 * 2 * 3 * 4 ) *
If F L A G e a u a l s one in the d e s c r i p t o r h e a d e r 3nd the i n d e x
v a l u e is invalid? the p r o c e s s o r t e r m i n a t e s e x e c u t i o n of
t h e c u r r e n t i n s t r u c t i o n and wi l l e x e c u t e a t r a p s e a u e n c e *
9* If th*e e l e m e n t d e s c r i p t o r s p e c i f i e s a b a s i c d a t a t y p e
(byte t h r o u g h string)? the p r o c e s s o r can process its
address information to get the a d d r e s s of the raw data*
O n c e the processor has the a d d r e s s of the raw data
element? it can p r o c e e d to m o v e the d a t a i n t o the chip*
If h o w e v e r ? the e l e m e n t d i s c r i p t o r is an a r r a y s t r u c t u r e ?
the a b o v e seauenee (3 t h r o u g h 9) w ill r e p e a t * When a
basic data e l e m e n t is e n c o u n t e r e d ? o n l y 3 and 4 wi l l be
p e r f o r m e d to f e t c h the d a t a f i e l d * In b o t h c a s e s ? 4 h a s a
d i f f e r e n t m e a n i n g s i n c e Y n o w c o n t a i n s the a d d r e s s to the
b a s e of t he a r r a y * T h e r f o r e ? a t t a c h e d m o d e (in t h i s c a s e
c a l l e d the a t t a c h e d r e l o c a t a b l e m ode) is u s e d to a c c e s s
t he f i r s t e l e m e n t of the array* R e l a t i v e m o d e (in t h i s
case called s h o r t or long r e l o c a t a b l e m ode) now c o n t a i n s
the the o f f s e t f r o m p r e v i o u s l y c a l c u l a t e d a d d r e s s i n s t e a d
of t h a t of the d e s c r i p t o r *
fM ax COptional]
;T1 .O .
Descrio j
t
J
Addr’ Info.
!
Ele Length
Max (Optional
i
j Desr •
i
!
Array
Descriptor
Block
©Attached Mode
not allowed here
Final De s ig n Specification for the M C S 6 5 E 4 Microprocessor
4 *6 * 4 * 4 R e c o r d
Descriptor
Header
Addressing
Information
Field Descriptor
F i e l d *1
Field Descriptor
F i e l d *2
Field D e scriptor
F i e l d *3
s t r u c t u r e s ( mu 1 1 i - d i m e n s i o n a 1 a r r a y s ? a r r a y s of r e c o r d s * etc ♦ ) ♦ If
the s h o r t or long r e l o c a t a b l e o f f s e t is s p e c i f i e d in the f i e l d
descriptor? the o f f s e t will be added to the p r e v i o u s address
calculated* If the attached relocatable addressing mode is
specified? t h e n z e r o is a d d e d to the p r e v i o u s a d d r e s s c a l c u l a t e d *
I t the l o g i c a l a d d r e s s i n g a c c e s s m o d e is s p e c i f i e d ? the s p e c i f i e d
logical address r e p l a c e s the p r e v i o u s a d d r e s s c a l c u l a t e d * T h i s is
i l l u s t r a t e d in d e t a i l in the e x a m p l e s b e l o w *
2* A c h e c k is m a d e to d e t e r m i n e w h e t h e r the d e s c r i p t o r
i n d i c a t e s a r e c o r d s t r u c t u r e * If it is not? t he p r o c e s s o r
c o n t i n u e s to d e t e r m i n e the d e s e c r i p t o r ' s t ype*
3* If the d e s c r i p t o r i n d i c a t e s a r r a y s t r u c t u r e ? the M C S 6 5 E 4
gets the addressing information from the descriptor
block*
5* To d e t e r m i n e w h i c h f i e l d w i t h i n the r e c o r d to a c c e s s ?
the p r o c e s s o r fetches the d a t a specified by the next
o p e r a n d in the i n s t r u c t i o n * T h i s d a t a is t r e a t e d as the
o f f s e t into the r e c o r d d e s c r i p t o r to o b t a i n the field
descriptor *
• 1
Y
GET ADDRESSING
INFORMATION FROM
RECORD DESCRIPTOR
A
POINT TO b e g i n n i n g ;
OF RECORD's ROW
DATA. THIS IS j
OBTAINED BY ACCESSj
MODE BITS, AND 1
ADDRESS INFORMATION
hvj ETELD___________ !
GET FIELD
Final Design Specification for the MCS65E4 Micros
The d e f e r r e d d e s c r i p t o r c o n t a i n s no i n f o r m a t i o n r e d a r d i n d t h e t y p e
of d a t a w h i c h is s t o r e d in the d a t a f i e l d w h i c h is to be a c c e s s e d
by the i n s t r u c t i o n * For t h i s r e a s o n * the d e f e r r e d d e s c r i p t o r d o e s
not d i r e c t l y re f e r to the raw d a ta* I n s t e a d ? it p o i n t s to a n o t h e r
d escriptor which can c o n t a i n d a t a t y p e i n f o r m a t i o n * It s h o u l d be
rioted t h a t this second descriptor is e x a c t l y the s a m e as any
variable descriptor ( i * e * ? t he s e c o n d d e s c r i p t o r c o u l d v e r y well
be a n o t h e r deferred descriptor)* In all c a s e s ? it is n e c e s s a r y
that the p r o c e s s o r e n c o u n t e r d a t a t y p e i n f o r m a t i o n b e f o r e raw d a t a
can be fetched from memory* The o p e r a t i o n of the deferred
d e s c r i p t o r is i l l u s t r a t e d in F'arsraph 4 * 6 * 6 * 4*
*********CONFIDENTIAL? MOS T E C H N O L O G Y ? I N C ** * * * * * * * * P a3 e - 89
Final D e sign Specification for the MC S6 5E 4 Microprocessor
4 *6 *6 * 1 I n t r o d u c t i o n
H i5 h - order Memory
(3*4)
( 3 *2 )
(3*1)
(2/4)
(2^3)
(2 *2 )
(2*1)
(1*4)
(1*3)
(1*2)
( 1* 1) Address of array
Low-Order Memory
To c r e a t e the d e s c r i p t o r fo r t h i s a r r a y * the s t r u c t u r e m u s t be
v i e w e d 3s a s i n g l e - d i m e n s i o n a r r a y in w h i c h each elem e nt conta in s
four data f i e l d s * T h i s can be i l l u s t r a t e d as follows}
! I I 1
IHidh-order Memory! 1H i d h - o r d e r m e m o r y !
1 1 1 I
j----------- ---- ------j 1 _ ___ !
1 (3*4) I 1 1
i — i
i (3*3) I ! Element !
j„ ------------------------ ------------------------------------------------------j
1- 3 -!
1 (3*2) I ! 1
i
i —
— — i
i
1 (3,1) 1 1 !
1
1
— — !
! i
i — — i
i
1 (2*4) 1 1 1
j ----------------------------------------------------------------------------------- j j- - j
1 (2 ? 3 ) i 1 Element 1
j--------------------- |
1 (2 ? 2 ) I 1 " j
i--------------------- j
1 (2? 1 ) 1 i i
i — — i i— — i
1 (1,4) i ! I
1— — ———— —1
1 <1,3) 1 1 Element 1
1--------------------- | 1- 1 -J
1 (1,2) 1 1 1
1 — — —— 1
1 (1,1) 1 I 1
I — — —— I \— — — — _ i
i \ i i
ILow-Order Memory 1 IL o u - o r d e r Memory 1
1 1 1 1
The d e s c r i p t o r w h i c h s p e c i f i e s the f o r m of t h i s s i n g l e - d i m e n s i o n
array must contain an e l e m e n t length which is four times the
a c t u a l e l e m e n t s i z e * F or e x a m p l e ? if the raw d a t a is t e n b y t e real
t h e n the e l e m e n t l e n g t h in the a r r a y d e s c r i p t o r w o u l d be f o r t y * I f
the i n d e x is to be c h e c k e d for m a x i m u m si ze? the d e s c r i p t o r m u s t
s p e c i f y 3 as the m a x i m u m for the f i r s t i n d e x into the a r r a y * U s i n d
the p r o c e d u r e s d e s c r i b e d a b o v e ? the M C S 6 5 E 4 will f i r s t u t i l i z e the
addressing; e l e m e n t s i z e arid i n d e x i n f o r m a t i o n to d e t e r m i n e the
location of an element in this single-dimension ar ra y * For
instance? if the instruction references element (2?3) in the
a r r a y ? the p r o c e s s o r will f i r s t d e t e r m i n e the a d d r e s s of e l e m e n t 2
in the s i n g l e - d i m e n s i o n a r r a y by e v a l u a t i n g the f o l l o w i n g f o r m u l a *
Motet * = multiplication
Low-Order Memory
Descriptor Header
Addressing
Information
Element Size 1
Max i murn In d e x V a 1 1
j e
Element Descriptor
Header
Addressing
Information
High-order Memory
( c o n t e n t s of s p e c i f i e d b a s e r e g i s t e r ) +
(base of a r r a y l o g i c a l a d d r e s s ) +
( e l e m e n t s i z e 1 * i n d e x 1) +
(element 2 addressing information) +
( e l e m e n t s i z e 2 * in d e x ) +
Data A d d r e s s i n g Infor m at io n
Low-Qrder Memory
Descriptor Header
Addressing
Information
Element Size
Element Descriptor
Header
Addressing
EDI Information
Element Size
TAD
Maximum Index Value
Element Descriptor
Header
Ad d re s s i ng
Information
ED2
I Element Size
I
Maximum Index Value
Element Descriptor
ED3 for a r r a y e l e m e n t
* thi rd le v e l 1
High-order Memory
j — ---------------J
I 5 byte 1
1 hole 1
4 byte i 4 byte !
i 4 byte i 4 byte ! 4 byte t 4 byte
hole 1
i real i
1 real ! real i
1 real 1 real
Logical
Address
i — —-
1* 011FF0 1 T 1 I 0 1 1101 i 11 Define Array Structure
ii —
2* 1 56
ii I
1 34 Logical of raw data
ii — _____
— ——— — I
1 12
ii
3* I- F5 - Element Length
1
i ____
4♦ 1 T i 1 I 1101 1 01 lElement Descriptor (array)
i
i
5* 1 5 Short Relocatable Addressing
it ___
—
6♦ I- 9 - Maxi m urn I n d e x Value
ii___ _
7* |- 18 - Element Length
ii ___i
3* I T ! 1 I 0110 1 01 Element Descriptor (REAL4 )
i
i _
—
9* 1 4 Short Relocatable Addressing
i ____
Field Description
3* S p e c i f i e s the e l e m e n t l e n g t h for f i r s t d i m e n s i o n *
E l e m e n t l e n g t h = HI + M A X 2 * (H2 + ( M A X 3 * L ) )
(where HI = hole 1
MAX2 = second d i mension size
H2 = hole 2
MAX3 = third d i m e n s i o n size
L = l e n g t h of e l e m e n t )
4* S p e c i f i e s s e c o n d d i m e n s i o n as a r r a y structure with
short relocatable mode a ddressing
7* S p e c i f i e s e l e m e n t l e n g t h for s e c o n d d i m e n s i o n *
E l e m e n t l e n g t h = 4 + 5*4
= 18 (hex) u s i n g f o r m u l a *
Element length = HI 4* M A X 3 * L
(where HI = 4 hole
M A X 3 = third dimension size)
3* S p e c i f i e s the t h i r d d i m e n s i o n as an a r r a y of
f o u r - b y t e r e a l s (th i s as a c c o m p l i s h e d by s e t t i n g
F L A G = 1) w i t h s h o r t r e l o c a t a b l e o f f s e t m o d e
addressing♦
Q = AID + (ELI * I I ) +
E2A +
(EL2 * 12) +
E3 A +
(L * 13)
where A ID = A d d r e s s I n f o r m a t i o n of D e s c r i p t o r
ELI = Element 1 Length
II = Index 1
E2A = Element 2 Addressing Information (relocatable)
EL 2 = Element 2 Length
12 = Index 2
E3A = Element 3 Addressing Information (relocatable)
L = Data Le n g t h
13 = Index 3
Q = 123456 + (F 5 * OA) +
5 +
(18 * 08) 4*
4 i
'(4 * 3)
Q = 123EBD
1 T 1 0 1 1101 1011
1 03 1
1- 13 -1
1 T 11 1 1 0101 1 00 1
Field Definition
I
IE x t e r n a l
1B a s e w i t h
In g o f f s e t
Th e c o m p l e x r e c o r d s t r u c t u r e c a n b e s t be d e s c r i b e d by r e f e r r i n g to
a diagram arid f o l l o w i n g the o p e r a t i o n s t he p r o c e s s o r m u s t p e r f o r m
to a c c e s s the da t a * A s s u m e we h a v e a P A S C A L - l i k e record shown
belowt
A = Record
B : A R R A Y C l ♦ ♦ 1 5 3 of I N T E G E R *2? -Cdefine 2 b y t e i n t e g e r a r r a y >
C : BC D4 ? { d e f i n e 4 b y t e BCD f i e 1d >
D : REAL40 ? • -Cdefine p o i n t e r to 4 b y t e R E A L )
E = Record { d e f i n e new r e c o r d )
BB : BYTE? ■Cdefine a b y t e f i e l d >
CC : O R D I N A L -Cdefine an o r d i n a l fie 1 d >
End 7 {end record)
F : A R R A Y C l ♦*260] of C H A R; -Cdefine a 260 b y t e s t r i n g )
G : INTEGER*4 -Cdefine a 4 b y t e i n t e g e r f i e l d )
End 7 -Cend r e c o r d )
Logical Relative
A d d re s s Address
123473 T I 0 I 0110 11
Field D
125656
I
Field F
125656 11
33
44
Rea l D at 3 Field
I
01F234 T I 0 I 11 0 0 i 11
56 Define Record
with
34 Logical
Base Addressing
12
01F239 1 0 I 1001 I 01
Define Field A .C
IE
01F23B 1101 I 01
Define Field A.DS
(deferred descriptor)
01F23D T I 0 I 0010 I 01
Define Field A ♦D
6 23
01F242 A T I 0 I 0010 I 01
Define Field A.E.CC
B 01
01F244 C 0 i 1011 01
28
Define Field A .F
04 I
01
01F248 10 0 I 0100 I 10
I
2C Define Field A.G
01 I
BAS + 3 e xt F2 01 OC
bytes
I
I BAS 4- 3 ext F2 01
1 bytes
iB A S + 3 ext! 34 F2 01 07 00
I bytes I
j------------- ,
4 *6 *6 *5 E x c e p t i o n Vectors
4♦6♦6♦5♦1 Introduction
E a c h of the e x c e p t i o n v e c t o r s l i s t e d in S e c t i o n 4 * 4 * 4 is s t o r e d in
a four - b y t e f i e l d in a manner w h i c h is compa t i b l e with the
MC365E4 data structure* The f i r s t b y t e of t h e vector contains a
descriptor which p r i m a r i l y s p e c i f i e s t h a t the l o g i c a l a d d r e s s of
the e x c e p t i o n processing s o f t w a r e is either "attached" to the
d e s c r i p t o r or is l o c a t e d in a " r e m o t e " data structure* If the
a d d r e s s is a t t a c h e d ? the t h r e e b y t e s f o l l o w i n g the d e s c r i p t o r are
a s s u m e d to be t he l o g i c a l a d d r e s s of the software which will
s e r v i c e the exception (exeception h a n d l e r ) * T h i s a d d r e s s wil l be
a d d e d to the c o n t e n t s of the P r o c e s s B a s e R e g i s t e r to d e t e r m i n e
the corresponding physical address* This address is then
t r s n s f e r e d into the P r o c e s s P r o g r a m C o u n t e r * The p r o c e s s o r the n
begins execution of the exception software* In a d d i t i o n to the
simple "attached" f o r m of the exception vector? the l o g i c a l
a d d r e s s car! be l o c a t e d in a d a t a s t r u c t u r e w h i c h is s e p a r a t e f r o m
the f o u r byte ex c e p t i o n vector* In t h i s ca s e ? the t h r e e b y t e s
f o l l o w i n g the d e s c r i p t o r c o n t a i n s the l o g i c a l a d d r e s s of the d a t a
s t r u c t u r e in which the address of the execution software is
stored* In all cases this vector format must c o n f o r m to the
M C S 6 5 E 4 d a t a s t r u c t u r e d e s c r i b e d a b o v e arid the d a t a f i e l d w h i c h is
r e f e r e n c e d by the vector m u s t be a three byte ordinal* This
o r d i n a l is a s s u m e d to be the logical address of the exception
handler*
4 * 6 *6 *5 *2 D e s c r i p t o r Format
E8* T ?0 ?0 0 1 0 ? 00 Descriptor
D3* T ? 0 , 0 0 1 0 : 11 Descriptor \
D B* 00 (HEX) H i g h o r d e r b y t e of the p o i n t e r to
the e x c e p t i o n h a n d l e r *
* - P a g e a d d r e s s w i t h i n the L M T P 3 g e
** - L o g i c a l a d d r e s s w i t h i n t he p r o c e s s
4*7*1 Introduction
b i t : 7
T he i n s t r u c t i o n s e t C 3 n be o r g a n i z e d in t o t h r e e m a j o r g r o u p s * The
first group contains the basic data manipulation instructions
(Add? s u b t r a c t ? e t c * ) * T h e s e c o n d c o n t a i n s all i n s t r u c t i o n s w h i c h
c o n t r o l p r o g r a m f l o w ( b r a n c h e s ? J u m p to s u b r o u t i n e ? e t c * ) * G r o u p 3
c o n t a i n s the advanced arithmetic and l o g i c operations* E a c h of
t h e s e g r o u p s is d i s c u s s e d s e p a r a t e l y b e l o w *
Figure 5*3 below summarizes the instruction set format for the
Format Mnemonic
i I ? I ?R 1 C E Q , C N E , C G T , CGE 1
4*7,3*1 Introduction
Add ADD
Subtract SUB
Multiply MUL
D iv id e div
Modulus MOD
L o g i c And AND
L o g i c Or OR
Exclusive Or EOR
Format
Three o p e r a rid *
♦ Qp-Code 0P1?0P2?0P3
Single
Ope rand Two O p e r a n d
Instruction Mnemonic O p Code O p code
F o rm a t
*********
* AD D *
*********
4 * 7 *3 *2 A dd
Formati A DD 0P1?0P2?QP3
A DD 0Pli0P2
Description:
A d d s the c o n t e n t s of th e d a t a f i e l d s p e c i f i e d by o p e r a rid 2
to the c o n t e n t s of the d a t 3 f i e l d s p e c i f i e d by o p e r a n d 1 and
p l a c e s the r e s u l t s in the data field specified by e i t h e r
operand 2 (two operand addressing) or o p e r a rid 3 (three
operand addressing)*
Valid Da t a Types:
Re a l
Q*
Performs a floating point add o p e r a t i o n * I n p u t d a t a is
a s s u m e d to be normalized* A f t e r the add o p e r a t i o n is
complete? the r e s u l t s are n o r m a l i z e d b e f o r e b e i n g s t o r e d
in the r e s u I t s f i e l d * Real o p e r a n d s c a n n o t be m i x e d w i t h
B i n a r y or BCD d a t a f i e l d s *
BCD
Immediate Operands
Immediate operands c a n be s p e c i f i e d in c o m b i n a t i o n w i t h
any of the o t h e r data types* The i m m e d i a t e operand
a s s u m e s the d a t a t y p e of the s e c o n d i n p u t o p e r a n d * If
both input o p e r a n d s are I m m e d i a t e d a t a ? the d a t a t y p e is
a s s u m e d to be i n t e g e r *
Op Codes:
Two o p e r a n d a d d r e s s i n g - ____
T h r e e o p e r a n d a d d r e s s i n g - _______
*********
* SUB *
**^******
4 * 7 *3 *3 S u b t r a c t
Format: S UB QF’l * 0 P 2 y Q P3
SU B 0 P 1 ?0 P 2
Description:
Op Codes:
Two o p e r a n d a d d r e s s i n g - _______
T h r e e o p e r a n d a d d r e s s i n g - _____ __
* M UL *
*********
4*7*3*4 Multiply
Description:
yes no
Integer I x I i
Bed I x I I
Real ‘ I x I I
String I x I I
Notes:
Restrictions:
Op Codes:
T wo o p e r a n d a d d r e s s i n g - _____
T h r e e o p e r a n d a d d r e s s i n g - _______ _
* DIV *
*********
4*7*3*5 Divide
Descriptiont
yes no
Integer I xI I
Bed I xi I
Real I xI I
String I xI I
Restrictions^
Op Codes:
Tw o o p e r a n d a d d r e s s i n g - .________
T h r e e o p e r a rid a d d r e s s i n g - _______
* AND *
*********
4 ♦ 7 ♦3 ♦6 A n d
Format: A ND 0P1?0P2?0P3
AND 0P1?0P2
De s c r i p t i o n :
CASE1 : P e r f o r m s a l o g i c ANIi o p e r a t i o n b e t w e e n e a c h b it of
the d a t a f i e l d s p e c i f i e d by o p e r a n d 1 and the c o r r e s p o n d i n g
b i t of the d a t a f i e l d s p e c i f i e d by o p e r a n d 2 arid p l a c e s the
r e s u l t s in the data field s p e c i f i e d by operand 3 (three
o p e r a rid a d d r e s s i n g ) * The f o l l o w i n g d i a g r a m d e p i c t s t h e AND
operation:
0P2
0 1
0 0 0
op: = > 0P1
1 0 1
0P1 = = > OP 1
y es no
I n teg e r
Bed
R e a 14
R e a 18
R e a 110
String I y% ( i
I |---- ,
Restrictions^
Op Codes:
T wo o p e r a n d a d d r e s s i n g - _______
T h r e e o p e r a n d a d d r e s s i n g - _______
********
* OR *
■•
'n^P>o''
V' 'P
V^
'V-r* o
‘
-'
V
4 ♦ 7 ♦3 ♦7 Or
Format: OR Q P 1 >0 P 2 *Q P 3
OR OP 1 f0 P 2
Description;
0P2
0 1
0 0
0P3 = = > 0P1
1 1
CASE2 : P e r f o r m s a logic OR o p e r a t i o n b e t w e e n e a c h bi t of
the data f i e l d s p e c i f i e d by o p e r a n d 1 a nd the cor r e s p o n d i n g
b i t of t h e d a t a f i e l d s p e c i f i e d by o p e r a rid 2 a nd p l a c e s the
r e s u l t s in the data field s p e c i f i e d by operand 2 (two
operand addressing)* The f o l l o w i n g d i a g r a m d e p i c t s the OR
operation:
0P2
O
1^
I
1O 1
1
1
1
0 l
!
= > 0P1
1 l l
y es no
I ntege r
Bed
Re a 14
RealS
ReallO
j--- j----
String I x I
Restrictions^
Op Codes:
Two o p e r a n d a d d r e s s i n g -
Three operand a d d r e ssing-
** * * * * * * C O N F I D E N T I A L ? MOS T E C H N O L O G Y rI N C * * * ** * ** * * Page-
Final Desig n Specification for the M CS 6 5E 4 Microprocessor
^ ^
EOR *
4 . 7 .3 .8 E x c l u s i v e Or
F o r m a t J EOR 0P1»0P2»0P3
EOR 0P1»0P2
DescriptionJ
OP 2
0 1
0 0 1
OP = > 0P1
1 1 0
CASE2 I P e r f o r m s a l o g i c EO R o p e r a t i o n b e t w e e n e a c h b i t of
the data f i e l d s p e c i f i e d by o p e r a n d 1 an d the c o r r e s p o n d i n g
b it of th e d a t a f i e l d s p e c i f i e d by o p e r a rid 2 and p l a c e s the
r e s u l t s in th e data field s p e c i f i e d by operand 2 (two
operand addressing). T he f o l l o w i n g d i a g r a m d e p i c t s th e EOR
operationJ
OF'2
0 1
0 0 1
0P3 = = > 0P1
1 1 0
Valid D 3 1 3 Types;
yes no
Integer I x I I
Bed I x I I
R e s 14 I x I I
R e a 18 I x I I
R e a 110 I I y, I
I--- i----- i
String i x I I
j--- j----- j
Restrictions^
Op Codes:
Two o p e r a nd a d d r e s s i n g - ______
Three o p e r a nd a d d r e s s i n g - _____
*********
* MOD *
*********
Format: MO D 0P1>QP2>0P3
MOD OF*1f OP2
Description:
CASE1 : D i v i d e th e c o n t e n t s of the d a t a f i e l d s p e c i f i e d by
operand 2 by the c o n t e n t s of the data field s p e c i f i e d by
operand 1 a nd p l a c e s the remainder i n t o the data field
s p e c i f i e d by o p e r a n d 3 ( t h r e e o p e r a n d a d d r e s s i n g ) *
yes no
Integer ! x I I
Bed I x i I
Real Ii x !
String I x l I
Restrictions:
Op C o de s :
Two o p e r a n d a d d r e s s i n g - _______
T h r e e o p e r a n d a d d r e s s i n g - _______
*********
* ABS *
*********
4 * 7 * 3 * 1 0 A b s o l u t e V a l u e
Description:
C A S E 1 : C h a n g e s t he d a 1 3 f i e l d s p e c i f i e d by o p e r a n d 1 i nt o a
positive number storing the r e s u l t s int o t he d a t a field
s p e c i f i e d by o p e r a n d 2 (two o p e r a n d a d d r e s s i n g ) *
yes no
In t e g e r I x I I
Bed I x I I
Resl I x l I
3 1 r in g I I x l
Op Codes:
*********
* NEG *
& /{&\ /|S
"k& ^'in'x^ it£
Description i
yes no
Integer I x I I
Bed 1 x I !
Real I x I i
String II x I
Notes t
Op Codesi
*********
* INC *
O'O''T*<T*O*O'-T*-h‘
V-
4.7.3.12 Increment
Description*
Valid D 3 13 Types!
yes no
Integer I xI I
B ed I ;< I I
R e 31 I I I
String I I x l
Op Codes!
*********
* DEC *
*********
4 ♦ 7 ♦ 3 ♦ i3 D e c r e m e n t
Description:
yes no
Integer 1 x I
Be d i x S
R ea l I I x
String I ! x
Op Codes:
* SORT * *
**********
4*7*3*14 S q u ar e Root
Description:
yes no
Integer I x l I
B ed I x I I
Real I x l I
String I I x l
Op Codes:
^ v if ^ v y \Lr ^ \Lr
^ ^ 4v ^ ^ ^
*^ MO V *
4 ♦7 ♦ 3 ♦ 1 5 Move
Format: MOV 0 P 1 f 0P 2
Description:
yes no
Integer I x i i
Bed I x I 1
Real I x l 1
String 1 x 1 1
Restrictions:
Op Code- _______
***********
* LEADZ *
* * * * * * * * *<|v*
4 ♦ 7 ♦ 3 ♦ 16 Leadz
Descript i o n ;
ye s no
Integer4
Integers
B ed
Real
String i x l
Restrictions:
Example:
If the f i r s t z e r o is in the f i f t h p o s i t i o n of t he f o u r t h
b y t e t h e n a v a l u e of 30 < ( 4 - l ) * 8 + 4) ) w i l l be r e t u r n e d *
If th e f i r s t z e r o b i t is t h e f i r s t p o s i t i o n t h e n a v a l u e of
0 w i l l be r e t u r n e d *
Op Code-
***********
* LEAD1 *
***********
4*7*3*17 Leadl
Description:
y es no
In t e g e r4 { x 1 I
Integers 1 x I I
Bed I x 1 i
Real I x l 1
String I x l 1
Restrictions:
Example:
Op Code- _______
* * * * * * * **
* C LR *
*********
4 ♦7 * 3 ♦ 1 8 Clear
Description:
yes no
Integer i x l I
Bed I x l I
Real I x l 1
String I x l I
Op Code- _______
*********
* SE T *
*r 'Af v i/ %L* *Xr ^
✓fw • / f . ^ ^ ^ ^
4*7*3*19 Set
yes no
Integer I x I
Be d I x I
Real i x l
String I x I
Op Code-
7*5+1 Introduction
* BE Q *
%y ^
•*'n•-!*
'ft* *JL* '±r ‘±r ^
T*■'ft'ft'ft'ft^'ft
4 * 7 *5 *2 C s m p are 3 nd B r 3 nch If Eq u3 1
Description:
Notes:
Loc3tiori is d e t e r m i n e d by s u b t r s c t i n g the p r o g r 3m c o u n t e r
f r o m the brsnch destinstion* T h i s o f f s e t m u s t be grester
t h a n or e a u a 1 to - 6 5 5 3 6 3nd l e s s t h 3 n or e a u 3 1 to + 6 5 5 3 5
b y t e s f r o m the s t s r t of the n e x t i n s t r u c t i o n s o p c o d e *
Restrictions:
Op Codes:
*********
* BN E *
*********
4 * 7 * 5 *3 C o m a p r e a nd Branch If No t Eaua 1
Description♦
Notes:
Location # is d e t e r m i n e d by s u b t r a c t i n g th e p r o g r a m c o u n t e r
f r o m the branch destination* T h i s o f f s e t m u s t be greater
t h a n or e a u a l to - 1 2 8 and l ess t h a n or e a u a l to +1 2 7 b y t e s
f r o m the s t a r t of th e n e x t i n s t r u c t i o n s o p c o d e *
Location is d e t e r m i n e d by s u b t r a c t i n g t h e p r o g r a m c o u n t e r
f r o m the branch destination* T h i s o f f s e t m u s t be greater
t h a n or e a u a l to - 6 5 5 3 6 and l es s t h a n or e a u a l to + 6 5 5 3 5
b y t e s f r o m the s t a r t of the n e x t i n s t r u c t i o n s o p c o d e *
Restrictions:
Op Codes!
* ********
* BGT *
*********
Description♦
Notes:
Location # is d e t e r m i n e d by s u b t r a c t i n g the p r o g r a m c o u n t e r
f r o m the branch destination* T h i s o f f s e t m u s t be greater
t h a n or e a u a l to - 1 2 8 arid less t h a n or e a u a l to + 1 2 7 b y t e s
f r o m the s t a r t of the n e x t i n s t r u c t i o n s o p c o d e *
L o c a t i o n ♦♦ is d e t e r m i n e d by s u b t r a c t i n g the p r o g r a m c o u n t e r
f r o m the branch destination* T h i s o f f s e t m u s t be greater
t h a n or e a u a l to - 6 5 5 3 6 3n d l es s t h a n or e a u a l to + 6 5 5 3 5
b y t e s f r o m the s t a r t of the n e x t i n s t r u c t i o n s o p c o d e *
Restrictions;
Op Codes:
*********
* BGE *
Format; BGE 0 P 1 ? 0 F ‘2 ? *
BGE 0P1'?QP2?«
Description:
Notes:
Location t is d e t e r m i n e d by s u b t r a c t i n g the p r o g r a m c o u n t e r
f r o m the branch destination* T h i s o f f s e t m u s t be greater
t h a n or e a u a l to - 1 2 3 arid less than or e o u a l to + 1 2 7 bytes
f r o m the s t a r t of t he n e x t i n s t r u c t i o n s o p c o d e *
L o c a t i o n #4 is d e t e r m i n e d by s u b t r a c t i n g the p r o g r a m c o u n t e r
f r o m the branch destination* T h i s o f f s e t m u s t be greater
t h a n or e a u a l to - 6 5 5 3 6 and less t h a n or e a u a l to + 6 5 5 3 5
b y t e s f r o m the s t a r t of the n e x t i n s t r u c t i o n s o p c o d e *
Restrictions:
Op Codes:
**********
* BEQZ *
**********
Description:
Notes:
0 p Codes:
* BNEZ *
**********
Description;
Notes:
Location ♦ is d e t e r m i n e d by s u b t r a c t i n g the p r o g r a m c o u n t e r
f r o m the branch destination* T h i s o f f s e t m u s t be Greater
t h a n or e a u a l to - 1 2 8 a nd less t h a n or e a u a l to + 1 2 7 b y t e s
f r o m the s t a r t of t he n e x t i n s t r u c t i o n s o p c o d e *
L o c a t i o n * * is d e t e r m i n e d by s u b t r a c t i n g th e p r o g r a m c o u n t e r
f r o m the branch destination* T h i s o f f s e t m u s t be Greater
t h a n or e a u a l to - 6 5 5 3 6 a nd l es s t h a n or e a u a l to + 6 5 5 3 5
b y t e s f r o m the s t a r t of the n e x t i n s t r u c t i o n s o p c o d e *
Op Codes;
* BROS *
**********
Format: BPOS 0P 1 j*
BPOS Q P 1 >**
Description:
Notes ;
Location # is d e t e r m i n e d by s u b t r a c t i n g the p r o g r a m c o u n t e r
f r o m the branch destination* T h i s o f f s e t m u s t be greater
t h a n or e a u a l to - 1 2 3 a n d less t h a n or e a u a l to + 12 7 b y t e s
f r o m the s t a r t of th e n e x t i n s t r u c t i o n s o p c o d e *
Location is d e t e r m i n e d by s u b t r a c t i n g t h e p r o g r a m c o u n t e r
f r o m the branch destination* T h i s o f f s e t m u s t be greater
t h a n or e a u a l to - 6 5 5 3 6 arid l es s t h a n or e a u a l to + 6 5 5 3 5
b y t e s f r o m the s t a r t of t h e n e x t i n s t r u c t i o n s o p c o d e *
Op Codes:
*********
* BM I *
*********
4*7*5*9 Branch If Minus
Format; BMI 0 P 1 ? #
BM I OP if**
Description;
Notes :
Location * is d e t e r m i n e d by s u b t r a c t i n g th e p r o g r a m c o u n t e r
f r o m the branch destination* T h i s o f f s e t m u s t be Greater
than or e a u a l to - 1 2 8 and l ess t h a n or e a u a l to 4*127 b y t e s
f r o m the s t a r t of th e n e x t i n s t r u c t i o n s o p c o d e *
L o c a t i o n ** is d e t e r m i n e d by s u b t r a c t i n g the p r o g r a m c o u n t e r
f r o m the branch destination* T h i s o f f s e t m u s t be Greater
t h a n or e a u a l to - 6 5 5 3 6 and l ess t h a n or e a u a l to + 6 5 5 3 5
b y t e s f r o m the s t a r t of the n e x t i n s t r u c t i o n s o p c o d e *
Op Codes J
********
* BR *
********
F o rm a 1 1 B R £
BR **
Description*
Notes t
L o c a t i o n t £ is d e t e r m i n e d by s u b t r a c t i n g t h e p r o g r a m c o u n t e r
from the br a rich destination* T h i s o f f s e t m u s t be greater
than or e a u a l to - 6 5 5 3 6 an d l es s t h a n or e a u a l to + 6 5 5 3 5
b y t e s f r o m the s t a r t of the n e x t i n s t r u c t i o n s o p c o d e *
L o c a t i o n s $ and ** c a n n o t s p e c i f y a v a r i a b l e w h i c h c o u l d be
u s e d for i n d i r e c t a d d r e s s i n g * I n s t e a d ? the g e n e r a t e d a d d r e s s
is a p o s i t i v e or n e g a t i v e o f f s e t f r o m th e o p c o d e of th e n e x t
instruction* I n d i r e c t a d d r e s s i n g c an be a c c o m p l i s h e d with
t he JMP i n s t r u c t i o n (see S e c t i o n 4 * 7 * 5 * 1 1 ) *
*********
* JMP *
Description;
Notes :
If the d e s t i n a t i o n l o c a t i o n is f i x e d (i»e» no t c a l c u l a t e d at
run t i m e bu t r a t h e r a s s e m b l e time) the d a t a f i e l d r e f e r e n c e d
by 0P1 should be an immediate value* However? if the
destination address is n o t k n o w n at a s s e m b l e t i m e t h e n 0P1
s h o u l d be a variable* In fact? O P 1 can d e f i n e an array
structure which could be u s e d to e s t a b l i s h an array of
addresses* Thu s ? a 'case' t y p e of i n s t r u c t i o n c a n be f o r m e d
(see e x a m p l e b e l o w ) *
Example
LABLA
LABLB
LABLC
TABLE =
Descriptor Header
LABLA
LABLB
LABLC
*********
* BSR *
*********
Format: BSR *
BSR **
Dascription!
Notes:
Location # is d e t e r m i n e d by s u b t r a c t i n g the p r o g r a m c o u n t e r
f r o m the branch destination* T h i s o f f s e t m u s t be greater
t h a n or e a u a l to - 1 2 8 an d less t h a n or e a u a l to + 1 2 7 b y t e s
f r o m the s t a r t of th e n e x t i n s t r u c t i o n s o p c o d e *
Location is d e t e r m i n e d by s u b t r a c t i n g the p r o g r a m c o u n t e r
f r o m the branch destination* T h i s o f f s e t m u s t be greater
t h a n or e a u a l to - 6 5 5 3 6 and le s s t h a n or e a u a l to + 6 5 5 3 5
b y t e s f r o m the s t a r t of the n e x t i n s t r u c t i o n s o p c o d e *
L o c a t i o n s t and ** ca n n o t s p e c i f y a v a r i a b l e w h i c h c o u l d be
u s e d for i n d i r e c t a d d r e s s i n g * I n s t e a d ? the g e n e r a t e d a d d r e s s
is a p o s i t i v e or n e g a t i v e o f f s e t f r o m the o p c o d e of t h e n e x t
instruction* I n d i r e c t a d d r e s s i n g c an be a c c o m p l i s h e d with
t h e JSR i n s t r u c t i o n (see S e c t i o n 4 * 7 * 5 * 1 3 ) *
^ ^ ^
* JSR *
*********
Format; JS R DPI
Description t
Notes J
If the d e s t i n a t i o n l o c a t i o n is f i x e d (i.e. n ot c a l c u l a t e d st
run t i m e bu t r a t h e r a s s e m b l e time) the d a t a f i e l d r e f e r e n c e d
by 0P1 should be an immediate value. However) if the
destination address is no t k n o w n at a s s e m b l e t i m e t h e n OF'l
s h o u l d be a variable. In fact* QP1 c a n d e f i n e an array
structure which could be u s e d to e s t a b l i s h an array of
a d d r e s s e s (see e x a m p l e b e l o w ) .
E x a m p 1e
LABLA
LABLB
LABLC
TABLE =
Descriptor Header
LABLA
LABLB
i LABLC I
* BDEC *
**********
4 ♦ 7 ♦5 * 14 Decrement arid B r a n c h
Format I BDEC 0 P 1 ? -t !
BDEC OPlf*#
Description t
Notes*
Location # is d e t e r m i n e d by s u b t r a c t i n g the p r o g r a m c o u n t e r
f r o m the branch destination* T h i s o f f s e t m u s t be greater
t h a n or e a u a l to - 1 2 8 a n d less t h a n or e a u a l to +1 2 7 b y t e s
f r o m the s t a r t of the n e x t i n s t r u c t i o n s o p c o d e *
Location is d e t e r m i n e d by s u b t r a c t i n g th e p r o g r a m c o u n t e r
f r o m the branch destination* T h i s o f f s e t m u s t be greater
t h a n or e a u a l to - 6 5 5 3 6 and l e ss t h a n or e a u a l to + 6 5 5 3 5
b y t e s f r o m the s t a r t of the n e x t i n s t r u c t i o n s o p c o d e *
***********
* BCQND *
******* ****
Description:
Notes:
T h e “s t e p p i n g v a l u e - c an e i t h e r be p o s i t i v e or n e g a t i v e * If
it is p o s i t i v e the c u r r e n t v a l u e is i n c r e m e n t e d u n t i l it is
greater than or e a u a l to the l i m i t v a l u e * If th e “s t e p p i n g
v a l u e * is n e g a t i v e the c u r r e n t v a l u e is d e c r e m e n t e d u n t i l it
is l e ss t h a n or e a u a l to t he l i m i t v a l u e *
L o c a t i o n s * and ** can n o t s p e c i f y a v a r i a b l e w h i c h c o u l d be
u s e d for i n d i r e c t a d d r e s s i n g * I n s t e a d ? the g e n e r a t e d a d d r e s s
is a p o s i t i v e or n e g a t i v e o f f s e t f r o m th e o p c o d e of the n e x t
instruction*
* SC *
********
Format: SC
Description:
C a u s e s the p r o c e s s o r to e x e c u t e a t r 3P t h r o u g h the e x c e p t i o n
v e c t o r l o c a t e d at the a d d r e s s _____________ _ on the l i m i t p a g e *
This operation is described in more detail in Section
Restrictions X
*********
* 3CM *
*********
Format! SC M *
Description t
C a u s e s the p r o c e s s o r to e x e c u t e a t r a p t h r o u g h the e x c e p t i o n
vector located at a d d r e s s ------- w i t h i n the l i m i t p a g e * At
the s a m e ti me? the 8 b i t m e s s a g e ($> w h i c h f o l l o w s the
o p e r a n d is p a s s e d to the o p e r a t i n g s y s t e m * T h i s o p e r a t i o n is
d e s c r i b e d in m o r e d e t a i l in S e c t i o n ___________ ♦
Restrictions;
* ****^ ** *
* RTS *
*********
Format: RTS
Description:
Notes:
sj^ ^
* RTE *
*********
Description:
Notes:
* I OS *
*********
Description:
Notes:
Restrictions:
**********
* TASK *
•■
;
Pkns
± /yv
± /'fJ\z £ £ 'k&
/p %
*X«
4 ♦ 7 ♦5 ♦ 21 TASK
Description;
Initiates a u s e r p r o c e s s * B o t h th e u s e r / s u p e r v i s o r f l a g and
t he k e r n s l f l a g 3re set to 0♦ T h i s o p e r a t i o n is d e s c r i b e d in
d e t a i l in S e c t i o n _________ ♦
Notes ;
Restrictions;
4 ♦ 7 ♦6♦1 Introduction
T hi s g r o u p of i n s t r u c t i o n s c o n t a i n s a n u m b e r of p o w e r f u l i n s t r u c t i o n s
w h i c h g r e a t l y f a c i l i t a t e th e c o n t r o l of p r o g r a m s e q u e n c i n g w i t h i n
the M C S 6 5 E 4 s o f t w a r e * T h e s e i n s t r u c t i o n s a l l o w t h e p r o c e s s o r to c o m p a r e tw
d a t a f i e l d s and to set a B o o l e a n v a r i a b l e as a f u n c t i o n of the d a t a in the
two f i e l d s * In a d d i t i o n ? a fu l l set of s t r i n g i n s t r u c t i o n s ? d a t a s h i f t i n g
i n s t r u c t i o n s and d a t a c o n v e r s i o n i n s t r u c t i o n s is p r o v i d e d a l o n g w i t h a num
of i n s t r u c t i o n s w h i c h are s p e c i f i c a l l y d e s i g n e d to f a c i l i t a t e th e c o n t r o l
of the d a t a w i t h i n the M C 3 6 5 E 4 p r o c e s s * E a c h of t h e s e i n s t r u c t i o n s is
d e s c r i b e d below*
***********
* RESET *
***********
4 ♦ 7 ♦ 6 ♦2 R e s e t
Format: RESET
Description;
Notes!
*********
* CEQ *
Description:
Notes :
Restrictions:
Example:
B e f o r e CEQ i n s t r u c t i o n :
OF* 1 = R e f e r e n c e s a d a t a field whose value is 16
OF’2 = R e f e r e n c e s a d a t a field whose value is 16
0P3 = R e f e r e n c e s a data field whose value is 0111 0001
A f t e r CE Q i n s t r u c t i o n :
QF‘1 = R e f e r e n c e s a d a t a field whose value is 16
0P2 = R e f e r e n c e s a data field whose value is 16
OF*3 = R e f e r e n c e s a d a t a field whose value is 0 0 0 0 000 1
*********
* CNE *
*********
Format! CN E 0P1>0P2>0P3
Description ;
Notes;
Restrictions;
Example;
B e f o r e CNE i n s t r u c t i o n ;
0P1 = R e f e r e n c e s a d a t a field whose value i s 13
0P2 = R e f e r e n c e s a d a t a field whose v a 11 je is 1 6
0P3 R e f e r e n c e s 3 data field whose v a 1 *j e is 011 1 0001
After C NE i n s t r u c t i o n ;
0P1 = R e f e r e n c e s a data field whose v a l u e i s 13
0P2 = R e f e r e n c e s 3 data field whose v a 11 je is 16
OF‘3 = R e f e r e n c e s 3 data field whose v a l u e is 0000 0001
* CGT *
r-
* -V• ! ' *'r*k * •T'><»'
'V's'-
Format: CGT 0 P 1 ?0 P 2 ? 0 P 3
Description:
C o m p a r e the d a t a f i e l d r e f e r e n c e d by 0 P 1 w i t h the d at a f i e l d
r e f e r e n c e d by QP2* If t he d a t a f i e l d r e f e r e n c e d by 0P1 is
greater than the d a t a f i e l d r e f e r e n c e d b y O P 2 t h e n p u t the
boolean result into the low order bit position into the
f i e l d r e f e r e n c e d by OF’3*
Notes :
Restrictions:
Example:
B e f o r e CGT i n s t r u c t i o n :
OF* 1 = R e f e r e n c e s a d a t a field whose v a l u e is 47
OF’2 = R e f e r e n c e s a d a t 3 field whose v a l u e is 16
OF’3 = R e f e r e n c e s a d a t a field whose v a l u e is 0111 0001
A f t e r CGT i n s t r u c t i o n
0 P 1 = Refer e n c e s a data field whose v a l u e is 47
0F‘2 = R e f e r e n c e s a d a t a field whose v a l u e is 16
OF'3 = R e f e r e n c e s a d a t a field whose v a l u e is 1 1 10 0011
*********
■ V ■( / • !/ -,Lr •»/ \( / •,<.*
• i-. • ) ' ■?• f‘- • ! ' -t>
Description:
C o m p a r e the d a t a f i e l d r e f e r e n c e d by 0 P 1 w i t h the d a t a f i e l d
r e f e r e n c e d by 0 P 2♦ If the d a t a f i e l d r e f e r e n c e d by 0 P 1 is
g r e ater than or e a u a l to the d a t a f i e l d r e f e r e n c e d by 0 P 2
t h e n pu t the b o o l e a n r e s u l t into the low o r d e r b i t p o s i t ion
i n t o the f i e l d r e f e r e n c e d by 0 P3 *
Notes:
If the f i e l d r e f e r e n c e d by 0 P 1 is g r e a t e r t h a n or e a u a l to
th e f i e l d r e f e r e n c e d by 0 P 2 t h e n the v a l u e 0 0 0 0 0001 w ill be
p u t into the d a t a f i e l d r e f e r e n c e d by 0 P 3 else the v a l u e
0 0 0 0 0 0 0 0 wi l l be u sed*
Restrictions t
The fields referenced by OF’1 arid OF’2 must be the same type,
arid l e n g t h *
Example:
Before C GE i n s t r u c t i o n :
0P 1 = R e f e r e n c e s a data field whose value is 47
OF‘2 = R eferences a data field whose value is 16
0P3 = R e f e r e n c e s a data field whose value is 0111 0 001
After CGE i n s t r u c t i o n :
OF* 1 = R e f e r e n c e s a data field whose value is 47
OF‘2 = R e f e r e n c e s a data field whose value is 16
OF*3 = R e f e r e n c e s a data field whose value is 0 0 0 0 0001
* FIND *
• v-vv •>-V *V--k'k
/ f . . f . . f. .fv .-fs -r* •P' -r-
4 *7 *6 * 7 F i n d S t ri ng
Description
opi:
0P2J
GP3:
T h e d a t s f i e l d r e f e r e n c e d by O P 3 r e p r e s e n t s the s t r i n g f i e l d
to be searched* The s t a r t i n g point w i t h i n the dats field
r e f e r e n c e d by OF‘3 is c o n t a i n e d in the d a t a f i e l d r e f e r e n c e d
by OF‘2 *
Notes!
T h e d a t a r e f e r e n c e d by O p e r a rid 3 m u s t be of t y p e s t r i n g * The
l e n g t h of t h i s s t r i n g is d e f i n e d by its d e s c r i p t o r *
If the d a t a r e f e r e n c e d by O p e r a rid 1 is of t y p e s t r i n g ? t h e n
o n l y the f i r s t 8 b y t e s are u s e d for the search argument*
It is the u s e r s r e s p o n s i b i l i t y to i n i t i a l i z e the d a t a f i e l d
r e f e r e n c e d by O P 2 w i t h the i n i t i a l s t a r t i n g p o i n t w i t h i n the
string* T he s e a r c h will b e g i n f r o m the first byte of the
s t r i n g if the d a t a f i e l d r e f e r e n c e d by 0 P 2 c o n t a i n s -1* If a
m a t c h is detected? the d a t s f i e l d r e f e r e n c e d by OF*2 will
contain a positive number w h i c h w ill indicate the byte
p o s i t i o n w i t h i n the s t r i n g * W h e n t h e s e 3 r c h is c o m p l e t e ? the
d a t a f i e l d r e f e r e n c e d by GP 2 will c o n t a i n -2*
Example:
##***:***#*
* 'f|:r— p
***#*#*###
4 * 7 ♦6 *8 D e t e c t Character in String
Description:
opi :
0 P2 :
op 3:
T he d a t a f i e l d r e f e r e n c e d by O P 3 r e p r e s e n t s the s t r i n g f i e l d
to be searched* The s t a r t i n g p o i n t w i t h i n the data field
r e f e r e n c e d by OF‘3 is c o n t a i n e d in the d a t a f i e l d r e f e r e n c e d
by 0 P2*
Notes :
T h e d a t a r e f e r e n c e d by O p e r a n d 3 m u s t be of t y p e s t r i n g * The
l e n g t h of t h i s s t r i n g is d e f i n e d by, its d e s c r i p t o r *
If the d a t a r e f e r e n c e d by O p e r a n d 1 is of t y p e s t r i n g ? t h e n
o n l y the f i r s t 8 b y t e s are u s e d for the search argument*
It is the u s e r s r e s p o n s i b i l i t y to i n i t i a l i z e the d a t a f i e l d
r e f e r e n c e d by OF'2 w i t h the i n i t i a l s t a r t i n g p o i n t w i t h i n the
string* The s e a r c h will begin from the first byte of the
s t r i n g if t h e d a t a f i e l d r e f e r e n c e d by OF'2 c o n t a i n s -1 *
Example J
###*#***##
% NDET t
#**###***#
4 * 7 *6 ♦? D e t e c t Character no t in String
Description:
opi :
QP2:
QF'3 :
T h e d a t a f i e l d r e f e r e n c e d by OF'3 r e p r e s e n t s the s t r i n g f i e l d
to be searched* Th e s t a r t i n g p o i n t w i t h i n the data field
r e f e r e n c e d by OF’3 is c o n t a i n e d in the d a t a f i e l d r e f e r e n c e d
by 0 P 2 *
Notes:
T h e d a t a r e f e r e n c e d by O p e r a n d 3 m u s t be of t y p e s t r i n g * The
l e n g t h of t h i s s t r i n g is d e f i n e d by its d e s c r i p t o r *
If the d a t a r e f e r e n c e d by O p e r a n d 1 is of t y p e s t r i n g ? t h e n
o n l y the f i r s t 8 b y t e s are u s e d for the search argument*
It is the u s e r s r e s p o n s i b i l i t y to i n i t i a l i z e the d a t a f i e l d
r e f e r e n c e d by OF'2 w i t h th e i n i t i a l s t a r t i n g p o i n t w i t h i n the
string* The s e a r c h will b e g i n f r o m the frrst byte of the
s t r i n g if the d a t a f i e l d r e f e r e n c e d by OF’2 c o n t a i n s -1*
Example:
After ND E T instruction!
4,7,6*10 DETR
Description:
0P1 :
T h e d a t a f i e l d r e f e r e n c e d by 0P1 c o n t a i n s the tw o b y t e r a n d e
field which d e f i n e s the l o w e r and upper bound* The l e a s t
signif i c a n t byte of t h i s f i e l d d e f i n e s the u p p e r b o u n d and
n e x t c o n s e c u t i v e b y t e d e f i n e s the l o w e r b o u n d *
0P2:
QP3:
T h e d a t a f i e l d r e f e r e n c e d by QF‘3 r e p r e s e n t s the s t r i n g f i e l d
to be searched* Th e s t a r t i n g p o i n t w i t h i n the data field
r e f e r e n c e d by .OF'3 is c o n t a i n e d in the d a t a f i e l d r e f e r e n c e d
by 0 P 2 *
Notes:
E x a m p le :
After D E T F: in s t r jj c t ion I
In t h i s e x a m p l e the l o w e r b o u n d = D 7 an d the u p p e r b o u n d = B
S i n c e BF is g r e a t e r t h a n or e a u a 1 to D 7 and l es s t h a n or ecu
to B 4 f the d a t a f i e l d r e f e r e n c e d by 0 F’3 wil l c o n t a i n r 1 ♦
*********
* 3HM *
**$%** *$ %
4 , 7 ♦6 , 11 Shift Multiple
Description:
Notes:
If the f i e l d r e f e r e n c e d by OF’2 is p o s i t i v e a l e ft s h i f t w : 11
occur, A n e g a t i v e n u m b e r wi l l c a u s e a r i g h t shift*.
Th e l e n t h of the d a t a f i e l d to be s h i f t e d is s p e c i f i e d in
th e d e s c r i p t o r of the field referenced by OF’l or in the
o p e r a rid c o n t r o l byte in the case of by t e* i n t e g e r or
ordinal ,
Example :
♦
♦
B e f o r e SHM i n s t r u c t i o n :
OF’1 = R e f e r e n c e s a one b y t e f i e l d whose- v a l u e is 1011 000 1
OF*2 = R e f e r e n c e s a d a t a f i e l d w h o s e v a l u e is -2
OF’3 = R e f e r e n c e s a d a t a f i e l d w h o s e v a l u e is 1111 1111
A f t e r SHM i n s t r u c t i o n :
OF11 = R e f e r e n c e s a one byte field whose value is 1011 00 01
^
U y --V
-f--t-t- -r*
4 / ir -J/ - 4 - 1 / -4 .*
-r-
* PTR *
\V 4 / ■ • i ' v U 'V ■ • i ' * 4 -' • j ' 'i - *
. r. . f. /i% .r \ .r . 4 ’.. r-
Description*
OPI : •
QP2:
Notes:
T h i s i n s t r u c t i o n is v e r y u s e f u l to s p e e d up the o p e r a t i o n in
t he loop i n s t e a d of h a v i n g to c a l c u l a t e the a d d r e s s of the
o p e r a n d e v e r y t i m e * All t h a t is n e e d e d is f i r s t c a l c u l a t e the
a d d r e s s of the d a 1 3 item t h e n u p d a t e the pointer address*
Example4
* P TR T A B L E C I 3 ?B
B e f o r e PTR i n s t r u c t i o n :
OF* 1 = R e f e r e n c e s t h e d 3 t 3 f i e l d whose vslue is 23456789 with
1o g i c 3 1 3 d d r ess 001C20*
B = R e f e r e n c e s th e d s t a f i e l d whose value is 00 0 0 0 0
Af t e r PTR i n s t r u c t i o n *
0P1 = R e f e r e n c e s th e d s t s f i e l d whose value is 2 34 5 6 7 8 <i w i t h
logical address 001C20*
B = R e f e r e n c e s th e d a t a f i e l d whose value is 001C20
' VM''V-4/y
/ f . /’js rff. /|% 4*.
V / f . -V'V*4^
.f.
* D TYPE *
***********
Description:
OPI :
OP2 :
Notes :
T h e r e s u l t s of t h i s o p e r a t i o n m u s t r e t u r n e i t h e r s t r i n g d a t a
t y p e or s c a l a r <e*g* by t e * i n t e g e r ? real? etc *) d a t a type*
If the d a t a f i e l d r e f e r e n c e d by OF’1 is n o t s t r i n g or s c a l a r
data type (i*e* re.cord or a r r a y t y pe) the p r o c e s s o r will
search through the data s t r u c t u r e until it e n c o u n t e r s a
b a s i c d a t a e l e m e n t f r o m the s t r u c t u r e *
Byte 04
Ordinal 08
Two B y t e I n t e g e r OC
Four Byte Integer 10
Eight Byte Integer 14
F o u r B y t e R eal 18
E i g h t B y t e Real 1C
Ten B y t e Re a l 20
F o u r B y t e BCD 24
E i g h t B y t e BCD 28
Ten B y t e BC D 2C
String 30
Examp 1e :
* CNVRT *
\ l r \ l t '4 / \ \ f \1/ \ty - it ' i t -.J? '.It
• i ' -f* • '!' 'P- *T* *'»' -T* *T* -r> M-
4*7.6.16 CNVRT
Description^
Op Code- _______
% EVAL *
#**#**#**#
4,7,6.17 EMAL
Th e E V A L i n s t r u c t i o n a l l o w s t he M C S 6 5 E 4 to d i r e c t l y e v a l u a t e an
arithmetic expression. T h i s is a c c o m p l i s h e d by organizing the
e x p r e s s i o n in t o Reverse Polish notation and a t t a c h i n g it to the
EVAL O p Code,
Code Operation
50 AD D
51 SUBTRACT
52 MULTIPLY
53 DIVIDE
54 AND
55 OR
56 EOR
57 MOD
58 ABS
59 NEG
5A INC
5B DEC
CEO
CNE
COT
CGE
5D MOV
5E LEADZ
5F LEAD1
The e x p r e s s i on t
* * * * * * * * * C O N F I D E N T I A L , MOS T E C H N O L O G Y ;I N C ,* * * * * * * * * P a g e - 17?
Final Desig n Specification for the MCS 65 E 4 Microprocessor
1 EVAL O p Code .
2 OF'A Variable A Operand
3 OPB VariableBOperand
4 5A INC O p C o d e
5 OPC Variable C Operand
6 52 MU L O p C o d e
7 OPD Variable D Operand
S OPE Variable E Operand
9 51 SUB O p C o d e
10 53 DIV O p C o d e
11 OPF Variable F Operand
12 59 N EG O p C o d e
13 OF'G Variable G Operand
14 OF'H Variable H Operand
15 55 L o g i c OR O p C o d e
16 50 AD D O p C o d e
17 54 Logic AND O p Code
18 5D MO V O p C o d e
19 OPY Results Data Field (Y)