Professional Documents
Culture Documents
INTERRUPTPROCESS
The sqstem €v€nts thet cen cauEe interrupts are list€d belot:
ch ip-reset - po { r e r _ u p
OPERATINGSYSTEI'ICO16559 -- SeEtion 6
102
T h e c h i p - r e s e t i n t e r r u p t i . s v e c t o r € d v i s l D c s t i o n F F F C t d E 4 7 7'
u h e l . e e J l v l Pv e c t o r t o t h e p o u e r - u p r . o u t i n € i s 1 o . : t e d . All NHI
intertuptE a.e vectored via locatioh FFFA to the Nl,lI inteitupt
servite routine et E784, a'ld €11 IRQ interrupts are vectoied
via location FFFE to the IRC i.nterruot seivice routine at E6F3,
at that point the casse of the interrupt nuEt be determined bV
€ serieE of teEts. For sone ot the events there ere built in
dronitor actions and for other eventE the ro.responding
inte?rupts 3re di6abled or ignored. The Egstsm provides RAM
vectot6 so that gou can intercept interfupts uhen
nec€59€rg.
NONITIASKASLEINTERRUPTS
The +ollouing action6 occur:rEgu.|ling that gou have not chEnged VVBLKI.
OPERATINGSYSTE|1CO16559 -* Se€tion 6
103
T h e E t a g e 1 V B L A N Kp r o c e s E o r i i exacuted.
The +ollouing aations ocrui a6g!oing th€t gou have not ch€nged VVBLKD.
T h a s t a g E l V B L A N Kp r o c e e s i n c r e m e n t s t h a 3 - b g t e f r a | | l e
countei RTCLBK !OO12-OO14J, RTCLOK+O is the l4SB and RTCLOK+2
i 5 t h e L S B . T h i E c o u n t e i u r a p E t o z e r o & r h e ni t o v e r + l o u 5
( e v e r q 7 7 h o u r " Eo r . s o ) , a n d c o n t i n u e 6 c o u n t i n q .
T h a s t a g € l V B L A N Kp r o r e g s d e c r e r n s n t s t h e S g s t e n T i f t e r 1
CDTtM tO218,21 if it i6 nonzero; if the ti|ne. ooes fiom
I O16555 --
O P E R A T I N GS Y S T E I ' C Se€tion 6
104
n o n z e i o t o z e r o t h e n a n ind ireE t JSR iE perforned via CDTl.tAl
S t a g e 2 V B L A N KP r o c e E s
T h e s t a g e 2 V E L A N Kp r o r € E s i n g p e r f o ? m s t h e f o l l o u i n g f o ? t h o s e
V B L A N Ki n t e r l ' u p t s t h a t d o n o t i n t e r r u p t c r i t i c a l sectionE:
T h e s t e g e 2 V B L A N Kp ? o c e s 6 u p d a t e s v a r i o u 6 h e f d u a f e
r e g i s t e r E u i t h d e t € + r o n t h e O S d e t a b E g e , a s s h o u j nb e l o u :
D a t e B EE e Hat durare R e es o n f o r U pd a t e
I ten Register
Constant = B C o N S A Lt D O t F l C o n s o1 e s o e a k e r o f + .
T h e s t € g e 2 V B L A N Kp r o c e 6 s d e E r e m e n t 5 t h e S g E t e m T i m e r 2
C D T H V zt 0 2 1 A , 2 l i f i t i s n o n z e i o r i f t h e t i m e i g o e s f r o m
nonzero to zero, then an indiref,t JSR i5 oerfor|ned
throug h CnTHA2 tO22E'27.
T h e s t a g e 2 V B L A M Kp r o c e E g d e c r e o e n t s g u g t e m T i o e r s 3 , 4 a n d
5 i+ theg are non!ero; the corresponding +lag5 ai. ret to
zero for each timer th€t chanoeE fron nonzero to ,e?o.
B P E R A T I N GS Y S T E | IC O 1 6 5 5 5 - - Section 6
105
T i r n e r T i m e r V E1 u e Tifter F 1a9
3 C D T H V 3t O 2 1 C , 2 l C D T M F 3C O 2 2 Ar,l
4 CDTHV480 21E,21 CDTMF4tO22C, I l
5 CDT}4VSt02eo,2l CDTMFStoeeE, 1l
A c h a r a c t e r . i s r e a d f r o n t h e P O K E Yl e { b o r r d F e g i 6 t e r and
Etor'ed in CH IOAFCl, if €uto reDE:t iE sctive.
T h e 6 t E g e 2 V B L A N Kp r o r e E E d e c r e f i e n t s t h e & e g b o d r d d e b o u n c e
counte? if it i€ not equal to zero, end if no te{ iE
T h e E t e g e 2 V B L A N Kp r o c e s s p i o c e s r e s t h e & e V b o a r d a u t o
r e p e a t ( s e e A p p e n d i xL , E B ) .
T h e s t e g e 2 V A L A N Kp | . o E e g s r e : r d 6 g € l n e c o n t r o t l e r data fionr
the ha.d0rdre to the FAM date b€se, as shourn belo!r:
The sgEteo IRO interrupt service routine de:ls uith each of the
po6sible IRC cauEinq event5, in the follouing uagB:
If the interiupt i s d u e t o P O K E Yt i { t l e r { t 1 , t h e n c l e e r t h e
interrupt E n d J U r n pt h r o u g h 9 1 o b a l R A I ' Iv e c t o t V T I I ' l R 1 t 0 2 1 O l .
I f t h e i n t e r r u D t i s d u e t o P O K E Yt i n e r * a , t h e n c l e a r t h e
interiupt and Jldrp through global RAMveEtol' VTIMRa t0212l.
I f t h e i n t e r r u p t i E d u e t o P O K E Yt i m e r * 4 , t h e n c l e 5 r t h e
interrupt. The service routine conteins a bug, aod +€lIs
inio the +ollouring test.
O P E R A T I N eS Y S T E MC O 1 6 5 5 5 - - Section 6
107
Return +roo the interrupt aftel' r.estoiing the 690A A
re9 ister +roin the Etack.
I N T E R R U P TI N I T I A L I Z A T I O N
T h e i t l t e r r . u p t s u b s g s t e d rc o o p l e t e l q r . e i n i t i e l i z e s itsel+ uhenever
t h e e q s t e m i 6 p o u e r e d u p o r t h e I g Y S T E MF . ESETI kerJ iE pres6ed.
The BS cleer6 the harduare negiEters, and sets the interr.upt
g l o b a l R A t ' lv e c t o r s t o t h e + o l l o u i n g c 6 n f i g u r a t l o n s :
Figure 6-e I n t e r f o p t R A t ,V
l ector Initi€liration
OPERATINOSYSTEI'ICO1655$ -- Section 6
104
Sg6tem initiel ization sets the interrupt ensble Etatus
as fo I Io{rE:
NMI V B L A N Ke n € b l e d , d i 6 p l a U l i i t di6ab1€d.
IRO IBREAKIteg and data teg ioterrupte enabled, a1l others
di6abled.
9YSTEH T IIIERS
The follolring t€b1e Ehorrs the tiflers and the f!.a|ne counter.
c h e r € ct e r i s t i eE :
USACE NOTES
O P E R A T I N GS Y S I E H C O 1 6 5 5 9 - - Section 6
109
P O K E Y I n t e r r u p t M a sk
; EXAMPLEOF INTERRUPTENAELE
SEI t T O A V O I D C O N F L I C T[ , I T H I R A . . .
LDA PIIKMSK , ... PROCESSORWHICH ALTERS vAR.
ORA *trx ; E N A B L EB f T ( s ) .
STA POKI.{SK
STA IROEN , TO HARDWARE REG TOA.
SEL T O A V O I D C U N F L I C Tt r I T H I R G . . .
LDA POKHSK ; . . . PROCESSORWHICH ALTERS VAR.
AND { + $ F F - rx ; D I S A B L E B I T ( S ) .
STA PT]KI'ISK
STA IROEN , TO HARDWARE REOISTER TOU.
N o t e t h a t t h e O S I R O s e ? v i r e r o u t i n e u s e e a n d a l t e r s P O I ( | ' I S K s, o
Elt€iations to the variable ou6t be done u,ith interruptg
inhibited. If done et the interropt level there is no problem, as
the I bit iE elreadg set; if done at a baclground level then the
SEI end CLI i.nBtruction€ should b€ u6ed as, shoun in the exallrD1eE.
O P E R A T I N eS Y S T E MC O 1 6 5 5 5 - - Section 6
110
the SETVBVtE4$Fl rootine i6 Frovided to perfoifi the desired
update in gafe mdnner. The cslling gequence is shoun belo{r:
JSR SETVBV
lrhen uorting uith the SVstem Timer6, the vectorg for tifteis l end
2 end the flag6 for tirrere 3,4 and 5 slrould be 6et uhile the
associated ti&er is equal to rero, thsn the tiner should be Eet
*o its (nonzer.o) ve1ue.
M i s € e 1l a n e o u s C o n i i d e r € t i o n E
RestrictionE on CIeBring
I n t e r " t u pt P r o c e E s T i m e R e g t r i c t i o n s
You Bhould not ur.ite en inter?uDt routine thet exceedE 4Oo m6ec.
u h e n a d d e d t o t h e 6 t a q e 1 V B L A N I , (i,f t h € s e . i a l I/O ie being
u6ed. The SI0 6ets the CRITIC flao uhile seriel bu€ I/O is in
Prog?e95.
i U16555 --
O P E R A T I N cS Y S T E I ' C Sectidn 6
InterruFt Dela! Dus to "t"rAIT FUR SYNC"
[,lhen€ver E teg i.s read +rom the tegboer.d, the Keqboard Handler
sets l^lsYNC ID4CA] repetstedlg uhile generating the audible rlic*
on the EonEole gpeak€r. A ptoblem occurE lrhen interrupts are
gen€rated during the u€it-for-EgnE period; the processing of such
interruptE rriII be del:qed bV one horizontal scan line. IhiG
condition cannot be prevented. You can uor* ar.ound the condition
b g e t a n i n i n g t h e I i n e c o u n t V C O U N TC D 4 O D Ia n d d e l a g i n g i n t e r l . u p t
p r o c e s 6 i n g b g o n e I i n e { r h e n n o t l S y N Cd e l a g h e s o c E U r r e d .
FLOI"'CHARTS
O P E R A T I N GS Y S T E HC U 1 6 5 5 5 - - gection 6
113
OPERATINe SYSTEM CO16595 -- Section 6
114
NMI INTEBRUPTPROCESS
OPERATINcSYSTEIIc016559 -- S.ction 6
7 SYSTEd INI T IAL I ZATION
Eoth poure.-up (elEo calted coldEt€rt) end pressing CSYSTEM RE. SETI
(uar.tn5tait) rrill cauEe 6gstem initiatization: In addition, ther€
ate vectoi5 for. these p?ocesseE at E474 tEg6teft reEet) and E477
(polrer-up) so thet theV can be uEer-initieted.
P r e s 6 i n g t h e I S Y S T E HR
. ESETI teg p.oduc€s en NMI interrupt. It
doeE not perfor{rl a 6502 chip-ie5et. I+ the processor is locked
u p , t h e I S Y S T E MR. E S E T I k e g c a n n o t b e s u f + i c i € n t t o u n l o c k i t , e h d t h e
6q€tem rnuet have pousr cgcled to clear the problelll.
OPERATINCSYSTEI'ICO16955 -- Section 7
116
The OS tegts to see i* a diagnostic cartridge is in the A slot:
Ca.tridqe Bddregs BFFC = OO?
4 . T h e U S d e t e r f t i n e s t h e l o u e s t m e m o r qa d d r e s 6 c o n t a i n i n g
non-RAH, bU teEting the first bgte of ev€r{, 4K ,,block', to see
if the content cen be codrpleoented. If it EEn be compl€anented,
then the oritinal value iE restored End testinq continues. I+
i t c a o ' t b e c o n F l e m e n t e d r t h e n t h e c o n t e n t i s i s E u t t l e dt o b e
the first n o n - R A l . ,al d d r e 6 E i n t h e E g B t e n . T h e | 4 S B o + t h e
addreie iE Eto?ed tenpofa!ilq i n T R A M S Zt O O O 6 l .
O P E R A T I N CS Y S I E M C O 1 6 5 5 5 - - Se€tion 7
LL7
o T h e I B R E A K I k e ' J f l E g S R K K E Yt O O l 1 l = - 1 (+alse).
S c t ' e e n E di t o r
D i B p l a { H a n dl e r
K a g b o a r d H a n dl e r
P r i n t e r H a n dI e r
C a g s e t t e H a n dI e ! '
Centi€ I I/O Monito" (CIO)
Seiial I . / O l . l o ni t o r ( S I O )
Int€rr.up t p.oc egsor
1 3 . T h € d e v i c e t s b l e H A T A S Sl O 3 1 A l i s i n i t i € 1 i z e d to point to the
r€sident handlers. See Section I +or inform6tion r.€latino to
th€ Device Handlei'tEbte.
1$. IOC8 l+O is iet op for an BPEN of the Scr€en Editor (E) and
t h e O P E Ni s p e r f o r m e d . T h e S c r e e n g d i t o r u i 1 1 u s e t h e h i g h e s t
p o r t i o n o + R A M+ o r t h 6 s c i e e n e n d u i l l adJUst ilEHTUp
aErordinglq. If thi6 oper.ation shoutd fail, the entire
initialization proeesg is repsated.
1 6 . A d e l a { i s a f f € c t e d t D a s s u r e t h a t a V B L A N Ki n t e r . u p t h e s
occrrr.ed. This is done Eo th€t the Ecreen uill be e6tabliEhed
be + o r e c o n t i n ! i n g .
1 9 . T h e c o l d s t € r t f 1 6 g C O L D S Ti E i e t e t * o i n d i c a t e that the
coldstert process uent to cotnpletion.
o t ' , € J u m p i s e t e c u t e d t h i o u g h t h e v e € t o r D O S V E Ct h e t c a n
ooint io tha blEc&boa.d routine (default case)' caEsette
booted 6oftuere or diskette booted to+tuate. D O S V E Cc a n b e
eltered bq t h e b o o f , e d E o f t u r a i e € s e x p l € i n e d i n SeEtion 1O'
T h € f u n c t i o n s l i E t e d b e 1 o u ,a r e p e r f o i i n e d , i n t h e o r d e r s h o u n ' a 5
pert of the 6!rten r€set initializetion procesE:
O P E R A T I N eS Y S T E MC O 1 6 $ 5 5 - - Section 7
119
e. Sameas pouer-up step 18, €xcept in6terd of bootinq rne
diEkef,te Eoftu€re, a JSR is executed thrrugh the vector DUSINI
tOOOCIif the diskette-boot uaB succeEsfuttg co|npleted during the
Poorer-upiniti€lization. See Section 10 +or details of the
diBkette-boot pror€ss.
Noto that the initializEtion pioEedures €nd n€in entrie6 fo? all
softual.e entities aas executed €t ever.g sgsten reEet as uell aE
at polr€r up {EEe stepE 14, t7, 1A, 2O, F end G}. If the
u s a r - g u p pI i e d i n i t i E l i z € t i o n / 6 t s r t u p c o d e m r , s t b e h a v e d i f f e r e n t l q
in l.ecponse to sqstem reset than it doe5 to po{rer-up, then the
0 r a i . n s t E r t f l a g W A R I I S Tt O O O E l s h o u t d b e i n t e r r o g a t e d ; I I A R H S T= O
fteang pouer-up entr.V, else sgsteft r€set entr.!.
This section describeg the 8CD flo€tinq point (FP) p6ctage that
i.s resident in the OS 80l'l in both th6 dodels 4OO and 8OO.
ASCII to FP conversion-
F P t o A S C II c o n v e r s i o n .
Integ er to FP converEion.
F P t o i n t e g e i c o n v e r si o n .
FP add, subtr€ct, |nrrltiplq, dnd divide.
FP logar'ithm. erponenti6tion, and polrrnofiial evaluation.
FP zero, load, stor€, €tnd move.
I I P E R A T I N Gg Y S T E H C O 1 6 5 5 9 - - SEction E
F R O C O O D 4 I= 6-bqte inteinal foim of FP nuftber.
FRl IOOEOI = 6-bqte interntsI foin of FP nuftber-
F L P T R T O O F C := ?-bgte pointer (1o,hi) to e FP.
nufib et,
I N S U F Ft O O F 3 l = z - b q t e p o i n t e r ( l o , h i ) to an AScII tert
brr+fer.
CIX [OOF2l = 1-brJte index, used a€ offEet to b!f+e!'
pointed to bg INBUFF.
L B U F F C O S A O I= r e € u l t b u f f e r f o r t h e F A S C i o r r t i n e .
FUNCTIONS,/CALL I NE SEOUENCES
C a I l i n 9 s e q u e n ce :
I N S U F F= p 6 i n t e r t o b u f f e r c o n t e i n i n g t h e A S C I !
r a P a E E e n t a t i o n o f t h e n u f t be r .
CIX = the buffer offset to the fi"st bgf,e o+ the ASCII
nu bet.
O P E R A T I N eS Y S T E I ' cI o 1 6 5 5 5 - - section E
Calling 6equenre:
C a1 1 i n 9 E e q u e n ce :
FRo = integer ( F R O + O= L S B , F R O + I = H 5 8 ) .
1 O16555 --
U P E R A T I N eS Y S T E T C Section I
t23
Floatitlg Pr int Addition (FADD)
Function: This routine edds trro floeting point nuftbers end check6
the resul.t for dut-of-r€nge.
C e l l i n O s e q u e n re :
CaIling s e { u e nc e :
Calling Ee q l e n c e :
O P E R A I I N OS Y S T E MC O 1 6 5 5 5 - - Sertion I
124
Fl oet ing Foint DiviEion (FDM
F 0 n c t i o n : T h i E r o u t i n e d i v i d e 6 t u o f l o a t i n g p oi n t n u m b e r s a n d
checl6 for division bq rer-o and for result out-o+-rtsn9€.
Calling s e q u e n ce :
F R O= r e s u l t o + F R O. / F R 1 -
FR1 iE al tered.
C a I I i n g 6 e q u e n €e :
O P E R A T I N OS Y S T E MC O 1 6 5 5 5 - - Section B
1?5
Floating Point Erponentiation (EXP and EXPIOl
Flnction: T hi E r o u t i n e exponentiates.
C a l I i n g s e q r e n ce :
C e l l i n g r e { u e n Ee :
A l q o r i t h m : T h e p o l g n o n i e l P ( Z ) = S U H ( i = Ot o n ) ( A ( i ) * Z * * i ) i5
cooputed u6in9 the Etendard oethod shoun 6elou,:
P ( Z ) = ( . . . ( A ( n l r + Z+ A ( n - 1 ) ) * Z + . . . + A(1))*Z + A(O)
O P E R A T I N eS Y S T E I IC O 1 6 5 5 5 - - Section g
Clear FRO ( ZFRO)
Calling Eequence:
C€Iling gequence:
C € l I i n 9 Ee q u e n ce E :
Calling sequences:
Stot'e Floating P o i . n t N u n b e r F t o n F R O ( F S T O R € n d F S T O P)
C:IIing E € q u e n ce :
FRt = FRO ( F R Or e m a i n s u n c h a n g e d ) .
RESOURCEUTIL I ZATION
T h e + l o a t i n g p o i n t p a c k e g e { r E e Et h e f o 1 1 o { r i n g R A H l o E e t i o n s i n
th€ Eour6e of perforfiing the functionE desEribed in thig section:
OOD4th.ough OOFF
ut /E tnfouon u ) t -t -
The rnost 6ignificant bit of the exponent bqte provideg the sign
+or the trt5ntiEsa; O $or po6itive and 1 for_negative. The
iemai.ning 7 bits o+ the exponent bgts provide the exponent in
excess &4 notation. Ihe r€Eulting n l m b € r l ' e p f e ! i e n t E p o u r e r , so f 1 O O
decimal (not poorersof lO,. This storage format allolrs the
mentiEs€ to hold 10 BCDdigits {rhen tha value o+ the erponent ig
an even pou,er of 10, and I gCO digitg uhen the velue o+ the
exponent iE an odd pouer o+ 10.
N u m be r : + O .0 2 = 2 * 1 O + * - 2 - 2 * 1 O O * * - l
Stored: 3F Oe 0O 0O OO OO (FP exponent = 40 - 1)
N u f l be r : -O. OA = - 2 * 1 O + * - 2 = - 2 * 1 O O * + - 1
Stored: F F O e O O OO O0 OO (FP exponent = BO + 40 - t)
O P E R A T I N GS Y S T E i 4C O 1 6 5 5 9 - - Se.tion g
Nuftber +37.O = 3.7 * 1O**1 = 37 * 1OO**O
gtored 40 37 OOOOOOOO {FP exponent = 40 + O}
N u m b e r: o . o
Stored : OO OO OO OO OO OO (sPecial Eese)
O P E R A T I N OS Y 9 T E H c o l 6 5 5 5 - - gettion I
130
9 ADDING NEW DEVICE HANDLEfiS/PER
IPHERALS
T hi 9 s e c t i o n d e s c r i b e s t h e i n t e i f d c e r e q u i r e n e n t E + o r a
noniesident Device Handl€r. thet i5 to be accesEed via the Centr"€l
I/O utilitg (CIO). The S€rial bus I/O otilitg (SIO) interface is
defined +or thoEe hendlers thet utitize ths Seriel I/O buE.
U s e r b u f f e P h e n dl i n g .
T h e d e v i c e h e n d l e r s a r e b e 1 o u ,C I O . T h e g p e r + o r f i t h e
follotring +un.tionE:
Oevice initialization o n p o u r e r - u pa n d 6 g 5 t e o r e s e t .
Device-dependent 6upport o f O P E Na n d C L O S E E o f l m a n o s .
D e v i E e - d e p e n d s n t c o l n f n € n ds u p p o r t .
The SIO is at the bottom level (for Serial I/O bus peripheral
handlerE). It p e r f o r . | ' l st h e + o 1 l o u i n g f u n c t i o n 6 :
O P E R A T I N OS Y S T E MC O 1 6 5 5 5 - - Section I
131
A 6eDttate €ontro! Ett'rrcture is uied +ot communic.tion at each
interface, as f ollotlB:
OPERATINGSYSTET'ICA16$55 -- Section 9
13e
I uger I
i p r'og rEn I --------------*-----*------+
+---------+
! IOCB.E
I DCB | **++*t1* |
+---------+ +---------+ * |
l*
.*
+---------+ * i
I zlocB I lDevice I iDiE* Filel * i
+---------+ i lable i +---- i Manager l-----+ !
i +---------+
+------------+------+------+--+--
! SIO I
i Uti I itq I
+---------+
T h e d e v i c e t a b l e i s e R A f ' l - ! . e s i d e n tt a b l e t h a t c o n t a i n s t h e
single*cha.arter' device name {e. g. K, D, C, etc). and the
handler eddress foi each o+ the hendlerE knoun to CIO. The
table is initialized to contain entries +oi the foltouj.ng
resident handlersr Kegboerd (K), Displag (S), Screen Editot'
(E', Cassette (C). end Print€r. (P) at pouer-!p and 6{Etem reset. To
i n s t a l l € n e u h E n d I e r , g o r n ep r o c e d u r e m u s t i n s e r t € d e v i ! e t e b l e entiq
a+ter the teble iE initialized.
+----------------+ -+
H A T A B S[ O 3 1 A ] i devi.ce nams i I
r----------------+ :
I handler vector I +- one entrg
+ + i
i table eddress I i
+*---------------+ -+
I mor'e I
I entiie6 i
i zero +ill to !
i end of table I
T h i s 3 8 - b g t e t a b l e u i 1 1 h o l d € n € x i , n u | no + 1 2 e n t r i e E , u , i t h t h e
last 2 bgtei being zero. CIO EcanE th€ table from the end to
the beginning (high to Iou addresE), so the entrg nearest the
end of the table 0rill teke precedence in Eese of nultiple
o c e { r t l e n c e 6 o f a d e v i r e n a m e .-
The device naoe +or etsch entr! is e single ATASCII rharaeter, end
the hendler addres€ points to the hendler's vecto1. tab1e, thet
tri.II be de6cribed in the +ollo0rino section.
CIO/HANDLER INTERFACE
| O16555 --
O P E R A T I N CS Y S T E I ' C Section 9
C a1 1 i n g H e r h a n i s m
+ O P E Nv s . t o r - + ( lo|l, ed d l.ess l
+---------*------+
+ CLUSE vec tor +
+----------------r
+ OETBYTE vector +
+----------------+
+ P U T B Y T Ev e c t o r +
+----------------+
+ OETSTAT vec tor +
+----------------,
+ S P E CI A L v e c t o r +
The devi{e tabts entr.U +or the handter pointE to the first
brJte of the vectoi table.
The firEt €ir entries in the tabte aie vectors (to,hi) that
c o n t a i n t h e € d d r e s s - 1 o f t h e h t s n d 1 e ?r o ! t i n e t h a t h a n d l e s
the indicated fun€tion- The seventh entrg is a 650A JMp
instl"uction to the hendler initiali!ati.on routine. CIO uEeE
onlq the addresses conteined in this table +or handler. entrg_
g a c h u s e r . / C I 0 E o m m a n dt r a n g l a t e g t o o n e o r m o t e . s l t s to one
of the handle. entrieE de+ined in th€. veEtor tab1e.
T h € v e e t o f t a b l e p r o v i d e s t h e h a n d l e r a d d t . e s E e €f o r c e r t e r n
fired functions to be perfo.med to CIO. In addition, ooerarlon
paramet€rs also oust be pa66ed foi most +unction6. patamerer
pEssing i6 acconplished using the 6902 A, X. and y reqister6
and an IOCB in page O narned ZIOCB tOOaOl. In oeneral., l.eoister
A is used to paEE dat€, r-egiBter X containE tf,e index to the
originating IOCB, and regiEter y i6 {rsed f,o pe66 statuE
infordlation to CIO. The zero-page IOCB, iE a .op! of tne
originatinq IOCB, but in the coui6e of grocessino sotne
comm€ndE? CI0 can alter the buffer addr.essend b;f+er length
per'€n€terE in ZIOCB, but not in the origin€ting IOCB (Eee
Section 5 for information relating to the ot.iginating IOCB).
H a h d1 € r I n i t i a l i r € t i o n
F u n ct i o n 6 S u p p o r t e d
I]PEN
T h i E e n t r q i s c e l l e d i i 1 i e g p o n € e t o a n O P E Nc o m m e n dt o C I o . The
h a n d l e r i s € x p e c t e d t o v a l i d a t e t h € O P E Np a r a d e t e l ' E a n d p e r f o r m
ang !'equtred device initialization €sEocieted {rith a device OPEN.
I C D N A Zf O O 2 1 l = d e v i c e n u f t b e r ( 1 - 4 , f o . n u l t i p t e device
h a n dl e r E ) .
I C B A L Z . / I C B A H Z[ O O 2 4 , / O O 2 5 l= a d d r e s s o f d e v i r s , / + i l e n a m e
specificEtion.
I C A X l Z / I C A X 2 Z t O O a A . / O O A B= I d e v i c e - s p e c i f i c information.
T h e h a n d l e r e t t 6 m p t s t o p e r f o r m t t r e i n O i c a t e d O P E Na n d
indicates the statu6 of the operation bq the value of the Y
r e g i s t e i . T h e r e 5 p o n s i b i l i t V + o r c h e c k i n g f o t . f t u l t i p l e O P E N gt o
O P E R A T I N GS Y S T E i 4C O 1 6 5 5 5 - - ge.tion 9
13h
the sane deviEe oi fi1e, ohere it is illeoal, lies o,ith the
h e n dI e r .
T h i s v e t t o r t a b l e e n t r g i E c a l l e d i n r " e s p o n s e t o s C L O S Ec o m m e n d
to CIO. The hendler iE expected to r.elease ang hetd reso!,r.ee5
that r€lete gpecificallrJ to that device/fil.enarhe, and for. output
fileE to:
I C D N O ZC O O 2 1 1= d e v i . c e n u o b e l . ( 1 - 4 , f o r n u l t i p l e device
handlers).
I C A X I Z / I C A X ? Z T O O A A / O O 2 B =l d e v i E e - E p e c i + i c infor|natioh.
T h e h a n d l e r . a t t e m p t s t o p e . f o r n t h e i n d i ( e t e d C L O S Ea n d
indi.ates the 6tatu5 of the operation brJ the value of the Y
ieg i s tel'.
GETBYTE
I C O N O Zt O O 2 1 l = d e v i c e n u m b e r ( 1 - 4 , f o . m u l t i p l e d e v i c e h a n d l e r E ) .
l C A y . l Z/ I C A X ? Z t O O A A / O o a B l = d e v i c e - s r e c i f i c i n f o r n t s t 1 o n .
T h e h a n d l e r u i 1 1 o b t a i n a d a t e b q . + €d i ! . e c t l ' J f . o m t h e d e y i c e o r ' f . o r n s
h a n d l e r ' _ m a i n t a i . n e db u f f e r 6 n d i e t u r n t o C I 8 u i t h t h e b u t e i n t h e
A r'egistei and the operation Etatui in the Y register.
O P E R A T I N CS Y S T E I 4C U 1 6 5 5 5 - - S€ction 9
137
Handlers th6t do not h€ve shoit timeouts asEociated urith the
ieading of deta (such a5 the Keqboard end CaEEettE Handleisl,
m u s t n o n i t o r t h e I B R E A K I k e g f l a g B R K K E Yl O O 1 1 l a n d r e t u r n u i t h a
stetu6 of $8O uhen a tBREAKIcondition occufs. See Appendir L,
85, and Section 1e for a discuision of,CBREAKItel, fionitoring.
CIO checkE for reads fron device/fiIeE th€t heve not baen o!ened
or have been opened for. output onlgi th€ handlet' {ri11 not be called in
t h o s e c€ s e s .
PUTBYTE
T h i s e n t r g i E € a 1 1 6 d i n r e 5 p o h s e t o e p U T C H A R A C T E RoSr p u f
RECORD c o m f l l e n dt o C I O . T h e h e n d l e r i 5 e r p e c t e d t o a E c s p t a s i n g t e
bgte in the A registei oi return an error Etetus in the v
ieg i 9ter.
I C D N O Zf O O 2 l l = d e v i c e n u m b e r ( 1 - 4 , f o r r n u l t i p l e d e v i r e
h a n dl e r s ) .
ICAXIZ/LCAX?Z [O02A/OO28J= device-specific information.
C I O c h e c l s f o r W R I T E st o d e v i c e , / t i l e s t h a t h a v e n o t b e e ' l o o e n e d .
or have baen opened for input onlg. The handler. u,ilI not be call€d in
t h o s e ca g e E ,
N o u , t h t s t t h e n o r m € 1 o p e r a t i o n o f P U T B Y T Eh a s b e e n d e f r n e s , a
speciel case nu6t be added. Ang handler that ui11 op€r€te l|rithin
the enviionnent of the ATARI AK BASIC lang!a9€ interpreter has a
diffefent E€t of ruleE. Because BASIC c€ln ce11 the handler
P U T B Y T Ee n t r r J d i f e c t l g . uithout going through CIO, the zero-page
IUCB (ZIOCB) can or mag not have a rslation t o t h e P U T B Y T Ec a l 1 .
Thei'efor€, the handler must oEe the outer level IOCE to obtain
ang inforoation that uould noimallg be obtained f.om ZIBCB. Note
E l s o t h a t t h e O P E Np l ' o t e . t i o n n o r m a l l q p r o v i d e d b r t C I O i s
b{paEsed (i.e. P U T B y T Et o e n o n - O P E N d e v i c e / f i l e € n d P U T B Y T Et o a
.ead-on 1g OPEN,.
O P E R A T I N CS Y S T E MC O 1 6 5 5 5 - - S€€tion g
134
EETSTAT
I C D N 0 ZI o o 2 1 l = d e v i c e n u n b e r ( 1 - 4 , f o r m u l t i P l e d e v i c e h € n d l e r s ' .
I C B A L Z / I C B A H Z t O O a 4 , / O O 2 5 l= € d d r e 5 3 o +
d€vice/+ i 1enafiespeci+icetion.
tcAxlz/ rcAxzz
I O 0 " A / O O ? B 1= d e v i c e - E p e € i + i . inf ormation.
SPECIAL
I C D N A Zt O O 2 1 l = d e v i c € n u m b e . ( 1 - 4 , f o r ultiple d€vit€
handlersl
I C C U M Zt o o z z l = c o o o a n d b g t e .
ICBALZ/ICBALH IOO24/OOas] = bu+fei addre55.
ICBLLZ/ICELHZ tOOaA/OO29! = buffer length.
ICAXIZ / ICAX?Z |OO?A/ OO2B1 = ilevi€e-3p ec i f i c inf oifiati on.
Ihe IBCB need not be opened nor cloged in oider for uou
t o r e q u e s t C I O t o p e r f o r i n s S P E C I A Lo p e r a t i o n , t h e h i n d t e r
tnu6t che€k {rh€ie th€pe ar"e r.estriction5. See gection S for
e
discuEEion o+ the CIO ections involved uith a SFECIAL
op€tatiof| uEing both open and closed IOCB.s, and note the
inpact of this on the u6e of the buffer address pitraoetei.
E r r d r . H a n dI i n 9
E r r o r h a n d l i n g h E s b e e n E i m p l i f i e d E o m e u h e tb q h € v i n 9 C I O h 5 n d l e
o u t e r l 6 v e l e r r o r . s a n d h € v i n g S I 0 h s n d1 e S e r i € l b u 6 e r r o . t ' s ,
l e a v i n g t h e h a n d l e . t o p r o r e E s t h e r e m ai n i n g e i . r o r E . These
efiot s inc l ud€:
out-o+-renge par'ameterE
TBREA(l teg abor t.
Inv€ I id command.
Read after end of file.
Resoufc e Al location
OFERATINOSYSTEH c o r 6 5 5 5 - - SBetion 9
140
Zero-P€qe RAM
Z e ? o - p € g e R A I ' Ih € s n o s p a f e b g t e s , a n d e v e n i f t h e r e u e r " e , t h € r e
_
i5 no €tlo.etign s€hefle to Eupport nultiple p.ogrE$:ssiqnfienf, of
the spare!i, There+ore, the nonresident htsndler must seve i|nd
regtore the bgtei of zeio-page RAMit iE going to ure. The bgtes
to u5e muEt be chosen c€re+ullV, €{rording to the *ollouing
€riteria:
XXX (COLCRS),v r D O Y O U RP O I N T E R T H I N G .
N o nz e r o - P a g e R A H
O P E R A T I N CS Y S T E MC 0 1 6 5 5 5 - - Section ?
141
former.lg !'€s i dent hend I er tlou I d h€ve uged
S t a r I S p a Ee
HANDLER,/SII] INTERFACE
Bus timeout.
Tr€nsfel o + d a t a b e t u r e e nt h s b u s € n d t h s c a l l e r . E buffer.
Calling Hechanis
SIO has a Eingle entrg point SIUV tE459l for eII oDeretionF. The
devi ce contro I blork (DCB) tO3OOl containE all pareneters oassed
to SIB. The DCE c o n t a i n s t h e f o t l o l r j . n g b g t e s :
D E V I C E B U S I D -- DDEVTC to300l
-.
DEVICE COHI.IAND DCOMNDTO3OE]
O P E R A T I N CS Y S T E MC O l 6 g g S - - Section
DEVICE sTATUs -- DSTATS tO3O3]
7 o
+-+-+-+-+-+-+-+-+
lWlRl (J'tused i
+-+-+-+-+-+-+-+-+
A +t e r a n S I O c e l l :
7 o
+-+-+-+-+-+-+-+-+
I statuE code i
+-+_+-+-+-+_+-+-+
Ihe hendle? sets thi5 bqte. It specifier the device timeout time
in units a+ b4/6O o+ d second. For exatnple, a count o+ 6
speci+ies a ti.neout of 6.4 secondE.
I ' { A R N I N G :T h e r e i s a b u g i n S I O t h e t c a u s e s i n c o r r e c t
e E t i o n s { r r h e nt h e 1 a 9 t b g t e o f a b u f f e r i s i n a o e m o r {
addr.esE endinq in $FF, such as 13FF, 4eFF, etc.
The handler setE these E-brJte6. The SIO inrludes thelll in the bu5
condand +rade, theg have device-specific meaning€.
F u n c t i o n 5 S u pp o r t e d
S I O d o e s n o t e r € d i n e t h e C O H M A NbD{ t e i t 6 e n d s t o t h e d e v i c e ,
becau5e el1 bur transactions ere expectsd to ron+orft to e
univarg€l pr.otorol. Ths protocol includ€s three forfts, stated
belou, (as 5een fiom the rofiouter ):
Send comm6ndfnefie.
gend commandfraoe and gend dats fram€.
S e n d c o t n f t a n d+ r : m e e n d r e c e i , v e d a t a f r € r f l e .
The velues of the t, and I bits in the statug bgte Eelect the
c otlftand f or.m.
Error H a n d1 i n g
SIO hendleE moEt o+ the Eeriel buB errorE foi. the hdndler,
as ind i cated belolr:
8 u 9 t i n e o u t - - S I O p r o v i d e s e u n i f o r . m E o m m e n df r : t n e a n d d a t a
ft'ame ACK bvte timeout oe L/6O oC € seEond - O / + 1/he.
T h e h € n d l e f E p e c i + i e s t h e n e x i m u m C O M P L E T bEg t e t i t n e o u t
value in DTIHLO.
gus errors -- SIO dete.ts snd ?eports UART overrun and
fTeming errorE. The sen6ing of thess e!-rors in €rnl received
bgte uill c€use the entire assoc;ated +rame to be conEidened
bed.
I 016595 --
O P E R A T I N GS Y S T E I ,C Section 9
144
rereive the COI'IPLETE
code and Fo5siblq a dste fraoe.
o T h e o v e r a l l c o r D n a n ds e q u e n c e E t h e t u t i l i z e frames
and i'€5ponie .b9tes to ptovide coftPUter/periphertsl co nonication.
H € r d u e r e / E l e Et r i c a I c h € i a c t e r i 9 t i c s
I O16595 --
O P E R A T I N oS Y S T E I ' C gection I
2 4 6 A 10 1?
o o o o o o
o o o o o o o
1 3 5 7 I 11 '3
uhere: 1 = c o d r F u t e i C L O C KI N .
2 s Eooputer CLOCI,(UUT.
3 = conputer DATA IN.
4 = OND.
5 = computer DATA OUT.
5 = GND.
7 = C0HMAND-.
a = HOTORCONTROL.
I = PROCEED-.
1O = +5v,/READy.
11 = ro.nputer AUDIO IN.
12 = +72v.
13 - INTERRUPT-.
C L O C KI N i s n o t u 6 e d b g t h e p r e 6 e n t O S e n d p e r i p h e r 6 l s . T h i e
l i n e E a n b e u B e d i n f u t u r e E g n c h r . o n o u sE o m m u n i c e t i o n s E € n e m e t i .
C L O C KU U T i s t h e E e r i € 1 b u 5 c 1 o c k . C L O C KO U T g o e E h i q h a t t h e
s t a r t o f e E E h D A T AO U T b i t E n d r e t u r n s t o ! o { , i n t h e n i d d t e o f
each bit.
+ 5 V , / R E A D iYn d i c a t e s t h a t t h e c o m p u t e r r 9 t u r n e d o n e n d r e 6 d q . T h i E
line can a16o b€ used as a +g volt gupplrJ of soma Eurrent rating
foi ATARI periph€raIs on1g.
A U D T Ot N a E c e p t s a n a u d i o B i g n a l f i o f i the casEette_
OPERATINOSYSTEI'ICC116599-- Section 9
L46
+12V is € +12 volt s u p p l { o f u n k n o u n c u r r . e n t .at ing for A T A RI
per iphera I s onlg.
I N T E R R U P T -i s n o t u s e d b g t h e p r e s e n t OS and p e r i p h e r a1 5 , t h i s
l ine iE rulIed hioh.
Periphe.al input:
VlH = 2. Ov rnin.
VIL = O.4v lrlex.
V O L = O .4 v m € x . @ 1 . 6 m a .
VOH = 4. 5v min. urith external lOOKohn putl-up
B U E C o m m a ngd
T h € b u s p r o t o r o l g p e c i f i e s t h a t a I t c o m m a n d sf t o E t o r i g i n a t e + r o m t h e
computer, and th5t peripherals uill present deta on the buE onl{ rlhen
c o i n m a n d e dt o . E v e r ' g b u s o p e i a t i o n 0rill go to coopletion before
another bus oper.tion iE initieted (no ov€rlepl. An error detected at
ang p o i n t i n t h e c o o o a n d E e q u e n c eo i l l aboit the entiae Eeqoence.
O p e r e t i o n c o m p l e t e ( C A H P L E T E f) r o m t h e p e r i p h e . a l .
O P E R A T I N eS Y S T E I iC O 1 6 5 5 5 - - Section 9
147
Coflnr3nd Ffafie
The eeriel bus protocol provides for three tVpe6 of connandst l) data
s e n d , 2 t d . t a r e c e i v e a n d 3 ) i r n n e d i s t e ( n o d e t a - - c o m m a n do n l u ) .
T h s r e i B € c o f t m o ne l e n e n t i n € 1 1 t h ? e e t g p e 6 , e c o m m a n df F a m €
conEisting of five bqtes o+ infornation sent froln the compuxer
u h i l e t h e C O M H A N D l-i n € i 6 h e l d l o r ! . T h e $ o i m € t o f t h e c o m o € n d
+ralne ls
5ho{rn b e Io{r:
+----------------+
! device ID !
I coonand i
r_________-______+
i aurilia!"g *1 I
i EUxiliarg *e !
+----------------+
I chec&surl I
t----------------+
T h e c o r n m a n db g t e c o n t E i n s E d e v i c e - d e p e n d e n t aommand (Eee
Appendir I for € list of deviEe commsnds).
T h e E h e c k s u n b q t e c + n t a i n s t h e € r i t h | n e t i E E U mo f t h e f i i s t four
b g t e s ( u t i t h t h e c a r r V a d d e d b a €f t e f t € r e v e r g € d d i t i o n )
C o n , n a n dF r a o e A r l n o u r l e d g e
Data Frafie
i but€s i
I
+----------------+
i c h e c* E u m i
The €he€ksuo value in the deta fl'Etnei9 the arithfietic sum sf all
of the frane dat€ pre€eding the che€kFUm, '!ith the carrg +rofll
e a E h a d d i t i o n b e i n o a d d e d b € E l ( t h e E a m ea E f o l . t h e c o o o e n d
frame).
O p e r a t i o n C o n pI e t e
A peripheral is:1so e r p e c t e d t o 6 e n d a n o p e f a t i o n - c o M P L E T Eb g t e
( 9 4 3 ' 6 t t h e t i m e t h e c o n m a n d e do p e r € t i o n i s c o n p l E t e . T h e
I o c a t i o n o f t h i s b g t e i n t h e c o t n m a n ds e q ! e n c e f o t e a c h c o o h a n d
- trtpe i.i Eholrn in the tioing diagranE in Section 9. If the
oPeration cannot go to notmal, etror-+tee coopletion, the
p e r i p h e r B t e h o ! 1 d r e s p o n d u i t h a n E R R O Rb ' r t € ( $ 4 5 ) i n E t e a d o f
COMPLETE.
O F E R A T I N eS Y S T E MC O 1 6 5 5 $ - - Section 9
149
Bus Titning
coMhAND- I I
+--------+
cot'$tAND- i I
+--------+
c{]flMAND- i i
+------+
DATA oUI i cinnd I
----+irafie +--------------
+-+ +-+
DArA IN '' '*.--...--..-..--t
t-----l ,;----------
ACK CHPL
t0 t1 t2 t5
Fi.qute 9-6 Serial Bus Tirning Diagran
periph€ral to (min' = ??
peripheiel t0 (max) = ?t
peripheral t1 (mifl) = ??
per.ipheral tl (ftar l = ??
per'ipheral t2 (ftin, = ??
peripheral t2 (&ar' = ??
O P E R A T I N OS Y S T E MC O 1 6 5 5 5 - - Section 9
151
The co|nputer g€nerateE a delaq (t3) bstureenthe i.eceipt of the
le6t bit of th€ ACK bgte and the transmission of the first bit of
the data frafte bl the tornpoter.
co|nDute. t3 ( m i n ) = 1 O O 0m i c r o s e c .
conpLrte. t3 ( n e x ) = 1 E } O On i c r o s e c .
peripher€1 t3 (minl = ?D
peripheral t3 (rnar' = ??
peripher€1 t4 (min) = ?t
pe?ipheral t4 (naxl * ??
peiiphe|,al t$ (oin) = ??
peripheral t5 (rlar) = N/A
HANDLER ENVIRONHENT
FLOT.ICHARTS
{ O16555 --
O P E R A T I N CS Y S T E T C Section 9
153
PERIPHERAL'SCOMIVIAND
FFAME PROCESSiNG
OPERATINOSYSTEI'IC O 1 6 5 9 5- - 6sction I
DATA FRAI\'IETO COMPUTER