============== Page 1/1 ============== PDP-1 1 Maschinensprache G 582-1 INHALTSVERZEICHNIS KAPITEL 1 - 1.1 P P D EINFÜHRUNG 11 - F a m i l i e 1.2 G e n e r e l l e Eigenschaften 1.3 P h e r i p h e r e G e r ä t e 1.4 P D P 11 - S o f t w a r e 1.5 D a r s t e l l u n g v o n Z e i c h e n u n d Z i f f e r n KAPITEL 2 - SYSTEMAUFBAU 2.1 S y s t e m ü b e r b l i c k 2.2 C P U 2.3 A d r e s s - KAPITEL 3 (Zentraleinheit) und Speicherbereich - ADRESSIERUNGSARTEN 3.1 E i n f ü h r u n g 3.2 B a s i c 3.3 P C Modes Modes KAPITEL 4 - B E F E H L E UND PROGRAMMIERTECHNIKEN 4.1 E i n f ü h r u n g 4.2 E i n i g e Befehle 4.3 S t a c k , Trap, I n t e r r u p t 4.4 U n t e r p r o g r a m m i e r u n g 4.5 E i n -/Ausgabe-Programmierung ANHANG A.1 B e d i e n u n g s a n l e i t u n g e n A.2 P r o g r a m m b e i s p i e l e A.3 A b k ü r z u n g e n KAPITEL 1 - EINFÜHRUNG 1.T P 11 - F a m i l i e P D 1.2 G e n e r e l l e Eigenschaften 1.2.1 U N I B U S 1 . 2 . 2 L S I - 1 1 BUS 1.2.3 I n t e r r u p t (Unterbredhung) 1.2.4 D M A (Direkter Speicherzugriff) 1.2.5 C P U (Zentraleinheit) 1.2.6 M e m o r y ( A r b e i t s s p e i c h e r ) 1.3 P e r i p h e r e 1.3.1 Geräte E i n -/Ausgabe-Geräte 1.3.2 S p e i c h e r -Geräte 1.4 P D P 11 - S o f t w a r e 1.4.1 B e t r i e b s s y s t e m e ( O p e r a t i n g Systems) 1.4.2 T e s t p r o g r a m m e 1.5 D a r s t e l l u n g v o n Z e i c h e n u n d Z i f f e r n 1.5.1 B i t , Byte, Wort 1.5.2 Z a h l e n -und Z e i c h e n d a r s t e l l u n g 1.5.3 G r a p h i s c h e D a r s t e l l u n g d e r p o s i t i v e n und negativen Zahlen ( Z a h l e n k r e i s ) Arbeitsblatt 1.1 1 1 1.1 P D P 1 1 F a m i l i e (PDP = P r o g r a m m a b l e D a t a P r o c e s s o r ) Die PDP-11 F a m i l i e b e i n h a l t e t m e h r e r e 1 6 - B i t - Z e n t r a l e i n heiten, e i n e große Anzahl von peripheren Geräten und Zus ä t z e n s o w i e e i n e a u s b a u f ä h i g e S o f t w a r e . P D P - 11 M a s c h i n e n sind von d e r A r c h i t e k t u r h e r ä h n l i c h , Hardware und Software sind aufwärts kompatibel. A n d e r e r s e i t s h a t jedoch j e d e Mas c h i n e i h r e e i g e n e C h a r a k t e r i s t i k . N e u e PDP-11 S y s t e m e w e r den m i t d e n b e r e i t s b e s t e h e n d e n M i t g l i e d e r n d i e s e r F a m i l i e kompatibel s e i n . D e r Benutzer kann das System aussuchen, w e l c h e s f ü r s e i n e Anwendungen a l s g ü n s t i g s t e s e r s c h e i n t . S o l l t e n j e d o c h d i e E r f o r d e r n i s s e wachsen o d e r s i c h g a r ä n dern, s o kann d i e Hardware a u f e i n f a c h s t e Weise e r w e i t e r t oder g e ä n d e r t w e r d e n . D i e w e s e n t l i c h s t e n E i g e n s c h a f t e n d e r PDP-11 S y s t e m e s i n d i n d e r T a b e l l e 1 - 1 z u s a m m e n g e s t e l l t . Von d e h PDP-11 P r o z e s s r e c h n e r n w e r d e n f o l g e n d e Ty p e n a n geboten: PDP 11 - F a m i l i e L S I - 11 BUS- R e c h n e r PDP 1 1 / 0 3 " 11 / 2 3 U N P I D l B U S P t ty tt ir 1 3 1 -Rechner 11/04 11 / 0 5 , 11 / 3 4 , 11 / 3 5 , 11 / 4 4 11 / 1 0 11 / 3 4 A 11 / 4 0 1 1 / 4 5 , 1 1 / 5 0 , 1 1 / 5 5 11 / 6 0 11/70 03 LSI-11 04 05 (OEM) 10 (END) 23 34 35 (OEM) 40 (END) 44 45 50 max.Adr. Bereich(KW) 32 32 32 32 128 128 128 128 2048 128 128 BUS LSI-11 Bus U U U LSI-11 U Bus U U U M.Bus 1 4 4 4 4 4 4• Betr.Arten Kernel Superv User x x x x x x x x x x GRPs 8 8 8 8 8 8 Opt. x x x x CPU Interruptebenen HW SW Progr.Console Oper. Console x LSI-o. + Fastbus 4 7 4 7 4 . 7 x x x x x x x x x x x 8 8 10 16 16 0pt. x x x x x 0pt. x 4Kw Opt. Opt. 0pt. Opt. Opt. Elec. Cons. Opt. Memory Nanagem. Cache x x Opt. FP 0pt. 0pt. Opt. (34A) EIS CIS x x Opt. Opt. x Opt. x x MOS Core OS Core Core MOS Core MOS Memory Large I n s t r . Set Core MOS PROM Core MOS Core Core x Preis/Leistungsvergleich cc e .e° 0 • • • e . Q . A e 0 e • P e A42 e 0 Y‘ • •e 0 • e• TIME 11/45 11/70 N 11/35 11/05 LSI-11 L S I 11/03 - 1 1 / 2 3 LEISTUNG Preis /Leistungsvergleich 1- 5 1.2 G e n e r e l l e E i g e n s c h a f t e n 1 . 2 . 1 D e r UNIBUS ( B i l d 1.1.) A l l e K o m p o n e n t e n e i n e r PDP11 M a s c h i n e ( Z e n t r a l e i n h e i t , S p e i c h e r, P e r i p h e r i e ) s i n d a n e i n e n gemeinsamen K a n a l - d e n UNIBUS- a n g e s c h l o s s e n . ü b e r i h n l ä u f t d i e g e s a m t e Kommunikation d . h . e r ü b e r t r ä g t a l l e Daten, Adressen und Steuersignale. Durch d i e b i d i r e k t i o n a l e V e r w e n d b a r k e i t d e s UNIBUS k a n n e i n Gerät I n f o r m a t i o n e n senden u n d empfangen u n d D a t e n ohne Mitwirkting d e r Z e n t r a l e i n h e i t v e r a r b e i t e n . Zudem i s t d e r UNIBUS a s y n c h r o n . D a s b e d e u t e t , d a ß j e d e s G e r ä t m i t d e r i h m eigenen G e s c h w i n d i g k e i t t ä t i g s e i n kann und d i e Systemleistung insgesamt verbessert w i r d . 1 . 2 . 2 D e r L S I - 11 - B U S F ü r d i e R e c h n e r PDP 1 1 / 0 3 , 1 1 / 2 3 w u r d e e i n e e i g e n e B u s s t r u k t u r e n t w i c k e l t : d e r L S I - 11 - B U S . Im G e g e n s a t z z u m UNIBUS w e r d e n w ä h r e n d d e s B e t r i e b s A d r e s sen u n d D a t e n i m Z e i t m u l t i p l e x ü b e r t r a g e n . D i e Z e n t r a l e i n h e i t b r i n g t z u e r s t d i e Adresse d e r gewünschten S p e i c h e r s t e l l e o d e r d e s I / O - I n t e r f a c e s a u f d e n Bus-, e s f o l g e n Steuersignale, d i e d i e G ü l t i g k e i t d e r Adresse bestätigen. Da d e r B u s b i - d i r e k t i o n a l i s t , z e i g e n w e i t e r e S t e u e r s i g n a l e die Richtung des Datenflusses a n . Das a d r e s s i e r t e Modul übersetzt diese Signale und r e a g i e r t , indem e r d i e Daten entweder v o n d e r Z e n t r a l e i n h e i t a k z e p t i e r t o d e r i h r D a t e n zuführt. 1.2.3 I n t e r r u p t (Unterbrechungen) Ein automatisches I n t e r r u p t System a u f P r i o r i t ä t s b a s i s e r laubt d e r Z e n t r a l e i n h e i t , a u f Anforderungen außerhalb des Systems o d e r i n d e r Z e n t r a l e i n h e i t s e l b s t a u t o m a t i s c h z u reagieren. Jede b e l i e b i g e Anzahl von Geräten kann a u f v e r schiedenen Ebenen a n g e s c h l o s s e n werden. J e d e s p e r i p h e r e G e r ä t i n n e r h a l b d e s PDP-11 S y s t e m s h a t e i n e n " H a r d w a r e - Ve c t o r " ( Z e i g e r ) z u zwei eigens diesem Gerät zugeordneten A r b e i t s s p e i c h e r -Worten. E i n Wort z e i g t a u f d i e S e r v i c e -Routine f ü r dieses Gerät und das andere b e i n h a l t e t e i n e S t a tus- I n f o r m a t i o n f ü r d i e Service -Routine. D i e s e e i n h e i t l i c h e I d e n t i f i k a t i o n e r ü b r i g t d a s Ablegen" d e r Geräteadressen i n e i n e r L i s t e , d a d i e H a r d w a r e d i e A u s w a h l , und D u r c h f ü h r u n g der entsprechenden S e r v i c e - R o u t i n e v o r n i m m t , s o b a l d d e r S t a t u s d e s u n t e r b r o c h e n e n Programms a u t o m a t i s c h g e r e t t e t wurde. 1- 6 1.2.4 DMA ( D i r e k t e r S p e i c h e r z u g r i ff ) A l l e PDP-11 S y s t e m e e r m ö g l i c h e n d e n d i r e k t e n S p e i c h e r z u g r i f f . W i r bezeichnen i h n nachfolgend als,DMA ( D i r e k t Memory A c e s s ) . J e d e b e l i e b i g e A n z a h l v o n D M A - G e r ä t e n k a n n an d e n UNIBUS b z w . L S I - 11 - B U S a n g e s c h l o s s e n w e r d e n . E i n e m DMA-Gerät w i r d d i e h ö c h s t e P r i o r i t ä t z u g e o r d n e t , u m j e d e r z e i t Daten l e s e n und schreiben z u können. D i e Ve r l u s t z e i t i s t a u f G r u n d d e r O r g a n i s a t i o n u n d L o g i k d e s UNIBUS a u f e i n Minimum r e d u z i e r t . A l l e S t e u e r l e i t u n g e n f ü r I n t e r r u p t u n d DMA s i n d i m UNIBUS bzw. L S I - 11 - B U S i n t e g r i e r t . 1.2 5 C P U ( Z e n t r a l e i n h e i t ) . Die Z e n t r a l e i n h e i t , a l s U n t e r s y s t e m a n d e n UNIBUS a n g e s c h l o s s e n , ü b e r w a c h t d i e Z u o r d n u n g d e s UNIBUS f ü r d i e Peripherie und f ü h r t neben a r i t h m e t i s c h e n und l o g i s c h e n Operationen d i e Befehlsdekodierung d u r c h . S i e b e i n h a l t e t mehrere s c h n e l l e , a l l g e m e i n v e r w e n d b a r e R e g i s t e r , d i e a l s Akkumulatoren, Z e i g e r , I n d e x - R e g i s t e r o d e r a l s Z e i g e r f ü r a u t o m a t i s c h e n I n d e x -Modus b e n u t z t w e r d e n k ö n n e n . D i e Zentraleinheit f ü h r t den d i r e k t e n Transfer zwischen E i n / A u s g a b e g e r ä t e n u n d dem A r b e i t s s p e i c h e r d u r c h , o h n e dabei d e n I n h a l t d e r R e g i s t e r z u z e r s t ö r e n ; b e a r b e i t e t 16- b i t - W o r t D a t e n e b e n s o w i e 8 - b i t - B y t e D a t e n u n d - u n t e r Verwendung d e r d y n a m i s c h e n " S TA C K " - T e c h n i k - i s t d i e Möglichkeit von verschachtelten I n t e r r u p t s (Unterbrechungen) u n d S u b r o u t i n e n ( U n t e r p r o g r a m m e n ) g e g e b e n . Befehls- S t r u k t u r Der B e f e h l s s a t z v e r w e n d e t d i e F l e x i b i l i t ä t d e r g e n e r e l l e n R e g i s t e r, u m d a r a u s ü b e r 4 0 0 v e r d r a h t e t e B e f e h l e z u e r s t e l len - d a s l e i s t u n g s f ä h i g s t e B e f e h l s r e p e r t o i r e e i n e s Rechners der 1 6 - b i t K l a s s e ü b e r h a u p t . I m Gegensatz z u k o n v e n t i o n e l len 16- b i t Rechnern, d i e normalerweise d r e i K l a s s e n von B e f e h l e n haben ( A r b e i t s s p e i c h e r bezogene B e f e h l e , O p e r a t i o n s B e f e h l e u n d E i n / A u s g a b e B e f e h l e ) , w e r d e n i n d e r PDP-11 a l l e Operationen d u r c h e i n e n e i n z i g e n B e f e h l s s a t z a u s g e f ü h r t . D a die R e g i s t e r v o n p e r i p h e r e n Geräten genauso f l e x i b e l b e h a n d e l t werden können w i e z . B . d e r A r b e i t s s p e i c h e r d u r c h d i e Z e n t r a l e i n h e i t , können a l s o d i e Befehle gleichermaßen f ü r die M a n i p u l a t i o n von A r b e i t s s p e i c h e r d a t e n w i e auch f ü r d i e R e g i s t e r d e r p e r i p h e r e n G e r ä t e v e r w e n d e t werden. Zum B e i s p i e l können Daten e i n e s externen Geräte- R e g i s t e r s d i r e k t durch d i e Z e n t r a l e i n h e i t g e t e s t e t o d e r m o d i f i z i e r t w e r d e n , ohne s i e d a b e i i n d e n A r b e i t s s p e i c h e r z u b r i n g e n o d e r d i e Inhalte d e r Prozessor-Register zu zerstören. 1- 7 1.2.6 Memory ( A r b e i t s s p e i c h e r ) Arbeitsspeicher verschiedenster Geschwindigkeit und Charakt e r i s t i k a k ö n n e n i n e i n e m e i n z i g e n PDP-11 S y s t e m f r e i v e r wendet u n d u n t e r e i n a n d e r a u s g e t a u s c h t w e r d e n . Wa c h s e n a l s o d i e E r f o r d e r n i s s e a n S p e i c h e r g r ö ß e o d e r S p e i c h e r - Te c h n o l o gie, i s t d a m i t k e i n e Ve r a l t e r u n g wie b e i herkömmlichen . Rechnern g e g e b e n . B i s h e r z u r Ve r f ü g u n g s t e h e n d e S p e i c h e r s i n d i n M a g n e t k e r n - , MOS- u n d B i p o l a r e r Te c h n i k a u s g e f ü h r t . Ta b e l l e 1 . 1 g i b t A u s k u n f t ü b e r S p e i c h e r g r ö ß e n . 1 8 PROCESSOR M E M O RY TELETYPE PAPER TAPE DISK DECTAPE SYSTEM BLOCK DIAGRAM Bild 1.1 1- q 1.3 P e r i p h e r e G e r ä t e über d e n UNIBUS b z w . L S I - 4 1 - B U S s i n d e i n e g r o ß e A n z a h l v o n p e r i p h e r e n G e r ä t e n a n d i e Z e n t r a l e i n h e i t e n d e r PDP 1 1 - F a m i l i e n a n s c h l i e ß b a r. 1.3.1 E i n / A u s g a b e g e r ä t e A l l e PDP-11 S y s t e m e s t e h e n m i t D E C t e r m i n a l s o d e r D E C w r i t e r a l s Standarid- E i n h e i t z u r Ve r f ü g u n g . J e d o c h können d i e E i n / A u s g a b e - M ö g l i c h k e i t e n um s c h n e l l e L o c h s t r e i f e n l e s e r u n d - s t a n z e r, Z e i l e n d r u c k e r, K a r t e n l e s e r o d e r alpha-numerische Sichtgeräte e r w e i t e r t werden. D e r "DECwriter" - e i n komplett von DEC e n t w i c k e l t e s u n d h e r g e s t e l l t e s G e r ä t h a t d e n S t a n d a r d - F e r n s c h r e i b e r (TELETYPE g e n a n n t ) a b g e l ö s t . D i e V o r t e i l e d e r n e u e n Te r m i n a l s g e g e n ü b e r d e n ü b l i c h e n e l e k t r o m e c h a nischen F e r n s c h r e i b e r n s i n d u . a . h ö h e r e G e s c h w i n d i g k e i t , weniger mechanische Te i l e und Geräuscharmut. U n t e r d i e PDP-11 E i n / A u s g a b e g e r ä t e f a l l e n : DECterminal alphanumerische S i c h t g e r ä t e : VT 5 0 , V T 5 2 , V T 1 0 0 u s w . DECwriter F e r n s c h r e i b e r : LA 3 0 , L A 3 4 , L A 3 6 , L A 3 8 , L A 1 2 0 Schnelle Zeilendrucker: LP 0 5 , L P 2 5 u s w . Schnelle L o c h s t r e i f e n l e s e r und - s t a n z e r PC 11 F e r n s c h r e i b e r ( Te l e t y p e ) ASR 3 3 Kartenleser CD 11 1.3.2 S p e i c h e r -Geräte Die S p e i c h e r g e r ä t e r e i c h e n v o n bequemen k l e i n e n M a g n e t band- E i n h e i t e n b i s z u g r o ß e n M a g n e t b ä n d e r n u n d P l a t t e n s p e i c h e r n . ü b e r d e n UNIBUS k a n n e i n e g r o ß e A n z a h l v o n S p e i c h e r g e r ä t e n d e r v e r s c h i e d e n s t e n K o m b i n a t i o n e n a n d a s PDP-11 System a n g e s c h l o s s e n w e r d e n . 1 - 10 Magnetbandeinheiten: T E 1 0 , T E 16 TS 0 3 , T S 11 TU 4 5 , T U 5 6 , T U 5 8 , T U 6 0 , T U 7 7 u s w . Plattenspeicher: R K 05, RL 01, RL 02 RX 0 1 , R X 0 2 RM 0 2 / 0 3 RP 0 4 / 0 5 / 0 6 u s w . Die K a p a z i t ä t e n d i e s e r ( M a s s e n - o d e r H i n t e r g r u n d - ) S p e i c h e r - G e r ä t e r e i c h e n b i s z u 2 0 0 M i l l i o n e n B y t e s u n d m e h r. 1.4 P D P 11 - Software Für d i e F a m i l i e d e r PDP-11 S y s t e m e i s t e i n e e r w e i t e r u n g s fähige Software f ü r P l a t t e n - und Lochstreifensysteme e r h ä l t l i c h . J e g r ö ß e r d i e PDP-11 K o n f i g u r a t i o n i s t , d e s t o umfangreicher Und v o r t e i l h a f t e r w i r d d i e m i t g e l i e f e r t e Software. 1.4.1 B e t r i e b s s y s t e m e ( O p e r a t i n g Systems) Unter den Betriebssystemen e i n e r Datenverarbeitungsanlage w i r d e i n e , d u r c h i h r e A u s s t a t t u n g f e s t g e l e g t e Menge v o n Organisationsprogrammen u n d Programmsystemen v e r s t a n d e n . Diese s i n d vom s p e z i e l l e n A n w e n d u n g s f a l l u n a b h ä n g i g u n d werden i n d e r R e g e l vom, H e r s t e l l e r g e l i e f e r t . M i t d e m B e t r i e b s s y s t e m w i r d d i e t e c h n i s c h e S t r u k t u r e i n e s Rechners um die programmierte S t r u k t u r e r w e i t e r t , s o daß d e r Benutzer d i e R e c h e n a n l a g e m i t m ö g l i c h s t bequemen M i t t e l n a n s e i n e s p e z i e l l e n Aufgaben anpassen kann. Man könnte das B e t r i e b s system i m ü b e r t r a g e n e n S i n n a l s D i r i g e n t o d e r ü b e r w a c h e r bezeichnen, d e r a l l e Aufgaben und O p e r a t i o n e n k o o r d i n i e r t . Anlagenausstattung und Benutzerwünsche bestimmen d i e V a r i anten d e r B e t r i e b s s y s t e m e . Aufgaben d e s B e t r i e b s s y s t e m s D ie e r s t e G r u n d f u n k t i o n e i n e s B e t r i e b s s y s t e m s i s t e s , e i n e DVA " b e d i e n b a r " z u m a c h e n , d . h . d e m B e n u t z e r d e n V e r k e h r m i t d e r Rechenanlage ü b e r h a u p t e r s t z u e r m ö g l i c h e n . U n t e r "bedienen" i s t z u v e r s t e h e n , d a ß d e r Benutzer d u r c h Eingabe von a l p h a n u m e r i s c h e m T e x t o d e r d u r c h B e t ä t i g u n g v o n F u n k tionstasten d i e Anlage z u bestimmten, gewünschten Reaktionen v e r a n l a s s e n k a n n (Kommandos, B e d i e n u n g s a n w e i s u n g e n ) . D ie e i n f a c h s t e n B e d i e n u n g s f u n k t i o n e n s i n d : Eingabe u n d S t a r t v o n Programmen Die E i n g a b e e r f o l g t e n t w e d e r v o n d e n " k l a s s i s c h e n " D a t e n t r ä g e r n , L o c h k a r t e b z w. L o c h s t r e i f e n , . o d e r v o n m a g n e t i s c h e n D a t e n t r ä g e r n w i e M a g n e t b ä n d e r, T r o m m e l - o d e r P l a t t e n s p e i chern. Den T r a n s f e r i n den A r b e i t s s p e i c h e r d e s Rechners b e z e i c h n e t man a l s L a d e n d e s P r o g r a m m s . D i e s e s L a d e n ü b e r nimmt z . B . d a s B e t r i e b s s y s t e m . D i e F u n k t i o n " P r o g r a m m l a den" k a n n b e i d e n v e r s c h i e d e n e n B e t r i e b s s y s t e m e n m i t m e h r oder w e n i g e r B e d i e n u n g s k o m f o r t a u s g e s t a t t e t s e i n . 1 - 12 Einige Betriebssysteme RT1 1 H i e r h a n d e l t e s s i c h um e i n p l a t t e n o r i e n t i e r t e s Einzelbenutzersystem; f ü r d i e Programmentwicklung m i t e i n e r BackgroundF o r e g r o u n d - Ve r s i o n , d i e E c h t z e i t p r o g r a m m e im F o r e g r o u n d u n t e r s t ü t z e n k a n n u n d g l e i c h z e i t i g Programmentwicklung I m " B a c k ground" e r m ö g l i c h t . RSTS/E Ein umfangreiches Ti m e s h a r i n g - B e t r i e b s system f ü r d i e P D P - 11 , d a s s i m u l t a n b i s z u 32 B e n u t z e r b e d i e n e n k a n n . RSX-11 D i e s e Echtzeitbetriebssysteme können zahlreiche Aufgaben g l e i c h z e i t i g ausführen. IAS i e s e s Betriebssystem f i n d e t b e i großen P D P - 11 - K o n f i g u r a t i o n e n E i n s a t z . E s k a n n Ti m e s h a r i n g - , B a t c h - und Echtzeitanwendung geichzeitig fahren. D MUMPS- 11 Ein f l e x i b l e s u n d dynamisches B e t r i e b s system f ü r d e n A u f b a u u n d d i e V e r w a l t u n g von u m f a n g r e i c h e n D a t e n b a n k e n . 1 . 4 . 2 Te s t p r o g r a m m e Für d e n T e s t e i n z e l n e r H a r d w a r e -Komponenten o d e r b e l i e b i g e r System- K o n f i g u r a t i o n e n s t e h e n vom B e t r i e b s s y s t e m u n a b h ä n g i g e Te s t p r o g r a m m e z u r V e r f ü g u n g . S i e e r l e i c h t e r n g a n z entscheidend d i e Fehlersuche und v e r k ü r z e n entsprechend e v. anfallende Reperaturzeiten. O b e r b e g r i f f f ü r Te s t s o f t w a r e : XXDP+ D i a g n o s t i c S o f t w a r e 1 - 13 1.5 D a r s t e l l u n g v o n Z e i c h e n u n d Z i f f e r n Im f o l g e n d e n w i r d d a s Z a h l e n s y s t e m u n d d i e D a r s t e l l u n g v o n Z i f f e r n u n d Z e i c h e n i n e i n e r PDP 1 1 f e s t g e l e g t . 1.5.1 B i t , B y t e , W o r t I n e i n e m Programm k a n n e i n B e n u t z e r B i t s , B y t e s u n d W o r t e d i r e k t ansprechen. Definition: Ein B I T i s t d i e k l e i n s t e ansprechbare E i n h e i t . E i n BYTE b e s t e h t a u s 8 B i t s . E i n WORT b e s t e h t a u s 1 6 B i t s o d e r 2 B y t e s , h i g h B y t e u n d • low Byte. LSB = L e a s t S i g n i f i c a n t B i t - B e z e i c h n u n g f ü r d a s B i t m i t der n i e d r i g s t e n W e r t i g k e i t MSB = M o s t S i g n i f i c a n t B i t - B e z e i c h n u n g f ü r d a s B i t m i t der h ö c h s t e n W e r t i g k e i t Beispiel Byte 0 1 1 1 0 1 1 BIT 7 0 BIT 0 iMSB LSB t Wort 1 0 BIT 1 5 MSB 1 1 h i g h 0 Byte 0 1 0 1 8 0 7 1 1 1 0 low B y t e 1 1 0 0 LSB 1.5.2 Z a h l e n - und Zeichendarstellung Der g e s a m t e Z a h l e n - u n d Z e i c h e n v o r r a t l ä ß t s i c h i n B i t s , Bytes u n d Wo r t e n d a r s t e l l e n . Z u r v e r e i n f a c h t e n S c h r e i b w e i s e werden j e 3 B i t s z u s a m m e n g e f a ß t . A u s d i e s e m G r u n d e r e c h n e t man m i t O k t a l z a h l e n ( 2 i = 8 ) . E i n e OKTALZIFFER i s t a l s o i n 1 B i t s d a r s t e l l b a r . Zahlenbereich e i n e r O k t a l z i f f e r : 0 . . . 7 Buchstaben, Z i f f e r n u n d S o n d e r z e i c h e n l a s s e n s i c h a u c h durch e i n e 7 - B i t K o d i e r u n g d a r s t e l l e n . E i n e s p e z i e l l e Kodierung i s t d e r ASCII-Code. EINHEIT 1 BIT INHALT 0 od. 1 1 BYTE 1WORT 8 Bits 16 B i t s b z w . 2 B y t e s POSITIVER ZAHLEN BEREICH - 0-177,,Q bzw. 0...+12710 0...777778 bzw. 0...+3276710 NEGATIVER ZAHLEN BEREICH - 3778'..2008 bzw. - 11 0 ' . . - 1 2 8 1 0 1777778— .100 0 0 0 3 bzw. - 11 0 — . 3 2 7 6 8 1 0 ASCII - 1A S C I I - Z e i c h e n und e i n Paritätsbit 2 ASCII-Zeichen und j e e i n Paritätsbit N e g a t i v e Z a h l e n w e r d e n i m s o g e n a n n t e n Z w e i e r -Komplement dargestellt. 1 - 15 Beispiele z u r Zahlen- und Zeichendarstellung Byte - Zahlendarstellung 0 1 1 1 1 1 1 1 1778 o d e r + 1 2 7 1 0 0 0 2008 o d e r - 1 2 8 1 0 0 1 1018 A S C I I : A 100 101 +123458 1777778 o d e r - 1 1 0 B i t 7 = Vo r z e i c h e n b i t 1 0 0 0 - Zeichendarstellung 0 1 0 (ASCII) 0 0 0 0 0 Bit 7 = Paritätsbit Wort - Zahlendarstellung 0 001 010 011 B i t 15 = Vo r z e i c h e n b i t . 1 111 111 111 111 111 001 000 001 - Zeichendarstellung 0 100 15 1 4 001 8 7 0 Bit 15 u . B i t 7 : P a r i t ä t s b i t Bits 8...14 : 1 0 2 8 = A S C I I : B Bits 0 . . . 6 : 1 0 1 8 z A S C I I : Anmerkung Man k a n n dem I n h a l t e i n e s S p e i c h e r s n i c h t a n s e h e n , o b Zahlen, A d r e s s e n , B e f e h l e o d e r A S C I I - Z e i c h e n a b g e s p e i c h e r t wurden. D i e s e I n t e r p r e t a t i o n b l e i b t dem P r o g r a m m i e r e r überlassen. 1.5.3 G r a p h i s c h e D a r s t e l l u n g d e r p o s i t i v e n und n e g a t i v e n Zahlen (Zahlenkreis) 1. W o r t f o r m a t 177777 0 0 0 000 POSITIV N E G AT I V 100 000 0 7 7 7 7 7 höchste p o s i t i v e Z a h l : dezimal oktal + 32767 0 77 7 7 7 + 32766 0 77 776 • • • 1 0 00 001 0 0 00 000 1 77 777 2 1 77 776 • höchste n e g a t i v e Zahl: - 32767 1 00 001 - 32768 1 00 000 1 - 17 Arbeitsblatt 1.1 1. W i e g r o ß i s t d e r Z a h l e n b e r e i c h e i n e s B y t e s ( 8 B i t ) ? Benützen S i e H i l f s b l a t t 1 2. G e g e b e n s e i d i e B i t k o m b i n a t i o n 0 1 0 0 0 0 0 1 0 1 0 1 0 I n t e r p r e t i e r e n S i e diese Kombination a l s a) a r i t h m e t i s c h e 1 6 B i t Z a h l b) a r i t h m e t i s c h e 8 B i t Z a h l e n c) A S C I I - Z e i c h e n d) B e f e h l Verwenden S i e H i l f s b l a t t 2 1 - 18 0 1 0 Hilfsblatt 1 NEGATIV POSITIV 1 - 19 Hilfsblatt 2 85 84 8, 82 81 80 r ,,, ,,, ,, 1 , 1 4 of 10 1 4 1 I J I L I I I IU 0 I / 0 0 4 1 1I u 1 LOW BYTE 1 - 20 KAPITEL 2 - SYSTEMAUFBAU 2.1 S y s t e m ü b e r b l i c k 2.2 C P U (Zentraleinheit) 2.2.1 A u f g a b e n 2.2.2 A u f b a u 2.2.3 B e f e h l s a r t e n und Befehlsformate 2.2.4 Arbeitszustände (Major States) 2.3 A d r e s s - u n d S p e i c h e r b e r e i c h 2.3.1 A d r e s s b e r e i c h 2.3.2 R e g i s t e r - und Geräteadressen (I/O-Page) 2.3.3 S p e i c h e r b e r e i c h und I / O Page 2 . 3 . 4 S p e i c h e r o r g a n i s a t i o n (Memory-Mapping) Arbeitsblatt 2.1 2- 1 2.1 S y s t e m ü b e r b l i c k B i l d 2 . 1 g i b t e i n e n g u t e n ü b e r b l i c k ü b e r e i n e System-Konf i g u r a t i o n u n d s t e l l t d i e z e n t r a l e B e d e u t u n g d e s UNIBUS heraus. M i t Ausnahme d e s S p e i c h e r s ( M e m o r y ) k a n n j e d e s G e r ä t d e n UNIBUS a n f o r d e r n ( R e q u e s t ) , u m I n f o r m a t i o n e n z u e i n e m a n deren G e r ä t ( D e v i c e ) z u ü b e r t r a g e n . A l l e G e r ä t e r e g i s t e r Adressen l i e g e n i n d e n o b e r s t e n 4 K d e s a d r e s s i e r b a r e n B e r e i c h s . A u f Grund d i e s e r S t r u k t u r kann d i e Z e n t r a l e i n h e i t (CPU) G e r ä t e r e g i s t e r w i e S p e i c h e r z e l l e n b e h a n d e l n u n d d i e g l e i c h e n B e f e h l e d a r a u f anwenden. Der UNIBUS s t e l l t d i e Ve r b i n d u n g s w e g e f ü r A d r e s s e n , D a t e n und S t e u e r - I n f o r m a t i o n e n f ü r a l l e G e r ä t e i n b i d i r e k t i o n a l e r Richtung h e r. Daraus r e s u l t i e r t , d a ß e i n G e r ä t e r e g i s t e r f ü r E i n - u n d Ausgabe verwendet werden k a n n . Die G e r ä t e - K o m m u n i k a t i o n ü b e r d e n UNIBUS e r f o l g t n a c h e i n e m s o g e n a n n t e n "MASTER-SLAVE" ( H e r r u n d S k l a v e ) - P r i n z i p . Z u m Z e i t p u n k t e i n e r BUS- O p e r a t i o n h a t e i n Gerät d i e K o n t r o l l e ü b e r d e n BUS. D i e s e s G e r ä t - a l s "MASTER" b e z e i c h n e t - k o n t r o l l i e r t d e n BUS, w e n n e s m i t e i n e m a n d e r e n G e r ä t - a l s "SLAVE" b e z e i c h n e t - i n V e r b i n d u n g t r i t t . Das o . g . P r i n z i p i s t d y n a m i s c h : S o k a n n z . B . d i e Z e n t r a l e i n h e i t a l s M a s t e r S t e u e r - I n f o r m a t i o n e n z u r P l a t t e ( S L AV E ) s c h i c k e n , d i e d a n n w i e d e r u m d e n BUS ü b e r w a c h t ( a l s MASTER), wenn s i e m i t d e m S p e i c h e r i n V e r b i n d u n g t r i t t . Der UNIBUS w i r d v o n d e r Z e n t r a l e i n h e i t u n d v o n a l l e n a n deren G e r ä t e n v e r w e n d e t . E i n e P r i o r i t ä t s - S t r u k t u r e n t s c h e i d e t , w e l c h e s G e r ä t d i e K o n t r o l l e ü b e r d e n BUS b e k o m m t . S o m i t i s t a l s o j e d e m G e r ä t , w e l c h e s M a s t e r f ü r d e n BUS w e r d e n kann, e i n e g e w i s s e P r i o r i t ä t z u g e o r d n e t . Wenn z w e i G e r ä t e z u r g l e i c h e n Z e i t n a c h dem BUS v e r l a n g e n , ü b e r n i m m t d a s G e r ä t m i t d e r höheren P r i o r i t ä t d i e K o n t r o l l e . D i e K o m m u n i k a t i o n z w e i e r G e r ä t e w i r d n a c h dem s o g e n a n n t e n " h a n d s h a k i n g " - Ve r f a h r e n d u r c h g e f ü h r t : F ü r j e d e s v o m M a s t e r gesendete S t e u e r - S i g n a l w i r d vom S l a v e e i n e R ü c k a n t w o r t g e geben. D a d u r c h i s t d i e K o m m u n i k a t i o n u n a b h ä n g i g v o n d e r BUSLänge o d e r d e r G e s c h w i n d i g k e i t , m i t d e r e i n G e r ä t a r beitet. 2- 3 UNIBUS ADRESS-BUS A D R E S S DATEN-BUS STEUER-BUS TERMINATOR \7 V V ADRESS- RECHEN- B U S REGISTER WERK STEUERUNG (DATA PATH) DATENREGISTER AD OE ADRESS- SPEICHERZELLEN DEKOD. f SCHREIB-ILESELOGIK ZENTRALEINHEIT (CPU) A R B E I T S S P E I C H E R IN R S R E X T E R N 2.2 C P U (Zentraleinheit) 2.2.1 A u f g a b e n Die CPU f ü h r t a l l e v o m S y s t e m v e r l a n g t e n a r i t h m e t i s c h e n u n d logischen Operationen durch und v e r a r b e i t e t e i n e große A n z a h l v o n S p r u n g - u n d Te s t b e f e h l e n ( I n s t r u k t i o n s - D e c o r d e r , ALU, P r o z e s s o r - S t a t u s w o r t - P S W ) W e i t e r h i n e n t s c h e i d e t s i e , w e r d i e UNIBUS- K o n t r o l l e ü b e r nehmen s o l l u n d ü b e r t r ä g t d i e s e K o n t r o l l e d a n n dem G e r ä t m i t d e r h ö c h s t e n P r i o r i t ä t (UNIBUS- I n t e r f a c e u n d S t e u e r u n g ) 2.2.2 A u f b a u ( B i l d 2.2) 1. U n i b u s - I n t e r f a c e Das UNIBUS- I n t e r f a c e s o r g t f ü r d i e A n p a s s u n g d e s P r o z e s s o r an d e n UNIBUS. A l l e S i g n a l e w e r d e n m i t BUS- T r e i b e r n a u f d e n BUS g e g e b e n b z w . m i t BUS- E m p f ä n g e r n v o m BUS a b g e g r i f f e n . F e r n e r s o r g t d a s UNIBUS- I n t e r f a c e f ü r d i e z e i t l i c h e S t e u e r u n g ( T i m i n g ) a l l e r BUS- S i g n a l e . 2. D a t a P a t h ( R e c h e n w e r k ) Im D a t a P a t h f i n d e t d i e V e r a r b e i t u n g d e r D a t e n s t a t t . Das K e r n s t ü c k i s t d i e A r i t h m e t i k E i n h e i t ( A r i t h m e t i k L o g i c Unit, ALU). D i e R e g i s t e r RO b i s R 7 ( G e n e r a l P u r p o s e R e g i s t e r , GPR) s t e h e n dem B e n u t z e r z u r V e r f ü g u n g u n d h a b e n zusammen m i t w e i t e r e n 8 i n t e r n e n R e g i s t e r n (R10 . b i s R17) Zugang z u r ALU. D ie ALU g r e i f t , e n t s p r e c h e n d d e m a u s z u f ü h r e n d e n B e f e h l , a u f diese R e g i s t e r z u und verwendet s i e a l s Rechenregister (AKKU), D a t e n z w i s c h e n s p e i c h e r o d e r A d r e s s r e g i s t e r . R e g i s t e r R7 w i r d a l s Programmzähler f ü r d i e Maschine v e r wendet ( a u c h PC:Programm C o u n t e r g e n a n n t ) . D e r PC b e i n h a l t e t d i e Adresse des nächsten auszuführenden Befehls. E s h a n d e l t s i c h b e i R 7 a l s o a u c h um e i n g e n e r e l l e s R e g i s t e r , das j e d o c h n u r f ü r A d r e s s i e r u n g , n i c h t a b e r a l s A k k u m u l a t o r oder f ü r s o n s t i g e O p e r a t i o n e n v e r w e n d e t w i r d . Das R e g i s t e r R 6 w i r d n o r m a l e r w e i s e a l s S t a c k - P o i n t e r v e r wendet u n d z e i g t a u f d e n l e t z t e n E i n t r a g i m z u g e h ö r i g e n Stack ( s i e h e d a z u K a p i t e l 4 . 3 ) . 2 5 9 MICRO CONTROL LOGIC PROCESSOR STATUS 1-REGISTER D A T A PATH B -REGISTER U N I B U S C REGISTER R0R 1 7 --> MICROPROGRAMM V. V B PSW A ALU ( RECHENWERK ) A 00:17 * IN DATA CONTROLLSIGNALS V ALU MULTIPLEXER DATA 00:15 (T E 3. M i c r o C o n t r o l L o g i c ( S t e u e r l o g i k ) Diese L o g i k b e s t e h t i m w e s e n t l i c h e n a u s e i n e m I n s t r u k t i o n s r e g i s t e r ( I - R e g i s t e r, I R ) welches den j e w e i l s a k t u e l l e n Bef e h l b e i n h a l t e t u n d dem I n s t r u k t i o n s d e c o d e r ( M i c r o C o n t r o l Unit) d e r d i e z u r Ausführung des Befehls notwendigen Steuersignale erzeugt. Diese Einheit s t e l l t praktisch einen Mikroprozessor d a r, w e l c h e r z u r Abarbeitung eines B e f e h l s e i n Mikroprogramm s t a r t e t . 4. P r o z e s s o r - S t a t u s w o r t (PSW) Das PSW i s t e i n C P U - i n t e r n e s R e g i s t e r w e l c h e s m i t d e r Adresse 7 7 7 7 7 6 a n s p r e c h b a r i s t ( b e i L S I 1 1 / 0 3 n u r m i t 2 speziellen Befehlen). Es b e i n h a l t e t I n f o r m a t i o n e n ü b e r d e n Z u s t a n d d e s g e r a d e laufenden Programms, i m besonderen ü b e r d i e A r t d e s E r g e b nisses des z u l e t z t ausgeführten Befehls. 87 15 PRIORITÄT 5 14 3 2 1 0 T N Z V C 777 7 7 6 Priorität D i e B i t s 5 . . . 7 geben d i e P r i o r i t ä t des gerade l a u f e n d e n Programms a n ( S o f t w a r e - P r i o r i t ä t ) . Sie k a n n vom P r o g r a m m i e r e r f r e i z w i s c h e n 0 . . . 7 gewählt werden. Sie i s t z u u n t e r s c h e i d e n v o n d e n HardwarePrioritäten ( v e r t i k a l , h o r i z o n t a l ) welche einmal f e s t g e l e g t und i . a . b e i b e h a l t e n werden (siehe Kap. 4 . 3 . 3 ) T B i t 4 , T r a c e T r a p , k a n n p e r Programm g e s ä t z t werden u n d e r z w i n g t n a c h j e d e m B e f e h l e i n e n Tr a p n a c h 1 4 N B i t 3 , N e g a t i v, w i r d a u t o m a t i s c h g e s e t z t wenn das E r g e b n i s d e s l e t z t e n B e f e h l s n e g a t i v w a r Z B i t 2 , Z e r o , w i r d a u t o m a t i s c h g e s e t z t wenn d a s Ergebnis des l e t z t e n B e f e h l s n u l l w a r V B i t 1 , O v e r f l o w, w i r d automatisch g e s e t z t b e i arithmetischem ü b e r l a u f ( s i e h e Zahlenkreis Kap. 1 . 5 . 3 ) , e b e n s o b e i C a r r y C B i t 0 , C a r r y, w i r d automatisch g e s e t z t b e i physikalischem ü b e r l a u f v o n B i t 1 5 b z w. B i t 7 (siehe Kap. 4 . 2 . 2 ) 2 - 7 2.2.3 B e f e h l s a r t e n und Befehlsformate 1. B e f e h l s a r t e n D i e I n s t r u k t i o n e n d e s PDP-11 B e f e h l s s a t z e s w e r d e n i n v e r schiedene Gruppen e i n g e t e i l t . D i e e i n z e l n e n B e f e h l s a r t e n unterscheiden s i c h durch i h r e n Aufbau. P D P - 11 - I n s t r u k t i o n e n s i n d i n 4 G r u p p e n e i n g e t e i l t : 1. S i n g l e - O p e r a n d - B e f e h l e 2. D o u b l e - O p e r a n d - B e f e h l e 3. V e r z w e i g u n g s b e f e h l e - Branch - Jump - Jump t o Subroutine - Trap 4. S o n s t i g e - Condition-Code-Befehle - e i n i g e Spezial-Befehle Gruppe 3 u n d 4 w e r d e n i n K a p t e l 4 b e s p r o c h e n . 2- 8 2. B e f e h l s f o r m a t e Allgemeiner Befehlsaufbau Da e s n i c h t m ö g l i c h i s t i n e i n e m W o r t e i n e n B e f e h l u n d d i e dazugehörigen Operanden u n t e r z u b r i n g e n , w i r d d e r B e f e h l i n einen Operationscode u n d Angaben d a r ü b e r, w o d i e Operanden zu f i n d e n s i n d , a u f g e t e i l t . Operation Code Angaben ü b e r Operanden Instruktionen bestehen a l s o aus: 1. O p -Code Maschinencode f ü r d e n B e f e h l 2. A n g a b e n ü b e r d i e O p e r a n d e n Hier w i r d angegeben a) E i n e s d e r R e g i s t e r R O . . . R 7 b) A n g a b e w i e d a s R e g i s t e r i n t e r p r e t i e r t w e r d e n s o l l (=Adressierungsart, Adressierungs-Mode) Anmerkung: D i e A d r e s s i e r u n g s a r t e n w e r d e n i n K a p i t e l 3 ausführlich behandelt 2- 9 Aufbau v o n S i n g l e - O p e r a n d - B e f e h l e n Diese B e f e h l e b e e i n f l u s s e n n u r e i n e n Operanden, D e s t i n a t i o n (Zieloperand). Op -Code a) D e s t i n a t i o n - R e g i s t e r und b) A d r e s s i e r u n g s a r t 15 6 5 Ein S i n g l e -Operand- B e f e h l b e s t e h t aus: 1. Op-Code-Bits 6 . . . 1 5 2. a) D e s t i n a t i o n - R e g i s t e r B i t s 0 . . . 2 (CPU-Reg. R O . . . R 7 ) b) A d r e s s i e r u n g s a r t B i t s 3 . . . 5 Beispiel: C L R R3 ( L ö s c h e d a s R e g i s t e r 3 ) a) R 3 b) A d r e s s i e r u n g s a r t 0 0 5 0 3 0 Op-Code f ü r CLR 9 - In Aufbau v o n D o u b l e - O p e r a n d B e f e h l e n Diese B e f e h l e b e e i n f l u s s e n z w e i Operanden, S o u r c e ( Q u e l l o p e r a n d ) und D e s t i n a t i o n ( Z i e l o p e r a n d ) . OpCode a) S o u r c e - R e g i s t e r und b) A d r e s s i e r u n g s a r t 15 1 2 11 a) D e s t i n a t i o n - R e g i s t e r und b) A d r e s s i e r u n g s a r t 6 5 0 Ein D o u b l e -Operand- B e f e h l b e s t e h t a u s : 1. O p - C o d e - B i t s 1 2 - 1 5 2. a ) S o u r c e - R e g i s t e r B i t s 6 . . . 8 ( R O . . . R 7 ) b) A d r e s s i e r u n g s a r t B i t s 9 . . . 1 1 3• a ) D e s t i n a t i o n - R e g i s t e r B i t s 0 . . . 2 ( R 0 . . . R 7 ) b) A d r e s s i e r u n g s a r t B i t s 3 . . . 5 Beispiel: M O V R1, R5 ( ü b e r t r a g e den I n h a l t des Registers 1 i n s R e g i s t e r 5 ) a) R 1 a ) R5 b) A d r . a r t 0 b ) A d r . a r t 0 15 0 1 0 1 0 5 Op-Code f ü r MOV (oktale Darstellung) 2 - 11 2.2.4 A r b e i t s z u s t ä n d e (Major States) D e r. P r o z e s s o r k e n n t 5 A r b e i t s z u s t ä n d e , g e n a n n t " M a j o r Stetes". j e d e I n s t r u k t i o n durchläuft b e i seiner Ausführung i n d e r CPU e i n i g e ( o d e r a l l e ) d i e s e r Z u s t ä n d e , B i l d 2 . 3 . 1. F e t c h Nach A b a r b e i t u n g d e r v o r a n g e g a n g e n e n - I n s t r u k t i o n s c h a l t e t der P r o z e s s o r i n d e n F e t c h - M a j o r S t a t e . D i e n e u e I n s t r u k t i o n w i r d a u s dem A r b e i t s s p e i c h e r - g e l e s e n , i n d a s I n s t r u k t i o n s r e g i s t e r geladen und d e k o d i e r t . Von h i e r w i r d d i e Zentraleinheit i n einen der nachfolgenden Arbeitszustände v e r s e t z t . V o r h e r w i r d n o c h d e r PC ( = P r o g r a m m C o u n t e r ) u m 2 erhöht! 2. S o u r c e Wurde v o m I n s t r u k t i o n s - D e k o r d e r e i n e " D o p p e l - O p e r a n d - I n struktion" erkannt, s o schaltet der Prozessor i n den .Source-Major S t a t e . D e r Source-Operand w i r d e r m i t t e l t . (z. B . ' H o l e n d e s Source-Operanden a u s dem S p e i c h e r ) . 3. D e s t i n a t i o n . Nach A u s f ü h r u n g d e s S o u r c e - S t a t e s , b z w . b e i < 3 i n g l e - O p e r a n d I n s t r u k t i o n e n n a c h dem F e t c h - S t a t t g e h t d e r P r o z e s s o r i n den D e s t i n a t i o n - S t a t e . D e r D e s t i n a t i o n - O p e r a n d w i r d e r m i t telt. 4. E x e c u t e Sind d e r D e s t i n a t i o n -Operand b z w. S o u r c e - u n d D e s t i n a t i o n Operand e r m i t t e l t ( d . h . s i e b e f i n d e n s i c h i n d e r C P U ) , kenn d e r B e f e h l a u s g e f ü h r t w e r d e n . 5. S e r v i c e Bevor d e r n i c h s t e B e f e h l a u s dem S p e i c h e r 7 s h o l t w i r d , s c h a l t e t d i e CPU i n d e n S e r v i c e - M a j o r - S t e t e . H i e r w i r d d a s Prozessorstatuswort " a k t u a l i s i e r t " (vom Ergebnis des Befehls abhängig), eventuell vorliegende Interruptwünsche und Traps k ö n n e n j e t z t ( u n d n u r j e t z t ) b e d i e n t w e r d e n , u n d f a l l s d i e H a l t - Ta s t e g e d r ü c k t w u r d e s o b l e i b t d i e CPU j e t z t stehen. 12 FETCH SOURCE DESTIN. /ERROR EXECUTE SERVICE Bild 2.3 Arbeitszustände (Major Stetes) 2 - 13 Beispiel Ausführung e i n e s Doppel -Operand- B e f e h l s , w o b e i b e i d e Operanden u n d das E r g e b n i s i m S p e i c h e r s t e h e n s o l l e n ( z . B . ADD A , B ) VORGANG BESCHREIBUNG DIAGRAMM FETCH Holen d e r I n s t r u k t i o n . a u f d i e d e r PC z e i g t , i n d i e CPU ( I R ) ; e r höhen d e s PC u m 2 ; dekodieren UNIBUS -----e. IR REG ' ___ j : PC Instruktion 1.Operand 2.0perand CPU SPEICHER UNIBUS \ -.......„„\\ Holen d e s 1 . Operanden (Source-Operand) i n d i e CPU ( i n t . R e g . ) ; erhöhen d e s PC u m 2 . SOURCE I n: M\ M i o n REG •. 1.Operand 2.0perand r - - - - . - - i j PC CPU SPEICHER _ • 111111131.111111.11111111111ECEM 11111 Holen d e s 2 . Operanden ( D e s t i n a t i o n -Operand) i n d i e CPU ( i n t . R e g . ) DESTINATION 111111111111 REGummiemm . '• PC - IMEMEMMI tOpemmd 2.0peand SPEICHER CPU UNIBUS EXECUTE • Ausführung d e r I n s t r u k t i o n gemäß B e fehls code; Abspeichern des Ergebnisses. Instruktion tOperand Ergebnis Nächste Instruk PC CPU SERVICE S P E I C H E Prozessor- S t a t u s w o r t s e t z e n ; A b f r a g e nach I n t e r r u p t , Tr a p o d e r H a l t - Ta s t e u n d g g f . S p r u n g i n s B e d i e n u n g s programm. " N o r m a l f a l l " : H o l e n d e r n ä c h s t e n I n s t r u k t i o n (Fetch) 2 - 14 R . 2.3 A d r e s s - u n d S p e i c h e r b e r e i c h Die K a p a z i t d t e i n e s S p e i c h e r s w i r d i n x K - W o r t e n o d e r i n x K - B y t e s a n g e g e b e n ( 1 K ;".. F a k t o r 1 0 2 4 ) . D a man i n d e r PDP 11 s o w o h l m i t W o r t - , a l s a u c h m i t B y t e - A d r e s s i e r u n g a r b e i t e t , muß jedem B y t e e i n S p e i c h e r p l a t z z u g e o r d n e t werden. Durch d i e A n o r d ü n g : • H i g h - u n d L o w b y t e i n e i n e m W o r t e r g e b e n sich gerade Adressen f ü r Worte und Lowbytes, s o w i e ungerade Adressen f ü r H i g h b y t e s . 2.3.1 A d r e s s b e r e i c h e 16- B i t A d r e s s e n : Mit 1 6 - B i t -Adressen können 32K Worte a d r e s s i e r t werden ( 6 4 k Bytes) Davon s i n d 28K f ü r d i e Programmierung z u g ä n g l i c h ( A r b e i t s s p e i c h e r b e r e i c h ) u n d d i e r e s t l i c h e n , o b e r s t e n 4K s i n d r e s e r v i e r t f ü r I / O - D e v i c e r e g i s t e r u n d C P U - R e g i s t e r, wie PSW u n d G P R ' s . ( I / O - P a g e ) Mit 16 B i t können d i e o k t a l e n Zahlen von 0 b i s 177 7778 g e b i l d e t werden d . h . : 2 0 0 0008 v e r s c h . Adressen s i n d m ö g l i c h Dezimal a u s g e d r ü c k t : 6 5 5 3 6 1 0 o d e r 64K A d r e s s e n 18- B i t A d r e s s e n : M i t 1 8 - B i t - A d r e s s e n , d i e m a n u n t e r Ve r w e n d u n g e i n e r " M e mory-Management"-Einrichtung erzeugen kann, i s t e s m ö g l i c h 128K W o r t e ( 2 5 6 K B y t e s ) z u a d r e s s i e r e n . Mit 18 B i t können d i e o k t a l e n Zahlen v o n 0• bis 777 7778 g e b i l d e t w e r d e n d . h . : 1 0 0 0 000Q v e r s c h . A d r e s s e n s i n d möglich. D e z i m a l s i n d d i e s 2 6 2 1 4 4 b z w. 256K A d r e s s e n . 22- B i t - A d r e s s e n ( n u r 1 1 / 4 4 u n d 1 1 / 7 0 ) H i e r e r r e i c h t man e i n e n A d r e s s b e r e i c h v o n 2048K W o r t e n 2 - 15 2.3.2 R e g i s t e r - und Geräteadressen (I/O-Page) A l l e Adressen a b 160000 werden n i c h t z u r A d r e s s i e r u n g d e s Arbeitsspeichers verwendet. S i e s i n d r e s e r v i e r t f ü r d i e Reg i s t e r d e r CPU u n d f ü r e x t e r n e G e r ä t e b z w . d e r e n I n t e r f a c e Module ( I / O - P a g e ) Da d e r UNIBUS ü b e r 1 8 A d r . L e i t u n g e n v e r f ü g t , d i e CPU a b e r nur 1 6 B i t A d r e s s e n v e r a r b e i t e n k a n n (Ausnahme: Memory Management), w e r d e n d i e B i t s 1 6 u n d 1 7 d e r A d r e s s e p e r Hardware w i e f o l g t e r z e u g t : Bit 17 1 6 1 15 1 1 4 1 13 1 1 2 1 X 11 1 0 X 6 9 X X X X X 5 4 X 3 X X 2 i X 0 X X = 0 oder 1 Das b e d e u t e t : B e i a l l e n A d r e s s e n v o n 1 6 0 0 0 0 b i s 1 7 7 7 7 7 8 (rs. I / O P a g e ) i s t d a s UND- G a t t e r e r f ü l l t ( a l l e E i n g . = " 1 f i u n d d i e t a t s ä c h l i c h ( p h y s i k a l i s c h ) a u f dem A d r e s s b u s e n t s t e h e n d e n Adressen d e r I / O - P a g e l i e g e n z w i s c h e n 7 6 0 0 0 0 8 u n d 7 7 7 7 7 7 8 B e i s p i e l : a ) I n e i n e m Programm w i r d d i e A d r e s s e 1 0 0 0 ( = v i r t u e l l e A d r e s s e ) v e r w e n d e t . A u f dem Adressbus e n s t e h t e b e n f a l l s 1 0 0 0 ( = p h y s . A d r e s s e ) , d a d a s UND- G a t t e r n i c h t e r f ü l l t i s t . Mit d i e s e r Adresse w i r d e i n e Arbeitsspeicherz e l l e angesprochen. b) I n e i n e m Programm w i r d d i e A d r e s s e 1 7 7 5 6 6 ( = v i r t u e l l e A d r e s s e ) v e r w e n d e t , d a s UND- G a t t e r i s t e r f ü l l t d . h . e s e n t s t e h t a u f dem A d r e s s bus 7 7 7 5 6 6 ( = P h y s . A d r e s s e ) . D a m i t w i r d d e r Printer- B u ff e r des Consol-Interface angesprochen. 2 - 16 X 2.3.3 S p e i c h e r b e r e i c h und I/O-Page PSW 1 1 7 77 7 6 1 1 17 7 7 0 3 32K R3 1/0-PAGE Adressen für CPU-Register Geräte-Register Bootprogramme ( virtuell !) trodr TBUF (Printer Buffer) ••••• 1 1 ews, e r, 16 0 0 0 0 15 7 7 7 6 28K1 SPEICHERBEREICH < 1 177.566 241 14 0 0 0 0 13 7 7 7 6 20K 1 12 0 0 0 0 11 7 7 7 6 16K 10 0 0 0 0 077 7 7 6 12K 06 0 0 0 0 05 7 7 7 6 1 04 00 0 0 03 7 7 7 6 8K 02 0 0 0 0 01 7 7 7 6 4K 1 1 00 0 0 0 4 00 0 0 0 2 00 0 0 0 0 HIGH BYTE L O W BYTE Bild 2.4 2 - 17 Anmerkung z u B i l d 2 . 4 1. D i e a n g e g e b e n e n ( g r a d z a h l i g e n ) A d r e s s e n b e z i e h e n s i c h bei W o r t z u g r i f f a u f das ganze Wort, b e i B y t e z u g r i f f a u f das L o w - B y t e . B e i B y t e z u g r i f f a u f d a s H i g h - B y t e muß d i e e n t s p r e c h e n d e ungradzahlige A d r e s s e angegeben werden. 2. W i e i n K a p . 2 . 3 . 2 d a r g e s t e l l t , l i e g t d e r v i r t u e l l e B e r e i c h von 160 000 b i s 177 776 p h y s i k a l i s c h b e i 776 000 bis 777 776. I m Bereich 0 b i s 157 77 s i n d d i e v i r t u e l l e n Adressen i d e n t i s c h z u d e n p h y s i k a l i s c h e n ( o h n e Memory Management!) 3. G e d a n k e n s t ü t z e : 4K W o r t e e n t s p r e c h e n 2 0 0 0 0 A d r e s s e n 16K W o r t e e n t s p r e c h e n 1 0 0 0 d 0 8 A d f . e s s e n 2 - 18 2 . 3 . 4 S p e i c h e r o r g a n i s a t i o n (Memory Mapping) Einige Bereiche i m A r b e i t s s p e i c h e r werden n i c h t f ü r d i e f r e i e Programmierung verwendet, s o n d e r n s i n d f ü r s p e z i e l l e Zwecke r e s e r v i e r t . ( B i l d 2 . 5 ) 1. B e r e i c h d e r T R A P - Ve k t o r e n Ve r s c h i e d e n e F e h l e r i m Programm o d e r i m S y s t e m b e w i r k e n e i nen T R A P. D i e s i s t e i n e ( P r o g r a m m - ) U n t e r b r e c h u n g d i e z u r Folge h a t , d a ß a u t o m a t i s c h e i n e ( f ü r j e d e n F e h l e r d e f i n i e r te) Adresse i m Bereich zwischen 0 u . 4002 a u f den Adressbus ausgegeben w i r d ( = V e k t o r ) . U n t e r d i e s e m V e k t o r f i n d e t d e r Prozessor e i n e S t a r t a d r e s s e f ü r e i n e F e h l e r r o u t i n e . 2. B e r e i c h d e r INTERRUPT - V e k t o r e n Der o b e n g e n a n n t e A d r e s s b e r e i c h w i r d e b e n f a l l s a u t o m a t i s c h angewählt, wenn e i n P e r i p h e r i e g e r ä t e i n e Unterbrechung des Hauptprogrammes v e r u r s a c h t . D a s G e r ä t s e n d e t s e l b s t s e i n e n I n t e r r u p t - Ve k t o r m i t dessen H i l f e d e r Prozessor d i e S t a r t adresse d e r I n t e r r u p t r o u t i n e f i n d e t . 3. B e r e i c h d e s Hardware-STACK Der B e r e i c h v o n A d r e s s e 4 0 0 3 ( S TA C K L I M I T ) b i s z u r n i e d r i g s t e n v o m Programm b e n u t z t e n A d r e s s e ( z . B . 1 0 0 0 8 ) k a n n a l s STACK b e n u t z t w e r d e n . D i e B e n u t z u n g d i e s e s B e r e i c h s w i r d i n den K a p i t e l n Ü b e r I n t e r r u p t - u n d U n t e r p r o g r a m m i e r u n g e r l ä u t e r t ( a b Kap. 4 . 3 ) . 2 - 19 Memory-Mapping 157776 PROGRAMME 1000 (z.B.) STACK 400 TRAP-U. INTERRUPTVEKTOREN 0 Bild 2.5 9 - 911 Arbeitsblatt 2.1 1. N a c h w e l c h e m P r i n z i p e r f o l g t d i e K o m m u n i k a t i o n a u f dem UNIBUS? 2. K a n n d e r A r b e i t s s p e i c h e r d e n UNIBUS a n f o r d e r n ? 3. N e n n e n S i e d i e 4 H a u p t b e s t a n d t e i l e d e r CPU! 4. N e n n e n S i e d i e • 4 G r u p p e n d e r P D P 11 - B e f e h l e ! 5. S k i z z i e r e n S i e d e n A u f b a u e i n e s D o u b l e - O p e r a n d - B e f e h l s ! 6. W i e h e i ß e n d i e A r b e i t s z u s t ä n d e d e r CPU? 7. a ) W i e h e i ß e n d i e o b e r s t e n 4 K d e s A d r e s s b e r e i c h e s ? b) K ö n n e n i n d i e s e m B e r e i c h A r b e i t s s p e i c h e r z e l l e n liegen? c) B e i w e l c h e r A d r e s s e ( p h y s i k a l i s c h u n d v i r t u e l l ) beginnt d i e s e r Bereich? 8. I n w e l c h e m B e r e i c h l i e g e n d i e V e k t o r a d r e s s e n u n d d e r STACK? 9. W i e g r o ß i s t d i e k l e i n s t e a d r e s s i e r b a r e _ E i n h e i t i m Arbeitsspeicher? 2 - 21 KAPITEL 3 - ADRESSIERUNGSARTEN 3.1 E i n f ü h r u n g 3 . 2 B a s i c Modes 3 . 2 . 1 M o d e 0 , R e g i s t e r Mode 3 . 2 . 2 M o d e 1 , R e g i s t e r D e f e r r e d Mode 3 . 2 . 3 M o d e 2 , A u t o i n c r e m e n t Mode 3 . 2 . 4 M o d e 3 , A u t o i n c r e m e n t D e f e r r e d Mode 3 . 2 . 5 M o d e 4 , A u t o d e c r e m e n t Mode 3 . 2 . 6 M o d e 5 , A u t o d e c r e m e n t D e f e r r e d Mode 3 . 2 . 7 M o d e 6 , I n d e x Mode 3 . 2 . 8 M o d e 7 , I n d e x D e f e r r e d Mode 3.3 P C Modes 3 . 3 . 1 M o d e 2 / R e g . 7 , I m m e d i a t e Mode 3 . 3 . 2 M o d e 3 / R e g . 7 , A b s o l u t e Mode 3 . 3 . 3 M o d e 6 / R e g . 7 , R e l a t i v e Mode 3 . 3 . 4 M o d e 7 / R e g . 7 , R e l a t i v e D e f e r r e d Mode Arbeitsblätter 3.1, 3.2 3- 1 3.1. E i n f ü h r u n g A l s E i n f ü h r u n g i n d a s K a p i t e l ADRESSIERUNGSARTEN s o l l h i e r zunächst e i n i g e s a u s f r ü h e r e n K a p i t e l n zusammengefaßt w e r den: D ie D a t e n i m A r b e i t s s p e i c h e r w e r d e n m i t H i l f e v o n Befehlen ( I n s t r u k t i o n e n ) v e r a r b e i t e t . E i n e PDP 1 1 - I n s t r u k t i o n e n t h ä l t g e w ö h n l i c h : 1. D i e A r t d e r V e r a r b e i t u n g ( A D D , MOV u s w . ) , a l s o den O p e r a t i o n s c o d e . 2. D a s C P U - R e g i s t e r , w e l c h e s d e n S o u r c e - O p e r a n d e n oder d e s s e n A d r e s s e , u n d / o d e r d a s CPU-Regis t e r, w e l c h e s d e n D e s t i n a t i o n -Operanden o d e r dessen A d r e s s e e n t h ä l t . 3. D i e A d r e s s i e r u n g s a r t , d . h . w i e d i e a n g e g e b e n e n Register zu i n t e r p r e t i e r e n s i n d . Abhängig v o n d e r A d r e s s i e r u n g s a r t k ö n n e n d i e C P U Register w i e f o l g t verwendet werden: 1. A l s A k k u m u l a t o r , u m d i e D a t e n d i r e k t i m R e g i s t e r zu v e r a r b e i t e n , d . h . d e r I n h a l t d e s R e g i s t e r s i s t d e r Operand s e l b s t . 2. A l s Z e i g e r a u f e i n e n O p e r a n d e n , d . h . d e r I n h a l t des R e g i s t e r s i s t d i e A d r e s s e d e s O p e r a n d e n . 3. A l s a u t o m a t i s c h e r Z e i g e r , d e r n a c h j e d e r B e n u t zung a u t o m a t i s c h e r h ö h t o d e r e r n i e d r i g t w i r d . 4. A l s I n d e x r e g i s t e r , w o b e i d e r I n h a l t d e s R e g . u n d das n ä c h s t e , a u f d e n B e f e h l f o l g e n d e W o r t a d d i e r t w e r d e n . D i e Summe s t e l l t d i e A d r e s s e d e s Operanden d a r . D i e s w i r d h a u p t s ä c h l i c h f ü r v a r i able L i s t e n verwendet. 3 3 Aufbau v o n S i n g l e - u n d D o u b l e - O p e r a n d - B e f e h l e n SINGLE O P E R A N D - B E F E H L 15 6 1 1 L 1 1 1 1 ) 1 1 1 5 3 0 2 1 1 1 1 LIIM.B.M.MM•••••••••1111MMI.) ILMINMM•MMMOINIMM...11 OP-CODE MODE R n Mode Beispiel: CLR (R 0) 0 DD D E S T I N AT I O N ADDRESS 5 0 1 0 OP-Code Register DOUBLE O P E R A N D - B E F E H L 15 1 1 1 2 1 1 8 9 1 6 1 1 1 1 MODE OP-CODE R n M 2 3 5 0 1 1 ‘..mIlm1Mm•••1••••••./ 1 1 O n D E R • 1 SS SOURCE ADDRESS DD D E S T I N AT I O N ADDRESS Mode Mode MOV R1.R 2 0 1 0 1 0 2 t OP-Code Register Register Die A d r e s s i e r u n g s a r t e n ( A d r e s s i n g Modes) w e r d e n i n 2 Gruppen e i n g e t e i l t : 1. B a s i c M o d e s : v e r w e n d e t w e r d e n d i e R e g i s t e r R O . . . R 6 2. P C M o d e s : v e r w e n d e t w i r d d a s R e g i s t e r R 7 ( = P C ) 3 4 3.2 B a s i c Modes 3 . 2 . 1 M o d e 0 , R e g i s t e r Mode Der I n h a l t d e s R e g i s t e r s i s t d e r :Operand. D i e s e r Mode e r m ö g l i c h t s c h e l l s t e n Z u g r i f f z u d e n D a t e n , d a d e r Weg ü b e r den U n i b u s e n t f ä l l t . ( I R = I n s t r u k t i o n s r e g i s t e r ) Symbol: R n o d e r %n n = 0...7 CPU IR OPCODE SOURCE Model R n ARBEITSSPEICHER D E S T I N AT I O N Mode R n (Kein D a k u z u g r i f f a u f A r b e i t s s p e i c h e r ) OPERAND B e i s p i e l e f ü r Mode 0 symbolisch o k t a l e r Code B e d e u t u n g 1. I N C RO 0 0 5 2 0 0 E 2. ADD R 1 , R 2 0 6 0 1 0 2 3 r h ö h e A d d i e r e 5 R e g i s t e r RO u m 1 R1 z u R 2 3 . 2 . 2 M o d e 1 , R e g i s t e r D e f e r r e d Mode Das R e g i s t e r e n t h ä l t d i e A d r e s s e e i n e s O p e r a n d e n , d e r entweder i m A r b e i t s s p e i c h e r o d e r i n e i n e m I / O - R e g i s t e r z u finden i s t . Anders ausgedrückt: D e r I n h a l t des Registers z e i g t a u f d e n Operanden. Symbol: ( R n ) n = 0...6 ARBEITSSPEICHER CPU IR Rn.413.- OPCODE SOURCE Mode l R n DESTINATION Mode I R n OPERAND ADRESSE B e i s p i e l e f ü r Mode 1 symbolisch o k t a l e r Code B e d e u t u n g 1. MOV R 1 , ( R 4 ) 0 1 0 1 1 4 Lade I n h a l t v o n R1 i n die S p e i c h e r z e l l e a u f d i e R4 z e i g t 2. MOV ( R 1 ) , ( R 4 ) 0 1 1 1 1 4 Lade I n h a l t d e r S p e i c h e r z e l l e a u f d i e R1 zeigt i n die Speicherz e l l e a u f d i e R4 z e i g t 3 6 3 . 2 . 3 M o d e 2 , A u t o i n c r e m e n t Mode Der I n h a l t d e s R e g i s t e r s i s t d i e A d r e s s e e i n e s O p e r a n d e n . D i e s e A d r e s s e w i r d n a c h A u s f ü h r u n g d e r O p e r a t i o n um 1 b e i B y t e - u n d um 2 b e i W o r t - I n s t r u k t i o n e n e r h ö h t . D i e s e r Mode e r m ö g l i c h t d a s a u t o m a t i s c h e A b a r b e i t e n v o n Listen. Symbol: ( R n ) + n = 0...6 ARBEITSSPEICHER CPU IR Rn-0- OP CODE SOURCE Mode I R n DESTINATION Mode R n ADRESSE OPERAND f-J1 • nach Ausführung 3 - 7 B e i s p i e l e f ü r Mode 2 1. B e i s p i e l symbolisch o k t a l e r Code B e d e u t u n g CLR ( R 5 ) + 0 0 5 0 2 5 L ö s c h e das Speicherwort auf d a s R5 z e i g t . Erhöhe R 5 a n s c h l i e ß e n d um 2 VOR DER A -..:FÜHRUNG 20000 0 0 5 0 2 5 Register 30000 1 1 1 1 1 6 R5 0 3 0 0 0 0 NACH DER AUSFÜHRUNG 20000 0 0 5 0 2 5 R 30000 0 0 0 0 0 0 e g i R s t e 5 r 030002 2. B e i s p i e l symbolisch o k t a l e r Code B e d e u t u n g CLRB ( R 5 ) + 1 0 5 0 2 5 L ö s c h e das Speicherbyte, a u f d a s R5 z e i g t . Erhöhe R 5 a n s c h l i e ß e n d um 1 VOR DER AUSFÜHRUNG 20000 1 0 5 0 2 5 R 30000 1 1 1 1 1 6 e g R i s 5 t e r 030000 NACH DER AUSFÜHRUNG 20000 1 0 5 0 2 5 Register 30000 1 1 1 0 0 0 R5 0 3 0 0 0 1 3 - 8 3 . 2 . 4 M o d e 3 , A u t o i n c r e m e n t D e f e r r e d Mode In d i e s e r Adressierungsart w i r d d e r I n h a l t des R e g i s t e r s a l s Z e i g e r b e n u t z t , d e r z u e i n e r Adresse e i n e s Operanden zeigt. Nachdem d e r B e f e h l a b g e a r b e i t e t i s t , w i r d d e r I n h a l t d e s R e g i s t e r s a u t o m a t i s c h um 2 e r h ö h t . Symbol: @ ( R n ) - 1 - n = 0...6 CPU IR OP CODE SOURCE Model R n ARBEITSSPEICHER DESTINATION Mode R n ADRESSE ADRESSE L.2-• nach A u s f ü h r u n g OPERAND B e i s p i e l f ü r Mode 3 symbolisch INOZXR24 o k t a l e r Code B e d e u t u n g 0 0 5 2 3 2 3 - R 9 2 zeigt auf eine Speicherzelle welche e i n e Adresse b e i n h a l t e t . D e r Inhalt d i e s e r Adresse s o l l um 1 e r h ö h t w e r d e n . Anschließend R2 um 2 e r höhen 3 . 2 . 5 M o d e 4 , A u t o d e c r e m e n t Mode Der I n h a l t d e s b e n u t z t e n R e g i s t e r s i s t d i e A d r e s s e e i n e s Operanden, w e l c h e v o r A u s f ü h r u n g d e s B e f e h l s j e n a c h verwendetem F o r m a t um 1 b z w . u m 2 e r n i e d r i g t w i r d . Symbol: - ( R n ) n = 0...6 CPU IR OP CODE ARBEITSSPEICHER SOURCE, Model R n DESTINATION Mode R n -1 ADRESSE OPERAND 2 ] B e i s p i e l . f ü r Mode 4 symbolisch INC - ( R O ) o k t a l e r Code B e d e u t u n g 0 0 5 2 4 0 D e r I n h a l t v o n R2 w i r d um 2 d e k r e m e n t i e r t u n d als Adresse des Operanden v e r w e n d e t . D e r O p e r and w i r d u m 1 e r h ö h t VOR DER AUSFÜHRUNG 1000 0 0 5 2 4 0 Register 7774 0 0 0 0 0 0 SO 0 0 1 7 7 7 6 NACH DER AUSFÜHRUNG 1000 0 0 5 2 4 0 Register 7774 0 0 0 0 0 1 RO 0 0 1 7 7 7 4 3 - 10 3 . 2 . 6 M o d e 5 , A u t o d e c r e m e n t D e f e r r e d Mode Das R e g i s t e r e n t h ä l t e i n e n Z e i g e r d e r z u e r s t u m 2 e r n i e d r i g t w i r d und anschließend a u f d i e Adresse e i n e r Adresse e i n e s O p e r a n d e n z e i g t . Symbol: & -(Rn) n = 0...6 ARBEITSSPEICHER CPU IR OP CODE SOURCE Mode 1 Feg.) DESTINATION Mode R n ADRESSE �Rn-e• H ADRESSE 2 OPERAND B e i s p i e l f ü r Mode 5 symbolisch COMO-4R0) o k t a l e r Code B e d e u t u n g 0 0 5 1 5 0 3 - 11 D e r I n h a l t v o n RO w i r d um 2 e r n i e d r i g t u n d a l s Adresse d e r A d r e s s e d e s Operanden v e r w e n d e t . Aus d e m O p e r a n d e n w i r d das E i n e r -Komplement gebildet. 3 . 2 . 7 M o d e 6 , I n d e x Mode I n d i e s e m Mode w i r d ' d e m B e f e h l e i n I n d e x b e i g e f ü g t , d e r z u m Registerinhalt addiert wird. D i e Summe i s t d i e e f f e k t i v e A d r e s s e e i n e s - O p e r a n d e n . I n d e x und R e g i s t e r i n h a l t b l e i b e n j e d o c h u n v e r ä n d e r t ! Symbol: X ( R n ) n = 0...6 ARBEITSSPEICHER CPU IR OPCODE SOURCE Mode 1 R n DESTINATION Mode ! R n 1 1.- BEFEHL. • ADRESSE INDEX « I » Ob- OPERAND B e i s p i e l f ü r Mode 6 symbolisch CLR 2 0 0 ( R 4 ) o k t a l e r Code B e d e u t u n g 0 0 5 0 6 4 000200 3-12 D a i n d e Adresse des Opere n wird durch d i e A d d i t i o n von 200 zum R e g i s t e r R4 e r r e c h n e t . Der O p e r a n d w i r d g e löscht. 3 . 2 . 8 M o d e 7 , I n d e x D e f e r r e d Mode Wie Mode 6 , d o c h i s t h i e r d i e Summe a l s Z e i g e r a u f e i n e Adresse z u v e r s t e h e n . Symbol: a X ( R n ) n = 0...6 ARBEITSSPEICHER CPU IR OP CODE SOURCE Mode I R n DESTINATION Mode 1 R n BEFEHL INDEX ADRESSE ADRESSE OPERAND B e i s p i e l f ü r Mode 7 symbolisch o k t a l e r Code B e d e u t u n g ADDe1000(R2),R1 067201 001000 3 - 13 1000 u n d d e r I n h a l t v o n R2 s u m m i e r t e r g e b e n d i e Adresse d e r A d r e s s e d e s Source-Operanden. D i e s e r I n h a l t w i r d d a n n z u R1 addiert. 3.3 P C Modes Diese A d r e s s i e r u n g s a r t e n b e n u t z e n a l s R e g i s t e r d e n P r o grammzähler R e g i s t e r 7 . Register 7 unterscheidet s i c h von den übrigen Registern ( R O . . . R 6 ) d a d u r c h , d a ß e s n a c h dem H o l e n j e d e r I n s t r u k t i o n a u t o m a t i s c h um 2 e r h ö h t w i r d . D i e s e E i g e n s c h a f t w i r d i n d e n f o l g e n d e n Modes a u s g e n u t z t . Programme d i e m i t PC Modes g e s c h r i e b e n w e r d e n , h a b e n d e n besonderen V o r t e i l , d a ß s i e a n j e d e r S t e l l e d e s Arbeitsspeichers l a u f f ä h i g abgelegt werden können. D e r Programmierer b r a u c h t a l s o v o r h e r d e n i h m z u r Ve r f ü g u n g s t e h e n d e n S p e i c h e r b e r e i c h n i c h t z u k e n n e n , w e n n e r m i t PC Modes ( u n d B r a n c h - B e f e h l e n , s i e h e s p ä t e r ) p r o g r a m m i e r t . D i e s e Programme s i n d p o s i t i o n s - u n a b h ä n g i g , d a a l l e V e r w e i s e r e l a t i v z u m a k t u e l l e n PC e r z e u g t w e r d e n (=position independent'coding, PIC). 3 . 3 . 1 M o d e 2 / R e g i s t e r 7 , I m m e d i a t e Mode D i e s e A d r e s s i e r u n g s a r t i s t ä h n l i c h dem A u t o i n c r e m e n t M o d e , nur w i r d h i e r d e r a u f d i e I n s t r u k t i o n f o l g e n d e We r t a l s Operand i n t e r p r e t i e r t . Symbol: i t n CPU IR OP CODE ?SOURCE Mode I R n ARBEITSSPEICHER DESTINATION Mode2f R . 7 1 PC PC (R7) BEFEHL. B E F E H L S A D R E S S E +2 PC + 3-14 OPERAND B e i s p i e l z u Mode 2 , R e g . 7 symbolisch ADD # 1 0 , 1 3 0 o k t a l e r Code B e d e u t u n g 0 6 2 7 0 0 000010 D e r Wert 10 s t e h t . u n m i t t e l b a r h i n t e r dem B e f e h l u n d w i r d zum I n h a l t v o n RO a d d i e r t . D i e CPU h o l t d e n B e f e h l und e r h ö h t d e n PC a u t o m a t i s c h um 2 . D a m i t z e i g t d e r PC a u f d e n Operanden. D i e s e r w i r d g e h o l t u n d a u f RO a d d i e r t . Wegen Mode 2 w i r d nun d e r PC um. 2 e r h ö h t und z e i g t a u f d e n nächsten B e f e h l . VOR DER AUSFÜHRUNG 1020 0 6 2 7 0 0 Register RO 0 0 0 0 2 0 PC 0 0 1 0 2 0 1022 p 0 0 0 l o 1024 NACH DER AUSFÜHRUNG 1020 0 6 2 7 0 0 1022 0 0 0 0 1 0 1024 Register RO 0 0 0 0 3 0 PC 0 0 1 0 2 4 3 - 15 3 . 3 . 2 M o d e 3 / R e g i s t e r 7 , A b s o l u t e Mode H i e r w i r d d e r A u t o i n c r e m e n t D e f e r r e d Mode m i t R e g . 7 v e r w e n d e t . N a c h dem H o l e n d e s B e f e h l s w i r d d e r PC a u t o m a t i s c h um 2 e r h ö h t . D e r PC z e i g t n u n a u f d e n S p e i c h e r p l a t z h i n t e r dem B e f e h l , w e l c h e r d i e ( a b s o l u t e ) A d r e s s e e i n e s O p e r a n d e n enthält. Symbol: a l t A CPU IR PC R7-im- OP CODE SOURCE Mode I R n ARBEITSSPEICHER DESTINATION Mode 3 I F t .7 BEFEHL BEFEHLSADRESSE +2 ADRESSE OPERAND B e i s p i e l f ü r Mode 3 R e g . 7 symbolisch o k t a l e r Code B e d e u t u n g CLR 6 / 4 . 11 0 0 0 0 5 0 3 7 001100 L ö s c h e den I n h a l t der A d r e s s e 11 0 0 VOR DER AUSFÜHRUNG 2000 0 0 5 0 3 7 2002 0 0 1 1 0 0 1100 1 7 7 7 7 7 Register PC 0 0 2 0 0 0 NACH DER AUSFÜHRUNG 2000 0 0 5 0 3 7 2002 0 0 1 1 0 0 2004 Register PC 0 0 2 0 0 4 1100 000000 3 - 16 3 . 3 . 3 M o d e 6 / R e g i s t e r 7 , R e l a t i v e Mode Z u e r s t w i r d d e r PC u m 2 e r h ö h t u n d z e i g t a u f e i n O f f s e t w o r t , w e l c h e s zum n ä c h s t f o l g e n d e n PC-Wert a d d i e r t w i r d . D i e e n t s t a n d e n e Summe i s t d i e A d r e s s e " A " e i n e s Operanden. Symbol: A ARBEITSSPEICHER CPU IR OP CODE SOURCE Mode I R n DESTINATION Mode 61 R . 7 PC PC (R7) BEFEHL O F F S E TA D R E S S E + 2 OFFSET PC+2 OPERAND Kurz: Offsetadresse • Offset • 2 • A d r e s s e d e s Operanden B e i s p i e l z u Mode 6 R e g . 7 symbolisch o k t a l e r Code B e d e u t u n g 1000 I N C A 1002 5 4 1004 005267 000054 3 - 17 Um d i e Z e l l e A z u i n krementieren, w i r d d e r I n h a l t d e s dem B e f e h l folgenden Wo r t e s zum I n h a l t d e s PC a d d i e r t . daraus e r g i b t s i c h d i e Adresse A = 1 0 6 0 . D e r I n halt d i e s e r Adresse w i r d dann um 1 e r h ö h t . 3 . 3 . 4 M o d e 7 / R e g i s t e r 7 , R e l a t i v D e f e r r e d Mode Hier w i r d durch A d d i t i o n von Offsetadresse + O f f s e t + 2 e i n Zeiger e r z e u g t , d e r a u f d i e A d r e s s e e i n e s Operanden w e i s t . Symbol: p 7 A ARBEITSSPEICHER CPU IR OP CODE DESTINATION Mode 71 R • 7 SOURCE Mode I R n .04 PC L PC R7 O F F S E TA D R E S S E + 2 BEFEHL PC+2 OFFSET 4 ADRESSE OPERAN D Offsetadresse Offset 2 Adresse d e r A d r e s s e e i n e s Operanden Kurz: n B e i s p i e l f ü r Mode 7 / R e g . 7 symbolisch o k t a l e r CLR @A Code 005077 000020 Bedeutung Addiere d a s z w e i t e Wo r t des B e f e h l s z u m PC u n d erstelle somit die Adresse d e r A d r e s s e d e s Operanden. D e r O p e r a n d wird dann g e l ö s c h t . VOR DER AUSFÜHRUNG 1020 005077 PC 1022 000020 1024 NACH DER AUSFÜHRUNG 1020 0 0 5 0 7 7 1022 0 0 0 0 2 0 1024 PC 1044 1044 0 1 0 1 0 0 010100 A=1044 10100 100001 10100 0 0 0 0 0 0 3 - 18 A r b e i t s b l a t t 3 . 1 B A S I C MODES F ü l l e n S i e f o l g e n d e Ta b e l l e u n t e r d e n g e g e b e n e n Vo r a u s s e t z u n g e n a u s . B e a c h t e n S i e b i t t e , d a ß f ü r j e d e n B e f e h l d e r L i s t e d i e s e l b e n Vo r a u s s e t z u n g e n g e l t e n : (RO) (R2) (R5) (R7) (2776) (3500) (4100) (2777) BEFEHL INC ( R 5 ) MODE 1 = = = = = = = = 1000 3000 4000 7000 276 350 410 177 (1000) (3000) (4000) (6504) ( 276) ( 350) ( 410) ADRESSE DES OPERANDEN 4000 DEC ( R 2 ) + CLR G a - ( R 2 ) CLR R 5 INC 1 0 0 ( R 5 ) DECB i l D ( R 2 ) + CLRB ( R 5 ) CLRB - ( R 2 ) INC ( : ) 1 0 0 0 ( R 2 ) CLRB ( R 0 ) + INC - 3 0 0 ( R 5 ) INC a -300(R5) 3 - 19 = = = = = = .1: 100 300 400 654 26 30 40 REGISTER INHALT NACH AUSFÜHRUNG 4000 (100) (300) (400) (654) ( 26) ( 30) ( 40) = = = = = = = 10 30 40 64 6 0 0 OPERAND NEUER VORHER NACHHER PC 400 401 7002 A r b e i t s b l a t t 3 . 2 PC-Modes Analog z u A r b e i t s b l a t t 3 . 1 Vo r a u s s e t z u n g e n : (R7) (1000) ( 100) ( 10) (SUM) (LIMIT) (7500) = = = = = = = 5000 100 10 1 2700, 4000, 1000 d e r O f f s e t b e i I N C SUM s o l l + 600,g s e i n d e r O f f s e t b e i CLR L I M I T s o l l - 5 ö 0 8 s e i n BEFEHL MODE 2.WORT DES BEFEHLS CLR # 1 2 3 4 27 001234 DEC e # 1 0 0 0 CLR aD7500 CLR 7 5 0 0 INC & . 1 0 0 CLR 11000 000 INC 141234 INCCD1000 INCa-4004(R7) INC SUM CLR L I M I T 3 - 20 OPERANDEN ADRESSE 5002 OPERAND VORHER NACHHER 1234 0 KAPITEL 4 - B E F E H L E u n d PROGRAMMIERTECHNIKEN 4.1 E i n f ü h r u n g 4.2 E i n i g e B e f e h l e 4 . 2 . 1 C O M ( B ) u n d NEG(B) 4 . 2 . 2 R O R ( B ) , A S R ( B ) u n d SWAB 4 . 2 . 3 A D C ( B ) u n d SXT 4.2.4 B I T ( B ) , BIC(B) und BIS(B) 4.2.5 C M P ( B ) u n d TST(B) Arbeitsblätter 4.1, 4.2 4 . 2 . 6 BRAUCH- B e f e h l e Arbeitsblatt 4.3 4.2.7 JUMP 4.3 Ein/Ausgabe-Programmierung ( o h n e I n t e r r u p t ) 4.3.1 E i n f ü h r u n g 4.3.2 G e r ä t e r e g i s t e r 4.3.3 Dateneingabe A.3.4 Datenausgabe Arbeitsblatt 4.4 4 . 4 S T A C K , T R A P, INTERRUPT 4 . 4 . 1 S T A C K - Te c h n i k 4.4.2 TRAP 4 . 4 . 3 INTERRUPT Arbeitsblatt 4.5 4.5 U n t e r p r o g r a m m i e r u n g 4.5.1 E i n f ü h r u n g 4.5.2 Unterprogrammsprung, JSR 4 . 5 . 3 U n t e r p r o g r a m m r ü c k s p r u n g , RT S Arbeitsblatt 4.6 4 . 5 . 4 Ü b e r t r a g u n g v o n Parametern i n Unterprogramme 4.5.5 V e r g l e i c h : Interrupt-Unterprogramm ( B e i s p i e l ) 4.5.6 E/A-Programmierung m i t I n t e r r u p t 4- 1 4.1 E i n f ü h r u n g Aufgrund d e r v i e l f ä l t i g e n A d r e s s i e r u n g s a r t e n v e r f ü g t d i e PDP11 ü b e r m e h r a l s 4 0 0 B e f e h l e . H i n z u k o m m t , d a ß S i n g l e wie D o u b l e - O p e r a n d - B e f e h l e D a t e n i m B y t e - u n d W o r t f o r m a t verarbeiten können. D i e s s p a r t S p e i c h e r p l a t z und v e r e i n facht z . B . d i e Steuerung von Peripherie-Geräten. Die B e d e u t u n g v o n D o p p e l - O p e r a n d - B e f e h l e n ( t y p i s c h e s M e r k mal s o g e n a n n t e r Z w e i - A d r e s s - M a s c h i n e n ) s e i a n f o l g e n d e m Beispiel gezeigt: Der B e f e h l ADD A , B a d d i e r t d i e I n h a l t e d e r S p e i c h e r s t e l l e n A und B und s p e i c h e r t das Ergebnis i n d i e Z e l l e B . B e i E i n - A d r e s s - M a s c h i n e n m ü ß t e d e r s e l b e Vo r g a n g w i e f o l g t programmiert werden: LDA A l a d e I n h a l t von A i n den Akkumulator ADD B a d d i e r e I n h a l t v o n B a u f d e n A k k u m u l a t o r STR B s p e i c h e r e I n h a l t d e s A k k u m u l a t o r s n a c h B Der g e s a m t e B e f e h l s s a t z d e r PDP11 l ä ß t s i c h i n f o l g e n d e v i e r Gruppen e i n t e i l e n : 1. S i n g l e O p e r a n d - B e f e h l e 2. D o u b l e O p e r a n d - B e f e h l e 3. V e r z w e i g u n g s b e f e h l e - Branch - Jump u . S u b r o u t i n e - Trap 4. S o n s t i g e B e f e h l e M i s c e l l a n e o u s ( H A LT, W A I T, N O P, RESET, M e m o r y Management) u n d Befehle z u r Beeinflussung d e r C o n d i t i o n - C o d e - B i t s . Die v o l l s t ä n d i g e A u f l i s t u n g u n d B e s c h r e i b u n g d e s B e f e h l s satzes f i n d e t s i c h i m " p r o c e s s o r handbook", K a p i t e l : I n s t r u c t i o n S e t . E i n i g e w i c h t i g e B e f e h l e werden i n den folgenden K a p i t e l n e r l ä u t e r t . 4- 3 4 . 2 . 1 C O M ( B ) u n d NEG(B) COMCB) Complement ( S i n g l e Operand) Die e i n z e l n e n B i t s d e s O p e r a n d e n w e r d e n n e g i e r t . D i e s e n t s p r i c h t d e r B i l d u n g d e s E i n e r -Komplements b z w. d e s logischen Kehrwerts. B e i s p i e l : C O M RO Vo r h e r Nachher RO 013333 RO 164444 NEG(B) N e g a t e ( S i n g l NZVC 1001 e Operand) D ie e i n z e l n e n B i t s d e s O p e r a n d e n w e r d e n n e g i e r t u n d a n s c h l i e ß e n d 1 a d d i e r t . D i e s e n t s p r i c h t dem Z w e i e r Komplement b z w . d e m a r i t h m e t i s c h e n K e h r w e r t , d a a l l e PDP-11en m i t Z w e i e r k o m p l e m e n t - A r i t h m e t i k a r b e i t e n . B e i s p i e l : N E G RO Vo r h e r N a c h h e r RO 000010 R O 1 7 7 7 7 0 NZVC 1001 Achtung: D i e g r ö ß t e n e g a t i v e Z a h l ( 1 0 0 0 0 0 b e i W o r t v e r a r b e i t u n g b z w. 2 0 0 b e i B y t e v e r a r b e i t u n g ) k a n n n i c h t n e g i e r t werden, d a d i e entsprechend p o s i t i v e Z a h l n i c h t mehr d a r s t e l l b a r i s t . ( s i e h e Zahlenkreis) In diesem F a l l w i r d d a s V- B i t ( O v e r f l o w ) g e setzt, um anzuzeigen das beim Negieren e i n arithmetischer Fehler aufgetreten i s t . 4 4 4 . 2 . 2 R O R ( B ) , A S R ( B ) u n d SWAB ROR(B) R o t a t e rig:ht ( S i n g l e Operand) Ve r s c h i e b u n g a l l e r B i t s d e s O p e r a n d e n um e i n e S t e l l e n a c h rechts. Das C- B i t w i r d nach B i t 15 ( B i t 7 ) und B i t 0 ( B i t 8) i n s C - B i t g e s c h o b e n ( 2 . R o t a t i o n ) Beispiel: W O R T: c 0 15 BYTE: ASR(B) A r i t h m . 0 8 151 Shift rieht ( S i n g l e Operand) Der a r i t h m e t i s c h e S h i f t ( h i e r R e c h t s - S h i f t ) w i r d a u f a r i t h m e t i s c h e Operanden angewendet, d a h i e r d a s Vo r z e i c h e n b e r ü c k s i c h t i g t w e r d e n muß. E i n A S R ( B ) - B e f e h l b e d e u t e t d i e D i v i s i o n d e s Operanden d u r c h 2 w o b e i s i c h d a s Vo r z e i c h e n selbstverständlich n i c h t ändern d a r f (analog: ' L i n k s - S h i f t ) : A l l e B i t s w e r d e n um e i n e S t e l l e n a c h r e c h t s g e s c h o b e n . B i t 0 ( B i t 8 ) kommt i n s C- B i t , B i t 1 5 ( B i t 7 ) w i r d " d u p l i z i e r t " . Beispiel: 0 W O R T: c 15 7 BYTE: c 4 5 0 c Graphische Zusammenfassung d e r R o t a t e - u n d S h i f t - B e f e h l e ROR RORB W O R T: C H - 1 1 1 1 1 1 1 1 15 BYTE: 15 8 0 ROL ROLB W O R T: C 1 1 15 1 1 1 1 1 0 BYTE: I ODD 1 1 1 15 1 1 1 1 EVEN 1 1 1 I 1 7 A5R ASRB rin, W O R T: 1 1 1 1 I 1 1 BYTE: c 1 1 ASL ASLB W O R T: I M M I • 11 • 11 . 0 , H 1 1 1 1 1 1 15 1 0 BYTE: c 15 I 1 1 c 1 1 4 6 H 7 1 I SWAB S w a p Bytes ( S i n g l e Operand) High B y t e u n d Low B y t e d e s Operanden werden v e r t a u s c h t . D i e angegebene O p e r a n d e n - A d r e s s e muß e i n e W o r t a d r e s s e s e i n . Dieser B e f e h l e r l e i c h t e r t d i e Ve r a r b e i t u n g von Datenbytes die a n d e r n f a l l s n u r m i t 8 - f a c h S h i f t s möglich wäre. B e i s p i e l : S W A B R1 Vo r h e r N a c h h e r RI 077777 R 1 N Z V C 1 7 7 5 7 7 0 0 0 0 4 . 2 . 3 A D C ( B ) u n d SXT ADC(B) A d d Carry ( S i n g l e Operand) Der I n h a l t d e s C a r r y - B i t w i r d z u m D e s t i n a t i o n - O p e r a n d e n addiert. B e i Additionen m i t mehrfacher Genauigkeit d i e n t dieser Befehl z u r Übertragung des Carry (Übertrag) a u f den n ä c h s t e n ( h ö h e r w e r t i g e n ) Te i l o p e r a n d e n . Beispiel: A D D A0,B0 Addiere d i e e r s t e n b e i d e n ( Te i l - ) W o r t e Addiere C zum n ä c h s t h ö h e r e n ( T e i l —)Wort Addiere d i e b e i d e n höheren ( Te i l - ) W o r t e ADC B1 ADD A 1 , B 1 Damit s t e h t i n ( B 1 , B 0 ) e i n 3 2 - B i t W o r t 4- 7 SXT S i p z n extend ( S i n g l e Operand) Abhängig vorn V o r z e i c h e n d e r v o r a n g e g a n g e n e n O p e r a t i o n (N- B i t ) w i r d d e r D e s t i n a t i o n - O p e r a n d m i t 0 . . . 0 ( N = 0 ) b z w . m i t 1 . . . 1 (14=1) " a u f g e f ü l l t " . Damit w i r d b e i O p e r a t i o n e n m i t m e h r f a c h e r G e n a u i g k e i t d a s Vo r z e i c h e n a u f d a s n ä c h s t h ö h e r e W o r t a u s g e d e h n t . Beispiel: S X T A Vo r h e r N a c h h e r A A beliebig NZVC 1000 N , Z • 177777 ( 1 . - - 1 ) V C 1000 4- 8 4.2.4 B I T ( B ) , BIC(B) und BIS(B) Diese B e f e h l e e r m ö g l i c h e n O p e r a t i o n e n a u f B i t -Ebene BIT(B) B i t Te s t (AND) ( D o u b l e Operand) S o u r c e - u . D e s t i n a t i o n - O p e r a n d w e r d e n l o g i s c h "UND" verknüpft. Das Ergebnis beeinflußt n u r d i e ConditionCode-Bits d e s P r o z e s s o r s t a t u s w o r t s . D i e Operanden b l e i b e n unverändert! Beispiel: B I T #30,R3 Ergebnis: T e s t B i t s 3 u . 4 v o n R3 = 1 N= 0 wenn B i t 3 = B i t 4 = 0 (von R 3 ) d . h . d i e V e r knüpfung e r g i b t 0 -z = 0 N= 0 wenn B i t 3 = B i t 4 = 1 , od.Bit 3 B i t 4 -N = 1 w e n n das höchste B i t des Ergebnisses g e s e t z t w i r d Stets g i l t : V = 0 und C wird nicht beeinflußt BIC(B) B i t Clear ( D o u b l e Operand) Es w i r d j e d e s B i t d e s D e s t i n a t i o n - O p e r a n d e n g e l ö s c h t , welches m i t e i n e m g e s e t z t e n B i t d e s S o u r c e Operanden übereinstimmt. B e i s p i e l : B I C R3,R4 Vo r h e r N a c h h e r Source R 3 001234 R 3 0 0 1 2 3 4 Destin. R 4 000111 R 4 0 0 0 1 0 1 NZVC 000- 4- 9 BIS(B) B i t S e t (OR) ( D o u b l e Operand) Source- u . D e s t i n a t i o n -Operand werden l o g i s c h " O R " - v e r knüpft. Jede B i t p o s i t i o n d e r Source welche " 1 " i s t e r w i r k t das S e t z e n d e r s e l b e n B i t p o s i t i o n d e r D e s t i n a t i o n . B e i s p i e l : B I S R0,R1 Vo r h e r N a c h h e r RO Source 0 0 1 2 3 4 R O 0 0 1 2 3 4 R1 Destin. 0 0 0 1 1 1 R 1 0 0 1 3 3 5 NZVC 0000 4 - 10 4 . 2 . 5 C M P ( B ) UND T S T ( B ) CMP(B) C o m p a r e - B e f e h l ' ( D o u b l e Operand) Der C M P - B e f e h l s t e l l t e i n w i c h t i g e s H i l f s m i t t e l f ü r Branchbefehle d a r . E r v e r g l e i c h t d e n S o u r c e - m i t dem D e s t i n a t i o n -Operanden. D a s E r g e b n i s d i e s e s Ve r g l e i c h s s c h l ä g t s i c h a u s s c h l i e ß l i c h i m P r o z e s s o r - S t a t u s w o r t (PSW) n i e d e r, d . h . d i e Operanden s e l b s t werden n i c h t v e r ä n d e r t . Beispiel: S e i RO = 2 CMP # 5 , R 0 5 Source 2 D e s t . PSW TST(B) T e s t -Befehl ( S i n g l e = + 0 3 0 0 0 N Z V C Operand) F a l l s aufgrund e i n e s b e r e i t s vorhandenen ( f r ü h e r b e rechneten) Wertes v e r z w e i g t werden s o l l , k a n n a u f d i e s e n der T S T- B e f e h l angewendet w e r d e n . Er v e r a n l a ß t d a s S e t z e n d e r B i t s N u n d Z i m PSW a b h ä n g i g davon o b d e r W e r t n u l l , n e g a t i v o d e r p o s i t i v i s t . B e i e i n e m p o s i t i v e n Wert i s t Z = N = 0 ( " n i c h t n u l l und n i c h t n e g a t i v = positiv") B e i s p i e l e z u CMP u n d T S T s i e h e K a p i t e l ü b e r B r a n c h - B e f e h l e . 4 - 11 Anmerkung z u BYTE- I n s t r u k t i o n e n - B e i B y t e - I n s t r u k t i o n e n i s t immer B i t 15 des I n s t r u k tionscodes g e s e t z t . - Es i s t dadurch d i e Adressierung von einzelnen Bytes (Halbwörtern) m ö g l i c h . - B y t e - I n s t r u k t i o n e n i n V e r b i n d u n g m i t AUTOINCREMENT-und AUTODECREMENT-Adressierung v e r ä n d e r n d e n I n h a l t d e s b e zogenen R e g i s t e r s n u r um 1 . - B y t e - I n s t r u k t i o n e n i n V e r b i n d u n g m i t AUTOINCREMENT DEFERRED u n d AUTODECREMENT DEFERRED A d r e s s i e r u n g v e r ändern d e n I n h a l t d e s bezogenen R e g i s t e r s j e w e i l s um 2 (der I n h a l t des R e g i s t e r s i s t d i e Adresse e i n e r Adresse, die immer e i n Wort m i t 16 B i t s b e l e g t ) . - B y t e - I n s t r u k t i o n e n i n Ve r b i n d u n g m i t d e n R e g i s t e r n 6 u n d 7 v e r ä n d e r n d i e s e R e g i s t e r i m m e r um 2 . - B y t e - I n s t r u k t i o n e n i n V e r b i n d u n g m i t dem REGISTER MODE a d r e s s i e r e n d a s LOW BYTE e i n e s R e g i s t e r s . - D i e I n s t r u k t i o n MOVB i n e i n R e g i s t e r ( D e s t i n a t i o n i m R e g i s t e r -Mode) f ü l l t d a s o b e r e B y t e d e s R e g i s t e r s m i t d e m Vo r z e i c h e n d e s S o u r c e - O p e r a n d e n a u f ( S i g n - E x t e n s i o n ) . 4-12 Arbeitsblatt 4.1 1. W i e s i e h t d e r M a s c h i n e n c o d e f ü r f o l g e n d e B e f e h l e a u s ? a) A d d i e r e 3 a u f d e n I n h a l t d e r A d r e s s e 11 0 0 : b) L ö s c h e d e n I n h a l t d e r A d r e s s e 1 4 0 0 : c) B r i n g e d e n I n h a l t d e r A d r e s s e 1 0 0 i n d i e A d r e s s e 5000: 2. W i e w i r d d a s PSW n a c h f o l g e n d e n B e f e h l e n g e s e t z t ? SS D D a) A d d i e r e n ( - 2 ) , ( - 1 ) b) S u b t r a h i e r e n ( - 2 ) , ( - 1 ) c) V e r g l e i c h e n ( - 2 ) , ( - 1 ) 4 - 13 N Z V C Arbeitsblatt 4.2 1. M i t w e l c h e m B e f e h l k a n n man d a s B i t 7 i n R 4 l ö s c h e n ? 2. M i t w e l c h e n B e f e h l e n k a n n man d e n I n h a l t v o n R1 m i t 4 multiplizieren? 3. W i e w e r d e n d i e C o n d i t i o n - B i t s n a c h A u s f ü h r u n g d i e s e r Befehle g e s e t z t ? • N Z V C MOV # 1 7 7 5 4 3 , R 0 BIT $ 2 0 0 , R0 4. D i e f o l g e n d e n B e f e h l e s o l l e n i n d e r a n g e g e b e n e n Reihenfolge a u s g e f ü h r t werden. Was i s t d e r I n h a l t v o n R e g i s t e r 0 n a c h A u s f ü h r u n g d i e s e r Befehle? I n h a l t RO a) M O V # 4 2 3 4 5 , R 0 b) S W A B RO 5. W i e k a n n man f e s t s t e l l e n , o b B i t 5 i n R 0 g e s e t z t i s t ? 4 - 14 4 . 2 . 6 BRANCH-Befehle Diese B e f e h l e e r m ö g l i c h e n Programm- Ve r z w e i g u n g e n . M a n unterscheidet zwei A r t e n : a) D e r Ve r z w e i g u n g s b e f e h l i s t u n b e d i n g t (BRANCH) b) D e r Ve r z w e i g u n g s b e f e h l i s t b e d i n g t . D i e E n t scheidung o b v e r z w e i g t w i r d h ä n g t vom Z u s t a n d der C o n d i t i o n - C o d e - B i t s i m P r o z e s s o r s t a t u s w o r t (PSW) a b . Die Z i e l a d r e s s e e i n e s B r a n c h e r g i b t s i c h a u s d e r Summe v o n OFFSET u n d P r o g r a m - C o u n t e r. U n t e r dem OFFSET v e r s t e h t man d i e A n z a h l d e r W o r t e vom a u g e n b l i c k l i c h e n PC a n g e r e c h n e t b i s z u r Z i e l a d r e s s e . E s i s t z u b e a c h t e n , d a ß d e r PC b e r e i t s zum n ä c h s t e n W o r t z e i g t , a l s o zum B e f e h l , d e r dem B r a n c h folgt (=updated PC). ' Der PC k a n n k e i n e B y t e - A d r e s s e a u s d r ü c k e n , d e r OFFSET i s t somit immer i n Wo r t e n angegeben. D e r OFFSET w i r d a u t o m a t i s c h m i t z w e i m u l t i p l i z i e r t u n d d a n n zum PC a d d i e r t . B i t 7 des O f f s e t i s t d a s Vo r z e i c h e n b i t . I s t d i e s e s B i t g e s e t z t , so i s t d e r O f f s e t n e g a t i v u n d d i e Ve r z w e i g u n g e r f o l g t i n Rückwärts- R i c h t u n g . M i t dem 8 - b i t O f f s e t i s t e i n e Ve r z w e i g u n g i n R ü c k w ä r t s Richtung um 2 0 0 W o r t e ( 4 0 0 B y t e s ) vom a u g e n b l i c k l i c h e n PC an m ö g l i c h . I n Vo r w ä r t s - R i c h t u n g b e t r ä g t d e r W e r t 1 7 7 8 Worte ( 3 7 6 B y t e s ) - e b e n f a l l s vom a u g e n b l i c k l i c h e n PC a n gerechnet. OFFSET F o r m e l OFFSET = ZIELADRESSE - UPDATED PC 2 Der OFFSET w i r d i m B e f e h l s c o d e d e s B r a n c h angegeben Befehlsformat 15 8 7 BASIS CODE O F 0 F S E T Es i s t z u b e a c h t e n , d a ß i n d e r Programmier- K a r t e b z w. i m Prozessor-Handbuch immer n u r d e r B a s i s Code d e s B r a n c h angegeben i s t , w o b e i d i e OFFSET- B i t s a l l e 0 s i n d . 4 - 15 Einteilung D i e S p r u n g b e f e h l e l a s s e n s i c h i h r e r Ve r w e n d u n g n a c h i n 3 Gruppen e i n t e i l e n : 1. U n b e d i n g t e u n d e i n f a c h e b e d i n g t e Ve r z w e i g u n g e n BR, B N E , B E Q , B P L , B M I , B V C , B V S , B C C , B C S D i e s e B e f e h l e t e s t e n j e w e i l s e i n B i t d e s PSW d a r a u f h i n ob e s g e s e t z t o d e r g e l ö s c h t i s t ( A u s n a h m e B R ) . Beispiele BR B r a n c h ( u n b e d i n g t e Ve r z w e i g u n g ) Operation: P C = P C + 2 * O f f s e t Beschreibung: o h n e Bedingung w i r d d a s P r o gramm i n n e r h a l b d e s B e r e i c h s von + 1 2 7 u n d - 1 2 8 W o r t e n f o r t gesetzt. Beispiel: 1000 1002 1001 1006 A: 1010 BR • • A ; m e i s t w i r d _der O f f s e t ; symbolisch angegeben ; hier Branch nach A • • • • • • • • • • Berechnung d e s O f f s e t n a c h d e r F o r m e l : 1006 - 1 0 0 2 2 =2 Der o k t a l e O f f s e t b e t r ä g t a l s o 2 u n d BR A m u ß a l s 0 0 0 4 0 2 programmiert werden. Anmerkungen: F ü r k u r z e S p r ü n g e i s t d i e O f f s e t - F o r m e l z u u n h a n d l i c h u n d man b e h i l f t s i c h d u r c h A b z ä h l e n d e r S p e i cherstellen, wobei beim Branchbefehl m i t - 1 ( ! ) z u beginnen ist. - 1A BPL B r a n c h i f plus (verzweige, f a l l s p o s i t i v ) O p e r a t i o n : P C = PC + ( 2 x O f f s e t ) , f a l l s N = 0 Beschreibung: Te s t e t d a s N- B i t ( N e g a t i v ) u n d b e w i r k t e i n e n Branch w e n n N=0 ( = n i c h t n e g a t i v = p o s i t i v ) BMI B r a n c h i f minus (verzweige, f a l l s n e g a t i v ) komplementär z u B P L : B r a n c h , f a l l s N=1 BNE B r a n c h i f not equal ( t o 0) (verzweige, f a l l s nicht n u l l ) O p e r a t i o n : P C = PC + ( 2 x O f f s e t ) , f a l l s Z = 0 Beschreibung: Te s t e t d a s Z - B i t ( Z e r o ) u n d b e w i r k t e i n e n Branch w e n n Z = 0 ( a n i c h t n u l l ) BEQ B r a n c h i f ecual ( t o 0) komplementär z u BNE: B r a n c h , f a l l s Z=1 Programmbeispiel: Zähle v o n 10008 a b w ä r t s b i s 0 1000 M O V I * 1 0 0 0 , R 4 1002 ; 1004 A : D E C R 4 ; 1006 B N E A ; 1010 H A L T ; 4-17 ; l a d e 1000 n a c h R4 e r n i e d r i g e R4 um 1 s p r i n g e nach A solange Z=0. 2. Ve r z w e i g u n g e n f ü r 2 e r K o m p l . - A r i t h m e t i k BGE, B Z T, B G T, B L E H i e r w e r d e n K o m b i n a t i o n e n v o n Z , V, N g e t e s t e t . D a m i t s i n d Ve r g l e i c h e v o n a r i t h m e t i s c h e n We r t e n m ö g l i c h . Beispiele BGE B r a n c h i f greater than or ecual ( t o 0) O p e r a t i o n : P C = PC + ( 2 x O f f s e t ) , f a l l s NVV=0 Beschreibung: E s w i r d v e r z w e i g t , f a l l s d i e B i t s N und V b e i d e g e l ö s c h t o d e r b e i d e g e s e t z t s i n d . D i e s e r m ö g l i c h t e i n e k o r r e k t e Ve r z w e i g u n g a u c h b e i arithmetischem ü b e r l a u f . (Man mache s i c h d i e s m i t H i l f e d e s C M P - B e f e h l s u n d des Z a h l e n k r e i s e s k l a r ) BLT B r a n c h i f less than (0) k o m p l e m e n t ä r z u BGE, B r a n c h f a l l s NVV=1 Programmbeispiele: Zähle v o n 0 b i s 10008 1000 C L R R 4 1002 A : I N C R 4 1004 C M P R 4 , e 1 0 0 0 1006 1010 B L T 1012 H A L T A 4 - 18 ; l ö s c h e R4 ; e r h ö h e R4 um 1 ; v e r g l e i c h e R4 m i t 1000 ; d . h . (R4) -1000 = ? ; N -Bit ; s o l a n g e R4<1000 w i r d ; verzweigt ; d . h . s o l a n g e N=1 i s t 3. Ve r z w e i g u n g e n o h n e B e r ü c k s i c h t i g u n g d e s V o r z e i c h e n s BHI, B L O S , B H I S , B L O Hier kann aufgrund a b s o l u t e r - a l s o vorzeichenunabhängigerOperationen v e r z w e i g t werden, z . B . b e i Ve r g l e i c h von A d r e s sen. Beispiele BHI B r a n c h i f higher O p e r a t i o n : P C = PC + ( 2 x O f f s e t ) , f a l l s C = 0 u n d Z = 0 Beschreibung: C=0 und Z=0 t r i t t b e i einem CMP-Befehl auf, wenn d e r Source-Operand betragsmäßig ( o h n e Vo r zeichen) g r ö ß e r i s t a l s d e r Dest.-Operand. BLOS B r a n c h i f l o w e r o r s a m e ko mpl eme ntä r z u B H I , B r a n c h f a l l s CIJZ=1 P r o g r a m m b e i s p i e l : B r i n g e i n RO e i n B i t a u f v o r g e g e b e n e Position (R4) 1000 M O V 1 4 2 0 0 0 , R 4 1002 2 0 0 0 1004 C L R RO 1006 I N C RO 1010 A : R O L RO 1012 CMP R 4 RO 1014 BHI A 1016 HALT 4 - 19 ; l a d e 2000 n a c h R4 ; ( B i t 10=1) ; l ö s c h e RO u n d e r h ö h e ; RO u m 1 ( B i t 0 = 1 ) ; v e r s c h i e b e RO um 1 ; Position nach l i n k s ; v e r g l e i c h e RO m i t R 4 d . h . R 0 -R4=? Z = ? ; s p r i n g e , s o l a n g e R2 größer i s t . Arbeitsblatt 4.3 Setzen S i e d e n r i c h t i g e n B r a n c h - B e f e h l e i n . D i e I n h a l t e d e r Register s i n d keine Adressen. Befehl E s s o l l verzweigt werden w e n n CMP RO,R1 ( R 0 ) = ( R 1 ) CMP RO,R1 (RO)>(R1) CMP RO,R1 (RO)<(R1) CMP R 0 , R 1 (RO)>(R1) CMP RO,R1 (R0)4(H1) 4-20 4.2.7 JUMP M i t d e m JUMP- B e f e h l k a n n m a n , i m G e g e n s a t z z u dem B r a n c h b e f e h l e n , k e i n e B e d i n g u n g e n a b f r a g e n . D e r V o r t e i l b e i m JUMP l i e g t d a r i n , d a ß man e i n e v o l l e 1 6 - B i t - A d r e s s e a l s S p r u n g z i e l angeben kann, i n d e r Sprungweite a l s o n i c h t b e s c h r ä n k t ist. Die A n g a b e e i n e r s o l c h e n a b s o l u t e n Z i e l a d r e s s e b i r g t j e d o c h den N a c h t e i l i n s i c h , d a ß e i n e V e r s c h i e b u n g d e s P r o g r a m m s n i c h t ohne Änderung d i e s e r Adressen m ö g l i c h i s t . D a r i n a b e r l i e g t gerade d e r Vo r t e i l d e r Branchbefehle, dessen Z i e l a d r e s s e n s i c h s t e t s r e l a t i v z u m PC d e s P r o g r a m m s e r r e c h n e n . Somit b l e i b t d i e L a g e d e r Z i e l a d r e s s e r e l a t i v z u m Programm immer k o n s t a n t , u n a b h ä n g i g v o n d e r L a g e d e s P r o g r a m m s selbst (=PIC=position independent coding). 4 - 21 4.3 E i n -/Ausgabe - Programmierung ( o h n e I n t e r r u p t ) 4.3.1 E i n f ü h r u n g J e d e r V e r k e h r z w i s c h e n e i n e m Programm u n d d e r A u ß e n w e l t ( P e r i p h e r i e ) g e s c h i e h t ü b e r d e n UNIBUS. I n d e n m e i s t e n Fällen befinden s i c h an der S c h n i t t s t e l l e ( I n t e r f a c e ) z w i s c h e n UNIBUS u n d P e r i p h e r i e g e r ä t e i n o d e r m e h r e r e R e g i s t e r, s o daß d i e p r i n z i p i e l l e n Betrachtungen f ü r ' e i l e n p r o g r a m m i e r t e n D a t e n v e r k e h r am B e i s p i e l e i n e s Te r m i n a l s (TTY, L A 3 6 , L A 1 2 0 , V T 1 0 0 o . ä . ) a n g e s t e l l t w e r d e n k ö n n e n . Das I n t e r f a c e - M o d u l ' DL11 e r l a u b t d i e s e r i e l l e u n d a s y n chrone ü b e r t r a g u n g v o n A S C I I - Z e i c h e n z w i s c h e n D r u c i < e r t e i l bzw. T a s t a t u r e i n e r s e i t s u n d UNIBUS ( C P U , S p e i c h e r ) andererseits. Ein s e r i e l l e s I n t e r f a c e . h a t f ü n f grundlegende F u n k t i o n e n z u erfüllen: 1. E r k e n n e n d e r a n g e w ä h l t e n G e r ä t e - A d r e s s e 2. E r z e u g e n d e r I n t e r r u p t - S i g n a l e a n d e n P r o z e s s o r 3. K o n t r o l l e u n d Ü b e r w a c h u n g d e r P e r i p h e r i e - O p e r a t i o n 4. D a t e n z w i s c h e n s p e i c h e r u n g ( D a t a - B u f f e r ) 5. U m s e t z u n g : p a r a l l e l e < - > s e r i e l l e D a t e n Das DL11 b e s i t z t f ü r j e d e D a t e n ü b e r t r a g u n g s r i c h t u n g z w e i Register: 1. E i n K e y b o a r d - S t a t u s - R e g i s t e r u n d e i n K e y b o a r d B u ff e r f ü r d i e Tr a n s f e r r i c h t u n g : Ta s t a t u r ( K e y b o a r d ) - > UNIBUS 2. E i n P r i n t e r - S t a t u s - R e g i s t e r u n d e i n P r i n t e r - B u f f e r f ü r d i e T r a n s f e r r i c h t u n g : UNIBUS - > D r u c k e r (Sichtgerät) Folgendes B i l d v e r m i t t e l t e i n e n ü b e r b l i c k 4-22 TERMINAL DL11-INTERFACE Keyboard-Status-Reg. Keyboard 7 775 60 Keyboard -Buffer / / 7 7 / / / 7 77 56 2 ____‘, V ' Ica .4 ..... , - - a • . . , , . . . . . - . . . Printer -Status-Reg. Printer 777 56 4 -Buffer Printer / / / / / / / / A 777 566 A 4.3.2 G e r ä t e r e g i s t e r Wie b e r e i t s i n f r ü h e r e n K a p i t e l n b e s c h r i e b e n , s i n d d i e R e g i s t e r v o n G e r ä t e n w i e S p e i c h e r z e l l e n a n s p r e c h b a r. D i e Adressen l i e g e n i n d e n o b e r s t e n 4 K d e s A d r e s s b e r e i c h s , a l s o zwischen 760000 u n d 777776 ( = I / 0 - P a g e ) . Es i s t z u b e a c h t e n , d a ß n i c h t a l l e G e r ä t e r e g i s t e r ( - B i t s ) les- und schreibbar s i n d . So i s t e s z . B . n i c h t möglich (und n i c h t s i n n v o l l ) d a s K e y b o a r d - B u f f e r v o m UNIBUS a u s z u b e schreiben. Di e R e g i s t e r d e s DL11 ( T e r m i n a l - I n t e r f a c e ) : Register Adresse (physikal.) KeyboardStatus (KBS) 777560 InterruptVe k t o r 60 _KeyboardBuffer .(KBB) 777562 PrinterStatus (PTS) 777564 InterruptVe k t o r Printer Buffer (PTB) Format Funktionen 76 7 -Done B i t - g e s e t z t , wenn e i n n e u e s Z e i c h e n i m KBB v o r l i e g t ; g e l ö s c h t , wenn das KBB g e l e s e n w i r d . 6 - I n t e r r u p t Enable B i t - kann vom Programm g e s e t z t werden. D a d u r c h w i r d e i n Interrupt ermöglicht. 0 0-7 E n t h ä l t e i n Z e i c h e n vom Keyboard i m A S C I I - C o d e und d a s P a r i t y - B i t . K 1 7 -Ready B i t - e s w i r d g e s e t z t nach B e e n d i g u n g e i n e r Druckoperation;gelöscht, wenn e i n n e u e s Z e i c h e n i m PTB v o r l i e g t . 7 .551 76 6 - I n t e r r u p t Enable B i t - kann vom Programm g e s e t z t werden. D a d u r c h w i r d e i n Interrupt ermöglicht. 64 777566 7 K5.1 4-24 0 0-7 E n t h ä l t e i n Z e i c h e n , d a s auf den Drucker gebracht wird. 4 . 3 . 3 DATENEINGABE Jedes e i n g e g e b e n e Z e i c h e n w i r d e i n z e l n b e h a n d e l t . E i n Zeichen w i r d i n d e n B u f f e r g e b r a c h t u n d v o n d o r t p e r Programm g e h o l t . Vorgang 1 Es w i r d a u f e i n e Ta s t e g e d r ü c k t . 2 Das Z e i c h e n w i r d in ASCII-Code ü b e r setzt. Keyboard- S t a t u s -Register 7 Keyboard- B u f f e r 0 0 Ta s t a t u r 3 Der C o d e w i r d s e r i e l l übertragen. 4 Sobald d a s R e g i s t e r v o l l i s t ( d a s ganze Zeichen wurde ü b e r tragen) w i r d das Done B i t ( 7 ) g e setzt. 0 11 0 0 Keyboard- S t a t u s -Register 7 Keyboard- B u f f e r / / Das D o n e B i t b l e i b t solange g e s e t z t , b i s das Z e i c h e n p e r Befehl g e h o l t w i r d Die Ü b e r t r a g u n g v o m Buffer a u f den UNIBUS g e s c h i e h t B i t parallel. Ta s t a t u r P 0 1 1 0 0 0 0 1 Dateneingabe-Programmierung ( o h n e I n t e r r u p t ) Wegen d e r u n t e r s c h i e d l i c h e n G e s c h w i n d i g k e i t e n d e r s e r i e l l e n Ü b e r t r a g u n g v o n Te r m i n a l s u n d d e r p a r a l l e l e n Ü b e r t r a g u n g a u f d e n UNIBUS muß e r s t p e r Programm a b g e f r a g t w e r d e n , o b ein Zeichen i m Keyboard B u f f e r vorhanden i s t . D i e s g e s c h i e h t d u r c h Te s t e n d e s " D o n e B i t s " . Im f o l g e n d e n P r o g r a m m s o l l e n Z e i c h e n v o m K e y b o a r d b u f f e r (KBB) g e h o l t u n d i n d e n S p e i c h e r a b g e l e g t w e r d e n . D a s j e w e i l i g e Z e i c h e n s o l l a u c h a u f dem P r i n t e r e r s c h e i n e n (Echo). M i t D r ü c k e n d e s Z e i c h e n s " ! " s o l l d a s Programm beendet w e r d e n . S TA R T DONE BIT TESTEN NEIN JA ZEICHEN I M SPEICHER A B L E G E N ; PA R I T Y B I T D E S Z E I C H E N S L Ö S C H E N ; ZEICHEN AUSDRUCKEN NEIN JA ENDE Programm s i e h e A n h a n g A . 2 4-26 4 . 3 . 4 DATENAUSGABE Jedes Z e i c h e n w i r d e i n z e l n g e h o l t u n d i n d a s B u f f e r - R e g i s t e r g e l a d e n . Vo n d o r t w i r d e s a u f den D r u c k e r g e b r a c h t . Vorgang 1 Ein Zeichen w i r d p e r Programm i n d e n Printer-Buffer gebracht. Printer- S t a t u s - R e g i s t e r 7 Printer- B u f f e r y 2 3 Das Z e i c h e n w i r d s e r i e l l a u s dem B u f fer a u f den Drucker übertragen. Sobald d a s R e g i s t e r entleert i s t , wird das R e a d y B i t g e setzt. 7 . » 1 0 0 0 0 0 1 Drucker Printer- S t a t u s - R e g i s t e r 1 7 Printer- B u t t e r 4 Das n ä c h s t e Z e i c h e n kann a u s g e g e b e n werden. 01000001 Drucker 4-27 Datenausgabe- P r o g r a m m i e r u n g ( o h n e I n t e r r u p t ) Ein Z e i c h e n w i r d v i e l s c h n e l l e r i n s P r i n t e r B u f f e r g e b r a c h t , a l s e s mechanisch vom D r u c k e r a b g e a r b e i t e t werden kann. D e s h a l b muß e r s t p e r P r o g r a m m f e s t g e s t e l l t w e r d e n , ob d a s Z e i c h e n v o l l s t ä n d i g a b g e a r b e i t e t w u r d e . D i e P r ü f u n g e r f o l g t d u r c h Te s t e n d e s " R e a d y B i t s " . Das f o l g e n d e P r o g r a m m s o l l i m S p e i c h e r a b g e l e g t e A S C I I Zeichen a u s d r u c k e n . E r s c h e i n t d a s Z e i c h e n " ! " s o w i r d d a s Programm a n g e h a l t e n . READY B I T TESTEN ZEICHEN A U S S P E I C H E R HOLEN UND AUSDRUCKEN NEIN ENDE Programm s i e h e A n h a n g A . 2 4-28 Arbeitsblatt 4.4 1. W a s s i n d d i e f ü n f g r u n d l e g e n d e n F u n k t i o n e n e i n e s Interfaces? 2. M i t w e l c h e m B e f e h l k a n n man p r ü f e n , o b d a s D o n e B i t i m Keyboard S t a t u s R e g i s t e r g e s e t z t i s t ? 3. W e l c h e W i r k u n g h a b e n d i e s e B e f e h l e ? A: B I T B # 2 0 0 , a # 1 7 7 7 5 6 4 BPL A 4. W a s i s t e i n E c h o ? 5. S c h r e i b e n S i e e i n e R o u t i n e , d i e I h r e n Namen a u s d r u c k t . 4-29 4 . 4 S T A C K , T R A P, INTERRUPT 4 . 4 . 1 S T A C K - Te c h n i k Der S t a c k i s t e i n s p e z i e l l e r S p e i c h e r b e r e i c h , d e r e n t w e d e r vom P r o g r a m m i e r e r o d e r v o n d e r S y s t e m h a r d w a r e z u m v o r ü b e r gehenden A b l e g e n v o n D a t e n u n d A d r e s s e n v e r w e n d e t w i r d . Der S t a c k a r b e i t e t n a c h dem " l a s t i n , f i r s t o u t " - K o n z e p t (LIFO). E i n B e i s p i e l f ü r d i e s e s P r i n z i p i s t e i n Sackbahnh o f : D i e Wagen, d i e z u l e t z t e i n f u h r e n , f a h r e n z u e r s t w i e d e r hinaus. S t a c k : Das z u l e t z t eingespeicherte Wort w i r d a l s erstes wieder abgeholt. LEERER' STACK 1 PUSH PUSH PUSH POP PUSH -•-••••• Push: Pop: 1Wort a u f Stack ablegen 1 W o r t vom S t a c k h o l e n Eine s o l c h e S t a c k o r g a n i s a t i o n k a n n p r o g r a m m i e r t w e r d e n , i n dem man s i c h d e s a u t o - i n c r e m e n t / - d e c r e m e n t - M o d e s m i t e i n e m b e l i e b i g e n R e g i s t e r RO b i s R 6 b e d i e n t . Das R e g i s t e r R 6 h a t d a b e i e i n e b e s o n d e r e B e d e u t u n g : E i n e r s e i t s k a n n e s v o m Programm b e n u t z t w e r d e n , a n d e r e r s e i t s w i r d e s v o n d e r Hardware b e i Tr a p und Unterprogrammen automatisch verwendet. R6 w i r d deshalb a l s S t a c k p o i n t e r (SP) b e z e i c h n e t . W i e - a u s o b i g e m B i l d e r s i c h t l i c h , z e i g t d e r Stackpointer ( P f e i l ) immer a u f das z u l e t z t eingeschriebene Wort. 4-30 Der S t a c k w i r d b e i d e r PDP-11 v o n h o h e n A d r e s s e n n a c h u n t e n b e s c h r i e b e n . D i e s e r Vo r g a n g w i r d " P u s h " g e n a n n t . M a n b e d i e n t s i c h dazu d e s a u t o - d e c r e m e n t Modes: "Push": M O V S o u r c e , - ( S P ) ; l a d e d e n Source Operanden d o r t h i n , w o h i n SP-2 . zeigt. Das A u s l e s e n a u s d e m S t a c k n e n n t man " P o p " . M a n b e d i e n t s i c h i n a n a l o g e r Weise d e s a u t o - i n c r e m e n t Modes. "Pop": M O V ( S P ) + , D e s t i n a t i o n ; l a d e den Wert a u f den SP z e i g t n a c h " D e s t i n a t i o n " u n d e r h ö h e SP anschließend um 2 . Nach e i n e m P o p i s t d e r ' S P u m 2 e r h ö h t u n d z e i g t a u f d i e n u n zuletzt beschriebene Speicherzelle. ü b l i c h e r w e i s e w i r d e i n Programm i n d e n h ö c h s t e n S p e i c h e r bereich geladen. O f t i s t e s von Vo r t e i l , d e n Stack g l e i c h d a r u n t e r a n z u o r d n e n . D a m i t v e r m e i d e t man e i n Ü b e r s c h r e i b e n des Programmes b e i S t a c k - R o u t i n e n . PROGRAMME POP P U S H PC ABLAUFRICHTUNG VON P R O G R A M M E N S TA C K SP S TA C K Z U G R I F F S TA R TA D R E S S E N FÜR TRAP- UNO I N T E R R U P TROUTINEN VEKTORBEREICH 400 .... Der S t e c k d a r f n u r b i s z u m S p e i c h e r p l a t z 4 0 0 b e n u t z t werden, d a d e r V e k t o r b e r e i c h w i c h t i g e I n f o r m a t i o n e n b e i n h a l t e t , w e l c h e n i c h t überschrieben werden d ü r f e n ! Jeder Ve r s u c h , m i t dem S t e c k P o i n t e r u n t e r d i e Z e l l e 4 0 0 (resp. S t a c k L i m i t ) z u schreiben, h a t einen Trap nach Z e l l e 4 z u r Folge (Steck Overflow Tr a p ) . Achtung: D e r Steck Overflow Tr a p verwendet seinerseits den Stack! (Genaueres s i e h e P r o c e s s o r H a n d b o o k ) Die G r ö ß e d e s S t e c k i s t s t a r k p r o g r a m m a b h ä n g i g . E r s o l l t e d e s h a l b i n j e d e m Programm g e n a u v o r a u s b e r e c h n e t w e r d e n , damit d i e A d r e s s e 4 0 0 n i c h t u n t e r s c h r i t t e n w i r d . 4 - 31 4.4.2 TRAP "TRAP" i s t d e r O b e r b e g r i f f f ü r P r o g r a m m u n t e r b r e c h u n g e n hervorgerufen durch: Interrupt (Anforderung von externen Geräten) Programm (programmierte U n t e r brechnung) Hardware (CPU-Hardware erkennt F e h l e r ) J e d e r TRAP l ö s t a u t o m a t i s c h f o l g e n d e n Vo r g a n g a u s : (SP) 1. P S a l t 2. P C -(SP) alt 3. ( V e k t o r ) 4. ( V e k t o r + 2 ) PC P S 1. D e r . P r o z e s s o r s t a t u s d e s u n t e r b r o c h e n e n Programms w i r d auf den Stack g e l e g t . 2. D e r Programm- C o u n t e r d e s u n t e r b r o c h e n e n Programms w i r d auf den Stack g e l e g t (=Rückkehradresse). 3. E i n e d u r c h d i e A r t d e s TRAP d e f i n i e r t e A d r e s s e ( V e k t o r ) wird ausgegeben. D e r I n h a l t d i e s e r Adresse w i r d i n den Programm- C o u n t e r ( P C ) g e l a d e n ( = S t a r t a d r e s s e f ü r B e d i e nungsprogramm). 4. D e r P r o z e s s o r e r h ö h t d e n V e k t o r um 2 u n d v e r w e n d e t d i e s e Adresse u m d e n n e u e n P r o z e s s o r s t a t u s z u l a d e n ( = P S f ü r Bedienungsprogramm). 4-32 B e i s p i e l f ü r e i n e TRAP-Sequenz 4 001012 6 000340 1000 START: 1010 012706 001000 005037 160000 000000 1012 1014 1016 000240 000000 000002 ERROR: 1004 movel000,sp CLR 4'44160000 HALT NOP HALT RTI TRAP PSW PC - ( ( (VECT) P (VECT+2) P S P ) S P ) C S X X X X X X - - - 4 . 1 1 W 0 0 3 1 0 1 - - e l . <774> 2 4 0 <776> - - PC - - - 0 . - PSW STACK 000776 X X X X X X 000774 0 0 1 0 1 0 000772 000770 RTI (SP)+ PC 1 0 (SP)+ PSW X X 1 X 0 X X ---0-PC X P S W Der F e h l e r i n Z e l l e 1 0 0 4 ( w e l c h e r ? ) l ö s t e i n e n TRAP d u r c h 4 aus. D i e B e d e u t u n g d e s B e f e h l s R T I ( R e t u r n f r o m I n t e r r u p t ) wird i n Kap. 4 . 4 . 3 e r k l ä r t . 4-33 TRAP-CATCHER 4 000006 6 000000 H A L T 1000 0 1 2 7 0 6 S T A R T : M O V 1 W 1 0 0 0 , S P 001000 1004 0 0 5 0 3 7 C L R a W 1 6 0 0 0 0 160000 1010 0 0 0 0 0 0 H A L T TRIP PSW - ( S P ) X X 0 X X 1 0 X ---.- <776> PC - - . - - 1 1 0 . • - ( S P ) (VECT) - - . 0 . P C 6 - - 1 . - PC (VECT+2) S W 0 - - - 0 - PSW P 1 X < 7 7 4 > STACK 000776 X X X X X X 000774 0 0 1 0 1 0 000772 000770 Hinweis: Jede v e r n ü n f t i g e P r o g r a m m i e r u n g muß m i t d e m A u f s e t z e n (=Laden) d e s S t a c k p o i n t e r s u n d d e r T r a p - V e k t o r e n b e g i n n e n , da man z u k e i n e m Z e i t p u n k t v o r F e h l e r n d e s P r o g r a m m s b z w . der Hardware s i c h e r i s t . N i c h t d e f i n i e r t e S t a c k p o i n t e r u . Ve k t o r e n f ü h r e n b e i T r a p s u . U . z u r Z e r s t ö r u n g d e s P r o g r a m m s und machen e i n e e f f i z i e n t e F e h l e r s u c h e p r a k t i s c h u n m ö g l i c h ! S i e h t m a n k e i n e S e r v i c e r o u t i n e n v o r , s o muß z u m i n d e s t e i n Tr a p - C a t c h e r a u f g e s e t z t w e r d e n ! 4 - 34 4 . 4 . 3 INTERRUPT 1. D e f i n i t i o n u n d Anwendung Unter I n t e r r u p t v e s t e h t man d i e U n t e r b r e c h n u n g e i n e s l a u f e n d e n Programmes d u r c h e i n b e s t i m m t e s e x t e r n e s Ereignis. • I n t e r r u p t - S t e u e r u n g w i r d d o r t angewendet, w o d a s E i n t r e f f e n e i n e s E r e i g n i s s e s d a s l a u f e n d e Programm u n t e r brechen s o l l . - D i e Interrupt-Steuerung erlaubt es, d i e Kapazität eines Rechners o p t i m a l u n d z i e l g e r i c h t e t a u s z u n ü t z e n . Beispiel: Die A u s g a b e e i n e s Z e i c h e n s z u m Te r m i n a l b e n ö t i g t c a . 1 0 0 ms. D i e O p e r a t i o n e n d e r CPU b e l e g e n d a v o n c a . 2 0 u s , d . h . ca. 0 , 2 % o . W ä h r e n d d e r r e s t l i c h e n 9 9 , 9 8 % d e r A u s g a b e z e i t w a r t e t d i e CPU i n e i n e r S c h l e i f e b i s d a s R e a d y - B i t g e s e t z t i s t . W i r d d i e Ausgabe i n t e r r u p t g e s t e u e r t , k a n n d e r P r o z e s sor während d i e s e r Z e i t v o n 9 9 , 9 ms c a . 2 0 ' 0 0 0 B e f e h l e weilt e r e r Programme a b a r b e i t e n . S o b a l d d a s Z e i c h e n a u s g e b e n w i r d , s e t z t d i e H a r d w a r e d e s Te r m i n a l - I n t e r f a c e d a s R e a d y B i t , was s o g l e i c h e i n e n I n t e r r u p t Request f ü r die'Ausgabe des n ä c h s t e n Z e i c h e n s e r z e u g t . O b w o h l d e r P r o z e s s o r F ü r weitere Aufgaben e i n g e s e t z t wurde, v e r z ö g e r t s i c h 'der A u s gabevorgang v o n a u ß e n g e s e h e n n i c h t . Ve r g l e i c h INTERRUPT LOOP SERVICE Mg> 17777777r> v / z / z / z / z / / / 7 7 / i > 1 E Z = 2 2 2 2 > PROZESSOR y//z77>-*-WARTEN AUFREADY-I.- / / / / ' / Z > ÜBERGABE INTERRUPT EINES I I 1 READY UND VEKTOR ZEICHENS PERIPH.GER ÄT GERÄTVERARBEITET DATEN P E R I P H . GERÄT VERARBEITET DATEN Da m e i s t m e h r e r e G e r ä t e " i n t e r r u p t - f ä h i g " s i n d ü b e r g i b t d a s u n t e r b r e c h e n d e G e r ä t e i n e n V e k t o r um d e n P r o z e s s o r a u f d i e entsprechende I n t e r r u p t - S e r v i c e r o u t i n e z u v e r w e i s e n . 4-35 2. D a s P r i o r i t ä t e n s c h e m a d e r PDP 1 1 A. V e r t i k a l e P r i o r i t ä t Da a l l e P h e r i p h e r a l s u n d d e r P r o z e s s o r d e n U n i b u s a l s gemeinsamen D a t e n k a n a l b e n u t z e n u n d s o m i t d i e G e f a h r b e steht, daß s i c h zwei Geräte z u r g l e i c h e n Z e i t melden, muß man d e n G e r ä t e n P r i o r i t ä t e n z u o r d n e n . Dies g e s c h i e h t m i t H i l f e v o n 5 R e q u e s t l e i t u n g e n : BR 4 , B R 5 , B R 6 , B R 7 , N P R . Die h ö c h s t e P r i o r i t ä t o h n e E i n s c h r ä n k u n g b e s i t z e n G e r ä t e an d e r N P R - L e i t u n g (MPR=non p r o c e s s o r r e q u e s t ) . H i e r werden G e r ä t e a n g e s c h l o s s e n , d i e d i r e k t m i t dem S p e i c h e r k o r r e s p o n d i e r e n o h n e M i t w i r k u n g d e s P r o z e s s o r s (DMA = d i r e c t memory a c c e s s ) . Ein I n t e r r u p t s i g n a l v o n einem G e r ä t m i t d i e s e r P r i o r i t ä t w i r d vom P r o z e s s o r i n jedem F a l l a k z e p t i e r t . A l l e a n d e r e n R e q u e s t s kommen n u r d a n n z u r G e l t u n g , w e n n d i e CPU i m PSW e i n e n i e d r i g e r e P r i o r i t ä t e n t h ä l t a l s d i e entsprechende R e q u e s t l e i t u n g . PROCESSOR PRIORITÄTEN GERÄTE PRIORITÄTEN NPR DMA BR7 D2 BR 6 D3 D4 BR 5 D5 D6 BR4 D7 De 0 PSW C P U —▶) EXTERNE GERÄTE n 4 - 36 D9 B. H o r i z o n t a l e P r i o r i t ä t : An e i n e r R e q u e s t l e i t u n g k ö n n e n m e h r e r e G e r ä t e l i e g e n . D a aber d i e G e r ä t e a l l e " i n t e r r u p t f ä h i g " s i n d , muß a u c h h i e r e i n e P r i o r i t ä t v e r t e i l t w e r d e n . Z u d i e s e m Zweck w i r d d i e GRANT- L e i t u n g v o m P r o z e s s o r d u r c h j e d e s I n t e r f a c e g e s c h l e i f t . S e n d e t e i n G e r ä t BUS-REQUEST ( B R ) , w i r d diese L e i t u n g i m b e t r e ff e n d e n I n t e r f a c e f ü r d i e f o l g e n den G e r ä t e u n t e r b r o c h e n u n d d a s v o m P r o z e s s o r a k t i v i e r t e GRANT- S i g n a l h a t n u r f ü r d i e s e s G e r ä t G ü l t i g k e i t . Durch d i e s e S e r i e n s c h a l t u n g e r g i b t s i c h , d a ß d a s G e r ä t , w e l c h e s d e r CPU am n ä c h s t e n l i e g t d i e h ö h e r e P r i o r i t ä t besitzt. I BR 4 1.4 SACK CPU 1 D2 GRANT 4 -37 D3 3. I n t e r r u p t - A b l a u f 1. I s t e i n G e r ä t z u m D a t e n a u s t a u s c h b e r e i t , s e t z t e s e i n DONE- b z w . R E A D Y- B i t i n s e i n e m S t a t u s w o r t . W u r d e d a s INTERRUPT ENABLE B i t g e s e t z t , e r z e u g t d a s G e r ä t d a durch e i n e n Bus-Reauest. 2. D e r UNIBUS- C o n t r o l l e r d e r CPU v e r g l e i c h t d i e P r i o r i tät des Gerätes m i t d e r a k t u e l l e n P r i o r i t ä t des Prozessors.. 3. D i e l a u f e n d e I n s t r u k t i o n w i r d f e r t i g a b g e a r b e i t e t . 4. I s t d i e P r i o r i t ä t d e s P r o z e s s o r s h ö h e r , w i r d d e r R e quest i g n o r i e r t . I s t a b e r d i e P r i o r i t ä t d e s Requests höher a l s d i e a k t u e l l e P r i o r i t ä t d e s P r o z e s s o r s , s o sendet d e r P r o z e s s o r e i n Q u i t t u n g s s i g n a l ü b e r d i e "BUS GRANT"- L e i t u n g u n d d a s G e r ä t e r h ä l t d i e K o n t r o l le über den Bus. 5. S o b a l d e i n G e r ä t " B U S MASTER" i s t , s e n d e t e s zusammen m i t d e m I N T E R R U P T- S i g n a l d e n VEKTOR. D i e s e r v e r w e i s t den P r o z e s s o r a u f d a s S t a t u s w o r t u n d d i e S t a r t a d r e s s e der I n t e r r u p t - S e r v i c e r o u t i n e . 6. D i e i n d e r CPU a b l a u f e n d e S e q u e n z i s t ( b e r e i t s i m Kap. 4 . 3 . 2 g e z e i g t ) b e i j e d e r A r t v o n U n t e r b r e c h u n g gleich: 1. P S - - ¢ - —:-- ( S P ) C 2. P — . . . . -(SP) 3. ( Ve c a l t o r ) - - - - 0 . P C 4. ( V e c t o r + 2 ) - - - e - P S 7. D a d u r c h w i r d d i e I n t e r r u p t - R o u t i n e a u f g e r u f e n . D e r ganze A b l a u f b i s h i e r h e r i s t r e i n h a r d w a r e m ä s s i g f e s t g e l e g t ; insbesondere g i l t : SP = R6! 8. M i t d e m B e f e h l R T I w i r d d i e I n t e r r u p t - R o u t i n e b e e n d e t . D e r a l t e PC u n d P S w e r d e n v o m S t a c k g e h o l t u n d i n d i e CPU g e l a d e n . RTI PC PS 1. ( S P ) + 2. ( S P ) + 9. E i n e I n t e r r u p t - R o u t i n e k a n n j e d e r z e i t d u r c h e i n e n Bus-Request, d e r h ö h e r e P r i o r i t ä t b e s i t z t , u n t e r brochen w e r d e n . B e i e i n e m s o l c h e n I n t e r r u p t w e r d e n d e r PC u n d PS d e r arbeitenden I n t e r r u p t - R o u t i n e e b e n f a l l s a u f den Stack g e r e t t e t , u n d d i e neue I n t e r r u p t - R o u t i n e w i r d g e s t a r t e t . D i e Ve r s c h a c h t e l u n g v o n I n t e r r u p t s k a n n b i s z u . einem b e l i e b i g e n L e v e l g e h e n ( N e s t i n g ) . S i e w i r d n u r durch e i n e n m ö g l i c h e n S t a c k - O v e r f l o w b e g r e n z t . 4-38 4. R e g e l n f ü r d i e I n t e r r u p t - P r o g r a m m i e r u n g Wie g e z e i g t , k ö n n e n I n t e r r u p t s b e l i e b i g v e r s c h a c h t e l t werden. B e i d e r B e h a n d l u n g d e r I n t e r r u p t s u n d d e r F e s t legung d e r P r i o r i t ä t e n müssen d e s h a l b d i e f o l g e n d e n R e geln b e a c h t e t werden: 1. R e g e l : D e r L e v e l i m S t a t u s - W o r t d e r I n t e r r u p t Routine s o l l t e mindestens g l e i c h hoch sein w i e d e r L e v e l d e r Bus Request L i n e , . an d i e d a s e n t s p r e c h e n d e G e r ä t a n g e schlossen i s t . Damit w i r d v e r h i n d e r t , d a ß w e n i g e r d r i n g e n d e I n t e r r u p t s (auf tieferem P r i o r i t ä t s n i v e a u ) e i n z e i t k r i t i s c h e s Interruptprogramm unterbrechen. B e i s p i e l : Würde das Interruptprogramm des K a r t e n l e s e r s ( B R 6 ) v o m TTY I n t e r r u p t ( B R 4 ) unterbrochen,wäre e s möglich, daß d i e Information e i n e r Lochkartenkolonne verlorengeht'. Diese R e g e l s e t z t v o r a u s , d a ß d i e H a r d w a r e p r i o r i t ä t e n vernünftig zugeteilt sind! 2. R e g e l : D i e P r i o r i t ä t e i n e r I n t e r r u p t - R o u t i n e s o l l e r s t dann h e r u n t e r g e s e t z t werden, wenn d e r I n t e r r u p t b e h a n d e l t i s t . Die I n t e r r u p t - R o u t i n e s o l l j e d o c h n u r d a s a b s o l u t N o t wendige e r l e d i g e n ( D a t e n t r a n s f e r , F e h l e r e r k e n n u n g , . . . ) und a l l e s w e n i g e r D r i n g l i c h e dem H a u p t p r o g r a m m ( r e s p . einem d u r c h p r o g r a m m i e r t e n I n t e r r u p t a u s g e l ö s t e n P r o gramm a u f t i e f e r e P r i o r i t ä t ) ü b e r l a s s e n . 3. R e g e l : S ä m t l i c h e R e g i s t e r , d i e i n e i n e r I n t e r r u p t - R o u t i n e g e b r a u c h t w e r d e n , s i n d am Anfang z u r e t t e n u n d v o r V e r l a s s e n d e r Routine w i e d e r z u r ü c k z u l a d e n . Beim E i n t r i t t i n e i n e I n t e r r u p t - R o u t i n e s i n d d i e R e g i s t e r m i t d e n W e r t e n d e s u n t e r b r o c h e n e n Programmes g e l a d e n . B e i d e r R ü c k k e h r a u s d e r I n t e r r u p t - R o u t i n e muß d i e s e s Programm d i e g l e i c h e n W e r t e w i e u n m i t t e l b a r v o r der U n t e r b r e c h u n g v o r f i n d e n . !•ian e r r e i c h t d i e s , i n d e m man a l l e R e g i s t e r , d i e i n d e r I n t e r r u p t - R o u t i n e g e b r a u c h t w e r d e n , a m A n f a n g r e t t e t u n d am S c h l u ß d e r I n terrupt-Routine wieder zurücklädt. 4. R e g e l : D e r g e s a m t e V e k t o r b e r e i C h d e s A r b e i t s s p e i c h e r s muß s i n n v o l l d e f i n i e r t s e i n . Beispiel: K a p i t e l 4.5.6 4 - 39 ARBEITSBLATT 4 . 5 1. Wa n n w i r d e i n I n t e r r u p t - S i g n a l v o n e i n e m I n t e r f a c e erzeugt? 2. Wa s i s t d e r I n h a l t d e r I n t e r r u p t - V e k t o r - A d r e s s e ? 3. W i e bekommt e i n G e r ä t B u s - K o n t r o l l e ? 4. Warum h a b e n N P R ' s d i e h ö c h s t e P r i o r i t ä t ? 5. W e l c h e s G e r ä t h a t d i e h ö c h s t e h o r i z o n t a l e P r i o r i t ä t ? 6. W o r a u s b e s t e h t d e r I n i t i a l i s i e r u n g s - T e i l e i n e s Interrupt-Programms? 4-40 4.5 U n t e r p r o g r a m m i e r u n g ( S u b r o u t i n e s ) 4.5.1 E i n l e i t u n g S o l l i n e i n e m ( H a u p t - ) Programm e i n b e s t i m m t e r A b s c h n i t t mehrmals ( a n v e r s c h i e d e n e n S t e l l e n ) d u r c h l a u f e n w e r d e n , s o kann d i e s e r a l s U n t e r p r o g r a m m g e s c h r i e b e n w e r d e n . A n j e d e r entsprechenden S t e l l e d e s Hauptprogrammes s t e h t n u n s t a t t des g e s a m t e n A b s c h n i t t e s l e d i g l i c h e i n S p r u n g b e f e h l i n d a s Unterprogramm ( J S R ) , a m E n d e d e s U n t e r p r o g r a m m s e i n R U c k sprungbefehl (RTS) i n s Hauptprogramm. H A U P TU PROGRAM M N P R T O E G R R A M M S TA R T R TS Anmerkung: W i e b e i I n t e r r u p t s ' i s t a u c h h i e r d i e M ö g l i c h k e i t des " N e s t i n g s " g e g e b e n , d . h . e i n U n t e r p r o g r a m m r u f t e i n w e i t e r e s Unterprogramm ( e v e n t u e l l s i c h s e l b s t ) a u f . D i e s e Methode w i r d b e i r e k u r s i v e n Prozeduren i n h ö h e r e n Programmiersprachen v e r wendet. 4 - 41 4.5.2 Unterprogrammsprung, JSR Vor e i n e m S p r u n g i n e i n U n t e r p r o g r a m m muß d i e R ü c k k e h r adresse g e r e t t e t w e r d e n . D i e s e A d r e s s e s t e h t a b e r g e r a d e i m PC, d a d i e s e r b e r e i t s a u f d e n n ä c h s t e n B e f e h l d e s H a u p t p r o grammes z e i g t . D e r S p r u n g s e l b s t w i r d d u r c h d a s L a d e n d e r Z i e l a d r e s s e i n d e n PC a u s g e l ö s t . D e r e b e n b e s c h r i e b e n e V o r gang w i r d d u r c h d e n B e f e h l J S R , J u m p t o S u b r o u t i n e , b e wirkt: JSR: C o d e 0 0 4 R D D 1. Z i e l a d r e s s e T e m p . 2. L i n k -Reg. - ( S P ) 3. P C - - A l b - 4. Te m p . R e g . P Reg. L i n k -Reg. C 1. D i e Z i e l a d r e s s e w i r d i n e i n e m C P U - i n t e r n e n R e g i s t e r ( Te m p . R e g . ) z w i s c h e n g e s p e i c h e r t . V o n w o d i e s e A d r e s s e g e h o l t w i r d e r g i b t s i c h a u s D e s t i n a t i o n -Mode u n d R e g i s t e r des JSR-Befehls (DD). 2. D e r I n h a l t e i n e s d e r a l l g e m e i n e n C P U - R e g i s t e r - b e i d e r Unterprogrammierung a l s " L i n k - R e g i s t e r " b e z e i c h n e t - w i r d in den Steck abgelegt. Dieses R e g i s t e r w i r d e b e n f a l l s i m JSR-Code a n g e g e b e n ( R ) . 3. D e r I n h a l t d e s PC ( = R ü c k k e h r - b z w . L i n k - A d r e s s e ) w i r d i n das L i n k r e g i s t e r g e l a d e n . 4. D i e Z i e l a d r e s s e w i r d v o m Te m p . R e g . i n d e n PC g e b r a c h t . Damit w i r d d a s U n t e r p r o g r a m m g e s t a r t e t . 4-42 4 . 5 . 3 U n t e r p r o g r a m m r ü c k s p r u n g , RT S Die R ü c k k e h r a u s d e m U n t e r p r o g r a m m w i r d d u r c h d e n B e f e h l RTS, R e t u r n f r o m S u b r o u t i n e , a u s g e f ü h r t . D a d i e R ü c k k e h r a dresse vom J S R - B e f e h l i n s L i n k - R e g i s t e r g e r e t t e t w u r d e , braucht d e r RTS-Befehl n u r a u f d i e s e s z u z u g r e i f e n : RTS: C o d e 00020R 1. L i n k -Reg. 2. ( S P ) + P L i C n k -Reg. 1. D e r I n h a l t d e s i m R T S - B e f e h l a n g e g e b e n e n L i n k - R e g i s t e r s w i r d i n d e n PC g e l a d e n . D i e A n g a b e d e s L i n k - R e g i s t e r s muß i n JSR u n d RTS . i d e n t i s c h s e i n ( A u s n a h m e n n u r d u r c h besondere p r o g r a m m t e c h n i s c h e Vo r k e h r u n g e n m ö g l i c h ) ! 2. D e r i n d e n S t a c k g e r e t t e t e I n h a l t d e s z u m " L i n k e n " b e nutzten CPU-Registers w i r d zurückgeladen. 4-43 ARBEITSBLATT 4 . 6 Beantworten S i e b i t t e f o l g e n d e F r a g e n : 1. Wa s i s t d e r I n h a l t d e s S P n a c h A u s f ü h r u n g d i e s e r Befehle? MOVI4500,SP MOV R 0 , - ( S P ) MOV R 1 , - ( S P ) 2. W i e i s t d e r i n t e r n e A b l a u f d e s B e f e h l s JSR R5,AUS ? 3. W i e i s t d e r i n t e r n e A b l a u f d e s B e f e h l s RTS PC ? 4. W i e r u f e n S i e d i e U n t e r r o u t i n e PRINT a u f ? PRINT: T S T B a#TKS RTS R 4 4-44 4.5.4 Ü b e r t r a g u n g v o n Parametern i n Unterprogramme ( L i n k a g e ) S o l l e i n Unterprogramm m i t Argumenten (Operanden) v e r s o r g t werden, s o g e s c h i e h t d i e s m i t H i l f e d e s L i n k - R e g i s t e r s . Das L i n k r e g i s t e r b e i n h a l t e t , w i e b e r e i t s e r l ä u t e r t , d i e Adresse d e r a u f d e n J S R - B e f e h l f o l g e n d e n S p e i c h e r z e l l e . Diese S p e i c h e r z e l l e b e i n h a l t e t e n t w e d e r - d e n n ä c h s t e n B e f e h l d e s Hauptprogramms, o d e r - e i n e n Operanden, o d e r - d i e A d r e s s e e i n e s Operanden Den l e t z t e n b e i d e n M ö g l i c h k e i t e n i s t d i e s e s K a p i t e l g e widmet. I s t z . B . R 5 d a s L i n k - R e g i s t e r, k a n n d a s e r s t e A r gument ü b e r d i e A d r e s s i e r u n g s a r t e n ( R 5 ) , ( R 5 ) + , X ( R 5 ) f ü r Operanden o d e r ü b e r ( R 5 ) + u s w . f ü r d i e A d r e s s e d e r O p e randen v e r w e n d e t w e r d e n . W i r d d e r A u t o - I n c r e m e n t - M o d e v e r wendet, s o w i r d d a s L i n k - R e g i s t e r a u t o m a t i s c h r i c h t i g g e s e t z t u n d z e i g t zum n ä c h s t e n Argument o d e r - f a l l s d i e Oper a n d e n / A d r e s s e n n a c h dem J S R - B e f e h l i m H a u p t p r o g r a m m s t e hen- e v e n t u e l l a u f d e n n ä c h s t e n B e f e h l d e s H a u p t p r o g r a m m s . 1, B e i s p i e l : 10400 10402 10404 10406 10410 JSR R5,SUBR lt N r. 2 > ("nächster Befehl"> ;Sprung i n d a s ; U n t e r p r o g r a m m SUBR ;Argumentenliste f ü r ;Unterprogramm 20306 SUBR: MOV (R5)+,R1 MOV (R5)+,R2 ;Zugriff auf Argumentliste ; m i t H i l f e v o n R5 ;R5 z e i g t j e t z t a u f d e n ;nächsten B e f e h l i m ;Hauptprogramm ;und d e r R T S - B e f e h l w i r d ;korrekt ausgeführt. RTS 4-45 2. B e i s p i e l : 10400 10402 10404 10406 10410 10412 JSR R 5 SUBR 77722 50304 30002 20306 20300 SUBR:MOVa(R5)+,R1 MOVa(R5)+,R2 RTS ;Sprung i n d a s ; U n t e r p r o g r a m m SUBR ;Adresse d e s 1.Arguments ; l t i t 2 . l t ; l t ▶ ▶ 3 . l t ;Zugriff (indirekt) auf ;die Argumente ;R5 z e i g t a u f d e n n ä c h s t e n ; B e f e h l i m Hauptprogramm ; R ü c k k e h r ins Anmerkung: S i n d d i e A r g u m e n t e a l l e i n e i n e r L i s t e m i t a u f steigenden Adressen a b g e l e g t , v e r e i n f a c h t s i c h das B e i s p i e l , d a i n 1 0 4 0 4 n u r d i e S t a r t a d r e s s e d e r L i s t e a n g e g e b e n w e r d e n muß. Z u s ä t z l i c h e r V o r t e i l d e r Angabe v o n A d r e s s e n v o n Operanden ( - L i s t e n ) : U n t e r p r o g r a m m e u n d O p e r a n den k ö n n e n b e l i e b i g i m S p e i c h e r v e r s t r e u t s e i n . Das H a u p t p r o g r a m m muß n i c h t d i e O p r a n d e n b e i n halten. 3. B e i s p i e l : . I n einem Unterprogramm s o l l e n 2 Wo r t e e i n e r Operanden- L i s t e addiert werden. Das Ergebnis s o l l i n d e r L i s t e stehen ( a n s t e l l e des 2 . Operanden). ; L i s t e n a n f a n g s a d r e s s e n a c h R1 ;laden ;PC a l s L i n k r e g i s t e r , w i r d ;immer a n g e g e b e n w e n n d a s ;Unterprogramm k e i n ;Linkregister benötigt. ;Addiere 1 . Operanden a u f 2 . ;Operanden ;R1 z e i g t a u f 2 . O p e r a n d e n ;(-Ergebnis) MOV LISTADR,R1 JSR PC,SUBR SUBR: ADD ( R 1 ) + , ( R 1 ) oder ADD ( R 1 ) , 2 ( R 1 ) ; w i e o b e n , j e d o c h z e i g t R1 n a c h ;wie v o r a u f den 1 . Operanden 4 - 46 4. B e i s p i e l : Da e s g r u n d s ä t z l i c h m ö g l i c h i s t , A r g u m e n t e v o m S t a c k z u holen, i s t e s e m p f e h l e n s w e r t e i n e K o p i e v o n R6 ( - S t a c k pointer) i n e i n anderes Register abzuspeichern. I n f o l g e n dem B e i s p i e l w u r d e R 6 v o r A b s p e i c h e r n d e r A r g u m e n t e n a c h R 5 g e r e t t e t . S o m i t z e i g t R5 s t e t s a u f d e n A n f a n g d e r S t a c k t a b e l l e , unabhängig von d e r Anzahl d e r Argumente: S TA C K Arg. N r.1 SP --•- R5 A r g . N r. 2 Arg. Nr. R5 A r g . N r. 2 Arg. N r. 3 Argumenthit2 steht i n (R5) Argument*. 2 steht ebenfalls in 2(R5) Würde man d e n S t a c k p o i n t e r a l s A r g u m e n t z e i g e r v e r w e n d e n : Argumentte2 steht i n -2(SP) Argument*2 steht i n (SP) Man m ü ß t e a l s o s t ä n d i g ü b e r d i e A n z a h l d e r A r g u m e n t e b z w . den S t a n d d e s S P i n f o r m i e r t s e i n . A u s f ü h r l i c h e B e i s p i e l e s i e h e Anhang A . 2 4-47 4.5.5 V e r g l e i c h : I n t e r r u p t - Unterprogramm ( B e i s p i e l ) BEISPIEL PERIPHERIE PROZESSOR, HAUPTSPEICHER HAU :)TPROGRAMM JSR UNTERPROGRAMM ÜBERGABE VON DATEN AN EXT. GERÄT EXT. GERÄT VERARBEITET DATEN READ.Y — INT. ENABLE START R TS INTERRUPT HAUPTPROGRAMM VEKTOR INTERRUPT SERVICE ROUTINE R T1 HAUPTPROGRAMM X PROGRAMMGESTEUERTER ÜBERGANG + EREIGNISGESTEUERTER ÜBERGANG 4-48 4.5.6 E/A-Programmierung m i t I n t e r r u p t Die E / A - P r o g r a m m b e i s p i e l e d e r v o r a n g e g a n g e n e n K a p i t e l h a b e n den g r o ß e n N a c h t e i l , d a ß d e r R e c h n e r w e r t v o l l e Z e i t i n e i ner Wa r t e s c h l e i f e v e r g e u d e t . Wie i n K a p i t e l 4 . 3 , 3 e r l ä u t e r t , s c h a f f t d i e M ö g l i c h k e i t d e r Programmunterbrechnung ( I n t e r r u p t ) e i n e s e h r e f f i z i e n t e A b h i l f e : N a c h übergabe/Übernahme e i n e s Z e i c h e n s b e g i n n t d e r Prozessor e i n e andere T ä t i g k e i t und d a s I n t e r f a c e m e l d e t sich p e r I n t e r r u p t wenn e s e i n neues Z e i c h e n übernehmen/ übergeben k a n n . D e r P r o z e s s o r u n t e r b r i c h t s e i n e T ä t i g k e i t nur f ü r d i e Z e i t d e r ü b e r g a b e n b e r n a h m e d e s n ä c h s t e n Z e i chens. Alle vorbereitenden T ä t i g k e i t e n d i e f ü r einen solchen Vo r gang n o t w e n d i g s i n d , w e r d e n a n f o l g e n d e m B e i s p i e l e r l ä u t ert. B e i s p i e l : E/A-Programm m i t I n t e r r u p t E i n Programm w e l c h e s f o r t l a u f e n d A S C I I - Z e i c h e n a u s d r u c k t , s o l l d u r c h d a s D r ü c k e n e i n e r b e l i e b i g e n Ta s t e d e r Te r m i n a l t a s t a t u r unterbrochen werden. Das g e d r ü c k t e Z e i c h e n s o l l a u f dem D r u c k e r e r s c h e i n e n (Echo) u n d a n s c h l i e ß e n d d e r A S C I I - A u s d r u c k f o r t g e s e t z t werden. Lesen S i e d i e s e s Programm a u f m e r k s a m u n d k o m m e n t i e r e n S i e es! 1000 S t a r t : M O V # 1 0 0 0 , S P 1004 C L R a#177776 1010 M O V #1050,a#60 1016 C L R a#62 1022 m o v e1o0,a#177560 1030 A S C I I : T S T B a # 1 7 7 5 6 4 1034 B P L ASCII 1036 M O V RO, 1 7 7 5 6 6 1042 I N C RO 1044 J M P A W A S C I I 1050 I N T : T S T B a # 1 7 7 5 6 4 1054 B P L INT 1056 M 0 V a # 1 7 7 5 6 2 , a # 4 7 7 5 6 6 1064 R T I 4-49 ANHANG A.1 B e d i e n u n g s a n l e i t u n g e n A . 1 . 1 L S I 11 - 0 D T A.1.2 P D P 11 / 0 4 , 11 / 3 4 Console E m u l a t o r A.1.3 P D P 11 / 0 4 , 11 / 3 4 Programmers C o n s o l e A.1.4 P D P 11 / 0 5 , 11 / 1 0 S w i t c h Panel A.1.5 P D P 11 / 3 5 , 11 / 4 0 S w i t c h Panel A.1.6 P D P 11 / 4 4 C o n s o l e A.2 P r o g r a m m b e i s p i e l s A.3 A b k ü r z u n g e n A.1 B e d i e n u n g s a n l e i t u n g e n A.1.1 L S I - O D T ( O n - l i n e Debugging To o l ) F ü r d i e F e h l e r s u c h e b e i Programmen h a t D i g i t a l E q u i p m e n t das Te s t p r o g r a m m ODT e n t w i c k e l t , d a s e n t w e d e r v o n e i n e m l o k a l e n o d e r e n t f e r n t e n Te r m i n a l b e d i e n t w e r d e n k a n n . D i e s e s Programm i s t e i n T e i l d e s P r o c e s s o r - M i c r o c o d e s u n d ermöglicht d e r Z e n t r a l e i n h e i t , a u f Befehle und I n f o r m a t i onen z u r e a g i e r e n , d i e d u r c h d a s Te r m i n a l e i n g e g e b e n w e r den. D i e K o m m u n i k a t i o n s e l b s t i s t e i n e F o l g e v o n A S C I I Zeichen, d i e v o n d e r Z e n t r a l e i n h e i t a l s K o n s o l b e f e h l e i n t e r p r e t i e r t werden. Die ODT-Kommandos k a n n man i m m e r b e n u t z e n , w e n n d e r P r o z e s s o r i m HALT-Mode i s t . I n d e n HALT-Mode kommt m a n : 1. d u r c h D r ü c k e n d e r BREAK- Ta s t e ( F u n k t i o n k a n n u n t e r drückt werden); 2. b e i d e r A u s f ü h r u n g e i n e r HALT- I n s t r u k t i o n ; 3. w e n n d e r R e c h n e r b e s t i m m t e F e h l e r e r k e n n t ; 4, w e n n man d i e HALT- Ta s t e b e t ä t i g t . H ä l t d e r P r o z e s s o r d a s l a u f e n d e Programm a n , d a n n e r f o l g t folgender Ausdruck: xxxxxx E7; Die Z a h l x x x x x x i s t d i e o k t a l e A d r e s s e d e s n ä c h s t e n B e f e h l e s u n d i s t d e r P r o m p t - C h a r a k t e r d e s O D T. ODT-Kommandos n/ D e r I n h a l t d e r S p e i c h e r z e l l e n ( o k t a l ) w i r d a u s g e d r u c k t . D a h i n t e r kann e i n n e u e r We r t angegeben werden (mit Abschlußzeichen): A b s c h l u ß z e i c h e n f ü r a n g e s p r o c h e n e Z e l l e ( S p e i c h e r R e gister) A b s c h l u ß z e i c h e n f ü r a n g e s p r o c h e n e Z e l l e ( S p e i c h e r R e g i s t e r ) und Ausdruck d e r nächst höheren Z e l l e ( S p e i c h e r, R e g i s t e r ) Sn/ o d e r Rn/ D e r I n h a l t d e s R e g i s t e r s n ( 0 - 7 ) w i r d a u s g e d r u c k t . D a h i n t e r k a n n e i n n e u e r We r t angegeben werden ( m i t A b schlußzeichen) RS/ D e r I n h a l t d e s PSW w i r d a u s g e d r u c k t nG E i n Programm w i r d b e i A d r e s s e n g e s t a r t e t P E i n Programm w i r d f o r t g e s e t z t ( n a c h HALT- B e f e h l ) A- 3 Single Step w i r d e i n Programm b e i . e i n g e s ä t l e i t e t e r HALT- Ta s t e m i t nG b e i A d r e s s e n g e s t a r t e t , s o k a n n e s m i t P i m E i n z e l s c h r i t t abgearbeitet werden. Anmerkung: D a s ODT b e i d e r 1 1 / 2 3 a r b e i t e t m i t 1 8 - B i t A d r e s s e n , a u c h w e n n k e i n e Memory-ManagementEinheit vorhanden i s t o d e r d i e s e n i c h t e i n g e schaltet wurde. A- 4 A.1.2 P D P 11 / 0 4 , 11 / 3 4 Console E m u l a t o r Der C o n s o l e E m u l a t o r i s t e i n i n ROM's a b g e l e g t e s H i l f s p r o gramm w e l c h e s d i e E i n g a b e v o n Programmen ü b e r e i n e Te r m i n a l t a s t a t u r e r m ö g l i c h t . I m N o r m a l f a l l w i r d d i e s e s Programm beim E i n s c h a l t e n d e r M a s c h i n e o d e r d u r c h B e t ä t i g e n d e r BOOT- Ta s t e ( b z w . CNTR-BOOT) g e s t a r t e t . D a s Programm m e l d e t s i c h n a c h dem A u s d r u c k d e r CPU R e g i s t e r RO R 4 I R 6 R 5 ( " O L D P C " ) m i t dem Prompt- Z e i c h e n o d e r 6'3 Nun k ö n n e n f o l g e n d e Kommandos e i n g e g e b e n w e r d e n : L x x x x x x Laden d e r A d r e s s e x x x x x x (oktal!). Examine: A u s d r u c k d e s I n halts der vorher eingegebenen A d r e s s e . Eingabe d e s W e r t s ZZZZZZ (oktal) i n die vorher eingegebene A d r e s s e . S t a r t d e s Programms. Startadresse vorher e i n geben. S t a r t e i n e s Bootprogramms (hier f ü r RK05-Platte). D i e s e s Programm h o l t d e n Monitor von externen Speichergeräten ( P l a t t e , Band) u n d s t a r t e t d i e s e n . i i E YYYYYY D ZZZZZZ a s 61. DKO A- 5 A.1.3 P D P 11 / 0 4 , 11 / 3 4 Programmers Console DC CN • DC OFF BOOT (P -/• 7 7 1 O K T A L E TASTEN 7 7-7 7 ' O 2 D I S P L A Y ADDRESS 3 L O A D ADDRESS 4 L O A D k t a D D SWITCH REGISTER y ' / 7 / ' 7 ' / 7 ' i e l e / j ' y • / % r Zahlen werden eingegeben. e laufende Adresse w i r d angezeigt. r I n h a l t des Display-Registers wird i n den Prozessor gebracht. D e r I n h a l t des Display-Registers wird i n d i e Adresse 177570 g e bracht. 5 C L E A R Das D i s p l a y w i r d g e l ö s c h t . A- 6 i 6 E X A M I N E Der I n h a l t d e r g e l a d e n e n A d r e s s e wird angezeigt. E i n wiederholtes Drücken z e i g t d e n I n h a l t d e r nächsten Adresse a n . 7 D E P O S I T Der I n h a l t d e s D i s p l a y - R e g i s t e r s wird i n d i e geladene Adresse gebracht. 8 C N T R L Diese Ta s t e w i r d i n Ve r b i n d u n g m i t a n d e r e n Ta s t e n v e r w e n d e t . (CONTROL) 9 I N I T I A L I Z E ( m i t CNTRL) 10 H A L T / S I N G L E STEP(mit CNTRL) 11 12 Der P r o z e s s o r w i r d a n g e h a l t e n . H A LT / S I N G L E STEP ( o h n e C N T R L ) Ermöglicht Single-Step-Mode. CONTINUE ( m i t C N T R L ) Nach e i n e m H A LT w i r d d i e A b a r b e i tung d e s Programms To r g e s e t z t . B O O T 13 S T A R T ( m i t CNTRL) Das B o o t s t r a p - P r o g r a m m w i r d g e startet. ( m i t CNTRL) Der P r o z e s s o r w i r d a n d e r g e l a denen A d r e s s e g e s t a r t e t . A- 7 A.1.4 P D P 11 / 0 5 , 11 / 1 0 S w i t c h Panel OAT.A 12 1 [ 7 1 1 1 [ 1 0 — I r 1 1-81 EEF-5-1 3 4 LGCO® 2 » U t e (lt, , r : -‘ -„ - . ,. --_.• ,ii,:i .....e ea......1 .-..-y- ......, ,..._.„..L.9 ',.:,;7:4 • 71."."'":7 . r_,...:, r .;.',,, -,........j .«...,....,....-- -.... , : • -A — ,_..... , 1 A D D R E S S / D A T A D I S P L AY 2 S W I T C H REGISTER 3 L O A D ADDRESS i n ä r e Zahlen oder Adressen werden i n d e n P r o z e s s o r g e l a d e n . Stellung d e r S c h a l t e r oben = 1 , unten = 0 . r Inhalt des Switch-Registers (eine Adresse) w i r d i n den P r o zessor g e b r a c h t . e D e r I n h a l t d e r geladenen Adresse wird angezeigt. E i n wiederholtes Drücken z e i g t d e n I n h a l t d e r nächsten Adresse. D e r Prozessor l ä u f t weiter, nachdem e r v o n e i n e m H A LT B e f e h l g e stoppt wurde. 6 E N A B L E / H A LT I n Enable-Stellung kann der Prozessor normal a r b e i t e n . I n H a l t Position w i r d d e r Rechner nach Ausführung d e r l a u f e n d e n I n s t r u k tionen angehalten. 7 S T A R T 8 D E P O S I T wenig/ 1,me.• D i e s e 1 6 Lämpchen ( 1 6 B i t s ) zeigen entweder Daten oder Adressen, a b h ä n g i g v o n d e n gedrückten Schaltern, a n . D EXAMINE ' 5 C O N T I N U E B Der P r o z e s s o r w i r d a n d e r g e l a denen A d r e s s e g e s t a r t e t . D e r A- 8 0 A(lIt5 CONTI I START) EXAM I n h a l t des Switch-Registers wird i n d i e geladene Adresse g e speichert. Durch wiederholtes Anheben w i r d d e r I n h a l t d e s - S w i t c h Registers i n d i e folgenden Adressen g e b r a c h t . DEP) A.1.5 P D P 11 / 3 5 , 11 / 4 0 S w i t c h Panel 1 A D R E S S R E G I S T E R D I S P L AY A n z e i g e d e r 1 8 - B i t - A d r e s s e n b e i LOAD A D R S , D E P u . E X A M . B e i H A LT u. WAIT w i r d d i e n a c h f o l g e n d e Adresse a n g e z e i g t . DATA R E G I S T E R D I S P L AY 2 S W I T C H REGISTER LOAD ADRS Anzeige d e r 1 6 B i t Daten b e i EXAM, D E P. B e i S i n g l e S t e p w i r d PSW a n g e z e i g t . B e i H A LT u . R E S E T w i r d RO a n g e z e i g t . B e i W A I T w i r d Instruktions Register angezeigt. S c h a l t e r f e l d z u r Eingabe von Daten ( 1 6 B i t ) u . Adressen ( 1 8 B i t ) p e r DEP b z w . LOAD ADRS. D e r Switch Register-Inhalt wird a l s A d r e s s e i n d i e CPU e i n g e g e ben. 4 E X A M . D e r Inhalt einer (vorher) geladenen A d r e s s e w i r d a u f dem D a t a Register Display angezeigt. Wiederholtes Drücken z e i g t den I n halt der nächsten Adresse. 5 D e r Prozessor l ä u f t weiter nachdem e r d u r c h e i n e n H A L T - B e f e h l gestoppt wurde. B e i gedrückter HALT- T a s t e k a n n e i n P r o g r a m m m i t CONT s c h r i t t w e i s e a b g e a r b e i t e t werden ( S i n g l e S t e p ) . C O N T 6 E N A B L E / H A LT H A L T A - 9 : Anhalten eines laufenden Programms b z w . f ü r S i n g l e Step ( m i t CONT). ENABLE: F r e i g a b e f ü r S TA R T e i n e s Programms. 7 S T A R T 8 D E 9 S t a t u s D P a D e s Programm w i r d a n d e r v o r h e r eingegebenen A d r e s s e (LOAD ADRS) gestartet ( m i t System-Reset). r Inhalt des Switch Registers wird i n d i e vorher geladene Adresse (LOAD ADRS) a b g e s p e i c h e r t (Deposit). Die Adresse wird automatisch e r h ö h t . Lämpchen RUN leuchtet: Prozessor-Clock l ä u f t , H A LT, W A I T gelöscht: Prozessor e r h ä l t Daten von P e r i p h e r i e b z w . b e i RESET PROC BUS l l e u c h t e t : P r o z e s s o r i s t BUSMASTER e u c h t e t : UNIBUS w i r d b e n u t z t e u CONSOLE l USER e l u c c h h t t VIRTUAL e e t t : C o n s o l e Mode, P r o z e s s o r steht : B e f e h l e i m USER-MODE (Memory M a n a g e m e n t ) werden a b g e a r b e i t e t leuchtet: Adress Register Display zeigt eine v i r t u e l l e 16 B i t A d r e s s e a n (Mem. Management) Schlüsselschalter OFF/POWER/PANEL L O C K I n PA N E L L O C K - S t e l l u n g s i n d d i e CONTROL SWITCHES a u ß e r Betrieb. Anmerkungen U n g e r a d e A d r e s s e n b e i EXAM l i e f e r n d a s g a n z e D a t e n w o r t (even a d d r e s s ) . B e i Ve r w e n d u n g n i c h t e x i s t i e r e n d e r A d r e s s e n w i r d b e i EXAM d e r I n h a l t d e s S w i t c h R e g i s t e r a n g e z e i g t . B e i DEP k o m m t d i e A d r e s s e d e s S w i t c h R e g i s t e r s i m D a t a D i s p l a y zur Anzeige (177570). A - 10 A.1.6 B e d i e n u n g s a n l e i t u n g 11 / 4 4 1. E i n s c h a l t e n o d e r CNTRL P u . H o d e r BOOT- Ta s t e ergibt: C O N S O L E 17777707 x x x x x x >>> 2. A n s p r e c h e n v o n S p e i c h e r z e l l e n >>> D 1 0 0 0 1 2 3 4 5 >>> E 1 0 0 0 o d . E * D 1 0 0 0 1111 D + 2222 1000 m i t 1 2 3 4 5 l a d e n I n h a l t v o n 1000 p r ü f e n Aufeinanderfolgende Zellen laden D + 3333 E 1000 E E Inhalt aufeinanderfolgender Z e l l e n p r ü f e n D * 4444 E * p D r i ü e f e z u l e t z t angesprochene Zelle ändern/laden und n 3. A n s p r e c h e n v o n R e g i s t e r n d e r CPU D/G 7 1 0 0 0 E/G 7 Register 7 (PC) m i t 1000 laden und p r ü f e n 4. S p e i c h e r b e r e i c h ü b e r p r ü f e n E/N:12 1000 128 S p e i c h e r z e l l e n ü b e r prufen, beginnend b e i 1000. 5. C P U - R e g i s t e r ü b e r p r ü f e n E/G/N:10 0 Reg. 0 . . . 7 6. P r o g r a m m s t a r t e n S 1000 7. S i n g l e S t e p S c h a l t e r : H A LT S 1000 C A - 11 A.2 P r o g r a m m b e i s p i e l e 1. P r o g r a m m b e i s p i e l : Dieses Programm s o l l d e n I n h a l t v o n 3 0 8 B y t e -Adressen löschen und anschließend a n h a l t e n . RO = 600 R1 = 30 A: CLRB ( R O ) + DEC R1 BNE A HALT 105020 005301 001375 000000 R1 e n t h ä l t d i e A n z a h l d e r A d r e s s e n , d i e g e l ö s c h t w e r d e n s o l l e n . R1 i s t a l s o e i n Z ä h l e r. Das Abzählen g e s c h i e h t m i t DEC R 1 , d . h . j e d e s m a l , w e n n e i n e B y t e a d r e s s e g e l ö s c h t i s t , w i r d d e r I n h a l t v o n R1 d e c r e m e n t i e r t . BNE t e s t e t d i e C o n d i t i o n c o d e s i m PSW u n d f ü h r t d i e V e r z w e i g u n g s o l a n g e a u s , b i s d a s Z - B i t i m PSW 1 i s t , d . h . b i s d a s R e g i s t e r 1 d e n I n h a l t 0 h a t u n d e r r e i c h t d a n n d e n H A LT- B e fehl. A - 13 2. P r o g r a m m b e i s p i e l : Multiplikation: Eine B i n ä r z a h l w i r d m i t 2 m u l t i p l i z i e r t , i n d e m man d i e Z a h l um e i n e B i n ä r s t e l l e n a c h l i n k s v e r s c h i e b t . D i e s e V e r s c h i e bung f ü h r t d e r B e f e h l A S L a u s . Aufgabe: 5 1 0 X 4 1 0 Ein R e g i s t e r w i r d m i t ( 4 1 0 = 2 2 ) 2 g e l a d e n und e i n anderes mit d e r zu m u l t i p l i z i e r e n d e n Zahl. R1 = 5 R2 = 2 START: A S L R1 DEC R 2 BNE START HALT Das E r g e b n i s i n R1 = 1 0 1 0 0 2 = 2 0 1 0 Division: Bei d e r D i v i s i o n w i r d g e n a u s o v e r f a h r e n , n u r w i r d s t a t t ASL d e r B e f e h l ASR ( a r i t h m e t i c s h i f t r i g h t ) v e r w e n d e t . A - 14 3. P r o g r a m m b e i s p i e l : Ein S p e i c h e r b l o c k v o n Adresse 1000 b i s Adresse 1500 ( i n c l . ) s o l l nach Adresse 3000 v e r l e g t werden. MOV 4 1 0 0 0 , R 2 MOV *3000,R3 A: M O V ( R 2 ) + , ( R 3 ) + CMP R 2 , W 1 5 0 2 BNE A HALT R2 z e i g t a u f d a s j e w e i l s n ä c h s t e W o r t , w e l c h e s i n d i e d u r c h R3 a d r e s s i e r t e Z e l l e g e l a d e n w i r d . N a c h j e d e m T r a n s f e r w i r d abgefragt, o b der l e t z t e Speicherinhalt schon übertragen wurde. 4. P r o g r a m m b e i s p i e l : Memory T e s t : D i e s e s P r o g r a m m l ö s c h t z u n ä c h s t j e d e S p e i c h e r zelle und s c h r e i b t dann 1 . . . 1 i n d i e Z e l l e und l i e s t diesen Wert w i e d e r a u s . A n s c h l i e ß e n d w i r d 0 . . . 0 z e s c h r i e b e n u n d ausgelesen b z w. v e r g l i c h e n . 0 0 1 2 7 0 0 M 2 TOPADDRESS 4 0 1 2 7 0 1 M 6 L O W ADDRESS 10 005040 12 0 0 5 11 0 14 022710 16 177777 20 001005 22 0 0 5 11 0 24 001003 26 020001 30 001365 32 000000 34 000000 O V WTOPADDRESS,R0 O V WLOW ADDRESS,R1 A: B: CLR - ( R O ) COM ( R O ) CMP4p177777,(RO) BNE B COM ( R O ) BNE B CMP R O , R 1 BNE A HALT HALT I n RO u n d R 1 w i r d d e r S p e i c h e r b e r e i c h v o r g e g e b e n . A b h ä n g i g vom E r g e b n i s d e s T e s t s e n d e t d a s P r o g r a m m i n Z e l l e 3 2 ( T e s t erfolgreich) oder Zelle 34 (Memory-Fehler). Im F e h l e r f a l l s t e h t d i e F e h l e r a d r e s s e i n R O . A - 15 5. B e i s p i e l e z u r E i n - / A u s g a b e - P r o g r a m m i e r u n g A) A b s p e i c h e r n v o n Te x t a b Z e l l e 5 0 0 0 , b i s " ! " g e d r ü c k t w i r d . Gemäß F l u ß d i a g r a m m K a p . 4 . 5 . 3 MOV # 5 0 0 0 , R 0 A: T S T B a # 1 7 7 5 6 0 BPL A MOVB a # 1 7 7 5 6 2 , (RO) BICB #-200, (110) MOVBae177562,a#177566 CMPB # 4 1 , ( R 0 ) + BNE A HALT ;Adresse d e s 1 . Z e i c h e n s ;DONE B I T t e s t e n ;Falls gesetzt: P r o g r. fortsetzen ;Abspeichern des Zeichens ;Parity B i t löschen ;Echo ;war a b g e s p e i c h e r t e s Zeichen e i n " ! " ? ;Falls Nein: Nächstes Zeichen a b s p e i c h e r n ; F a l l s J a : H A LT B) A u s g a b e v o n T e x t . Gemäß F l u ß d i a g r a m m K a p . 4 . 5 . 4 MOV # 5 0 0 0 , R 0 A: TSTB a # 1 7 7 5 6 4 BPL A MOVB ( H ) , 3 , 4 0 7 7 7 5 6 6 CMPB (110)+,4441 BNE A HALT A - 16 ;Adresse d e s 1 . Z e i c h e n s ;READY B I T t e s t e n ;Falls gesetzt: P r o g r. fortsetzen ;Ausgabe e i n e s Z e i c h e n s ;war g e d r u c k t e s Z e i c h e n ein "Ui? ;Falls Nein: Nächstes Zeichen d r u c k e n ; F a l l s J a : H A LT 6. B e i s p i e l e z u r U n t e r p r o g r a m m i e r u n g A) D i e s e s Programm a d d i e r t zwei Z a h l e n i n d e r U n t e r r o u t i n e d i e i n d e n S p e i c h e r z e l l e n ZAHL 1 u n d ZAHL 2 a b g e l e g t s i n d . D a s E r g e b n i s w i r d i n d i e Z e l l e SUM g e l a d e n . 000500 000504 000512 000520 000524 000530 000532 000536 000542 000546 000550 000552 000554 012706 000500 012767 000004 000036 012767 000005 000032 004767 000006 016704 000024 000000 016700 000012 066700 000010 010067 000006 000207 000000 000000 000000 START: MOV#500,SP M0VI44,ZAHL1 MOV 1#5,ZAHL2 JSR PC,ADD MOV SUM,R4 ADD: HALT MOV ZAHL1,R0 ADD ZAHL2,R0 MOV RO,SUM ZAHL1: ZAHL2: SUM: RTS PC 0 0 0 B) D i e s e s Programm a d d i e r t z w e i Z a h l e n i n d e r U n t e r r o u t i n e d i e h i n t e r dem J S R - B e f e h l a b g e l e g t s i n d . 000500 START: 000510 000512 000514 012706 000500 004567 000006 000004 000005 000000 000516 000520 000522 012500 062500 000205 ADD: 000504 MOVit500,SP JSR R5,ADD 4 5 HALT A - 17 MOV ( R 5 ) + , R 0 ADD ( R 5 ) + , R 0 RTS R 5 C) D i e s e s Programm a d d i e r t z w e i Z a h l e n i n d e r U n t e r r o u t i n e deren A d r e s s e n i n e i n e r A d r e s s t a b e l l e g e s p e i c h e r t s i n d . 000500 000504 000512 000520 000526 000532 000536 000540 000542 000544 000546 000550 000552 000554 000556 000560 012706 000500 012767 000004 000044 012767 000005 000040 012767 000002 000022 012705 000550 004767 000002 000000 012500 013504 063504 000207 000000 000556 000560 000000 000000 MOV#500,SP M0V144,FELD1 MOV#5,FELD2 MOV i t 2 , TA B M0V#TAB,R5 JSR PC,ADD ADD: TAB: FELD1: FELD2: HALT MOV ( R 5 ) + , R 0 M0VcD(R5)+,R4 ADDCD(R5)+,R4 RTS PC 0 556 560 0 0 D) D i e s e s Programm a d d i e r t z w e i Z a h l e n i n d e r U n t e r r o u t i n e d i e a u f dem S t a c k a b g e l e g t s i n d . 000500 000504 000506 000512 000516 000522 000524 000526 000530 000532 012706 000500 010146 012746 000004 012746 000005 004767 000002 000000 012601 012600 062600 000201 START: MOVW500,SP MOV R 1 , - ( S P ) MOV W 4 , - ( S P ) MOV1t5,-(SP) JSR PC,ADD ADD: A - 18 HALT MOV ( S P ) + , R 1 MOV ( S P ) + , R 0 ADD ( S P ) + , R O RTS R1 A.3 A b k ü r z u n g e n ABS a b s o l u t e A/D a n a l o g - t o - d i g i t a l ADC a d d carry ADRS a d d r e s s ASCII A m e r . i c a n S t a n d a r d Code f o r I n f o r m a t i o n I n t e r c h a n g e ASL a r i t h m e t i c s h i f t l e f t ASR a r i t h m e t i c s h i f t r i g h t automatic send/receive B b y t e BAR b u s address r e g i s t e r BBSY b u s busy BCC b r a n c h i f carry clear BCS b r a n c h i f carry set BEQ b r a n c h i f equal BG b u s grant BGE b r a n c h i f greater o r equal BGT b r a n c h i f greater than BHI b r a n c h i f higher BHIS b r a n c h i f h i g h e r o r s a m e BIC b i t clear BIS b i t set BIT b i t test BLE b r a n c h i f less or equal BLOS b r a n c h i f l o w e r o r s a m e BLT b r a n c h i f less than BMI b r a n c h i f minus BNE b r a n c h i f not equal BPL b r a n c h i f plus BR b r a n c h , b u s r e q u e s t BRD b u s register data BSP b a c h space BSR b u s shift register back s p a c e r e c o r d BSY b u s y BVC b r a n c h i f overflow clear BVS b r a n c h i f overflow s e t A - 19 CBR c o n s o l e b u s r e q u e s t CLC c l e a r carry CLK c l o c k CLN c l e a r negative CLR c l e a r CLV c l e a r overflow CLZ c l e a r zero CMP c o m p a r e CNPR c o n s o l e n o n - p r o c e s s o r r e q u e s t CNTL c o n t r o l COM c o m p l e m e n t COND c o n d i t i o n CONS c o n s o l e CONT c o n t e n t s continue CP c e n t r a l p r o c e i s o r CSR c o n t r o l a n d s t a t u s r e g i s t e r D d a t a D/A d i g i t a l - t o - a n a l o g DAR d e v i c e a d d r e s s r e g i s t e r , D AT I d a t a in D AT I P d a t a i n p a u s e DATO d a t a out DATOB d a t a o u t , b y t e DB d a t a buffer register DCDR d e c o d e r DE d e s t i n a t i o n e f f e e t i v e a d d r e s s DEC d e c r e m e n t D i g i t a l Equipment Corporation DEL d e l a y DEP d e p o s i t DEPF d e p o s i t f l a g DIV d i v i d e DMA d i r e c t m e m o r y a c c e s s DSEL d e v i c e s e l e c t DST d e s t i n a t i o n DSX d i s p l a y , X - d e f l e c t i o n r e g i s t e r EAE e x t e n d e d a r i t h m e t i c e l e m e n t EMT e m u l a t o r t r a p ENB e n a b l e EOF e n d - o f - f i l e EOM e n d - o f - m e d i u m ERR e r r o r EX e x t e r n a l EXAM e x a m i n e EXAMF e x a m i n e f l a g EXEC e x e c u t e EXR e x t e r n a l r e s e t A - 20 F f l a t ( p a r t o f s i g n a l name) FCTN f u n c t i o n FILO f i r s t i n , l a s t out FLG f l a g GEN g e n e r a t o r IDIVR i n t e g e r d i v i d e r o u t i n e INC i n c r e m e n t increase INCF i n c r e m e n t f l a g IND i n d i c a t o r INH i n h i b i t INIT i n i t i a l i z e INST i n s t r u c t i o n INTR i n t e r r u p t INTRF i n t e r r u p t f l a g I/O i n p u t / o u t p u t IOT i n p u t / o u t p u t t r a p IOX i n p u t / o u t p u t e x e c u t i v e r o u t i n e IR i n s t r u c t i o n r e g i s t e r IRD i n s t r u c t i o n r e g i s t e r d e c o d e r ISR i n s t r u c t i o n s h i f t r e g i s t e r JMP JSR j j u u m m p p t o subroutine LIFO l a s t in, f i r s t out LKS l i n e time clock status register LOC l o c a t i o n LP l i n e printer LSB l e a s t - s i g n i f i c a n t b i t LSBY l e a s t - s i g n i f i c a n t b y t e LSD l e a s t - s i g n i f i c a n t d i g i t LTC l i n e time clock MA m e m o r y a d d r e s s MAR m e m o r y a d d r e s s r e g i s t e r MBR m e m o r y b u f f e r r e g i s t e r MEM m e m o r y ML m e m o r y l o c a t i o n MOV m o v e MSB m o s t - s i g n i f i c a n t b i t MSBY m o s t - s i g n i f i c a n t b y t e MSD m o s t - s i g n i f i c a n t d i g i t MSEL m e m o r y s e l e c t MSYN m a s t e r s u n c A - 21 ND NEG NOR NPG NPR NPRF NS negative d r i v e r negative normalize non-processor g r a n t non-processor request non-processor request f l a g negative switch ODT OP octal debugging technique operate operation operator operand OPR PTR PTS PUN parity available program assembly language parity b i t program c o u n t e r positive driver programmed d a t a p r o c e s s o r peripheral program p a p e r t a p e punch paper t a p e punch b u f f e r r e g i s t e r p a p e r t a p e punch s t a t u s r e g i s t e r paper t a p e reader paper t a p e reader b u f f e r r e g i s t e r processor paper t a p e reader s t a t u s r e g i s t e r processor s t a t u s positive switch priority transfer paper t a p e s o f t w a r e s y s t e m punch RD RDR REG REL RES ROL ROM ROR R/S RTI RTS R/W R/WSR read reader register release reset rotate l e f t r e a d - o n l y memory rotate r i g h t rotate/shift return from interrupt return from subroutine read/write read/write s h i f t register PA PAL PB PC PD PDP PERIF PGM PP PPB PPS PR PRB PROC PRS PS A - 2 2 SACK SBC SC SE SEC SEL SEN SEV SEX SEZ SI SP SR SRC SSYN ST STPM STR SUB SVC SWAB TA single s e l e c t i o n acknowledge subtract carry single cycle source e f f e e t i v e a d d r e s s set c a r r y select set n e g a t i v e set o v e r f l o w sign extend set z e r o single instruction stack p o i n t e r spare switch r e g i s t e r source slave sync start set t r a p marker strobe subtract service swap b y t e TEMP TDR TK TKB TKS TP TPB TPS TRT TSC TSS TST trap address track address temporary timing, d r i v e r t e l e t y p e keyboard t e l e t y p e keyboard b u f f e r r e g i s t e r t e l e t y p e keyboard s t a t u s r e g i s t e r teletype printer teletype printer buffer teletype printer status register trace t r a p timing state control timing, selection switch test UTR user t r a p VEC vector WC WCR word c o u n t word c o u n t r e g i s t e r XDR XRCG XWCG X-line driver X- l i v e r e a d c o n t r o l g r o u p X-line write control group YDR YRCG YWCG Y- l i v e d r i v e r Y- l i n e r e a d c o n t r o l g r o u p Y- l i n e w r i t e c o n t r o l g r o u p A - 23