The Transactor V9 05 1989 Jun

84
8/7/2019 The Transactor V9 05 1989 Jun http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 1/84 C a n a d a $ 4 . 2 5 U S $ 3 . 5 0 I n n e r G E O S h o t h s y s t e m f i t s t o g e t h e r D i s k M o n i t o r f o t h C 1 2 8 T h 1 7 6 4 R a E x p a n s i o n U n i t : A d a E P R O M i n t e r n a l l y ! I m p l e m e n t i n g a R A d i s k f o A b a c u s ' S u p e r - C D i s k d r i v e m e m o r y - r e a d e r r o r e x p o s e d ! S u p e r n u m b e r s I I I : T h f a m o u s i n d e s t r u c t i b l e v a r i a b l e s c o m e t t h C 1 2 8 J i B u t t e r f i e l d o l i n k e d l i s t s : q u i z p r o g r a m f o a l C B 8 - b i t m a c h i n e s S h e l l S o r t f o B A S I C a r r a y s B r e a k G E O S ' s 3 - i c o n b a r r i e r ! s o m e i c o n p r o g r a m m i n g t r i c k s P r o d u c t R e v i e w : T w A s s e m b l e r s f o G E O S B e r k e l e y ' s G e o p r o g r a m m e r a n B i l l S h a r p ' s G e o C O P E P l u s R e g u l a r c o l u m n s b T o d d H e i m a r c k a n d J o e l R u b i n , P r o g r a m m i n g t i p s i B i t s , a n m o r e F i r e b i r d b W a y n e S c h m i d t

Transcript of The Transactor V9 05 1989 Jun

Page 1: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 1/84

C a n a d a $ 4 . 2 5U S $ 3 . 5 0

I n n e r G E O S h o t h s y s t e m f i t s t o g e t h e rD i s k M o n i t o r f o t h C 1 2 8

T h 1 7 6 4 R a E x p a n s i o n U n i t : A d a E P R O M i n t e r n a l l y !I m p l e m e n t i n g a R A d i s k f o A b a c u s ' S u p e r - CD i s k d r i v e m e m o r y - r e a d e r r o r e x p o s e d !S u p e r n u m b e r s I I I : T h f a m o u s i n d e s t r u c t i b l e v a r i a b l e s c o m e t t h C 1 2 8J i B u t t e r f i e l d o l i n k e d l i s t s : q u i z p r o g r a m f o a l C B 8 - b i t m a c h i n e s

S h e l l S o r t f o B A S I C a r r a y sB r e a k G E O S ' s 3 - i c o n b a r r i e r ! s o m e i c o n p r o g r a m m i n g t r i c k sP r o d u c t R e v i e w : T w A s s e m b l e r s f o G E O S B e r k e l e y ' s G e o p r o g r a m m e r a n B i l l S h a r p ' s G e o C O P EP l u s R e g u l a r c o l u m n s b T o d d H e i m a r c k a n d J o e l R u b i n , P r o g r a m m i n g t i p s i B i t s , a n m o r e

F i r e b i r d b W a y n e S c h m i d t

Page 2: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 2/84

                    

                

                        

                

                                                   

                                                    

                                                         

                                                     

                                               

                                          

       

                              

                        

                                         

                                                

                                             

                                                   

                                                  

                                                 

                                                      

                                                          

                                              

                                                         

                                            

    

                                      

                                                

                                              

                                           

                                   

               

     

          

     

             

     

          

     

           

     

          

     

                                              

                                                       

           

                    

                                            

           

        

                                          

                                                 

                                                

                                          

                    

                                                  

                                  

     

                                             

                       

                        

                        

                      

                                          

                                                

                                                  

                                              

                                                      

                                              

                                                

         

                             

                            

   

                   

      

                            

            

        

      

        

                       

                                          

                                             

                                                      

                                                   

                          

                  

                                             

                                                

                 

                                         

                                                  

       

                        

                      

                          

                                          

                                                  

                                                        

                                                 

                                             

                                        

                                            

                                              

                                               

                    

                        

               

       

                                  

                         

    

                    

                 

                        

                         

                                                   

                      

                     

                                           

                                                

                                              

        

         

                       

                                  

                                

       

                            

                                       

                                                      

                                               

                            

         

                                                  

                                        

                                         

                             

                                           

      

                                          

      

                                            

                                             

         

  

                                        

                                          

                                               

        

                                             

                                          

                                       

       

                                             

                                     

                                        

              

                                       

         

                                         

         

       

                            

            

                                         

           

                         

   

                             

                                       

          

                                                                 

                                                                  

                                                                    

                                 

                                     

                                                                

                                                           

                         

Page 3: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 3/84

W h a t d y o t h i n k ?

R e c e n t l y T r a n s a c t o r a c q u i r e d t w 1 5 8 1 d i s k d r i v e s .C o n s e q u e n t l y , a u t h o r s ( a n d w o u l d - b e a u t h o r s ) m a n o e l e c t t m a k e s u b m i s s i o n s o 3 . 5 " d i s k s . T h l i t t l e d i s k s ( c a l l t h e m " f l a p p i e s " ) a r p e r h a p s m o r el i k e l y t o s u r v i v e t h e i r j o u r n e y t h r o u g h t h e p o s t a ls y s t e m . M a k e c e r t a i n t h a t y o u r f l a p p y i c l e a r l yl a b e l e d a s 1 5 8 1 f o r m a t d i s k ! O t h e r w i s e i m i g h tg e s w a l l o w e d u p b y t h v o r a c i o u s A m i g a s .

N o t h a t y o k n o w w h a t w e ' v e g o t , w w a n t t k n o w w h a t y o u ' v e g o t ! T h o t h e r b i o T r a n s a c t o rn e w s f o t h i s i s s u e i t h a p p e a r a n c e o t h f i r s tT r a n s a c t o r R e a d e r S u r v e y . T h i s i C o m m o d o r e' c o n s c i o u s n e s s r a i s i n g ' e x e r c i s e . T h r e s u l t s o t h s u r v e y w i l l h e l p t d e t e r m i n e w h a t y o u ' l l s e i f u t u r e T r a n s a c t o r s . T e l l u a b o u t y o u r s y s t e m c o f i g u r a t i o n , t h s o f t w a r e y o u s m o s t a n y o u r l i k e sa n d i s l i k e s w i t h r e g a r d t m a g a z i n e c o n t e n t .

I n r e c e n t y e a r s t h 8 - b i t m a r k e t h a b e c o m e i n c r e a si n g l y f r a g m e n t e d ; i . e . , s o m e u s e r s r a r e l y l e a v e t h P o w e r e n v i r o n m e n t , s o m e s w e a r b C P / M , o t h e r sa r c o m m i t t e d t G E O S . O c o u r s e , t h e r e a r e y e o t e r w h d i s d a i n t h e s e n e d e v e l o p m e n t s a n d c o nt i n u e t u s t h m a c h i n e s i n t h e i r n a t i v e e n v i r o nm e n t . S u c h u s e r s a r c o n t e n t t u s B A S I C a n a a s s e m b l e r a n t h u s a v o i d t h ' o v e r h e a d ' o f d i f f e re n o p e r a t i n g e n v i r o n m e n t .

T h i s p o l a r i z a t i o n o t h u s e r c o m m u n i t y m a k e s i d i f f i c u l t f o a n m a g a z i n e t b ' a l l t h i n g s t a l M a l c o l m D O ' B r i e n

p e o p l e ' o e v e n a l p r o g r a m m e r s . T r a n s a c t o r h a r e s p o n d e d t t h e s e d e v e l o p m e n t s b a t t e m p t i n g t p r o v i d e u s e f u l i n f o r m a t i o n f o a l o t h e s e g r o u p si e v e r y i s s u e . A l t h o u g h t h e r e a r e t o p i c s t h a t w h a v e n ' t c o v e r e d ( o h a v e n ' t c o v e r e d r e c e n t l y ) , w f e e l t h a t T r a n s a c t o r o f f e r s m o r e s u p p o r t t p r g r a m m e r s a n s e r i o u s u s e r s t h a n a n o t h e r m a g az i n e . B u w w a n t t k n o w w h a t y o u t h i n k . P a r t i c ip a t e i o u R e a d e r S u r v e y . D o n ' t b e s h y . L e t ' s h e a rf r o m y o u .

T h i s i s s u e p u s h e s t h l i m i t s w i t h P a u l B o s a c k i ' sa r t i c l e o t h 1 7 6 4 R E U . Y o m a h a v e s e e n R E e x p a n s i o n a r t i c l e s f r o m o t h e r s o u r c e s b u t h i s o n i n c l u d e s a n e w r i n k l e : i n s t a l l i n g a E P R O M .F o l l o w i n g o t h e h e e l s o A d r i a n P e p p e r ' s P o w e rR A M d i s k a r t i c l e , K e r r y G r a y h a s u s I m p l e m e n t i n gR A M d i s k f o S u p e r - C . R o b e r t R o c k e f e l l e r m a k e s h i f i r s t a p p e a r a n c e i t h e s e p a g e s w i t h s o m e t i p s o u s i n g p s e u d o - o p s a n m a c r o s w i t h C o m m o d o r e ' sD e v p a k . A n t o n T r e u e n f e l s r e a p p e a r s w i t h n i f t yd i s k m o n i t o r , a m o n g o t h e r t h i n g s . J i B u t t e r f i e l dd i s c u s s e s l i n k e d l i s t s . B i l l C o l e m a n p r e s e n t s u w i t ha n o v e r v i e w o G E O S . F r a n c i s K o s t e l l a c o m p a r e st w G E O S a s s e m b l e r s . R i c h a r d C u r c i o b r i n g s r o b u s tv a r i a b l e s t t h e 1 2 8 , 6 a n V I C . A l t h i s a n s m u c h m o r e . E n j o y !

9 I s s u e

Page 4: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 4/84

V o l u m e 9 I s s u eP u b l i s h e r

A n t o n y J a c o b s o n

V i c e - P r e s i d e n t O p e r a t i o n sJ e a n n i e L a w r e n c e

A s s i s t a n t A d v e r t i s i n g M a n a g e rM i k e G r a n t h a m

E d i t o r sM a l c o l m O ' B r i e n

N i c k S u l l i v a nC h r i s Z a m a r a

C o n t r i b u t i n g W r i t e r sM a r t e B r e n g l eP a u l B o s a c k i

B i l l B r i e rA n t h o n y B r y a n tJ o s e p h B u c k l e yJ i B u t t e r f i e l f l

W i l l i a m C o l e m a nJ a m e s C o o k

R i c h a r d Q u u r c i oM i k l o s G a r a m s z e g h y

L a r r y G a y n i e rK e r r y G r a y

T o d d H t e i m a r c kA d a m H e r s t

R o b e r t H u e h nG e o r g e H u

D e n n i s J a r v i sG f e y K i z i a k

F r a n c i s K o s t e l l aM i k e M o h i l oD M o r r i s sN o e l N y m a n

A d r i a n P e p p e rS t e v e P u n t e r

R o b e r t R o c k e f e l l e rJ o e l R u b i n

D a v i d S a n n e rA n t o n T r e u e n f e l s

N i c h o l a s V r t i sW . M a t W a i t e s

C o v e r A r t i s tW a y n e S c h m i d t

T r a n s a c t o rT h M a g a z i n e f o C o m m o d o r e P r o g r a m m e r s

I n n e r G E O Sb W i l l i a m C o l e m a nA o v e r v i e w o t h G E O S o p e r a t i n g s y s t e m .

1 5 4 1 / 1 5 7 1 D O M - C o m m a n d E r r o rb A n t o n T r e u e n f e l sM u l t i p l e - b y t e r e a d s c a n b e h a z a r d o u s t y o u r d a t a . A n t o n e x p l a i n s w h y .

2

2

C 1 2 8 S i m p l e D i s k M o n i t o r 2 b y A n t o n T r e u e n f e l sT h C 1 2 8 ' s b u i l t - i n m a c h i n e l a n g u a g e m o n i t o r w a d e s i g n e d t b e x t e n s i b l e . H e r e ' s h o y o u d o i t

H C D 6 5 A s s e m b l e r M a c r o s 3 b R o b e r t R o c k e f e l l e rY o u r a s s e m b l e r ' s p s e u d o - o p s m a b m o r e v e r s a t i l e t h a n y o t h i n k .

I m p l e m e n t i n g R A M d i s k 3 b K e r r y G r a yW h s h o u l d P o w e r u s e r s h a v e a l t h f u n ? C 6 R A d i s k d r i v e r f o r A b a c u s ' S u p e r - C .

S u p e r N u m b e r s I I 3 b R i c h a r d C u r c i oN e d e v e l o p m e n t s i t h w i l d w o r l d o s t i c k y v a r i a b l e s f o t h C 1 2 8 , C 6 a n d V I C - 2 0 .

I n s i d e t h e 1 7 6 4 R E 4 b P a u l B o s a c k iC a y o r e a l l y p u a E P R O M i n t h e 1 7 6 4 a n d o u b l e i t m e m o r y i n t o t h e b a r g a i n ? P a u l e x p l a i n s .

C a p i t a l s : B A S I C Q u i z P r o g r a m 4 b J i B u t t e r f i e l dW h a t d g e o g r a p h y a n l i n k e d l i s t s h a v e i c o m m o n ? T h i s p r o g r a m f o a l C o m m o d o r e 8 - b i t c o m p u t e r s .

P r o b l e m s , T i p s A n O b s e r v a t i o n sb L a r r y G a y n i e rS o m e a n o m a l i e s i t h P o w e r c o m p i l e r , a n n o t e s o d r i v e u s a g e .

5

Page 5: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 5/84

P r o g r a m m i n g G E O S I c o n sb y J a m e s C o o kG E O S h a b u i l t - i n l i m i t o f 3 1 i c o n s . . . u n l e s s y o k n o w t h t r i c k s p r e s e n t e d h e r e .

5

B A S I C 2 . A r r a y S h e l l S o r t 6 b y A n t o n T r e u e n f e l sT h a n a t o m y o s o r t r o u t i n e , w i t h m a c h i n e l a n g u a g e i m p l e m e n t a t i o n y o c a c a l l f r o m B A S I C .

g l o b F u n c t i o n F o P o w e r 6 b A d r i a n P e p p e rO t h e r o p e r a t i n g s y s t e m s o f f e r f l e x i b l e p a t t e r n - m a t c h i n g f o f i l e n a m e s . . . n o t h P o w e r s h e l l d o e s t o o .

D e p a r t m e n t s a n C o l u m n sL e t t e r s

B i t s 1 S u p e r - C B I T h T a s m a n i a n D a t a l l e r !

Y o u r o t h e r f i l e c o p i e rW h e n G i a n t s W a l k . . .

T h M C o l u m nb T o d d H e i m a r c kH o t h a n d l e 4 8 - b i t n u m b e r s u t 2 8 1 , 4 7 4 , 9 7 6 , 7 1 0 , 6 5 5 . . . i n c l u d i n g s q u a r e r o o t s .

T h E d g e C o n n e c t i o nb J o e l R u b i nG E O S 1 2 2 . 0 , Z O O M , m a c r o s , r a d i o , e t c .

P r o d u c t R e v i e w : T w A s s e m b l e r s f o G E O Sc o m p a r i s o n o B e r k e l e y ' s G e o p r o g r a m m e r a n B i l l S h a r p ' s G e o C O P E

1

1

7

A b o u t t h e c o v e r : F i r e b i r d b W a y n e S c h m i d t :

* ' I n s p i r e d a f t e r h e a r i n g t r a n s c r i p t i o n o S t r a v i n s k y ' s ' T h e F i r e b i r d ' f o s o l o g u i t a r ( b Y a m a s h i t a ) , i t s e l f i n s p i r e d b l e g e n d a r y R u s s i a n f o l k t a l e s , t h i s i m F i r e b i r d . a f o n do t h f o l k a w e l l a s t h e p r i m i t i v e a r t r a d i t i o n s , a n t h r i c h i m a g e r y o f R u s s i a n i c o n sa n l a q u e r p a i n t i n g s e r y e d a m o d e l s f o t h i s . T h i s w a c r e a t e d w i t h A r t i s t 6 4 m o d i f i e df o t h 1 3 5 1 m o u s e . " l i V a y n e S c h m i d t

T r a n s a c t o r i p u b l i s h e d b i m o n t h l y b C r o f t w a r dP u b l i s h i n g I n c . , 8 5 - 1 0 W e s t W i l m o t S t r e e t R i c hm o n d H i l l , O n t a r i o , L 4 1 K 7 . I S S N # 0 8 3 8 - 0 1 6 3 .C a n a d i a n S e c o n d C l a s s M a i l R e g i s t r a t i o n N o 7 6 9 0 , G a t e w a y - M i s s i s s a u g a , O n t . U S P S P o s tm a s t e r s : $ e r \ 6 a d d r e s s c h a n g e s t o T r a n s a c t o r ,P B o 3 3 8 , S t a t i o n C B u f f a l o , N Y 1 4 2 0 9 .C r o f t w a r d p u b l i s h i n g i n c . i i n w a c o n n e c t e dw i t h C o m m o d o r e B u s i n e s s M a c h i n e s L t d . o C o m m o d o r e i n c o r p o r a t e d . C o m m o d o r e a n C o m m o d o r e p r o d u c t n a m e s a r r e g i s t e r e d t r a d em a r k s o C o m m o d o r e I n c .

S u b s c r i p t i o n s :

C a n a d a $ 1 C d n .U S A $ 1 5 U S

A o t h e r s $ 2 U A i M a i l ( O v e r s e a s o n l y ) $ 4 U

S e n d a l s u b s c r i p t i o n s t o : T r a n s a c t o r . , S u s c r i p t i o n s D e p a r t m e n t , 8 W e s t W i l m o t S t r e e t ,U n i t 1 0 R i c h m o n d H i l l , O n t a r i o , C a n a d a , L 4 1 K 7 , ( 4 1 6 ) 7 6 4 - 5 2 7 3 . F o r b e s t r e s u l t s , U s t h e ;p o s t a g e p a i d c a r d a t h c e n t r e o t h m a g a z i n e .

Q u a n t i t y O r d e r s : i C a n a d a : I n g r a m S o f t w a r eL t d . , 1 4 A d e s s o D r i v e , C o n c o r d , O n t a r i o , L 4 2 W 7 , ( 4 1 6 ) 7 3 8 - 1 7 0 0 . I t h U S A : I P ( I n t e r n at i o n a l P e r i o d i c a l D i s t r i b u t o r s ) , 1 1 7 6 Q . B S o r r e n t oV a l l e y R o a d , S a D i e g o , C a l i f o r n i a , 9 2 1 2 1 , ( 6 1 9 )4 8 1 - 5 9 2 8 ; a s f o D a v e B u e s c h e r .

E d i t o r i a l c o n t r i b u t i o n s a r w e l c o m e . O n l y o r i g i n a l ,p r e v i o u s l y u n p u b l i s h e d ^ m a t e r i a l w i l l b c o n s i de r e d . P r o g r a m l i s t i n g s a n a r t i c l e s , i n c l u d i n gB I T S s u b m i s s i o n s , o m o r e t h a n f e l i n e s ,s h o u l d b p r o v i d e d o d i s k . P r e f e r r e d f o r m a t i 1 5 4 1 - f o r m a t w i t h A S C I I t e x t f i l e s . M a n u s c r i p t ss h o u l d b t y p e w r i t t e n , d o u b l e - s p a c e d , w i t h s p c i a l c h a r a c t e r s o f o r m a t s c l e a r l y m a r k e d . P h o t o ss h o u l d b g l o s s y b l a c k a n w h i t e p r i n t s . I l l u s t r at i o n s s h o u l d b o w h i t e p a p e r w i t h b l a c k i n o l y H i - r e s g r a p h i c s f i l e s o d i s k a r e p r e f e r r e d t oh a r d c o p y i l l u s t r a t i o n s w h e n p o s s i b l e . W r i t e t T r a n s a c t o r ' s R i c h m o n d H i l l o f f i c e t o b t a i n w r i t *e r ' s g u i d e .

A l m a t e r i a l a c c e p t e d b e c o m e s t h p r o p e r t y o C r o f t w a r d p u b l i s h i n g I n c . , e x c e p t b s p e c i a l a rr a n g e m e n t . A l m a t e r i a l i c o p y r i g h t b C r o f t w a r dp u b l i s h i n g I n c . R e p r o d u c t i o n i a n y f o r m w i t h o u tp e r m i s s i o n i i v i o l a t i o n o f a p p l i c a b l e l a w s . W r i t et t h R i c h m o n d H i l l a d d r e s s f o w r i t e r ' s g u i d e . , '

T h o p i n i o n s e x p r e s s e d i c o n t r i b u t e d a r t i c l e sa r n o n e c e s s a r i l y t h o s e o C r o f t w a r d p u b l i s h i n gI n c . A l t h o u g h a c c u r a c y i m a j o r o b j e c t i v e , C r o f tw a r d p u b l i s h i n g I n c . c a n n o t a s s u m e l i a b i l i t y f o e r r o r s i a r t i c l e s o p r o g r a m s . P r o g r a m s l i s t e d i T r a n s a c t o r , a n d / o r a p p e a r i n g o T r a n s a c t o r d i s k s ,a r c o p y r i g h t b C r o f t w a r d ; p u b l i s h i n g i n c . a n m a n o b d u p l i c a t e d o r d i s t r i b u t e d w i t h o u t p e r -m i s s i o n .

P r o d u c t i o nI n - h o u s e w i t h A m i g a 2 0 0 0 a n d

P r o f e s s i o n a l P a g eF i n a l o u t p u t b V e l l u m P r i n t

G r a p h i c S e r v i c e s , I n c . , T o r o n t o

P r i n t i n gP r i n t e d i C a n a d a b

B o w n e o C a n a d a I n c .

Page 6: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 6/84

U s i n g " V E R I F I Z E R "

T r a n s a c t o r ' s f o o l p r o o f p r o g r a m e n t r y m e t h o d

V E R I F I Z E R s h o u l d b r u b e f o r e t y p i n g i a n l o n g p r o g r a mf r o m t h p a g e s o T r a n s a c t o r . I w i l l l e y o c h e c k y o u r w o r kl i n e b l i n e a y o e n t e r t h e p r o g r a m a n c a t c h f r u s t r a t i n g t y i n e r r o r s . T h V E R I F I Z E R c o n c e p t w o r k s b d i s p l a y i n g a t w o -l e t t e r c o d e f o e a c h p r o g r a m l i n e ; y o c a t h e n c h e c k t h i s c o d ea g a i n s t t h c o r r e s p o n d i n g o n i t h p r i n t e d p r o g r a m l i s t i n g .

T h e r e a r e t h r e e v e r s i o n s o v e r i f i z e r h e r e : o n e a c h f o r t h eP E T / C B M , V I C / C 6 4 , a n C 1 2 8 c o m p u t e r s . E n t e r t h a p p l i c ab l p r o g r a m a n d R U i t I y o g e d a t a o r c h e c k s u m e r r o r ,r e - c h e c k t h p r o g r a m a n d k e e p t r y i n g u n t i l a l g o e s w e l l . Y o s h o u l d S A V E t h p r o g r a m s i n c e y o u ' l l w a n t t u s i e v e r yt i m e y o e n t e r p r o g r a m f r o m T r a n s a c t o r . O n c e y o u ' v e R U t h l o a d e r , r e m e m b e r t e n t e r N E t p u r g e B A S I C t e x ts p a c e . T h e n t u r n V E R I F I Z E R o w i t h :

S Y 6 3 t e n a b l e t h P E T / C B M v e r s i o n ( o f f : S Y 6 3 7 )S Y 8 2 t e n a b l e t h C 6 4 / V I C v e r s i o n ( o f f : S Y 8 3 1 )S Y 3 0 7 2 , 1 t e n a b l e t h C 1 2 8 v e r s i o n ( o f f : S Y 3 0 7 2 , 0 )

O n c e V E R I F I Z E R i o n e v e r y t i m e y o p r e s s R E T U R N o p r o g r a m l i n e t w o - l e t t e r r e p o r t c o d e w i l l a p p e a r o t h t o l e f t o t h s c r e e n i r e v e r s e f i e l d . N o t e t h a t t h e s e l e t t e r s a r i u p p e r c a s e a n w i l l a p p e a r a g r a p h i c s c h a r a c t e r s u n l e s s y o a r i u p p e r / l o w e r c a s e m o d e ( p r e s s s h i f t / C o m m o d o r e o C 6 4 / V I C ) .

N o t e : I r e p o r t c o d e i m i s s i n g ( o " — " ) i m e a n s w e ' v ee d i t e d t h a t l i n e a t h l a s t m i n u t e , c h a n g i n g t h e r e p o r t c o d e .H o w e v e r , t h i s w i l l o n l y h a p p e n o c c a s i o n a l l y a n u s u a l l y o n l yo R E s t a t e m e n t s .

W i t h V E R I F I Z E R o n j u s t e n t e r t h e p r o g r a m f r o m t h m a g a z i n en o r m a l l y , c h e c k i n g e a c h r e p o r t c o d e a f t e r y o p r e s s R E T U R No l i n e . I t h c o d e d o e s n ' t m a t c h u w i t h t h l e t t e r s p r i n t e di t h b o b e s i d e t h e l i s t i n g , y o c a r e - c h e c k a n c o r r e c t t h l i n e , t h e n t r a g a i n . I y o w i s h , y o c a L I S T a r a n g e o f l i n e s ,t h e n t y p e R E T U R N o v e r e a c h i s u c c e s s i o n w h i l e c h e c k i n gt h e r e p o r t c o d e s a t h e y a p p e a r . O n c e t h p r o g r a m h a b e e np r o p e r l y e n t e r e d , b s u r e t t u r n v e r i f i z e r o f w i t h t h S Y i n d i c a t e d a b o v e b e f o r e y o u d o a n y t h i n g e l s e .

V E R I F I Z E R w i l l c a t c h t r a n s p o s i t i o n e r r o r s l i k e P O K E 5 2 3 8 1 , 0i n s t e a d o f P O K E 5 3 2 8 1 , 0 . H o w e v e r , V E R I F I Z E R u s e s a

" w e i g h t e d c h e c k s u m t e c h n i q u e " t h a t c a n b e f o o l e d i y o t r h a r d e n o u g h : t r a n s p o s i n g t w s e t s o f o u r c h a r a c t e r s w i l l p r d u c e t h s a m e r e p o r t c o d e , b u t h i s w i l l r a r e l y h a p p e n , ( v e r if i z e r c o u l d h a v e b e e n d e s i g n e d t b m o r e c o m p l e x , b u t h r e p o r t c o d e s w o u l d n e e d t b l o n g e r , a n u s i n g i w o u l d b m o r e t r o u b l e t h a n c h e c k i n g t h p r o g r a m m a n u a l l y ) , v e r i f i z e ri g n o r e s s p a c e s s o y o m a a d o o m i t s p a c e s f r o m t h l i s t e dp r o g r a m a w i l l ( p r o v i d i n g y o d o n ' t s p l i t u k e y w o r d s ! ) S t a nd a r d k e y w o r d a b b r e v i a t i o n s ( l i k e n i n s t e a d o n e x t ) w i l l n o a f f e c t t h V E R I F I Z E R r e p o r t c o d e .

T e c h n i c a l i n f o : V I C / C 6 4 v e r i f i z e r r e s i d e s i t h c a s s e t t eb u f f e r , s i y o u ' r e u s i n g a d a t a s e t t e b a w a r e t h a t t a p e o p e r at i o n s c a n b e d a n g e r o u s t i t h e a l t h . A f a r a s c o m p a t i b i l i t yw i t h o t h e r u t i l i t i e s g o e s , V E R I F I Z E R s h o u l d n ' t c a u s e a n y p r o bl e m s s i n c e i w o r k s t h r o u g h t h B A S I C w a r m - s t a r t l i n k a n j u m p s t t h o r i g i n a l d e s t i n a t i o n o t h l i n k a f t e r i t ' s f i n i s h e d .W h e n d i s a b l e d , i r e s t o r e s t h l i n k t i t o r i g i n a l c o n t e n t s .

P E T / C B M V E R I F I Z E R ( B A S I C 2 . o 4 . 0 )

C 1 r e m * d a t a l o a d e r f o r " v e r i f i z e r 4 . 0 "L 2 c s = 0H 3 f o i = 6 3 4 t 7 5 4 : r e a d a p o k e i , D 4 c s = c s + a : n e x tG 5 0 O 6 i c s < > 1 5 5 8 0 t h e n p r i n t " * * * * * d a t a e r r o r * * * * * " : e n J 7 r e s y 6 3 A 8 0 e n dI 1 0 0 :O 1 0 0 0 d a t a 7 6 , 1 3 8 , 2 1 2 0 , 1 7 3 , 1 6 3 , 2 , 1 3 3 , 1 4 4I B 1 0 1 0 d a t a 1 7 3 , 1 6 4 , 2 , 1 3 3 , 1 4 5 , 8 8 9 6 , 1 2 0 , 1 6 5C 1 0 2 0 d a t a 1 4 5 , 2 0 1 , 2 , 2 4 0 , 1 6 , 1 4 1 , 1 6 4 , 2 , 1 6 5E 1 0 3 0 d a t a 1 4 4 , 1 4 1 , 1 6 3 , 2 1 6 9 , 1 6 5 , 1 3 3 , 1 4 4 , 1 6 H 1 0 4 0 d a t a 2 , 1 3 3 , 1 4 5 , 8 8 , 9 6 , 8 5 , 2 2 8 , 1 6 5 , 2 1 7O 1 0 5 0 d a t a 2 0 1 , 1 3 , 2 0 8 , 6 2 , 1 6 5 , 1 6 7 , 2 0 8 , 5 8 , 1 7 3J 1 0 6 0 d a t a 2 5 4 , 1 1 3 3 , 2 5 1 , 1 6 2 , 0 , 1 3 4 , 2 5 3 , 1 8 9P 1 0 7 0 d a t a 0 2 , 1 6 8 , 2 0 1 , 3 2 , 2 4 0 , 1 5 , 2 3 0 , 2 5 3H 1 0 8 0 d a t a 1 6 5 , 2 5 3 , 4 1 3 , 1 3 3 , 2 5 4 , 3 2 , 2 3 6 ,E 1 0 9 0 d a t a 1 9 8 , 2 5 4 , 1 6 2 4 9 , 2 3 2 , 1 5 2 , 2 0 8 , 2 2 9 , 1 6 5L 1 1 0 0 d a t a 2 5 1 , 4 1 1 5 2 4 , 1 0 5 , 1 9 3 , 1 4 1 , 0 , 1 2 8K 1 1 1 0 d a t a 1 6 5 , 2 5 1 , 7 4 , 7 4 , 7 4 , 7 4 , 2 4 , 1 0 5 , 1 9 3E 1 1 2 0 d a t a 1 4 1 , 1 , 1 2 8 , 1 0 8 , 1 6 3 , 2 , 1 5 2 , 2 4 , 1 0 1D 1 1 3 0 d a t a 2 5 1 , 1 3 3 , 2 5 1 , 9 6

T r a n s a c t o

Page 7: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 7/84

V I C / C 6 4 V E R I F I Z E R

K 1 r e m * d a t a l o a d e r f o " v e r i f i z e r "J 1 r e v i c / 6 4 v e r s i o nL 2 0 c s = 0B 3 f o i = 8 2 8 t 9 5 8 : r e a d a : p o k e i , D 4 c s = c s + a : n e x tG 5 0 F 6 i c s < > 1 4 7 5 5 t h e n p r i n t " * * * * * d a t a e r r o r * * * * * " : e n K 7 0 r e m s y s 8 2 8A 8 0 e n dI 1 0 0 :E 1 0 0 0 d a t a 7 6 , 7 4 , 3 , 1 6 5 , 2 5 1 , 1 4 1 , 2 3 , 1 6 5E 1 0 1 0 d a t a 2 5 2 , 1 4 1 , 3 , 3 , 9 6 , 1 7 3 , 3 3 , 2 0 1O 1 0 2 0 d a t a 3 , 2 4 0 , 1 7 , 1 3 3 , 2 5 2 , 1 7 3 , 2 3 , 1 3 3M 1 0 3 0 d a t a 2 5 1 , 1 6 9 , 9 9 , 1 4 1 , 2 3 1 6 9 , 3 1 4 M 1 0 4 0 d a t a 3 , 3 , 9 6 , 1 7 3 , 2 5 4 , 1 , 1 3 3 , 8 9 , 1 6 2D 1 0 5 0 d a t a 0 , 1 6 0 , 0 , 1 8 9 , 0 2 , 2 4 0 , 2 2 , 2 0 1C 1 0 6 0 d a t a 3 2 , 2 4 0 , 1 5 , 1 3 3 , 9 1 , 2 0 0 , 1 5 2 , 4 1 , 3N 1 0 7 0 d a t a 1 3 3 , 9 0 , 3 2 , 1 8 3 , 3 , 1 9 8 , 9 0 1 6 , 2 4 9O 1 0 8 0 d a t a 2 3 2 , 2 0 8 , 2 2 9 , 5 6 , 3 2 , 2 4 0 , 2 5 5 , 1 6 9 , 1 A 1 0 9 0 d a t a 3 2 , 2 1 0 , 2 5 5 , 1 6 9 , 1 8 3 2 , 2 1 0 , 2 5 5 , 1 6 5G 1 1 0 0 d a t a 8 9 4 1 1 5 2 4 , 1 0 5 , 9 7 3 2 , 2 1 0 , 2 5 5J 1 1 1 0 d a t a 1 6 5 , 8 9 7 4 7 4 , 7 4 , 7 4 , 2 4 , 1 0 5 , 9 E 1 1 2 0 d a t a 3 2 , 2 1 0 , 2 5 5 , 1 6 9 , 1 4 6 , 3 2 , 2 1 0 , 2 5 5 , 2 4M 1 1 3 0 d a t a 3 2 , 2 4 0 , 2 5 5 , 1 0 8 , 2 5 1 , 0 , 1 6 5 , 9 1 2 B 1 1 4 0 d a t a 1 0 1 , 8 9 , 1 3 3 , 8 9 9

* N E W * C 1 2 8 V E R I F I Z E R ( 4 o 8 c o l u m n m o d e )

K 1 0 r e s a v e " 0 : c l 2 8 v f z . l d r " , 8O 1 1 r e c - 1 2 8 v e r i f i z e rM 1 2 r e b u g s f i x e d : 1 w o r k s i 8 c o l u m n m o d e .D 1 3 r e 2 s y 3 0 7 2 , 0 n o w o r k s .K 1 4 r e G 1 5 r e b j o e l m r u b i nH 1 6 r e * d a t a l o a d e r f o " v e r i f i z e r c l 2 8 "I F 1 7 0 r e c o m m o d o r e c l 2 8 v e r s i o nD 1 8 r e w o r k s i 4 o 8 c o l u m n m o d e ! ! !E 1 9 0 c h = 0G 2 0 f o j = 3 0 7 2 t 3 2 2 0 : r e a d x p o k e j , x : c h = c h + x : n e x tN 2 1 i c h 1 8 6 0 2 t h e n p r i n t " c h e c k s u m e r r o r " : s t o pB 2 2 p r i n t " s y s 3 0 7 2 , 1 t e n a b l eD 2 3 p r i n t " s y s 3 0 7 2 , 0 t d i s a b l eA 2 4 e n B 2 5 d a t a 1 7 0 , 2 0 8 , 1 1 , 1 6 5 , 2 5 3 , 1 4 1 , 2 M M 2 6 0 d a t a 1 6 5 , 2 5 4 , 1 4 1 , 3 3 9 6 , 1 7 3 ,A 2 7 d a t a 3 2 0 1 , 1 2 2 4 0 , 1 7 , 1 3 3 , 2 5 4 , 1 7 F 2 8 d a t a 2 , 3 , 1 3 3 , 2 5 3 , 1 6 9 , 3 9 , 1 4 1 ,I 2 9 d a t a 3 , 1 6 9 , 1 2 , 1 4 1 , 3 , 3 , 9 6 , 1 6 9F 3 0 d a t a 0 1 4 1 , 0 2 5 5 , 1 6 5 , 2 2 , 1 3 3 , 2 5 0L 3 1 d a t a 1 6 2 , 0 1 6 0 , 0 1 8 9 , 0 , 2 , 2 0 A 3 2 d a t a 4 8 , 1 4 4 , 7 , 2 0 1 , 5 8 , 1 7 6 , 3 , 2 3 2E 3 3 d a t a 2 0 8 , 2 4 2 , 1 8 9 , 0 2 , 2 4 0 , 2 2 , 2 0 1P 3 4 d a t a 3 2 , 2 4 0 , 1 5 , 1 3 3 , 2 5 2 , 2 0 0 , 1 5 2 , 4 F 3 5 d a t a 3 , 1 3 3 , 2 5 1 , 3 2 , 1 4 1 , 1 2 , 1 9 8 , 2 5 1D 3 6 d a t a 1 6 , 2 4 9 , 2 3 2 , 2 0 8 , 2 2 9 , 5 6 3 2 , 2 4 0

C 3 7 d a t a 2 5 5 , 1 6 9 , 1 9 3 2 , 2 1 0 , 2 5 5 , 1 6 9 , 1 O 3 8 d a t a 3 2 , 2 1 0 , 2 5 5 , 1 6 5 , 2 5 0 , 4 1 1 5 2 O 3 9 d a t a 1 0 5 , 1 9 3 , 3 2 , 2 1 0 , 2 5 5 , 1 6 5 , 2 5 0 , 7 O 4 0 d a t a 7 4 , 7 4 , 7 4 , 2 4 , 1 0 5 , 1 9 3 , 3 2 , 2 1 0O 4 1 d a t a 2 5 5 , 1 6 9 , 1 4 6 , 3 2 , 2 1 0 , 2 5 5 , 2 4 3 P 4 2 d a t a 2 4 0 , 2 5 5 , 1 0 8 , 2 5 3 , 0 1 6 5 , 2 5 2 , 2 B 4 3 d a t a 1 0 1 , 2 5 0 , 1 3 3 , 2 5 0 , 9

T h S t a n d a r d T r a n s a c t o rP r o g r a m G e n e r a t o r

I y o t y p e i p r o g r a m s f r o m t h m a g a z i n e , y o m i g h t b e a b l et s a v e y o u r s e l f s o m e w o r k w i t h t h p r o g r a m l i s t e d o t h i sp a g e . S i n c e m a n y p r o g r a m s a r e p r i n t e d i n t h e f o r m o B S I " p r o g r a m g e n e r a t o r " w h i c h c r e a t e s m a c h i n e l a n g u a g e( o B A S I C ) p r o g r a m o d i s k , w h a v e c r e a t e d a " s t a n d a r dg e n e r a t o r " p r o g r a m t h a t c o n t a i n s c o d e c o m m o n t a l p r o g r a mg e n e r a t o r s . J u s t t y p e t h i s i o n c e , a n s a v e a l t h a t t y p i n g f o e v e r y o t h e r p r o g r a m g e n e r a t o r y o e n t e r !

O n c e t h p r o g r a m i t y p e d i ( c h e c k t h e V e r i f i z e r c o d e s a u s u a l w h e n e n t e r i n g i t ) , s a v e i o d i s k f o f u t u r e u s e . W h e ne v e r y o t y p e i p r o g r a m g e n e r a t o r , t h e l i s t i n g w i l l r e f e r t ot h s t a n d a r d g e n e r a t o r . L o a d t h s t a n d a r d g e n e r a t o r f i r s t , t h e nt y p e t h l i n e s f r o m t h l i s t i n g a s h o w n . T h r e s u l t i n g p r o g r a mw i l l i n c l u d e t h g e n e r a t o r c o d e a n d b e r e a d y t r u n .

W h e n y o r u t h n e g e n e r a t o r , i w i l l c r e a t e p r o g r a m o nd i s k ( t h e o n d e s c r i b e d i t h e r e l a t e d a r t i c l e ) . T h g e n e r a t o rp r o g r a m i j u s t a e a s y w a f o y o t p u t a m a c h i n e l a n g u a g ep r o g r a m o n d i s k , u s i n g t h s t a n d a r d B A S I C e d i t o r a y o u r d i p o s a l . A f t e r t h f i l e h a b e e n c r e a t e d , t h e g e n e r a t o r i n l o n g e r n e e d e d . T h s t a n d a r d g e n e r a t o r , h o w e v e r , s h o u l d b k e p t h a n d y f o f u t u r e p r o g r a m g e n e r a t o r s .

T h s t a n d a r d g e n e r a t o r l i s t e d h e r e w i l l a p p e a r i e v e r y i s s u ef r o m n o o ( w h e n n e c e s s a r y ) a s t a n d a r d T r a n s a c t o r u t i l i t yl i k e V e r i f i z e r .

M 1 0 r e t r a n s a c t o r s t a n d a r d p r o g r a m g e n e r a t o rE 1 1 n $ = " f i l e n a m e " : r e n a m e o p r o g r a mL 1 2 0 n d = 0 0 0 : s a = 0 0 0 0 0 : c h = 0 0 0 0 0K 1 3 0 f o r i = l t o n d : r e a d xE 1 4 c h = c h - x : n e x tF 1 5 i c t h e n p r i n t " d a t a e r r o r " : s t o pD 1 6 p r i n t " d a t a o k , n o c r e a t i n g f i l e . "C 1 7 r e s t o r eC 1 8 o p e n l , 8 , l , " 0 : " + n $H 1 9 h i = i n t ( s a / 2 5 6 ) : l o = s a - 2 5 6 * h iN 2 0 0 p r i n t # l , c h r $ ( l o ) c h r $ ( h i ) ;K 2 1 f o i = t n d r e a dH 2 2 p r i n t # l , c h r $ ( x ) ; : n e x tJ 2 3 c l o s eM 2 4 p r i n f ' p r g f i l e ' " ; n $ ; " ' c r e a t e d . . . "

M 2 5 p r i n t " t h i s g e n e r a t o r n l o n g e r n e e d e d . "I 2 6 0 :

9 I s s u e

Page 8: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 8/84

R e s p o n s e s t t h M C o l u m n : d o n ' t k n o w i t h i s w i l l h e l p ,b u g e n e r a t e m r a n d o m n u m b e r s t h r o u g h t h K e r n a l R O M .d t h i s b l o a d i n g t h a c c u m u l a t o r w i t h m s e e d v a l u ee i t h e r z e r o , p o s i t i v e i n t e g e r o r a n e g a t i v e i n t e g e r ( t u r n i n g o b i 7 ) T h e n c a l l $ E 0 9 A . T h r a n d o m n u m b e r s w i l l n o b i n r e g i s t e r s $ 6 3 - $ 6 4 . ( B o t h w i l l f l u c t u a t e b e t w e e n z e r o a n 2 5 q u i t e b y r a n d o m ; a n d , i n o t , y o c a n a l w a y s u s e t h r a d o n u m b e r j u s t p r o d u c e d a y o u r s e e d w h i c h w i l l d e f i n i t e l yg u a r a n t e e r a n d o m n e s s . )

H e r e ' s q u i c k l o o k a t h c o d e f o s i n g l e r a n d o m n u m b e rb e t w e e n 0 a n d 7

I d # j s $ e O 9 aI d $ 6 a n #

T h e r e i o n d r a w b a c k : i w o n ' t w i n a n y a w a r d s a s f a r a ss p e e d i c o n c e r n e d .

S e a n P e c k , P i t t s b u r g h , P

C a m p a i g n i n g : w a s t r u c k b t h i d e a o C a m p a i g n ( w h i c hy o d e s c r i b e d i T r a n s a c t o r 9 : 3 ) f o c o u p l e o f r e a s o n s . T h f i r s t w a t h a t t h o u g h t i w o u l d b f u t s e i w o r k a n t h s e c o n d w a t h a t i a s k e d f o s o l u t i o n t t h p r o b l e m o t h g e n e r a t i o n o r a n d o m n u m b e r s . h a t r a n s l a t e d i n t o m a c h i n el a n g u a g e a n i d e a f o p s e u d o - r a n d o m n u m b e r g e n e r a t o r t h a tI ' s e e n i B y t e i M a r c h 1 9 8 7 . I h a s e e m e d a n i c e e x e r c i s ef o w r i t i n g m u l t i - b y t e d i v i s i o n a n m u l t i p l i c a t i o n r o u t i n e s .

T h o u g h i w a b e t t e r t h a n t h r a n d o m n u m b e r g e n e r a t o r w i t hC o m m o d o r e B A S I C a n w a w r i t t e n t b a c c e s s e d w i t h t h

U S R c o m m a n d , i s e e m e d o l i m i t e d a p p e a l t i l l y o u r a r t i c l ec a m e a l o n g . H a v i n g a s o u r c e o r a n d o m n u m b e r s , c a r r i e do u y o u r p r o g r a m i d e a a n t h o u g h t w o u l d s e n d i t y o u .

T h r e q u e s t f o r h e l p i y o u r a r t i c l e i m p l i e d t h a t a i d e a l s o l ut i o n w o u l d b s i n g l e m e m o r y a d d r e s s w h e r e r a n d o m n u b e r s c o u l d b e g r a b b e d q u i c k l y . T h p s e u d o - r a n d o m n u m b e rg e n e r a t o r t h a t u s e d i c o m p l i c a t e d e n o u g h t h a t t h p r o g r a mt a k e s p e r c e p t i b l e a m o u n t o f t i m e t c a l c u l a t e e a c h p o i n t b u n o n e t h e l e s s i m o v e s a l o n g a p r e t t y g o o d c l i p .

F r a n k v a n D e v e n t e r , G r o s s e P o i n t e F a r m s , M

F r a n k ' s F o l l o w - u p : s u b s e q u e n t l y r a a c r o s s a a r t i c l e i T r a n s a c t o r , V o l u m e 7 I s s u e ( p a g e 2 7 t h a t d e s c r i b e d ' l i n e a rm a x i m a l l e n g t h s h i f t r e g i s t e r s e q u e n c e s ' a w a t g e n e r a t e

l o n g s e r i e s o p s e u d o - r a n d o m n u m b e r s . T h m e t h o d i t a d p a i r s o n u m b e r s i s e r i e s , c a l l e d r e g i s t e r , t a k e t h er e m a i n d e r a f t e r d i v i d i n g b b a s e a n r e p l a c e o n o t h n u m b e r s i t h r e g i s t e r w i t h t h i s n e v a l u e w h i c h i a l s o u s e da t h r a n d o m n u m b e r o u t p u t . n e p a i r i t a k e n e a c h t i m et h i s i r e p e a t e d . T h i s p r o v e s t b a c o n s i d e r a b l y f a s t e rm e t h o d . I y o l o o k t h e o r i g i n a l a r t i c l e u p , y o u ' l l s e t h a t t h a u t h o r g a v e a e x a m p l e p r o g r a m b u f o u n d t h a t t h i d e ac o u l d b c a r r i e d o u m u c h f a s t e r b u s i n g t h i n d e x r e g i s t e r si n s t e a d o m o v i n g d a t a a n c o u l d b w o r k e d i e i t h e r b a s e 1 ( b i t s ) o b a s e 2 5 ( b y t e ) t o u t p u t r a n d o m b y t e s d i r e c t l y .

T h a r t i c l e i n d i c a t e s t h a t t h l e n g t h o t h s e r i e s i e q u a l t t h b a s e r a i s e d t t h p o w e r o t h n u m b e r o i t e m s i t h r e i s t e r . b a s e l a r g e r t h a n t h s i z e o t h r e g i s t e r d o e s n o t g i v em a x i m u m l e n g t h s e r i e s b u i s e e m s t p r o d u c e a d e q u a t e l yr a n d o m n u m b e r s . T h r e a l q u e s t i o n i w h e t h e r t h e r e i a n b a i t h s e r i e s a n t h a t i s n ' t s c l e a r . l i t t l e i n s p e c t i o n

T r a n s a c t o r

Page 9: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 9/84

s h o w s t h a t t h m a x i m u m s e r i e s o o d d n u m b e r s i e q u a l t t h l e n g t h o t h r e g i s t e r a n t h m a x i m u m s e r i e s o e v e n n u m b e r si e q u a l t t h d i s t a n c e b e t w e e n t h e p o s i t i o n s o t h t w n u b e r s t h a t a r a d d e d ; t h u p p e r a n l o w e r t a p s w h e n t w t a p sa r u s e d . T h p r o g r a m r u n s f a s t e r t h e l a r g e r t h r e g i s t e r a n f o t h o s e r e a s o n s p i c k e d t h e l a r g e s t r e g i s t e r t h a t h a a o p t im u t a n e a r t h b o t t o m .

r e w r o t e t h p r o g r a m t h a t s e n t y o e a r l i e r t u s t h n e r a d o n u m b e r g e n e r a t o r . Y o u ' l l s e e t h a t i t ' s m u c h f a s t e r a n d , a l e a s t t o v i s u a l i n s p e c t i o n , s e e m s t w o r k i r a n d o m f a s h i o n .I t ' s a l s o f a s t e n o u g h n o t f i l l t h s c r e e n w i t h r a n d o m b y t e s i a a c c e p t a b l e l e n g t h o t i m e . T h e r e a r t w v e r s i o n s o t h d i s k ,b o t h o w h i c h w o r k f r o m B A S I C . C a m p a i g n 6 4 + w o r k s i b a s e2 5 a n C a m p a i g n * w o r k s i b a s e 1 6 T h i s r e q u i r e s o n l y a m n o r c h a n g e i t h p r o g r a m . A l t h o u g h t h l a t t e r p r o g r a m i m a r g i n a l l y f a s t e r , i i s n ' t e v i d e n t t w a t c h i t a l s o i n c l u d e d t h p s e u d o - r a n d o m g e n e r a t o r s e p a r a t e l y a s r a n g e n 6 4 + a l o n g w i t hd e m o + t h a t s h o w s a c c e s s f r o m B A S I C u s i n g t h U S f u n c t i o n i y o u ' d l i k e t o t a k e a l o o k a i t Y o u ' l l f i n d t h i n k t h a t C a m p a i g ni e v e n m o r e f u t w a t c h w h e n i t ' s s p e e d e d u p

F r a n k v a D e v e n t e r , G r o s s e P o i n t e F a r m s , M

S I S a m p l i n g R a t e : T h M C o l u m n i T r a n s a c t o r 9 : e n d e dw i t h a r e q u e s t f o w a t g e n e r a t e r a n d o m n u m b e r s w i t h t h C 6 4 . 1 t h i n k t h e f o l l o w i n g m a h e l p .

h a v e f o u n d t h a t t h S I c h i p ' s n o i s e g e n e r a t o r c a g e n e r a t ew h a t a p p e a r t b t r u l y r a n d o m n u m b e r s , b u t h e r e ' s c a t c h .T h r a t e a w h i c h t h e s e n u m b e r s a r p r o d u c e d i d e t e r m i n e db v o i c e t h r e e ' s f r e q u e n c y s e t t i n g s t o r e d i $ D 4 0 E a n $ D 4 0 F .A t h h i g h e s t p o s s i b l e f r e q u e n c y , t h c h i p w i l l p r o d u c e a b o u t7 0 0 0 r a n d o m n u m b e r s p e r s e c o n d . T h i s t r a n s l a t e s t o n e n u m b e r e v e r y 1 4 c l o c k c y c l e s . C o n s e q u e n t l y , f a s t - r u n n i n gm a c h i n e l a n g u a g e r o u t i n e c a r e a d t h s a m e n u m b e r m a n yt i m e s b e t w e e n c h a n g e s .

O n s o l u t i o n t t h i s p r o b l e m i t w a i t f o r t h e n u m b e r t c h a n g e b e f o r e u s i n g i t l i k e s o

r a n d o m = $ d 4 1 b ; s i d r a n d o m n u m b e r

g e t r a n d I d a r a n d o m ; g e n u m b e rc m p r e v ; " c h a n g e dg e g e t r a n d ; n o , w a i ts t p r e v ; f o r n e x t t i m er t

p r e v . b y t e 0 ; p r e v s t o r a g e

T h i s s u b r o u t i n e c o m p a r e s t h e c u r r e n t v a l u e o r a n d o m w i t h w h a tw a t h e r e d u r i n g t h p r e v i o u s c a l l a n w a i t s f o r t h e n u m b e r t c h a n g e b e f o r e a c c e p t i n g i t T h n e n u m b e r i t h e n s t o r e d f o r t h en e x t c a l l b e f o r e r e t u r n i n g t h e n u m b e r i t h a c c u m u l a t o r . T h i sw i l l s l o w d o w n f a s t - r u n n i n g c a l l e r t o m a t c h t h r a t e a t w h i c ht h S I c a p r o d u c e n e n u m b e r s . N o t e t h a t t h e r o u t i n e a s s u m e st h a t t h S I h a b e e n i n i t i a l i z e d t p r o d u c e r a n d o m n u m b e r s .

T h i s r o u t i n e s t i l l h a s p r o b l e m s , h o w e v e r . t r u e e i g h t - b i t r a d o n u m b e r g e n e r a t o r h a o n i 2 5 c h a n c e o p r o d u c i n gt h s a m e n u m b e r t w i c e i s u c c e s s i o n , b u t h e n a t u r e o t h i sr o u t i n e e l i m i n a t e s t h i s c h a n c e . N o t e t h a t t h i s i o n l y a p r o b l e mi y o a r u s i n g a l e i g h t b i t s o t h n u m b e r . F o e x a m p l e , i y o u r C a m p a i g n r o u t i n e o n o e i g h t n e i g h b o r s m u s t b r a d o m l y s e l e c t e d . T h r e e o t h e e i g h t r a n d o m b i t s c a b u s e d t d t h i s . T h e s e t h r e e b i t s c a c o m e u t h s a m e w h i l e t h e o t h e rf i v e v a r y , s t h e r r o r s a r r e d u c e d .

I s e e m s l i k e t h c o m p l e t e s o l u t i o n t t h i s p r o b l e m r e q u i r e s a i n d e p e n d e n t s i g n a l t h a t i n d i c a t e s n e n u m b e r i p r e s e n t i t h ' r a n d o m ' r e g i s t e r . I t ' s t o b a t h a t C o m m o d o r e d i d n ' tt h i n k o t h i s w h e n d e s i g n i n g t h S I c h i p . I m a b p o s s i b l e t u s s o m e o t h e r s o u r c e , s u c h a t h v i s c a n l i n e r e g i s t e r o r C I t i m e r , a s s o u r c e f o t h i s s i g n a l .

R a n d o m n e s s i f a s c i n a t i n g s u b j e c t . I t i s a m a z i n g t m t h a ts u c h s i m p l e c o n c e p t c a n b s c o m p l i c a t e d i e x e c u t i o n .r e a l l y e n j o y y o u r c o l u m n a n h o p e i c o n t i n u e s a r e g u l a rf e a t u r e . G o o d l u c k a n d k e e p u t h g o o d w o r k .

M i k e G r a h a m , H o p a t c o n g , N

M W i s h L i s t : v e r y m u c h e n j o y y o u r T h M C o l u m n i T r a n s a c t o r . I w a n o t o m u c h o v e r m h e a d , a n c e r t a i n l yn o t o b a s i c e i t h e r .

I n f u t u r e c o l u m n , w o u l d l i k e t s e d i s c u s s i o n a b o u t I / r o u t i n e s ; f o r e x a m p l e , r e a d i n g a n w r i t i n g t d i s k w i t h v a r i o u sf i l e t y p e s , D O S c o m m a n d s , p r i n t i n g , e t c . l o o k f o r w a r d t f t u r e c o l u m n s .

B a r r y K u t n e r , Y a r d l e y , P

R a n d o m b u n n i e s : l o v e y o u r n e c o l u m n , T h M C o l u m n .( G r e a t t i t l e t o o ! ) l i k e h o y o p i c k i n t e r e s t i n g s u b j e c t s , o a l e a s t m a k e d u l l s u b j e c t s s o u n d i n t e r e s t i n g . w a v e r y i p r e s s e d w i t h y o u r b i n a r y d i v i s i o n c o l u m n i V o l u m e 9 I s s u e2 I a n s w e r e d c o u p l e o f q u e s t i o n s h a m y s e l f .

W i t h r e g a r d t t h c o l u m n i V o l u m e 9 I s s u e 3 . . . a r y o k i d i n g ? Y o h a s u c h b r i l l i a n t h e a d l o n g j u m p i n t o t h p r o bl e m , o n l y t b e s y m i e d b i n o b e i n g r a n d o m e n o u g h ? ! ( A t u a l l y , s k i m m e d t h a r t i c l e b r i e f l y , w a i m p r e s s e d , s a h o s h o r t t h e B A S I C g e n e r a t o r p r o g r a m w a s , w a v e r y i m p r e s s e d ,t y p e d i i n a n w a d i s a p p o i n t e d t s e t h s c r e e n n o c h a n gi n g . H a r u m p h ! )

A n y w a y , h a v e s o l u t i o n t h a t f i g u r e d o u t b s i m p l y l o o k i n ga t h n o t - c h a n g i n g s c r e e n . T h n a t u r e o t h S I D o u t p u t i s u c ht h a t i d e v e l o p s t h o s e i r r i t a t i n g d i a g o n a l l i n e s . B u e a c h b y t e i d i f f e r e n t f r o m t h l a s t i t h a t i i s h i f t e d o v e r s l i g h t l y . T w t r i c k s t o s o l v e t h i s , b u f i r s t t h e x p l a n a t i o n :

' R a n d o m ' i i t p u r e d e f i n i t i o n m e a n s a n a b s e n c e o p a t t e r n ,b u i d o e s n o m e a n t h a t l o c a l p a t t e r n s m a n o d e v e l o p ( l i k es q u a r e s , t r i a n g l e s , b u n n i e s , e t c . ) . B m o d i f y i n g t h p r o g r a m t

9 I s s u e

Page 10: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 10/84

r u i n f i n i t e l y , c o n s t a n t l y r e d r a w i n g t h e s c r e e n , w a a b l e t w a t c h o u t , b u d i d n ' t s e a n b u n n i e s . . . I f a c t , a l l I s a w a w h a t l o o k e d l i k e c h u r n i n g w a t e r ! O b v i o u s l y , t h e S I D d o e s n o d g o o d j o o p r o d u c i n g r a n d o m d i s p l a y s .

S f i g u r e d , " W h a t k i n d o d i s p l a y a r w l o o k i n g f o h e r e ? "a n i m m e d i a t e l y t h o u g h t o s t a t i c s c r e e n . A b o u t - u n i f o r md i s t r i b u t r i o n o b l u e a n w h i t e d o t s , l i k e s n o w o T V ( N d a g o n a l s . )

T h i s i s n ' t t r u e r a n d o m n e s s , b t h w a y , b e c a u s e i d o e s n ' t a l o f o r e c o g n i z a b l e s h a p e s , s u c h a b u n n i e s a n d u c k i e s .c a l l t h i s ' s n o w ' t h r a n d o m p a t t e r n , r e a l l y a w f u l o x y m o r o n !

A n y w a y , t w s o l u t i o n s , a n t h m a j o r p r o b l e m i t h p e s k y d a g o n a l l i n e s .

1 C h a n g e l i n e 6 3 i t h s o u r c e c o d e t o

6 3 l p c h o o s e I d a r a n d o m : a d r a n d o m : a d r a n d o m :a d r a n d o m : a d r a n d o m

N o w , t h g r a d u a l d i f f e r e n c e t h a t p r o v i d e d t h e o r i g i n a l d i a g on a t e n d e n c y i m u l t i p l i e d f i v e - f o l d . I t ' s s t i l l t h e r e , b u i n o m u c h m o r e j a g g e d , a n i t h 8 - b i t w i d e d i s p l a y , i i n d i s -c e r n a b l e . I a l s o t a k e s a l o l o n g e r t d r a w t h s c r e e n , b c a u s e t h i s i e x e c u t e d f o a l 8 1 9 2 b y t e s o t h e s c r e e n ! N o s g o o d .

2 T h d i a g o n a l t e n d e n c y i c a u s e d b p u t t i n g t h e s e s l i g h t l y -s h i f t e d d a t a b y t e s n e x t t e a c h o t h e r . . . o h y o g u e s s e d i a l r e a d y . C h a n g e t h c h o o s e r o u t i n e !

5 5 c h o o s e =5 6 b i t m a p = $ 2 0 0 05 7 l d # 5 8 l p c h o o s e l d x # 3 5 9 I d # < b i t m a p6 0 s t s e l f m o d + 16 1 I d # > b i t m a p6 2 0 s t a s e l f m o d + 26 3 0 I p 2 I d r a n d o m6 4 s e l f m o d s t $ f f f f , y6 5 i n s e l f m o d + 26 6 d e 6 7 b n I p 6 8 d e 6 9 b n e l p c h o o s e

a c t u a l l y c o n j u r e d u t h i s s o l u t i o n f i r s t , s i m p l y f r o m l o o k i n ga y o u r f i l l r o u t i n e . m i g h t u s t h f i r s t s o l u t i o n f o r t h e c a p a i g n r o u t i n e t h o u g h , t a d d a s h o f r e a l l y - m o r e - v a r i e dn u m b e r s t t h e s i m u l a t i o n . A n o t h e r m e t h o d w o u l d b t u s t h C o m m o d o r e r a n d o m n u m b e r g e n e r a t o r , t h o u g h t h a t i r e a l l y u g l y s l o w i c o m p a r i s o n . P l e a s e s e n d m y o u r e x i s t i n gc a m p a i g n r o u t i n e !

K e v i n M o o r m a n , C a l g a r y , A

P r e c i o u s p a g e s : r e a d w i t h i n t e r e s t J i B u t t e r f i e l d ' s r e v i e wo W h a t ' s R e a l l y I n s i d e T h C o m m o d o r e 6 [ a v a i l a b l e i N o r t h A m e r i c a f r o m S c h n e d l e r S y s t e m s , 2 E a s t w o o d R d . ,P . O . B o 5 9 6 4 , A s h e v i l l e , N C , 2 8 8 1 3 , ( 7 0 4 ) 2 7 4 - 4 6 4 6 ] ( T r a n sa c t o r , V o l u m e 9 I s s u e 4 ) u s t h b o o k o f t e n , a n a g r e ew i t h M r B u t t e r f i e l d ' s a s s e s s m e n t o i t w a s u r p r i s e d , h o e v e r , t f i n d t w o t h e r p o s s i b l e s u p p l e m e n t s w e r e l e f t o u t .

O n o t h m o s t u s e f u l b o o k s i m C o m m o d o r e l i b r a r y i M a p p i n g T h C o m m o d o r e 6 b S h e l d o n L e e m o n [ C o m p u t e !P u b l i c a t i o n s ] . I r e f e r e n c e s m e m o r y l o c a t i o n s , r a t h e r t h a n d i a s s e m b l i n g t h R O c o d e . T h a t g i v e s a p i c t u r e o t h d y n a m i c so t h m a c h i n e m i s s i n g f r o m t h e o t h e r t e x t s l i s t e d . W h i l e t h D a H e e b b o o k s [ a l s o f r o m C o m p u t e ! ] g i v e i n - d e p t h d i s c u ss i o n s o t h R O r o u t i n e s , t h e y ' r e o f t e n t o o d e t a i l e d . F o ' q u i c k a n d i r t y ' u s e o f t h C 6 R O c o d e , i n v a r i a b l y t u r n t L e e m o n ' s b o o k . I n f e w o r d s , h t e l l s m w h a t t d w i t hr e g i s t e r s , a n w h a t t e x p e c t a s o u t p u t .

u s u a l l y t e l l b e g i n n e r s t h a t i t h e y o n l y b u o n b o o k , m a k e i P r o g r a m m i n g T h C o m m o d o r e 6 4 b y R a e t o W e s t [ a l s o f r o mC o m p u t e ! ] . I t ' s n o a s d e t a i l e d i R O c o d e a a n o t h o t h e rr e f e r e n c e s . B u t , W e s t l i s t s t h c o m m o n l y u s e d r o u t i n e s a n g i v e s e x c e l l e n t e x a m p l e s . A c t u a l l y , a a s s e m b l y l a n g u a g e p r og r a m m e r s h o u l d h a v e a l s i b o o k s a v a i l a b l e .

H o s h e s h o u l d a l s o c o n s i d e r M r B u t t e r f i e l d ' s o w M a c h i n eL a n g u a g e F o r T h C o m m o d o r e 6 A n O t h e r C o m m o d o r e C o p u t e r s [ B r a d y B o o k s ] , a e x c e l l e n t , e a s i l y u n d e r s t o o d b e g i n n i n gt e x t . M a r v i n D e J o n g ' s A s s e m b l y L a n g u a g e P r o g r a m m i n g W i t hT h C o m m o d o r e 6 i a n o t h e r v a l u a b l e a d d i t i o n . I g i v e s w e l l a n o t a t e d e x a m p l e s o b i t m a p g r a p h i c s , S I D , a n I / r o u t i n e s .

T r o u n d o u t h l i b r a r y , n o p r o g r a m m e r s h o u l d b w i t h o u t1 5 4 1 U s e r ' s G u i d e b D r G e r a l d N e u f e l d , a n I n s i d e C o m o d o r e D O b N e u f e l d a n R i c h a r d I m m e r s .

N o e l N y m a n , S e a t t l e , w

M o r e o h o u s e h o l d a u t o m a t i o n : A f t e r r e a d i n g m r e v i e w o t h X - 1 0 P o w e r h o u s e I n t e r f a c e , y o m a h a v e d e c i d e d t h a t i t ' st o l i m i t e d b t h l a c k o r e a l - w o r l d i n p u t s f o r y o u r a p p l i c at i o n .

I y o p r e f e r n o t e x p e r i m e n t w i t h X - 1 0 ' s n e w e r m o d u l e s , a n y o h a v e a o l v i c - 2 0 o C 6 n o i a c t i v e u s e , t h e r e ' s a i n e xp e n s i v e s o l u t i o n . C h e c k f o t h M a 1 9 8 6 i s s u e o R a d i o -E l e c t r o n i c s m a g a z i n e . I t h " C o m p u t e r D i g e s t " s e c t i o n , C h a nd l e r S o w d e n p u b l i s h e d a s i m p l e h a r d w a r e c i r c u i t t h a t s e n d s X - 1 0s i g n a l s i n t o t h p o w e r l i n e . I u s e s t h u s e r p o r t a a o u t p u t , s t h v i c - 2 0 w i l l w o r k a w e l l a C 6 o C 1 2 8 . H a l s o p r o v i d e sB A S I C p r o g r a m t g e n e r a t e t h e c o n t r o l s i g n a l s .

J u s t a d s w i t c h e s t t h j o y s t i c k p o r t s ( u t 1 0 ) , o h e a t / l i g h ts e n s o r s t t h p a d d l e i n p u t s a n d y o u h a v e a e a s i l y p r g r a m m e d X - 1 0 s y s t e m t h a t w i l l r e s p o n d t t h r e a l w o r l d .

N o e l N y m a n , S e a t t l e , W

T r a n s a c t o r

Page 11: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 11/84

S o m e c o m m e n t s a n d q u e s t i o n : V o l u m e 9 I s s u e 2 J o e l R b i n w r o t e c o m p a r i s o n o s o m e c o m m e r c i a l a s s e m b l e r s f o r t h e1 2 8 , a n a l s o m e n t i o n e d T h F a s t A s s e m b l e r b y Y v e s H a n ,w h i c h a p p e a r e d i t h J a n u a r y 1 9 8 6 i s s u e o C o m p u t e r sG a z e t t e . w a i n t e r e s t e d i i t m e n t i o n , s i n c e u s t h i s s y s t e me x c l u s i v e l y . f e t h o u g h t s o t h i s v e r y u n i q u e a s s e m b l e r :

J o e l m e n t i o n e d t h a t F c a n ' t p r i n t o u l i s t i n g s . N o s o S i n c eB A S I C i s t i l l a c t i v e , a i n v o c a t i o n o t h f a m o u s l i n e o p e n4 , 4 : c m d 4 : l i s t w i l l d t h j o b . S i n c e a l o p c o d e s a n p s e u d o -o p a r t o k e n i z e d , h o w e v e r , t h i s c a o n l y b d o n e w h i l e t h a s s e m b l e r i a c t i v e . A n b e c a u s e o t h i s t o k e n i z a t i o n , s o u r c ec o d e i s n ' t e a s i l y t r a n s f e r a b l e b e t w e e n f a n o t h e r a s e m b l e r s .A n o t h e r p o i n t : F o p e r a t e s a a e x t e n s i o n o f B A S I C , n o t a r p l a c e m e n t f o i t I c a n b e u s e d t w r i t e B A S I C p r o g r a m s t h a tu s t h a d d e d f e a t u r e s ( i n d e n t a t i o n o l i n e s i s u p p o r t e d , a i t h u s o f b i n a r y a n h e n u m b e r s ) . B e c a u s e y o c a w r i t eb o t h B A S I C a n d M p r o g r a m s w i t h t h a s s e m b l e r , y o h a v e t m a n u a l l y e n c l o s e t h M p a r t i n s i d e f o r / n e x t l o o p t i m p l em e n t t h m u l t i p l e p a s s e s r e q u i r e d b a l a b e l - b a s e d a s s e m b l e r .

V o l u m e 9 I s s u e 4 J i B u t t e r f i e l d r e v i e w e d W h a t ' s R e a l l y I s i d e t h e C o m m o d o r e 6 4 b M i l t o n B a t h u r s t . J i m m e n t i o n e dA b a c u s ' T h A n a t o m y o t h C o m m o d o r e 6 4 M a d v i c e i s f o r g e t i t T h s o u r c e i s p a r s e l y c o m m e n t e d a n u n i n d e x e d .W i t h o u t m e m o r y m a p y o u ' l l g n u t s t r y i n g t f i n d t h e r o t i n e s y o w a n t . T h p r o g r a m m e r ' s r e f e r e n c e s e c t i o n i f u l l o e r r o r s . P e r s o n a l l y , r e c o m m e n d D a H e e b ' s T o o l K i t b o o k s ,p u b l i s h e d b C o m p u t e ! . R e g a r d l e s s o f w h a t y o u m a t h i n ka b o u t t h e i r m a g a z i n e s , C o m p u t e ! ' s p r o g r a m m i n g b o o k s a r g e n e r a l l y h a r d t o b e a t .

I ' m w o r k i n g o n l a r g e - s c a l e f i l i n g p r o g r a m a n d n e e d s o m eh e l p o a s o f t w a r e p r o j e c t w a n t t u n d e r t a k e . T h f i l i n g p r g r a m w i l l b w r i t t e n e n t i r e l y i n B A S I C a n w i l l u t i l i z e s t r i n ga r r y w h i c h o c c u p i e s a b o u t 3 0 o i t o w n . O b v i o u s l y , t h i si s n ' t a l g o i n g t f i i B A S I C w o r k s p a c e , a n d I ' m t o y i n g w i t ht h i d e a o s e t t i n g u b a n k o t h 1 7 6 4 R E ( s a y , b a n k 0 ) a s" p h a n t o m c o m p u t e r " . T h i d e a i t c o p y b o t h R O M s , z e r op a g e , v e c t o r s , t h e s t a c k , a n t h s t r i n g a r r a y t o t h e i r a p p r o p r ia t s p o t s i e x p a n s i o n m e m o r y , t h e n s w i t c h i a l i w h e n e v e rn e e d t a c c e s s t h a r r a y . P a r a m e t e r s a n r e s u l t s c o u l d b t r a n sf e r r e d b a c k a n f o r t h b e t w e e n t h 4 b l o c k s s t a r t i n g a $ C 0 0 0 .

O c o u r s e , t h e r e a r e s e v e r a l c o n s i d e r a t i o n s w h e n d o i n g t h i s .T h B A S I C p o i n t e r s i e x p a n s i o n R A w o u l d n e e d t b m o d if i e d f o r t h e ' n e w ' c o n t e n t s o B A S I C w o r k s p a c e . w o u l d h a v et p e r f o r m t h s w i t c h w i t h a M r o u t i n e a n i n t e r r u p t s w o u l dh a v e t b d i s a b l e d , s i n c e t h e r e w i l l b n I / O . T h q u e s t i o n i s w i l l t h i s w o r k ? I i t ' s p o s s i b l e t p u l l t h i s o f f , h o d m a k et h 6 5 1 0 r e c o g n i z e a b a n k o e x p a n s i o n R A a n h o d s l e c t w h i c h b a n k i w i l l l o o k a t A n i n f o r m a t i o n y o o y o u ro t h e r r e a d e r s c o u l d g i v e m w o u l d b g r e a t l y a p p r e c i a t e d . M a d d r e s s i s 1 6 9 2 5 M o r r i s o n A v e . , S o u t h f i e l d , M i , 4 8 0 7 6 .

Y o p u t o u t g r e a t m a g a z i n e ! K e e p u t h g o o d w o r k !

H o w a r d I G o l d m a n , S o u t h f i e l d , M

C O N C U R R . O ST h C O N C U R R E N T O p e r a t i n g s y s t e m s p l i t s y o u r C 6 I n t o t w B A S I C c o m p u t e r s a n d a l l o w s y o t s w i t c hb e t w e e n t h e m . O n o t h p r o g r a m s c a b f u l l l e n g t h ,( 3 8 9 1 1 b y t e s ) w h i l e t h o t h e r c a b " S h o r t " B A S I Cp r o g r a m ( 1 2 7 0 b y t e s ) . W h e n s w i t c h i n g b e t w e e n t h e s ep r o g r a m s t h a s s o c i a t e d s c r e e n d i s p l a y i a l s o s w i t c h e da n s a v e d .

I t y p i c a l c o n f i g u r a t i o n t h e S h o r t p r o g r a m i u t i l i t y t a i i y o u r p r o g r a m d e v e l o p m e n t . L o a d i n g a n r u n n i n gS h o r t p r o g r a m w i l l n o a f f e c t t h m a i n c o - r e s i d e n t B A S I Co M a c h i n e L a n g u a g e p r o g r a m .

C O N C U R R . O S c a b l o a d e d A F T E R y o u r m a i n p r o g r a mh a b e e n l o a d e d , i l o a d s w i t h o u t d i s t u r b i n g e x i s t i n g h a l t e dp r o g r a m s . I s w a p s o u t t h e c u r r e n t R A b e t w e e n $ 0 0 0 0a n $ 0 C F 7 p l u s t h e c o l o u r R A M , t R A a $ D 0 0 0 .C O N C U R R d o e s n o a f f e c t t h e v a l u a b l e R A a $ C 0 0 0 .T h i s c r e a t e s s p a c e f o S h o r t p r o g r a m s w h i c h c a p r o v i d ey o p o w e r f u l l f u n c t i o n s a n u t i l i t i e s s u c h a s

L i s t / D i s a s s e m b l e y o u r M a i n P r o g r a mL i s t / D i s a s s e m b l e n a m e d D i s k F i l e sL i s t / D i s a s s e m b l e t r a c k S e c t o rL i s t / D i s a s s e m b l e 1 5 4 1 D i s k R A M / R O MD i s a s s e m b l e P s e u d o C o d e sL i s t n a m e d B A S I C d i s k f i l eL i s t D i s k D i r e c t o r yL o o k u p , c r e a t e p r i n t d a t a s c r e e n f i l e sU n - N E W B A S I C p r o g r a m

T h e r e i a l s o S h o r t S c r e e n E d i t o r f o c r e a t i n g a n f i l i n gy o u r o w c o l o u r e d t e x t s c r e e n s .

C O N C U R R . O S a l l o w s y o t s w i t c h o v e r t t h S h o r t s i d ea n l i s t a o l v e r s i o n o y o u r p r o g r a m t t h e s c r e e n , v i e w

d i r e c t o r y , c r e a t e a n f i l e s o m e c o m m e n t s e t c . a n r e t u r nt y o u r p r o g r a m i t h s a m e s t a t e a y o l e f t i i n

W i t h t h 1 5 4 1 D i s a s s e m b l e r p r o g r a m y o u c a p l a c e a n r u y o u r o w p r o g r a m s i t h R A o t h d i s k .

T h C O N C U R R D I S K i n c l u d e s C O N C U R R . O S a n S h o r t u t i l i t i e s d e s c r i b e d h e r e .

S e n d $ 1 8 . 0 0 C d ( o $ 1 5 . 0 0 U S p l u s $ 2 . 0 0 f o s h i p p i n g a n h a n d l i n g ,M o n e y O r d e r o c h e q u ed r a w n o n C a n a d i a n B a n k .P l e a s e a l l o w w e e k s f o d e l i v e r y . P r e - p a y m e n t i r e q u i r e d .

t h

P R E C I S I O N W A R EA d a m s S t r e e t

B r a m p t o n , O n C a n a d a , L 6 Z 2 S 3

9 I s s u e

Page 12: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 12/84

G o a i n t e r e s t i n g p r o g r a m m i n g t i p , s h o r t r o u t i n e , o a u n k n o w n b i o C o m m o d o r e t r i v i a ? S e n d i i i w u s i i t h b i t s c o l u m n , w e ' l l c r e d i t y o i t h

c o l u m n a n s e n d y o f r e e o n e - y e a r s u b s c r i p t i o n t T r a n s a c t o r .

S u p e r - C B I K e r r y G r a y , S a l i n a s , C

S u p e r - C p r o g r a m i l o a d e d f r o m $ 0 8 0 1 l i k e B A S I C . I t s f i r s tt w b y t e s f o r m a p o i n t e r t t h f i r s t i n s t r u c t i o n i n t h p r o g r a m .Y o c a w r i t e s t a n d - a l o n e a s s e m b l e r l a n g u a g e p r o g r a m s t h a tc a n b e r u f r o m t h e n v i r o n m e n t i y o f o l l o w t h i s c o n v e nt i o n . Y o u r p r o g r a m s h o u l d e x i t w i t h J M P $ 0 4 0 0 t r e t u r n c o t r o l t t h s h e l l : D o n ' t u s a R T S .

Y o u r o t h e r f i l e c o p i e r

h a 4 5 7 - b l o c k A R f i l e t h a t w a n t e d t m o v e f r o m 1 5 8 1t 1 5 7 1 . M f i l e c o p i e r w o u l d n ' t b u d g e t h i s m o n s t e r !c a m e u w i t h a n o t h e r i d e a . b o o t e d G E O S a n d , s u r e e n o u g h ,m a n a g e d t c o p y t h f i l e . N o o n l y w i l l G E O S h a n d l e v e r yl a r g e f i l e s , b u y o a l s o g e t t h e a d d e d b o n u s o t h G E O S d i s kt u r b o .

T h T a s m a n i a n D a t a l l e r !E l a i n e F o s t e r , L a u n c e s t o n , T a s m a n i a

W h e n y o w a n t t m a k e b a s i c L o a d e r f o y o u r o w o o t h e r M p r o g r a m , i i v e r y n i c e d i r e c t l y t t r a n s l a t e t h d a t a i R A i n t o B A S I C D A T A l i n e s . T h i s p r o g r a m d o e s t h i sv e r y s i m p l y , a n i i o n l y f i v e b l o c k s l o n g c o m p a r e d t 2 9 - b l o c k c o m m e r c i a l e q u i v a l e n t . I d o e s r e q u i r e t h a t y o s u p p l y t h s t a r t a n e n a d d r e s s e s o f t h M p r o g r a m t b t r a n s l a t e d . T h e n a d d r e s s w i l l b a 4 5 - 4 6 a f t e r l o a d i n g ,a n t h s t a r t a d d r e s s w i l l b t h f i r s t t w b y t e s i t h f i r s ts e c t o r o t h p r o g r a m o t h d i s k a l i t h u s u a l l o b y t e / h i g h b y t e f o r m a t . M a n y u t i l i t i e s c a r t r i d g e s t h e s e d a y sa l s o a u t o m a t i c a l l y g i v e t h s t a r t a d d r e s s a n e n a d d r e s s o

l o a d e d p r o g r a m .

W i t h t h M p r o g r a m i m e m o r y , t h i s o n i l o a d e d i n t o t h eB A S I C w o r k s p a c e a n d r u n . I p r o m p t s y o f o r t h e s t a r t a d d r e s sa n d e n d a d d r e s s a n t h s t a r t i n g l i n e n u m b e r f o t h D A T As t a t e m e n t s . B u s i n g D y n a m i c K e y b o a r d m e t h o d s ( l i n e s5 0 1 9 0 - 5 0 2 3 0 ) i t h e n m a k e s t h D A T A l i n e s a n e n d s w i t h t h u s u a l F O R / N E X T r e a d i n g a n p o k i n g l o o p ( l i n e s 5 0 2 4 0 - 5 0 2 5 0 ) .T h l o a d e r p r o g r a m i t h e n r e a d y t s a v e t d i s k .

L i n e s 5 0 1 5 0 a n 5 0 1 6 0 e n s u r e t h a t a l d a t a e l e m e n t s a r a l i g n e d { T r a n s a c t o r s t y l e ) , w h i c h m a k e s t h e m m u c h e a s i e r t r e a d a n t c o p y . T h i s p r o g r a m c l e v e r l y e r a s e s i t s e l f w h e n i h a d o n e i t j o b , w h i l e l e a v i n g t h n e D A T A s t a t e m e n t s i n t a c t !T h i s m e a n s t h a t w h e n t h n e D A T A l i n e s h a v e b e e n m a d e t h p r o g r a m m a b e s a v e d ' a i s o y o c a b e g i n e n t e r i n g l i n e so B A S I C o a p p e n d a n o t h e r b a s i c p r o g r a m .

T h D e l e t e r i f o r m o s e l e c t i v e N E W , a n t h d e t a i l s a r g i e i t h s o u r c e c o d e s h o w n ( d e l e t e r . s r c p r o v i d e d a n p r s e n t e d i S p e e d y A s s e m b l e r f o r m a t M O ) . Y o c a s e t h a t i s c a n s B A S I C f r o m $ 0 8 0 1 o n w a r d s , l o o k i n g a e a c h l i n k a d d r e s sa n a e a c h l i n e n u m b e r i n t u r n . I f t h l i n e n u m b e r i n o ( i t h i s c a s e ) 5 0 0 0 0 i g o e s t t h n e x t l i n k a n n e x t l i n e n u m b e r ,a n s o n W h e n 5 0 0 0 0 i f o u n d , i b a c k s u p t w o b y t e s , a d d st e r m i n a t i n g z e r o s a n a d j u s t s t h e e n a d d r e s s b y t e s o l o c at i o n s 4 5 a n d 4 t s u i t .

T h s t a r t a d d r e s s o t h D e l e t e r r o u t i n e ( 5 3 0 0 0 i t h i s i s t a n c e ) c a n b e a n y o n e w h e r e t h e r e i r o o m f o 6 b y t e s ; t h i s i p o s s i b l e b e c a u s e l i n e s 5 9 0 - 6 0 0 r e p l a c e J M b B E Q , r e l at i v e a s s i g n m e n t . T h i s i n i c e , b e c a u s e i a l l o w s y o t a v o i da n c o n f l i c t w i t h t h M p r o g r a m b e i n g e x a m i n e d . I y o w i s ht u s t h D e l e t e r r o u t i n e a l o n e ( B A S I C L i n e s 5 0 0 1 0 - 5 0 0 8 0 ) , i m a b a d j u s t e d t d e l e t e f r o m a n d e s i r e d l i n e n u m b e r : s e r e m s i n l i n e s 5 0 0 3 0 a n 5 0 0 4 0 .

L i s t i n g 1 T h e T a s m a n i a n D a t a f i e r !

I 5 0 0 0 0 r e n - t h e t a s m a n i a n d a t a f i e r ! t r a n s a c t o r 9 - J 5 0 0 1 0 r e - m l t o d e l e t e l i n e 5 0 0 0 0 +N 5 0 0 2 0 p o k e 5 3 2 8 0 , 3 : p o k e 5 3 2 8 1 , l : p o k e 6 4 6 , 6 : d i m a $ ( 9 )K B 5 0 0 3 0 p r i n t " { c l r } { d o w n } ( d o w n ) ( r v s ) b a s i c l o a d e r f o r r a d a t aN 5 0 0 4 0 d a t a l 6 9 , 0 0 1 , 1 3 3 , 2 5 1 , 1 6 9 , 0 0 8 , 1 3 3 , 2 5 2 , 1 6 0 , 0 0 0N I 5 0 0 5 0 d a t a l 7 7 , 2 5 1 , 1 3 3 , 2 5 3 , 2 0 0 , 1 7 7 , 2 5 1 , 1 3 3 , 2 5 4 , 2 0 0D N 5 0 0 6 0 d a t a l 7 7 , 2 5 1 , 2 0 1 , 0 8 0 , 2 0 8 , 0 2 9 , 2 0 0 , 1 7 7 , 2 5 1 , 2 0 1 : r e m 0 8 l f o r l i n e 5 0 0 0 0B 5 0 0 7 0 d a t a l 9 5 , 2 0 8 , 0 2 2 , 1 3 6 , 1 3 6 , 1 6 9 , 0 0 0 , 1 4 5 , 2 5 1 , 1 3 6 : r e m 1 9 = h f o r l i n e 5 0 0 0 0I G 5 0 0 8 0 d a t a l 4 5 , 2 5 1 , 2 0 0 , 2 0 0 , 1 5 2 , 0 2 4 , 1 0 1 , 2 5 1 , 1 3 3 , 0 4 5D 5 0 0 9 0 d a t a l 6 5 , 2 5 2 , 1 3 3 , 0 4 6 , 0 9 6 , 1 6 6 , 2 5 3 , 1 3 4 , 2 5 1 , 1 6 6P P 5 0 1 0 0 d a t a 2 5 4 , 1 3 4 , 2 5 2 , 1 6 9 , 0 0 0 , 2 4 0 , 1 9 7A 5 0 1 1 0 c = 5 3 0 0 0 : f o r x = c t o c + 6 6 : r e a d y : d = d + y : r e m a n y w h e r e w h e r e r o o m f o 6 b y t e sI 5 0 1 2 0 p o k e x , y : n e x t : i f d < > 1 0 8 8 8 t h e n p r i n t " e r r o r ! " : e n dE H 5 0 1 3 0 p r i n t " { d o w n } ( e n t e r t o e x i t ) "M 5 0 1 4 0 i n p u t " { d o w n } { d o w n } b e g i n n i n g a d d r e s s " ; b a : i n p u t " { d o w n } e n d i n g a d d r e s s " ; e aN 5 0 1 5 0 i f b a = 0 o r e a = 0 t h e n e n d

1 T r a n s a c t o r

Page 13: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 13/84

C 5 0 1 6 0 i n p u t " { d o w n } f i r s t d a t a l i n e § " ; 1K F 5 0 1 7 0 i f e a - b a + l - 9 > 5 0 0 0 0 t h e n p r i n t " { d o w n } l i n e o v e r l a p w i t h t h i s p r o g ! " : g o t o 5 0 1 6 0H M 5 0 1 8 0 i f f t h e n 5 0 2 9 0A 5 0 1 9 0 f o r n = b a + a t o b a + 9 + a : a $ ( b ) = m i d $ ( s t r $ ( p e e k ( n ) ) , 2 )M 5 0 2 0 0 i f l e n ( a $ ( b ) ) = l t h e n a $ ( b ) = " " + a $ ( b )K N 5 0 2 1 0 i f l e n ( a $ ( b ) ) = 2 t h e n a $ ( b ) = " " + a $ ( b )F F 5 0 2 2 0 i f n = e a t h e n n = b a + 9 + a : n e x t : f = l : g o t o 5 0 2 4 0D I 5 0 2 3 0 b = b + l : n e x t : b = b - lI A 5 0 2 4 0 p r i n t " { c l r } { w h i t e } " m i d $ ( s t r $ ( l ) , 2 ) " d a t a " ; : f o r p = O t o b - l : p r i n t a $ ( p ) " , " ;K 5 0 2 5 0 n e x t : p r m t a $ ( p )I D 5 0 2 6 0 p r i n t " b a = " b a " : e a = " e a " : a = " a " : a = a + 1 0 : b = 0 : 1 = " 1 " : 1 = 1 + 1 0 : f = " f " : g o t o 5 0 1 8 0 "A 5 0 2 7 0 p r i n t " { d o w n } { d o w n } { d o w n } { b l u e } l i n e f " l " { w h i t e } "F 5 0 2 8 0 p o k e 6 3 1 , 1 9 : p o k e 6 3 2 , 1 3 : p o k e 6 3 3 , 1 3 : p o k e 6 3 4 , 3 1 : p o k e l 9 8 , 4 : e n dH 5 0 2 9 0 p r i n t " { c l r } " ; 1 ; " f o r x = " m i d $ ( s t r $ ( b a ) , 2 ) " t o " m i d $ ( s t r $ ( e a ) , 2 ) " : r e a d y : " ;F 5 0 3 0 0 p r i n t " p o k e x / y : n e x t " : p r i n t " s y s 5 3 0 0 0 "K 5 0 3 1 0 p r i n t " ( b l u e ) o k : d a t a e n t e r e d . . . { d o w n } { d o w n } { d o w n } { d o w n } { d o w n } { w h i t e } "D D 5 0 3 2 0 g o t o 5 0 2 8 0L i s t i n g 2 : d e l e t e r . s r c

5 2 5 3 5 4 5 5 5 6 l i n k5 7 5 8 5 9 6 0

I d $ f s t 4 r t

l d x $ £ ds t x $ £ bl d $ £ s t $ f I d f

; h b f m 2 5 ; h o f e a

; n x t l n k l b; s t o r e i t

h ; d i t t o

n G i a; = j m p s c a n

L a r r y R u t l e d g e , S a c r a m e n t o , C I m a g i n e h o t h L i l l i p u t i a n s f e l t . L e t ' s f a c e i t G u l l i v e r w a b i g u y . B r o b d i n g n a g i a n , y o m i g h t s a y .

N o w e ' r e n o g o i n g t t e l l y o u . Y o u ' l l h a v e t t y p e t h i s i n f o y o u r s e l f .

1 2 3 4 5 6 7 f t o 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 2 0 2 1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9 3 0 3 1 3 2 3 3 3 4 3 5 3 6 3 7 3 8 3 9 4 0 4 1 4 2 4 3 4 4 4 5 4 6 4 7 4 8 4 9 5 0 5 1

b l o c k d e l e t el i n e f o r m a t :

l i n e s > 5 0 0 0 0

[ l i n k ] [ l i n e i ] [ l i n e d a t a ] 0e n o p r o g : 0 [ e n d a d d r e s s ]

( l i n k

L i n e e q

o r

p o i n t s t o

5 0 0 0 0

5 3 0 0 0

A / t d e l e t e

/ s t a r t a d d r e s sn o t e : r e l o c a t a b l e a n y w h e r e

e n

s c a n b a s i c :s t a r t I d

s t I d s t

1 0 $ f # $ 0 8$ f

; s c a n l i n k a d d r e s s :s c a n l d y

I d s t i n I d s t

# ( $ f b ) , y

$ f

( $ f b ) , y$ f

/ s c a n l i n e n u m b e r !l i n e . n o . i n y

I d c o b n i n I d a n b n

/ t e r m i n a t i n gt e r m i n a t e d e y

d e I d s t d e s t

( $ f b ) , y# < l i n el i n k

( $ f b ) , y§ > l i n el i n k

: e r o s :

t ( $ f b ) , y

( $ f b ) , y/ m o v e e . a . p t r s t o b y t em o v e . e a i n

i n t y c l a d s t

$ f 4

; s y s

/ l i n k l b

/ l i n k h / i n d . a d d r .

/ i n i t . l o o p; l I n k l b/ s t o r e i t

• I I n k h b• s t o r e i t

n e x t b y t eI l n e l bl 5 0 0 0 0 ?n : n x t I n ky : n x t b y

h 5 0 0 0 0 ?n : n x t I n k

. y - 2

s t o r et h e r e .- b y

a g a i n .

a f t e r 0 0

+ b y t s

l b f r m 2 5 l b o f e

N r e m s c r e e n d i s p l a y l a r r y r u t l e d g eP r e t r a n s a c t o r 9 - J r e m a l l r i g h t s r e s e r v e dM p r i n t c h r $ ( 1 4 7 )F p r i n t t a b ( 1 1 ) ; c h r $ ( 1 5 4 ) ; c h r $ ( 1 7 ) ;

c h r $ ( 1 7 ) ; " w a t c h w h a t h a p p e n s "M f o r i = l t o 1 0 0 0 : n e x tK f o j = t 3 1 - . p o k e 5 3 2 7 0 , j : n e x tN g e a $ : i f a $ = " " t h e nD p o k e 5 3 2 7 0 , 2 0 0

V I D E O B Y T E t h f i r s t F U L L C O L O R !v i d e o d i g i t i z e r f o t h C - 6 4 , C - 1 2 8

I n t r o d u c i n g t h e w o r l d ' s f i r s t F U L L C O L O R l v i d e o d i g i t i z e r f o t h C o m m o d o r e C - 6 4 , C - 1 2 8 1 2 8 - D c o m p u t e r .

V I D E O B Y T E c a g i v e y o d i g i t i z e d v i d e o f r o m y o u r V . C . R . , B / o C O L O R C A M E R A o L I V E V I D E O ( t h a n k s t f a s t ! 2 . s e c . s c a n t i m e ) .F U L L C O L O R I Z I N G ! I p o s s i b l e , d u t u n i q u e S E L E C T a n I N S E R T c o l o r p r o c e s s ,w h e r e y o u c a n s e l e c t o n o 1 C O L O R S a n i n s e r t t h a t c o l o r i n t o o n o G R A YS C A L E S . T h i s p r o c e s s w i l l g i v e y o o v e r 3 2 , 0 0 0 d i f f e r e n t c o l o r c o m b i n a t i o n s t u s i y o u r v i d e o p i c t u r e s .S A V E S a K O A L A S ! V i d e o B y t e a l l o w s y o t s a v e a l y o u r p i c t u r e s t o d i s k a F U L LC O L O R K O A L A ' S . A f t e r w h i c h ( u s i n g K o a l a o r s u i t a b l e p r o g r a m ) y o u c a n g o i a n r e d r a w o r r e c o l o r y o u r V i d e o B y t e p i c ' s .L O A D a n d R E - D I S P L A Y ! V i d e o B y t e a l l o w s y o t o l o a d a n r e - d i s p l a y a l V i d e o B y t ep i c t u r e s f r o m i n s i d e V i d e o B y t e ' s m e n u .M E N U D R I V E N ! V i d e o B y t e c o m e s w i t h a n e a s y t u s m e n u d r i v e n U T I L I T Y D I S K a n dd i g i t i z e r p r o g r a m . *C O M P A C T ! V i d e o B y t e ' s h a r d w a r e i c o m p a c t ! I f a c t n b i g g e r t h a n y o u r a v e r a g ec a r t r i d g e ! V i d e o B y t e c o m e s w i t h i t o w c a b l e .I N T E G R A T E D ! V i d e o B y t e i d e s i g n e d t b e u s e d w i t h o r w i t h o u t E X P L O D E ! V 4 . 1 c o l o rc a r t r i d g e . E x p l o d e ! V 4 . 1 i t h p e r f e c t c o m p a n i o n .F R E E ! V i d e o B y t e u s e r s a r e a u t o m a t i c a l l y s e n t F R E E S O F T W A R E u p d a t e s a l o n g w i t hn e d o c u m e n t a t i o n , w h e n i b e c o m e s a v a i l a b l e .P R I N T ! V i d e o B y t e w i l l p r i n t o u t p i c t u r e s t o m o s t p r i n t e r s . H o w e v e r w h e n u s e d w i t hE x p l o d e ! V 4 . i y o u r p r i n t o u t ' s c a n b e d o n e i F U L L C O L O R o t h R A I N B O W N X - 1 0 0 0 ,R A I N B O W N X - 1 0 0 0 C J X - 8 0 a n d t h O K I D A T A 1 2 0

W h D R A W c a r , a i r p l a n e , p e r s o n o r f o r t h a t m a t t e r .a n y t h i n g w h e n y o c a B Y T E i t . . . l U n C H D V T C * 7 O V i d e o B y t e i t i n s t e a d . V l U t U D l T C $ 7 9 . 9 3

S U P E R E X P L O D E ! V 4 . 1 w / C O L O R D U M PI y o u r l o o k i n g f o C A R T R I D G E w h i c h c a C A P T U R E A N S C R E E N , P R I N T S A L H I - R E S a n T E X T S C R E E N S i F U L L C O L O R t t h R A I N B O W N X - 1 0 0 0 , R A I N B O WN X - 1 0 0 0 C E P S O N J X - 8 0 a n t h O K I D A T A 1 o 2 0 . P r i n t s i 1 g r a y s c a l e t a l o t h e r p r i n t e r s . C o m e s w i t h t h e w o r l d ' s F A S T E S T S A V E a n L O A D r o u t i n e s i c a

t r i d g e o d u a l S E Q . , P R G . f i l e r e a d e r . P l u s a b u i l t - i n S E C O N D f o r m a t a n M U C H , M U C H M O R E ! T h a n E x p l o d e ! V 4 . 1 i f o y o u .

P R I C E ? $ 4 4 . 9 5 S / o $ 4 9 . 9 5 w / o p t i o n a l d i s a b l e s w i t c h .

i 6 m o d e o n l y V I D E O B Y T E o n l y $ 7 9 . 9 5S U P E R E X P L O D E ! V 4 . 1 $ 4 4 . 9 5

T O R D E R C A L L 1 - 3 1 2 - 8 5 1 - 6 6 6 7 P L U S $ 1 . 5 0 S / C . O . D . ' S A D $ 4 . 0 0P e r s o n a l C h e c k s 1 0 D a y s t C l e a r I R E S I D E N T S A D 6 S A L E S T A

T H S O F T G R O U P , P . O . B O 1 1 1 , M O N T G O M E R Y , I 6 0 5 3 8

9 I s s u e 1

Page 14: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 14/84

T h M C o l u m n

B i n u m b e r s

b T o d d H e i m a r c k

T h i s i n s t a l m e n t o T h M C o l u m n s t a r t e d w i t h o n l a r g e i d e at h a t g r a d u a l l y d e v e l o p e d i n t o s e r i e s o f s m a l l e r i d e a s . I fh i g h - l e v e l l a n g u a g e i l i k e p i l e o b r i c k s f r o m w h i c h y o ub u i l d h o u s e , t h e n m a c h i n e l a n g u a g e i l i k e p i l e o c l a yf r o m w h i c h y o u m a k e t h e b r i c k s t b u i l d a h o u s e . I t u r n e d o u tt h a t n e e d e d s o m e b r i c k s .

T h i d e a b e h i n d t h o r i g i n a l p r o g r a m , w h i c h r e m a i n s i t h p l a n n i n g s t a g e , w a t b u i l d a e n o r m o u s l o o k - u p t a b l e w i t h i nt h 1 7 5 0 R A e x p a n s i o n u n i t . T h a t ' s 5 1 k i l o b y t e s ( o r , i t h p r o g r a m h a i m i n d , m e g a b i t s ) . W i t h t w b y t e s , y o c a c o u n t u t 6 5 , 5 3 5 , w h i c h i n o t n e a r l y h i g h e n o u g h . T h p r o g r a m n e e d s s e v e r a l b y t e s t c o u n t u t f o u r m i l l i o n .

H a n d l i n g m u l t i - b y t e n u m b e r s i s n ' t s d i f f i c u l t , b u t h e r e a r et w p r o b l e m s : i n p u t a n o u t p u t . T h p r o g r a m n e e d s r o u t i n et h a t a c c e p t s b i g n u m b e r s a n t u r n s t h e m i n t o b i n a r y v a l u e s i m e m o r y . P l u s , w h e n t h p r o g r a m i f i n i s h e d d o i n g w h a t i d o e s , i n e e d s a r o u t i n e t c o n v e r t t h o n e s a n z e r o s i n t op r i n t a b l e A S C I I n u m b e r s .

T h a t t o p i c i e n o u g h f o c o l u m n . W e ' l l h a v e t d i s c u s s t h eR A e x p a n d e r i s o m e f u t u r e c o l u m n .

I y o e x a m i n e t h b e g i n n i n g o P r o g r a m 1 y o u ' l l s e e t h e e ss e n t i a l s t r u c t u r e o t h p r o g r a m . I d o e s f i v e t h i n g s :

1 G e s t r i n g f r o m t h u s e r .2 C o n v e r t i t b i ( s i x - b y t e ) b i n a r y v a l u e .3 D s o m e t h i n g w i t h t h n u m b e r .4 C o n v e r t i b a c k t d e c i m a l .5 P r i n t t h e r e s u l t s .

A v a r i o u s s p o t s a l o n g t h w a y , t h p r o g r a m p r i n t s a p p r o p r i a t ep r o m p t s . I a l s o c h e c k s f o a z e r o v a l u e ( t h e s i g n a l t o e x i t t h p r o g r a m ) a n f o n u m b e r t h a t ' s t o b i g .

T e a r i n g a p a r t a A S C I I n u m b e r

d e c i d e d , f o v a r i o u s r e a s o n s , t u s e a s i x - b y t e v a l u e a n t s t o r e t h l o b y t e f i r s t . T h b i n a r y n u m b e r i s t o r e d i s e t i o n o m e m o r y I ' v e n a m e d B I G S I X . I c a n h o l d n u m b e r s i t h r a n g e 0 - 2 8 1 , 4 7 4 , 9 7 6 , 7 1 0 , 6 5 5 ( h e x a d e c i m a l $ f f f f f f f f f f f f ) .

T h u s e r t y p e s o t h k e y b o a r d , w h i c h m e a n s t h i n c o m i n gc h a r a c t e r s a r A S C I I v a l u e s . I h o s h t y p e s 9 1 0 , w e ' l lr e c e i v e 5 7 4 9 a n 4 8 b e c a u s e t h o s e a r e t h e A S C I I c o d e s f o t h c h a r a c t e r s ' 9 4 1 a n ' 0 ' .

T h p r o g r a m a c c e p t s c o m m a s b e c a u s e i f i l t e r s o u a n c h a r a ct e r s o u t s i d e t h r a n g e o A S C I I n u m b e r s ( 4 8 - 5 7 ) . I t h u s e rt y p e s 1 3 t u r t l e 5 6 , t h p r o g r a m s t o r e s t h e c h a r a c t e r s ' 1 3 5 6 ' i m e m o r y . T h e m e m o r y b u f f e r f o r t h e f i l t e r e d c h a r a c t e r s i c a l l e d m e m b u f .

W m u s t d e a l w i t h t w s p e c i a l c h a r a c t e r s t h a t m i g h t c o m ea l o n g . A A S C I I 1 3 i c a r r i a g e r e t u r n c h a r a c t e r , w h i c h m e a n st h u s e r p r e s s e d R e t u r n a n i d o n e . T h l o o p e n d s w h e n i s e e s 1 3 I a d d i t i o n , p e r i o d c a a l s o m a r k t h e n o i n p u t .F o e x a m p l e , i t h u s e r t y p e s 1 5 6 . 2 7 , w t a k e t h a t t o m e a n1 5 a n n o 1 5 , 2 6 7 .

T h f i r s t b i b r i c k , t h e n , i t h G S T R I N G s u b r o u t i n e . I r e p e a te d l y c a l l s t h K e r n a l r o u t i n e C H R E S f ( w h i c h i p r e f e r a b l e i t h i sc a s e t G E T I N ) . I f i l t e r s o u a l t h A S C I I n u m b e r s a n s t o r e st h e m i M E M B U F .

N e x t , w c a l l M A K E B I N , w h i c h c o n v e r t s t h A S C I I n u m b e r s i n t os i x - b y t e i n t e g e r . T h p r o c e s s i r e l a t i v e l y s i m p l e :

1 S t a r t w i t h i B I G S I X .2 M u l t i p l y B I G S I X b 1 0 ( b e c a u s e w e ' r e i b a s e t e n ) .3 G e a A S C I I n u m b e r a n s u b t r a c t 4 8 t m a k e t h c h a r

a c t e r ' 2 i n t o t h v a l u e $ 0 ( o w h a t e v e r ) .4 A d t h a t n u m b e r t B I G S I X .5 I t h e r e a r e m o r e c h a r a c t e r s i m e m b u f , g b a c k t o s t e p 2

S a t h u s e r t y p e s 5 9 9 3 . S t a r t a t h l e f t . Z e r o t i m e s t e i 0 A d t h f i r s t n u m b e r ( 5 ) . F i v e t i m e s t e i 5 a n a d 9 w h i c hi 5 9 T i m e s 1 ( 5 9 0 ) , p l u s ( 5 9 9 ) , t i m e s t e n ( 5 9 9 0 ) , a n a d 3 ( 5 9 9 3 ) . I s e e m s k i n d o s i l l y t s t a r t w i t h 5 9 9 3 a n d e n d w i t hi t b u t h a t ' s b e c a u s e t h e x a m p l e m a t h i i d e c i m a l . I n s i d et h c o m p u t e r , i t ' s a l o n e s a n z e r o s : 1 0 ( 5 b e c o m e s 1 1 0 0 1 0( 5 0 ) , 1 1 1 0 1 1 ( 5 9 ) , a n s o n

g e n e r a l r o u t i n e f o m u l t i p l y i n g i s n ' t n e c e s s a r y , b e c a u s e t h o n l y m u l t i p l i c a t i o n i t h p r o g r a m i n v o l v e s t h n u m b e r t e n . I f

T r a n s a c t o r

Page 15: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 15/84

y o s h i f t b i n a r y n u m b e r t t h l e f t , i t ' s t h s a m e a m u l t i p l yi n b t w o . S h i f t i n g t h r e e t i m e s i e q u i v a l e n t t m u l t i p l y i n g b e i g h t . I i t h n u m b e r , w w a n t 1 0 * x . T h a t ' s t h e s a m e a ( 2 * J t ) ( 8 * x ) . T m u l t i p l y b t e n , s h i f t l e f t a n t e m p o r a r i l ys a v e i ( t i m e s t w o ) . S h i f t l e f t t w i c e m o r e ( t i m e s e i g h t ) a n d a d dt h t e m p o r a r y v a l u e .

T h B I G X 1 0 r o u t i n e m u l t i p l i e s B I G S I X b t e a p a r t o t h M A K E B I N r o u t i n e . T h R O T S i x s u b r o u t i n e r o t a t e s a l s i b y t e so n b i t t h l e f t , a n t h D U P S i x s u b r o u t i n e c o p i e s t h B I G S I Xn u m b e r t B I G 2 . T h e s e r o u t i n e s a l s o h a v e t c h e c k f o a o v e rf l o w c o n d i t i o n , w h i c h h a p p e n s w h e n t h u s e r t y p e s i n u b e r b i g g e r t h a n 2 8 t r i l l i o n .

D s o m e t h i n g i n t e r e s t i n g

T h f i r s t v e r s i o n o t h i s p r o g r a m c o n v e r t e d t h A S C I I n u m b e r st b i n a r y a n t h e n b a c k t A S C I I , w h i c h i r a t h e r p o i n t l e s s e e r c i s e . Y o t y p e i n u m b e r a n t h e n i t e l l s y o t h n u m b e ry o j u s t t y p e d . S w h a t ?

S i n c e w e ' v e g o n e t a l t h i s t r o u b l e , w s h o u l d d s o m e t h i n g .P r o g r a m o n t a k e s t h e b i n a r y n u m b e r a n p r i n t s i a s e r i e so f o n e s a n z e r o s . I h a p p e n s i t h P R O C E S S r o u t i n e , w h i c hs h o u l d b e a s y t f o l l o w .

s e c o n d v e r s i o n o P R O C E S S c a l c u l a t e s t h e s q u a r e r o o t o t h B I G S I X n u m b e r . M o r e a b o u t t h a t i n m o m e n t .

C o n v e r t i n g b a c k t A S C I I

A f t e r p r o c e s s i n g t h b i n a r y v a l u e i P R O C E S S , w n e e d t h r o u t i n e t h a t c o n v e r t s b a c k t p r i n t a b l e b a s e - t e n n u m b e r s . S i n c ew m u l t i p l i e d b t e i t h e o t h e r r o u t i n e , i t ' s g o o d b e t h a tw n e e d t d i v i d e b t e i t h m a k e d e c r o u t i n e . S i n c e w s t a r t e d a t h l e f t b e f o r e , w p r o b a b l y n e e d t s t a r t a t t h r i g h t .

T a k e s h o r t n u m b e r , l i k e d e c i m a l 5 ( b i n a r y 1 1 1 0 0 1 ) . L e t ' ss e e , 1 1 1 0 0 1 d i v i d e d b 1 0 1 0 i a b o u t 1 0 w i t h r e m a i n d e r o 1 1 1 . I n d e c i m a l , t h a t m e a n s 5 d i v i d e d b 1 i w i t h a r m a i n d e r o 7 T h v a l u e c a n b e a d d e d t 4 t g e 5 5 w h i c hi t h A S C I I c h a r a c t e r ' 7 ' .

T h m a k e d e c r o u t i n e b u i l d s u d e c i m a l ( A S C I I ) n u m b e r b f o l l o w i n g t h e s e s t e p s :

1 D i v i d e b 1 0 2 A d 4 t t h r e m a i n d e r t g e a A S C I I n u m b e r .3 R e p e a t u n t i l t h r e s u l t i ( w i t h r e m a i n d e r o 0 - 9 ) .

p r e v i o u s c o l u m n d i s c u s s e d b i n a r y d i v i s i o n ; w o n ' t r e p e a tm y s e l f h e r e . S e T h M C o l u m n i V o l u m e 9 I s s u e o T r a n s a c t o r i y o u ' r e i n t e r e s t e d i t h d e t a i l s o b i n a r y d i v i s i o n .

A i m p o r t a n t t h i n g t r e m e m b e r i t h a t s h i f t i n g i r a d i x -d e p e n d e n t ( i t h a t ' s a w o r d ) , w h e r e a s b o t h d i v i s i o n a n m u l t ip l i c a t i o n a r r a d i x - i n d e p e n d e n t . T h d e c i m a l ( b a s e - t e n )n u m b e r 5 7 s h i f t e d t t h l e f t i 5 7 8 0 . T h b i n a r y ( b a s e - t w o )

n u m b e r 1 0 s h i f t e d l e f t i 1 0 1 0 . I b a s e t e n , s h i f t i n g l e f t i t h s a m e a m u l t i p l y i n g b 1 0 I b a s e t w o , s h i f t i n g l e f t i t h s a m e a m u l t i p l y i n g b 2

T f i n d o u t h a t t h r i g h t m o s t d i g i t o 9 1 i 4 w m u s t a c t u a ll d i v i d e b 1 0 ( a n d g e t t h e r e m a i n d e r o 4 ) W c a n n o t s h i f tr i g h t , b e c a u s e t h n u m b e r i s t o r e d a b i n a r y q u a n t i t y . S h i f ti n a b i n a r y r i g h t i e q u i v a l e n t t d i v i d i n g b 2 n o d i v i d i n gb 1 0

C a l c u l a t i n g b i s q u a r e r o o t s

P r o g r a m i c o d e f r a g m e n t t h a t c o n t a i n s a n e P R O C E S Sr o u t i n e . I t l i n e s r e p l a c e t h l i n e s f r o m P r o g r a m 1 t h f i r s tp a r t i i d e n t i c a l .

T h i s n e P R O C E S S r o u t i n e f i n d s t h e b i n a r y s q u a r e r o o t o b i s i x - b y t e n u m b e r , r o u n d e d d o w n t t h n e a r e s t i n t e g e r . I w i l ls a t h a t t h s q u a r e r o o t o 2 i 5 b u i a l s o s a y s t h a t t h s q u a r e r o o t o 3 i 5

S o u n d s c o m p l i c a t e d , d o e s n ' t i t I t ' s n o t . I y o u ' r e c u r i o u sa b o u t h o i w o r k s , r e a d o n

L e t ' s b e g i n w i t h a h i g h - s c h o o l m a t h r e f r e s h e r a n t a k e as q u a r e r o o t e n t i r e l y i n b a s e t e n . T h s q u a r e r o o t o 6 5 , 5 3 6 i 2 5 6 . T h p r o c e s s i d e s c r i b e d b e l o w a n c o r r e s p o n d s t t h r e p r e s e n t a t i o n i n c l u d e d a F i g u r e 1

) 5 5 2 3 3

3

3 3

( 0 + 2 ) * 2( 4 0 + 5 ) * 5( 5 0 0 + 6 ) * 6

F i g u r e 1 F i n d i n g t h s q u a r e r o o t o f 6 5 , 5 3 6

F i r s t , m a r k o f e v e r y t w d i g i t s s t a r t i n g a t h d e c i m a l p o i n t :6 / 5 5 / 3 6 . S t a r t w i t h a p a r t i a l a n s w e r o b e c a u s e w h a v e n ' tb e g u n . M u l t i p l y b y 2 0 t g e ( c a l l t h i s t h w e i r d n u m b e r ) .L o o k a t h f i r s t n u m b e r f r o m t h l e f t . I t ' s ( t h e f i r s tc l u m p f r o m 6 / 5 5 / 3 6 ) . W r i t e d o w n a p a r t i a l a n s w e r , b c a u s e ( p l u s w e i r d ) t i m e s i 4 w h i c h f i t s i n t o 6 S u b t r a c tf r o m ( 2 a n d a p p e n d t h n e x t t w o n u m b e r s ( 5 5 ) . N o w e ' v e g o t 2 5 5 .

T h n e w e i r d n u m b e r i t h p a r t i a l a n s w e r ( 2 t i m e s 2 0 w h i c h i 4 0 W n e e d n u m b e r x w h e r e ( 4 0 + x ) * x f i t s i n t o2 5 5 . F i v e w i l l d o b e c a u s e 4 5 * 5 i 2 2 5 a n d 4 6 * 6 i 2 7 ( t o ob i g ) . T h n e p a r t i a l a n s w e r i 2 5 , t h e n e w e i r d n u m b e r i 5 0 0 , a n t h n e t a r g e t i 3 0 3 6 . T h f i n a l d i g i t i n t h a n s w e r i 6 b e c a u s e 5 0 6 * 6 i 3 0 3 6 , w h i c h e x a c t l y e q u a l s 3 0 3 6 .

9 I s s u e 1

Page 16: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 16/84

W n e e d t o t r a n s l a t em u l ai t

I

" f o f i g u r i n g o u tt i m e s t w o , t h e n

b a s e t w o , w n e e d

t h a t t o b a s e t w o . A i t u r n s o u t , t h f o r -t h w e i r d n u m b e r i n o " t i m e s t w e n t y , "

s h i f t l e f t " . R e m e m b e r t h d i f f e r e n c e ?

t m u l t i p l y b i n s t e a d o 2 0 N p r o b -l e m . J u s t s h i f t l e f t t w i c e .

W h a t a b o u t g u e s s i n gt w c h o i c e s : z e r o o r1 1 0 1 0 0 . I t h a n s w e r

w h i c h n u m b e r i n e x t ? W e l l , t h e r e ' s o n l yo n e . S l e t ' s s a t h w e i r d n u m b e r i

i o n e , t h e n w s u b t r a c t 1 1 0 1 0 1 ( b e c a u s eo t h r u l e t a d t h d i g i t t o t h w e i r d n u m b e r ) .

I w o r k s o u t v e r y n i c e l y i n b i n a r y . S h i f t t h p a r t i a l a n s w e rt w i c e t t h l e f t a n b e l o w , t h n e x t d i g i t

z e r c

T h a t ' *i t s

>

t h e n o t h i s

a d o n e . I t h a t f i t s i n t o t h n u m b e ri t h p a r t i a l a n s w e r i 1 O t h e r w i s e , i t ' s

c o l u m n a b o u t b i s i x - b y t e n u m b e r s , b u g o o d s t a r t o a n o t h e r p r o g r a m t h a t w i l l d m o r e w i t h b i

n u m b e r s . W e ' v e g o t a f e b r i c k s n o w .

L i s t i n g l i B I G L S R CD P I K D N F C L C P L G D G J B F C O M E L N H J P O O I P M K 0 K C C H C H F L D F

1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 2 0 2 1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9 3 0 3 1 3 2 3 3 3 4 3 5 3 6 3 7 3 8 3 9 4 0 4 1 4 2 4 3 4 4 4 5 4 6 4 7 4 8 4 9 5 0 5 1 5 2 5 3

r e m s a v e " b i g l . s r c " ,s y s 7 0 0* = 4 9 1 5 2. o p t o z $ f t e m p § f t e m p 2 $ f c o u n t e r = $ f fe r r f l a g = $ 0 2c h r i n = $ f f c fc h r o u t = $ f f d 2

t h i s i t h m a i nm a i n I d f

s t e r r f l a gj s p m s g lj s g s t r i n gj s m a k e b i nb c e r r o rj s p m s g 2j s p r o c e s sj s m a k e d e cj s p m s g 3j m m a i n

e r r o r b n r e a l e r rr t

r e a l e r r j s p e m s gj m m a i n

g e n e r i c l o o p f o rm s g o u t

s t a z as t z a + 1l d #

m s g l p I d ( z a ) , yb e m s g e xj s c h r o u ti n b n e m s g l p

m s g e x r t sp m s g l

I d a f < m s g ll d § > m s g lj m m s g o u t

m s g l . a s c " e n t e r. b y t e 1 3 , 0

f r e e z e r o - p a g e l o c a t i o n

l o o p

n e r r o r s ( y e t )p r i n t m e s s a g eg e s t r i n g f r o m u s e rm a k e i b i n a r y n u m b e rt h e n u m b e r w a s t o o b i gp r i n t m e s s a g ed s o m e t h i n g t t h e n u m b e rm a k e t h e b i n a r y v a l u e i n t o a n a s c i i s t r i n gp r i n t m e s s a g el o o p f o r e v e ri n o e q u a l , a r e a l e r r o r o c c u r r e de l s e , i t w a z e r o e n t r yp r i n t e r r o r m e s s a g e " t o o b i g "a n g b a c kp r i n t i n g a m e s s a g e .

n

s t o r e t h e a d d r e s sb e g i n a t h e b e g i n n i n gg e t h c h a r a c t e re x i t i z e r oe l s e p r i n t i

c o n t i n u e l o o pe n o m s g o u t

t h e a d d r e s si m p l i e d r t a t h e e n d

n b e r ( c o m m a s o k ) .e n o p m s g l

A F H B 1 F O I N P G O B P O J D C F B P K J J P P D K L B G N H A P G E K F D K G G B H O A O G K G P B P M M L F M P A N J E D B B L K G M N E J M E

5 4 5 5 5 6 5 7 5 8 5 9 6 0 6 1 6 2 6 3 6 4 6 5 6 6 6 7 6 8 6 9 7 0 7 1 7 2 7 3 7 4 7 5 7 6 7 7 7 8 7 9 8 0 8 1 8 2 8 3 8 4 8 5 8 6 8 7 8 8 8 9 9 0 9 1 9 2 9 3 9 4 9 5 9 6 9 7 9 8 9 9 1 0 0 01 0 1 01 0 2 01 0 3 01 0 4 01 0 5 01 0 6 01 0 7 01 0 8 01 0 9 01 1 0 01 1 1 01 1 2 01 1 3 01 1 4 01 1 5 01 1 6 01 1 7 01 1 8 01 1 9 01 2 0 01 2 1 01 2 2 01 2 3 01 2 4 01 2 5 01 2 6 01 2 7 01 2 8 01 2 9 0

p m s g 2

m s g 2

p m s g 3

m s g 3

p e m s g

e r n n s g

t h

I d a # < m s g 2l d j f > m s g 2j m m s g o u t. b y t e 1 . a s c " c a l c u l a t i n g ,. b y t e 1 3 , 0

I d a f < m s g 3l d x # > m s g 3j s m s g o u tI d f < m e m b u fl d | > m e m b u fj s m s g o u tI d # 1 j s r c h r o u tj s r c h r o u tr t

e n d o f p m s g 2

p r i n t , b u t t h e n

p r i n t t h b u f f e r , t o

. b y t e 1 3. a s c " t h e a n s w e r i . b y t e 3 2 , 0

I d # < e r r m s gl d # > e r r m s g

. b y t e l 3. a s c " * * n u m b e r i . b y t e 1 3

e n o f p m s g 3

t o b i *

. a s c " m a x i m u m i 2 8 1 , 4 7 4 , 9 7 6 , 7 1 0 , 6 5 5 .. b y t e 1 3 , 0 e n o p e m s g

g s t r i n g r o u t i n e g e t s a s t r i n g a n d p u t s i i m e m b u fc h r i n s e n d s a 1 t o i n d i c a t e t h e e n d , b u t w e m a k e i z e r o

g s t r i n c

g s t l p

i s t e x

c h k n u m

c h k e r rc h k e x

l d H j s r c h r i nc m p f l 3b e q g s t e xc m | 4 b e g s t e xj s c h k n u mb c s g s t l ps t a m e m b u f , yi n b n e g s t l pI d 1 s t a m e m b u f , yr t c m f 5 b c s c h k e xc m 1 4 b c c c h k e r rc l r t s e r t

i 1 3 w e ' r e d o n e

s p e c i a l c a s e o f p e r i o d ( 5 3 . 1 5 , f o r e x a m p l e )

b e t t e r m a k e s u r e i t ' s a n u m b e rc a r r y s e m e a n s n o t - a - n u m b e ri i t i s a n u m b e r , s t o r e i t

b r a n c h a l w a y s

s t o r e a z e r os t o r e t h e l e n g t h a n e x i t5 7 i s a s c i ii f c a r r y s e t , i t ' s > " 9 " , s o e x i t w / c a r r y s e 4 8 i s a s c i ii c a r r y d r i t ' s s m a l l e r t h a n " 0

c l e a r c a r r y o s e = n o ke n o g s t r i n g

m a k e b i n m a k e s t h e a s c i i n u m b e r s i m e m b u fi n t o 6 - b y t e ( 4 8 - b i t )

m a k e b i n =

m a k l p

j s c l r b i gl d 1 I d a m e m b u f , yb e q m a k e n ds t a t e m p 2j s b i g x l OI d e r r f l a gb n a b o r tI d a t e m p 2s e s b # 4 c l a d b i g s i xs t b i g s i xb c m a k 2i n b i g s i x + 1b n m a k 2i n b i g s i x + 2b n m a k 2

n u m b e r b y r e p e a t e d l y m u l t i p l y i n g b y 1 0

c l e a r o u t h b i g n u m b e rs t a r t a t h e b e g i n n i n gg e t a n a s c i i c h a r a c t e r ( 4 8 - 5 7 )i z e r o , e n o b u f f e re l s e s t a s h i a n d m u l t i p l y b i g s i x b y 1

i e r r o r , t h e n q u i te l s e g e t h e d i g i t b a c k

m a k e i t 0 - 9

s k i p a h e a d i n c a r r y

e l s e h a n d l e t h h i g h e r b y t e s

T r a n s a c t o r

Page 17: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 17/84

E I M M E A M L G J F J K H L E K I D D O O M K I E O J O N G P L B P K L E G K D J N L J H I G F T i i

D A F D I M L C P M J G E C F P J J I O B L L B L F F B

1 3 0 01 3 1 01 3 2 01 3 3 01 3 4 01 3 5 01 3 6 0 a b o r t1 3 7 01 3 8 01 3 9 0 m a k 21 4 0 01 4 1 0 m a k e n d1 4 2 01 4 3 01 4 4 01 4 5 0 m a k e x1 4 6 01 4 7 0 c l r b i g1 4 8 01 4 9 0 c l r l p1 5 0 01 5 1 01 5 2 01 5 3 0 b i g x l O1 5 4 01 5 5 01 5 6 01 5 7 01 5 8 01 5 9 01 6 0 01 6 1 0 b i g x l p1 6 2 01 6 3 01 6 4 01 6 5 01 6 6 01 6 7 01 6 8 01 6 9 0 n o f l o w1 7 0 0 r o t s i x1 7 1 0 r o t 2 s i x1 7 2 01 7 3 01 7 4 01 7 5 01 7 6 01 7 7 01 7 f l f l f t l r• L / O v U f 1 7 9 0 d u p s i x1 8 0 0 d u p l p1 8 1 01 8 2 01 8 3 01 8 4 01 8 5 0 b i g o r1 8 6 01 8 7 01 8 8 01 8 9 01 9 0 01 9 1 0

i n c b i g s i x + 3b n m a k 2i n b i g s i x + 4b n m a k 2i n b i g s i x + 5b n m a k 2i n s e r t i n b n e m a k l pj s b i g o rb n e m a k e xs e r t c l r t l d 1 I d f s t b i g s i x , xd e b p c l r l pr t j s r o t s i xj s d u p s i xj s r o t s i xj s r o t s i xI d 1 s t a t e m pl d # c l I d b i g 2 , xa d c b i g s i x ,s t a b i g s i x , xi n d e t e m pb n e b i g x l pb c c n o f l o wi n e r r f l a gr t a s b i g s i xr o b i g s i x + 1r o l b i g s i x + 2r o b i g s i x + 3r o l b i g s i x + 4r o b i g s i x + 5b c o i n e r r f l a g

U l d # I d b i g s i x , xs t b i g 2 , xd e b p l d u p l pr t I d b i g s i x + 0o r b i g s i x + 1o r b i g s i x + 2o r a b i g s i x + 3o r b i g s i x + 4o r a b i g s i x + 5r t

1 9 2 0 m a k e d e c t u r n s t h e1 9 3 0 a s e r i e s o f a s c i i1 9 4 0 m a k e d e c1 9 5 01 9 6 01 9 7 0 m d l p l1 9 8 01 9 9 02 0 0 02 0 1 0 m d l p 22 0 2 02 0 3 02 0 4 02 0 5 02 0 6 0

I d # p h l d x § 4 8s t c o u n t e rI d f s t a t e m pj s r o t s i xr o l t e m pI d a t e m pc m p § 1 0b c c m d c o o ls b c # 1 0

c l e a r f l a g a n d f l a g t o m a r k a n e r r o r

b r a n c h a l w a y ss e e i f i t ' s z e r o s

c a r r y s e = e r r o r / e x i t

c l e a r c a r r y m e a n s a l i w e l l

c l e a r a l l s i b y t e sc o u n t b a c k

r o t a t e b i g s i x t t h l e f t ( t i m e s 2 c o p y i t b i g 2

d o a l l s i x b y t e ss t a r t i n g w i t h b y t e

a d d 2 xt o 8 xw h i c h e q u a l s l O x

a d a l l s i x b y t e si c c n o o v e r f l o we l s e s e e r r o r f l a gr e t u r n f r o m b i g x l O

r o t a t e b i g s i x o n e b i t l e f t

i c c n o o v e r f l o ws e e r r o r f l a g

c o p y b i g s i x t o b i g 2

e n d o f m a k e b i nb i n a r y v a l u e i n t on u m b e r s i n m e m b u f

s t a r t w i t h 0 w h i c h m e a n s " e n d "

4 b i t s

g e t a b i a n d m o v e i i n t o t e m p

i t e m p < 1 i t ' s c o o l , c l o n ' t w o r r ye l s e s u b t r a c t 1 ( c a r r y i s a l r e a d y s e t )

D L B I J H P J H H F P J J H K E J D L H I D I F O I P A O M P L P L K K D C I L G O J E

2 0 7 02 0 8 02 0 9 02 1 0 02 1 1 02 1 2 02 1 3 02 1 4 02 1 5 02 1 6 02 1 7 02 1 8 02 1 9 02 2 0 02 2 1 02 2 2 02 2 3 02 2 4 02 2 5 02 2 6 02 2 7 02 2 8 02 2 9 02 3 0 02 3 1 02 3 2 02 3 3 02 3 4 02 3 5 02 3 6 02 3 7 02 3 8 02 3 9 02 4 0 02 4 1 02 4 2 02 4 3 02 4 4 02 4 5 02 4 6 02 4 7 02 4 8 02 4 9 02 5 0 02 5 1 0

s t a t e m pm d c o o l p h

l s b i g s i xp i r o b i g s i xd e c c o u n t e rb n e m d l p 2I d t e m po r # 4 p h j s b i g o rb n e m d l p lI d #

m d l p 3 p l as t m e m b u f , yb e m d e xi n b n m d l p 3

m d e x r t p r o c e s s p r i n t s t h

p r o c e s s I d a # < b i n m s gl d # > b i n m s gj s m s g o u tI d #

p r o c l p l l d x # s t x c o u n t e rI d b i g s i x , ys t a t e m p

P r o c l p 2 I d a # 4 r o l t e m pb c s e n d i ta d c # 0

s e n d i t j s c h r o u td e c c o u n t e rb n e p r o c l p 2I d # 1 j s c h r o u td e b p p r o c l p lr t

b i n m s g . a s c " b i n a r y. b y t e 1 3 , 0

b i g s i x = $ c 4 0 0b i g 2 = $ c 4 0 6m e m b u f = $ c 4 0 c

L i s t i n g 2 B I G 2 . S R C2 2 5 0

s t o r e i ( c a r r y i s t i l l s e t )

p u t t h e b i t b a c k i n t o b i g s i x

m a k e i a s c i ia n d p u s h i i s i t z e r o y e n o i i s n ' t , g b a c k .

g e c h a r a c t e r

i 0 w e ' r e d o n ee l s e i n c r e m e n t ya n d b r a n c h a l w a y se n o m a k e d e c

I a n 0 o f t h e b i n a r y n u m b e r

s i b y t e se i g h t b i t s

a s c i i z e r o

i z e r o , p r i n t " 0 e l s e a d d ( p l u s s e c a r r y )

n e x t l i n e

c o n t i n u e o u t e r l o o p

( h i g h b y t e t o l o w ) :e n o p r o c e s st h * b i g 4 8 - b i t ( 6 - b y t e ) n u m b e ra n o t h e r b i n u m b e rm e m o r y b u f f e r

T c r e a t e t h i s p r o g r a m , u s l i n e s 1 O O -o B I G L S R C a n a d t h f o l l o w i n g l i n e s f o t h n e

P R O C E S S r o u t i n e .

J B K A A C L F L F I D H I O K K A J D H I N J H C

2 2 6 02 2 7 02 2 8 02 2 9 02 3 0 02 3 1 02 3 2 02 3 3 02 3 4 02 3 5 02 3 6 02 3 7 02 3 8 02 3 9 02 4 0 02 4 1 02 4 2 02 4 3 02 4 4 02 4 5 02 4 6 02 4 7 02 4 8 02 4 9 02 5 0 02 5 1 0

p r o c e s s f i n d s t h s q u a r e r o o t .b i g 4 . b y t e 0 , 0 , 0 , 0b i g 3 . b y t e 0 , 0 , 0 , 0p r o c e s s =

l d # p r o c l p l I d b i g s i x , x

s t b i g 4 , xI d # s t b i g 3 , xd e b p l p r o c l p lj s c l r b i gI d # 2 s t a c o u n t e r

p m a i n =j s d u p s i xc l j s r r o t 2s e j s r o t 2j s r o t 4 3j s c o m p 3 2p h r o b i g s i xj s r o t 2 s i xp i

, 0 , 0, 0 , 0

f i r s t c o p y b i g s i x t o b i g 4 a n d c l e a r b i g 3

c l e a r o u b i g s i x f o t h a n s w e r

r e p e a t t h e l o o p 2 t i m e s ( f o r 4 8 b i t s )m a i n l o o p f o r p r o c e s sc o p y b i g s i x t b i g 2

r o t a t e b i g 2

r o t a t e a g a i n p l u sr o t a t e b i g 4 i n t o b i g 3 t w i c ec o m p a r e b i g 3 t o b i g 2s a v e t h e p r o c e s s o r s t a t u s

p u t h b i t i n t o b i g s i x

9 I s s u e 1

Page 18: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 18/84

C J A G F B A J I H N C E E L 6 E N 1 C M D E B N O H L M B 1 E C E N N M P I D O

2 5 2 02 5 3 02 5 4 02 5 5 02 5 6 02 5 7 02 5 8 02 5 9 02 6 0 02 6 1 02 6 2 02 6 3 02 6 4 02 6 5 02 6 6 02 6 7 02 6 8 02 6 9 02 7 0 02 7 1 02 7 2 02 7 3 02 7 4 02 7 5 02 7 6 02 7 7 02 7 8 02 7 9 02 8 0 02 8 1 02 8 2 02 8 3 02 8 4 02 8 5 02 8 6 02 8 7 02 8 8 02 8 9 02 9 0 02 9 1 02 9 2 0

p m l p

n o s u b

r o t ;r o t 2

r 2 1 p

b c c n o s u bl d x j f Ol d 1 I d b i g 3 , xs b b i g 2 , xs t b i g 3 , xi n d e b n e p m l pd e c c o u n t e rb n p m a i nr t r o t a t e s b i g 2 t l d x f Ol d # r o b i g 2 , xi n d e b n r 2 1 pr t

i c a r r y i s c l e a r , c o n t i n u e

e l s e s u b t r a c t 3 -

t h l e f t

r o t 4 3 r o t a t e s t w o b i t s f r o m b i g 4 i n t o b i g 3r o t 4 3t w i c e

r 4 3 1 p

j s t w i c el d x i Ol d 1 1 r o l b i g 4 , xi n d e b n e r 4 3 1 pr t

c o m p 3 2 c o m p a r e s b i g 3c o m p 3 2c 3 2 1 p

c 3 2 e xb i g s i xb i g 2m e m b u f

l d # I d b i g 3 , xc r a p b i g 2 , xb c c 3 2 e xb n e c 3 2 e xd e b p l c 3 2 1 pr t

$ c 4 0 0$ c 4 0 6

= $ c 4 0 c

d i t w i c e

t o b i g 2c o m p a r e m s b ' s f i r s t

i c c b i g 2 > b i g 3i f n o t e q u a l , b i g 3 > b i g 2

e l s e t h e y ' r e e q u a l , s g o b a c k

t h * b i g 4 8 - b i t ( 6 - b y t e ) n u m b e ra n o t h e r b i g n u m b e rm e m o r y b u f f e r

L i s t i n g 3 B I G L G E N B A S I C g e n e r a t o r f o " b i g l . o b j "J P 1 0 0 r e m g e n e r a t o r f o r " b i g l . o b j "H 1 1 n $ = " b i g l . o b j " : r e n a m e o f p r o g r a mB 1 2 n d = 5 6 8 : s a = 4 9 1 5 2 : c h = 6 0 2 3 3

( f o r l i n e s 1 3 0 - 2 6 0 s e e t h e s t a n d a r d g e n e r a t o r o p a g e 5

N 1 0 0 0A 1 0 1 0M H 1 0 2 0F F 1 0 3 0P 1 0 4 0C 1 0 5 0N 1 0 6 0C 1 0 7 0I L 1 0 8 0B L 1 0 9 0C O 1 1 0 0G K 1 1 1 0B E 1 1 2 0O 1 1 3 0H 1 1 4 0J 1 1 5 0I N 1 1 6 0D 1 1 7 0N 1 1 8 0E 1 1 9 0G H 1 2 0 0F 1 2 1 0C D 1 2 2 0G D 1 2 3 0K 1 2 4 0N 1 2 5 0J 1 2 6 0

d a t a 1 6 9 ,d a t a 2 2 0 ,d a t a 9 2 d a t a 3 2 d a t a 9 6 d a t a 2 5 1 ,d a t a 6 d a t a 1 6 9 ,d a t a 7 8 d a t a 8 5 d a t a 7 9 d a t a 4 1 d a t a 7 6 d a t a 8 5 d a t a 4 6 d a t a 3 2 d a t a 3 9 d a t a 2 1 0 ,d a t a 6 5 d a t a 8 3 d a t a 3 9 d a t a 7 7 d a t a 8 4 d a t a 4 2 d a t a 8 5 d a t a 4 9 d a t a 5 4

0 1 3 3 ,1 9 2 , 3 2 1 9 2 , 3 2 1 1 6 , 1 9 2 ,

3 2 1 5 5 ,1 3 4 , 2 5 2 ,

3 2 2 1 0 ,6 3 1 6 2 ,8 4 6 9 7 7 , 6 6 ,7 7 7 7 4 6 1 3 3 9 , 1 9 2 ,7 6 , 6 5 ,4 6 1 3 3 9 1 9 2 ,

1 9 2 , 1 6 9 ,2 5 5 , 9 6

7 8 8 3 3 2 0

1 9 2 , 1 3 6 6 , 6 9 ,7 9 , 7 9 ,4 2 , 1 3 ,7 7 , 3 2 ,4 4 , 5 2 ,4 4 , 5 5 ,

2 3 2 5 6 6 1 9 3 , 1 7 6 ,

2 4 2 , 1 9 3 , 3 2 7 6 0 1 9 2 ,

1 9 2 , 7 6 , 0 1 6 0 , 0 1 7 7 ,2 5 5 , 2 0 0 , 2 0 8 ,1 9 2 , 7 6 , 3 9 ,

8 2 , 3 2 , 6 5 ,6 9 , 8 2 , 3 2 ,6 5 , 8 3 , 3 2

0 1 6 9 , 9 9 1 3 , 6 7 , 6 5 ,8 4 7 3 , 7 8 ,

0 1 6 9 , 1 3 9 ,1 6 9 , 1 2 , 1 6 2 ,

1 3 , 3 2 , 2 1 0 ,1 3 , 8 4 , 7 2 ,8 7 , 6 9 , 8 2

1 6 9 , 1 6 2 , 1 6 2 ,4 2 , 4 2 , 3 2 8 2 3 2 , 7 3 ,3 2 6 6 7 3 7 7 , 6 5 , 8 8 7 3 8 3 , 3 2 ,5 5 5 2 , 4 4 ,4 9 , 4 8 , 4 4

1 9 2 , 3 21 5 3

1 8 2 , 1 9 2 0 8 ,1 9 2 , 1 3 32 5 1 , 2 4 02 4 6 , 9 61 9 2 , 6 9

3 2 7 4 0 6 7 9 7

1 6 2 , 1 9 7 6 , 6 77 1 4

1 6 2 , 1 9 1 9 6 , 3 2 5 5 , 3 2

6 9 3 3 2 7

1 9 2 , 7 7 8 8 8 3 3 7 1 3 7 3 7 5 0 5 5 7 5 5 4 5

L 1 2 7 0 d a t a 5 3 , 4 6 , 1 3 , 0 1 6 0 , 0 3 2 2 0 J F 1 2 8 0 d a t a 2 5 5 , 2 0 1 , 1 3 2 4 0 , 1 5 2 0 1 , 4 6 2 4 I 1 2 9 0 d a t a 1 1 , 3 2 , 2 5 0 , 1 9 2 , 1 7 6 , 2 4 0 , 1 5 3 , 1 2G 1 3 0 0 d a t a 1 9 6 , 2 0 0 , 2 0 8 , 2 3 4 , 1 6 9 , 0 1 5 3 , 1 2J F 1 3 1 0 d a t a 1 9 6 , 9 6 2 0 1 , 5 8 1 7 6 , 7 2 0 1 , 4 8K 1 3 2 0 d a t a 1 4 4 , 2 2 4 9 6 5 6 , 9 6 , 3 2 , 7 L E 1 3 3 0 d a t a 1 9 3 , 1 6 0 , 0 1 8 5 , 1 2 , 1 9 6 , 2 4 0 , 5 4B 1 3 4 0 d a t a 1 3 3 , 2 5 4 , 3 2 9 0 1 9 3 , 1 6 5 , 2 2 0 N 1 3 5 0 d a t a 3 9 1 6 5 , 2 5 4 , 5 6 2 3 3 , 4 8 , 2 4 , 1 0 C 1 3 6 0 d a t a 0 1 9 6 , 1 4 1 , 0 1 9 6 , 1 4 4 , 2 8 2 3 G 1 3 7 0 d a t a 1 1 9 6 , 2 0 8 , 2 3 2 3 8 , 2 1 9 6 , 2 0 C L 1 3 8 0 d a t a 1 8 2 3 8 , 3 1 9 6 , 2 0 8 , 1 3 2 3 8 ,I 1 3 9 0 d a t a 1 9 6 , 2 0 8 , 8 2 3 8 , 5 1 9 6 , 2 0 8 ,C P 1 4 0 0 d a t a 2 0 0 , 5 6 9 6 2 0 0 , 2 0 8 , 1 9 7 , 3 2 , 1 6 G 1 4 1 0 d a t a 1 9 3 , 2 0 8 , 2 5 6 , 9 6 , 2 4 9 6 1 6 B 1 4 2 0 d a t a 5 1 6 9 , 0 1 5 7 , 0 1 9 6 , 2 0 2 , 1 6P 1 4 3 0 d a t a 2 5 0 , 9 6 3 2 , 1 2 8 , 1 9 3 , 3 2 , 1 5 1 , 1 9 P 1 4 4 0 d a t a 3 2 1 2 8 , 1 9 3 , 3 2 1 2 8 , 1 9 3 , 1 6 9 ,N 1 4 5 0 d a t a 1 3 3 , 2 5 3 , 1 6 2 , 0 2 4 1 8 9 , 6 1 9 P O 1 4 6 0 d a t a 1 2 5 , 0 1 9 6 , 1 5 7 , 0 1 9 6 , 2 3 2 , 1 9 J 1 4 7 0 d a t a 2 5 3 , 2 0 8 , 2 4 2 , 1 4 4 , 2 2 3 0 , 2 9 A 1 4 8 0 d a t a 1 4 0 1 9 6 , 4 6 1 1 9 6 , 4 6 , 2D 1 4 9 0 d a t a 1 9 6 , 4 6 3 1 9 6 , 4 6 4 1 9 6 , 4 6M 1 5 0 0 d a t a 5 1 9 6 , 1 4 4 , 2 2 3 0 , 2 9 6 1 6 J C 1 5 1 0 d a t a 5 1 8 9 , 0 1 9 6 , 1 5 7 , 6 1 9 6 , 2 0 L 1 5 2 0 d a t a 1 6 2 4 7 , 9 6 , 1 7 3 , 0 1 9 6 , 1 3 J 1 5 3 0 d a t a 1 9 6 , 1 3 , 2 1 9 6 , 1 3 , 3 1 9 6 , 1 3D 1 5 4 0 d a t a 4 1 9 6 , 1 3 5 1 9 6 , 9 6 1 6 9 ,F 1 5 5 0 d a t a 7 2 1 6 2 , 4 8 , 1 3 4 , 2 5 5 , 1 6 9 , 0 1 3 N 1 5 6 0 d a t a 2 5 3 , 3 2 1 2 8 , 1 9 3 , 3 8 2 5 3 , 1 6 5 , 2 5 E 1 5 7 0 d a t a 2 0 1 , 1 0 1 4 4 , 4 2 3 3 , 1 0 , 1 3 3 , 2 5 P 1 5 8 0 d a t a 8 7 8 0 1 9 6 , 4 0 , 4 6 , 0 1 9 L P 1 5 9 0 d a t a 1 9 8 , 2 5 5 , 2 0 8 , 2 2 9 , 1 6 5 , 2 5 3 , 9 4 L C 1 6 0 0 d a t a 7 2 3 2 , 1 6 3 , 1 9 3 , 2 0 8 , 2 1 1 , 1 6 0 ,D 1 6 1 0 d a t a 1 0 4 , 1 5 3 , 1 2 1 9 6 , 2 4 0 , 3 2 0 0 , 2 0 C 1 6 2 0 d a t a 2 4 7 , 9 6A 1 6 3 0 r e f o l l o w i n g d a t a i f o p r o c e s s 1M 1 6 4 0 r e p r i n t s i n p u t n u m b e r i n b i n a r yI G 1 6 5 0 d a t a 1 6 9 , 2 8 , 1 6 2 , 1 9 4 , 3 2 , 3 C 1 6 6 0 d a t a 1 9 2 , 1 6 0 , 5 1 6 2 , 8 1 3 4 , 2 5 5 , 1 8 5P 1 6 7 0 d a t a 0 1 9 6 , 1 3 3 , 2 5 3 , 1 6 9 , 4 8 , 3 8 , 2 5 D 1 6 8 0 d a t a 1 4 4 , 2 1 0 5 , 0 3 2 2 1 0 , 2 5 5 , 1 9 O 1 6 9 0 d a t a 2 5 5 , 2 0 8 , 2 4 1 , 1 6 9 , 1 3 , 3 2 , 2 1 0 , 2 5 B 1 7 0 0 d a t a 1 3 6 , 1 6 , 2 2 4 , 9 6 6 6 , 7 3 , 7 8 , 6 J 1 7 1 0 d a t a 8 2 8 9 , 3 2 , 4 0 7 2 , 7 3 , 7 1 7 K 1 7 2 0 d a t a 3 2 , 6 6 , 8 9 8 4 , 6 9 , 3 2 8 4 7 K 1 7 3 0 d a t a 3 2 7 6 , 7 9 , 8 7 4 1 , 5 8 , 1 3

L i s t i n g 4 B I G L G E N B A S I C g e n e r a t o r f o r " b i g l . o b fM 1 0 r e m g e n e r a t o r f o r " b i g 2 . o b j "I N 1 1 0 n $ = " b i g 2 . o b j " : r e n a m e o f p r o g r a mE 1 2 0 n d = 6 2 5 : s a = 4 9 1 5 2 : c h = 6 8 1 4 5

( f o r l i n e s 1 3 0 - 2 6 0 , s e e t h s t a n d a r d g e n e r a t o r o p a g e 5 ( u s e l i n e s 1 0 0 0 - 1 6 2 0 o f " b i g l . g e n " , c h a n g e t h e 2 4 i

l i n e 1 0 2 0 t 2 5 a n d a d d t h e f o l l o w i n g l i n e s )

D 1 6 3 0 r e f o l l o w i n g d a t a f o p r o c e s s 2M 1 6 4 0 r e f i n d s s q u a r e r o o t o f n u m b e rI 1 6 5 0 d a t a 0 0 0 , 0 , 0 ,O 1 6 6 0 d a t a 0 , 0 , 0 , 0 , 0 , 0 , 1 6 2 ,J 1 6 7 0 d a t a 1 8 9 , 0 1 9 6 , 1 5 7 , 2 4 2 , 1 9 3 , 1 6 9 ,E E 1 6 8 0 d a t a 1 5 7 , 2 4 8 , 1 9 3 , 2 0 2 , 1 6 2 4 2 , 3 2 7 M 1 6 9 0 d a t a 1 9 3 , 1 6 9 , 2 4 , 1 3 3 , 2 5 5 , 3 2 1 5 1 , 1 9 I 1 7 0 0 d a t a 2 4 , 3 2 , 7 0 , 1 9 4 , 5 6 , 3 2 , 7 0 , 1 9 P 1 7 1 0 d a t a 3 2 , 8 2 , 1 9 4 , 3 2 , 9 7 , 1 9 4 , 8 4 I 1 7 2 0 d a t a 0 1 9 6 , 3 2 1 3 1 , 1 9 3 , 4 0 1 4 4 f 1 B 1 7 3 0 d a t a 1 6 2 , 0 1 6 0 , 6 1 8 9 , 2 4 8 , 1 9 3 , 2 5 I O 1 7 4 0 d a t a 6 1 9 6 , 1 5 7 , 2 4 8 , 1 9 3 , 2 3 2 , 1 3 6 , 2 0 O 1 7 5 0 d a t a 2 4 3 , 1 9 8 , 2 5 5 , 2 0 8 , 2 0 8 , 9 6 , 1 6 2 ,C C 1 7 6 0 d a t a 1 6 0 , 6 6 2 6 1 9 6 , 2 3 2 , 1 3 6 , 2 0 D 1 7 7 0 d a t a 2 4 9 , 9 6 3 2 8 5 1 9 4 , 1 6 2 , 0 1 6 F 1 7 8 0 d a t a 1 2 , 6 2 , 2 4 2 , 1 9 3 , 2 3 2 , 1 3 6 , 2 0 8 , 2 4 K B 1 7 9 0 d a t a 9 6 1 6 2 , 5 1 8 9 , 2 4 8 , 1 9 3 , 2 2 1 ,J 1 8 0 0 d a t a 1 9 6 , 1 4 4 , 5 2 0 8 , 3 2 0 2 , 1 6 2 4 L 1 8 1 0 d a t a 9

T r a n s a c t o r

Page 19: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 19/84

T r a n s a c t o r R e a d e r S u r v e yH e r e i i s T r a n s a c t o r ' s f i r s t r e a d e r s u r v e y . W w a n t t k n o w w h a t y o l i k e a n d o n ' t l i k e a b o u t T r a n s a c t o r . W w a n t t k n o w w h a ts o f t w a r e a n d h a r d w a r e y o u ' r e u s i n g . A n w e ' d l i k e t o k n o w w h a t y o w a n t t s e i t h m a g a z i n e i t h f u t u r e . N o s e y , a r e n ' t w e

P l e a s e t a k e t h e t i m e t d t h s u r v e y a n s e n d u t h r e s u l t s . M a k e a p h o t o c o p y . ( W w o u l d n ' t w a n t y o u t o t e a r u t h m a g az i n e ) . P l e a s e s e n d y o u r c o m p l e t e d s u r v e y p a g e t o R e a d e r S u r v e y , T r a n s a c t o r , 8 W e s t W i l m o t S t . , U n i t 1 0 R i c h m o n d H i l l ,O n t a r i o , C a n a d a , L 4 1 K 7 .

S y s t e m c o n f i g u r a t i o n a n s o f t w a r e u s e d :

C o l u m n s

F e a t u r e s

T h M C o l u m nT h e E d g e C o n n e c t i o n

B i t sL e t t e r sN e w sR e v i e w s

L o v e i t L i k e i t D o n ' t l i k e . H a t e i t

A r t i c l e T o p i c sC 6 N a t i v e M o d eC 1 2 8 N a t i v e M o d eP o w e rC P / MG E O SR e f e r e n c e M a t e r i a lH a r d w a r e P r o j e c t sS o f t w a r e R e v i e w sH a r d w a r e R e v i e w sT h e o r e t i c a l M a t e r i a l

L o v e i t L i k e i t D o n ' t l i k e . H a t e i t

C o m m e n t s o s u g g e s t i o n s :

9 I s s u e 1

Page 20: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 20/84

T h E d g e C o n n e c t i o n

G E O S 1 2 2 . 0 , Z O O M , m a c r o s , r a d i o , e t c .

b J o e l R u b i n

T h m o s t i m p o r t a n t r e c e n t 8 - b i t C o m m o d o r e s o f t w a r e n e w s i t h r e l e a s e o G E O S 2 . f o r t h e C 1 2 8 . L i k e G E O S 2 . f o r t h eC 6 4 , i i n c l u d e s a n e v e r s i o n o g e o W r i t e W o r k s h o p ( i c l u d i n g T e x t G r a b b e r , g e o M e r g e , a n g e o L a s e r ) , g e o S p e l l ( b u tn o t h e f o n t e d i t o r w h i c h c a m e w i t h t h s e p a r a t e l y p a c k a g e dg e o S p e l l a n i n o p a r t o F o n t p a c k P l u s ) , n e d e s k T o p( w i t h b u i l t - i n c l o c k f o m i d n i g h t h a c k e r s , a n d , m o r e i m p o rt a n t , t h a b i l i t y t o s e l e c t m o r e t h a n o n f i l e f o c o p y i n g o e r a s i n g ) , e a l i a . T h n e v e r s i o n s o f g e o W r i t e a n g e o S p e l lo n l y w o r k i 8 0 - c o l u m n m o d e .

I n W I M P ( W i n d o w s I c o n s M o u s e P o i n t e r ) s y s t e m s u c h a G E O S ,a y o b e c o m e a e x p e r t , y o m a s t a r t w i s h i n g f o c r y p t i c c o t r o l c o d e s o c o m m a n d l i n e i n t e r f a c e . T h e s e m a b ' u s e r u f r i e n d l y ' b u a l e a s t t h e y g e t t h e j o d o n e w i t h o u t g o i n g t h r o u g hm e n u a f t e r m e n u . B o t h t h G E O S d e s k T o p a n d G E O S a p p l i c a t i o n sa r e g r a d u a l l y m o v i n g t o w a r d s c o n t r o l c o d e a l t e r n a t i v e s , w i t h e a c hv e r s i o n o G E O S h a v i n g m o r e a n m o r e o t h e m .

s t i l l t h i n k w o u l d g e n e r a l l y p r e f e r t u s e P a p e r c l i p o s i m il a c h a r a c t e r - b a s e d p o s t - f o r m a t t e d w o r d p r o c e s s o r t e n t e r t e x ta n t h e n u s e T e x t G r a b b e r t c o n v e r t t g e o W r i t e , i I ' n o s a t i s f i e d w i t h a A S C H / c o n t r o l - c o d e p r i n t o u t . B u ( e s p e c i a l l yw i t h t h M H c l o c k ) g e o W r i t e i b e c o m i n g l e s s o f a p a i n i t h n e c k a t e x t e d i t o r . S t i l l , t h e r e a r e t i m e s w h e n w a n t t m o v e m a r g i n a n g e t a m a r k e r i n s t e a d , o w h e n w a n t t e n t e r t e x t a n a c c i d e n t a l l y m o v e t h m o u s e a n f i n d t h i n g ss c r o l l i n g e v e r s s l o w l y t h o t h e r w a y . A t h o s e t i m e s , t h i n kt h a t t h e b e s t g a m e t p l a y w i t h m o u s e i t h a t c a n i n ef a v o u r i t e , " S h a k e I T D e a t h " .

T h e r e a r e q u i t e f e n e p r i n t e r d r i v e r s , i n c l u d i n g s o m e t h a tw o r k w i t h a u s e r p o r t t C e n t r o n i c s c a b l e ( s u c h a t h o n d s c r i b e d i T r a n s a c t o r V o l u m e 9 I s s u e 3 ) s o m e d o u b l e a n q u a d r u p l e s t r i k e d r i v e r s , f e d r i v e r s t h a t r e d u c e t h s i z e o t h p a g e a n o f f e r g r e a t e r d o d e n s i t y , a n e v e n v e r y f e d r i v e r s t h a t w i l l w o r k w i t h R S - 2 3 2 i n t e r f a c e s a n P A c l o c ks p e e d . ( Q u e s t i o n : H o d t h C o m m o d o r e c o m p u t e r s w o r k i F r a n c e , w h e r e t h e y h a v e n e i t h e r t h N T S C n o P A c o l o u r s t a nd a r d s b u S E C A M ? )

U n f o r t u n a t e l y , t h i s n e v e r s i o n o G E O S d o e s n o t a k e a d v a n -

s a l 8 0 - c o l u m n w o r k i g o i n g t b i m o n o . A l s o , a s u s u a l ,g e o W r i t e o n l y s u p p o r t s a 8 ( 2 c m ) w i d e p a g e , s o i y o w a n t t u s s o m e t h i n g w i d e r , y o a r o u o l u c k . T h o t h e ri m m e d i a t e l y o b v i o u s d e f i c i e n c y i t h m a n u a l ( w h i c h d o e s n ' tr e a l l y e x i s t y o g e c o p y o t h 6 v e r s i o n m a n u a l a n db o o k l e t t h a t g o e s t h r o u g h t h 1 2 d i f f e r e n c e s , c h a p t e r b c h a p t e r ) . a l w a y s t h o u g h t t h a t o n o t h a d v a n t a g e s o f u s i n g

c o m p u t e r f o w o r d p r o c e s s i n g w a t h a t i w o u l d b e a s i e r t e d i t o n e ' s d o c u m e n t a n c o m e o u t w i t h n e e d i t i o n .

B t h w a y , a l t h o u g h G e o p r o g r a m m e r 2 . i l i s t e d a a n a pp l i c a t i o n o n e m i g h t o w n , w a t o l d b c u s t o m e r s e r v i c e t h a tt h i s p r o d u c t h a b e e n c a n c e l l e d . S i n c e t h e c u r r e n t v e r s i o n o G e o p r o g r a m m e r a n d , i p a r t i c u l a r , G e o D e b u g g e r o n l y w o r ku n d e r C 6 G E O S , t h i s l e a v e s q u i t e g a p . R e a d e r s m i g h t w a n tt e x p r e s s t h e i r o p i n i o n s . L e a v e t h e m o n Q - L i n k , o r w r i t et h e m t B e r k e l e y S o f t w o r k s , 2 1 5 0 S h a t t u c k A v e n u e , B e r k e l e y ,C 9 4 7 0 4 .G e r m a n v i r u s e s i n v a d e M i c h i g a n !

N o t h a t w e ' v e g o t t e n t h r o u g h w i t h t h s u p e r m a r k e t t a b l o i d -t y p e h e a d l i n e , c a t e l l y o t h a t t h i s i a b o u t D a t a B e c k e rb o o k n e w l y t r a n s l a t e d i n t o E n g l i s h a n r e l e a s e d b A b a c u sC o m p u t e r V i r u s e s , H i g h T e c h D i s e a s e . O s c a l e o t o 1 0 ,

w o u l d g i v e t h i s b o o k a 8 o 9 M m a j o r c o m p l a i n t w o u l db t h a t i c o u l d u s g o o d b i b l i o g r a p h y . I d e a l s c a l m l y a n r a t i o n a l l y w i t h t h s u b j e c t , u n l i k e s o m u c h o t h p o p u l a rp r e s s . T e c h n i c a l p o i n t s a r i l l u s t r a t e d w i t h p r o g r a m s i v a r i o u sl a n g u a g e s , i n c l u d i n g G W - b a s i c , T u r b o P a s c a l , I B v m / c m sc o m m a n d l a n g u a g e ( t h e i n f a m o u s " C h r i s t m a s v i r u s " ) , a n M S - D O S a n I B m a i n f r a m e a s s e m b l y l a n g u a g e . T h A r p a n e tv i r u s h a p p e n e d t o l a t e t b c o v e r e d .

( J u s t i n c a s e y o t h i n k t h a t C o m m o d o r e 8 - b i t m a c h i n e s a r i m u n e f r o m v i r u s e s , t h e r e i s h o r t l i s t i n g o C P / M + B D O S c a l l s ;a l t h o u g h G E O S , w h i c h c r e a t e s s w a p f i l e s , i f a m o r e v u l n e r ab l e . A l w a y s k e e p w r i t e - p r o t e c t o o r i g i n a l G E O S a n G E O Sa p p l i c a t i o n d i s k s , u n l e s s y o n e e d t w r i t e o t h e m f o e x a mp l e , t o i n s t a l l t h e d e f a u l t p r i n t e r d r i v e r . S o m e v e r s i o n s o G E O Sw i l l , i a a n t i - p i r a c y t r a p , e r a s e b o o t f i l e s i t h e y ' t h i n k ' y o a r u s i n g a c o p y , a n t h t e s t m i g h t b s e n s i t i v e t d r i v e a l i g nm e n t . )

T r a n s a c t o r

Page 21: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 21/84

T h i s i n o j u s t t e c h n i c a l h a c k i n g b o o k . T h e r e a r i n t e r v i e w sw i t h s e c u r i t y p r o f e s s i o n a l s , s u c h a B a v a r i a n p o l i c e d e t e c t i v ea n t h h e a d o a i n s u r a n c e c o m p a n y . ( B t h w a y , t h o s e w h a r f i g h t i n g f o r t h e g o o d n a m e o " h a c k e r " w i l l b g l a d t n o t et h a t t h w o r d i u s e d i t h i s b o o k a s y n o n y m f o " t e c h n i c a l l y -o r i e n t e d c o m p u t e r u s e r , w h e t h e r l a w - a b i d i n g o n o t " . )

O c o u r s e , t h e l e g a l r e f e r e n c e s i t h i s b o o k a r l a r g e l y i r r e l ev a n t t m o s t r e a d e r s o t h i s m a g a z i n e n o o n l y a r e t h e s p e c i fi l a w s d i f f e r e n t , b u G e r m a n l a d e r i v e s l a r g e l y f r o m R o m a nl a a n t h C o d e N a p o l e o n , w h e r e a s m o s t o y o l i v e u n d e rs o m e v e r s i o n o f E n g l i s h C o m m o n L a w . ( F r a n k l y , t h i n k t h a t i i m i s t a k e t m a k e t o m a n y s p e c i f i c l a w s w h e n t h o l l a w s , s u c h a " M a l i c i o u s M i s c h i e f " , s t i l l h a v e t e e t h . W h e n t h l e g i s l a t o r s p a s s l o o s i t u a t i o n - s p e c i f i c l a w s , t h c o d e s g e c l u t t e r e d w i t h l a w s , m a n y o t h e m t e c h n o l o g i c a l l y o b s o l e t e ,a n i b e c o m e s d i f f i c u l t f o r t h e a v e r a g e c i t i z e n t o d e t e r m i n eh i o r h e r r i g h t s a n r e s p o n s i b i l i t i e s . )

c o m m e r c i a l d i s k - l o a d e d m o n i t o r f o t h C 6 a n C 1 2 8

Z o o m i m a c h i n e l a n g u a g e m o n i t o r f o r t h e C 6 4 , C 1 2 8 , a n d t h B B c o m p u t e r . ( H a s a n y o n e o u t s i d e B r i t a i n e v e r s e e n B B c o m p u t e r ? I ' v e s e e n b o o k s a b o u t p r o g r a m m i n g t h e m b u t h a t ' si t I w a 6 5 0 2 - b a s e d c o m p u t e r p u o u b A c o r n . [ A c o r n c o p u t e r s h a v e b e e n a v a i l a b l e h e r e i T o r o n t o . E d . ] I h a a v e r yn i c e s t r u c t u r e d B A S I C t h a t i n c l u d e d b u i l t - i n a s s e m b l e r , b u t h a t ' s a b o u t a l l I k n o w a b o u t i t . ) L i k e m o s t m o n i t o r s a v a i l a b l ef o C o m m o d o r e c o m p u t e r s , i i b a s e d o t h m o n i t o r b u i l t i n t oa l b u t h e a r l i e s t p e t / c b m c o m p u t e r s a n t h e x t e n s i o n s w r i tt e f o i t s u c h a S u p e r m o n , E x t r a m o n a n M i c r o m o n .

T h m o s t i m p o r t a n t f e a t u r e w h i c h t h i s m o n i t o r h a w h i c h i n o i t h b u i l t - i n C 1 2 8 m o n i t o r i t h a b i l i t y t w a l k ( s i n g l es t e p ) c o d e a t h r e e d i f f e r e n t s p e e d s a n t q u i c k t r a c e c o d e( r u n c o d e u n t i l y o u ' v e p a s s e d c e r t a i n p o i n t t i m e s a n a f t e rt h a t w a l k t h c o d e ) . O n c a a l s o s e u n o n - s t a n d a r d b a n k s ,s u c h a $ 3 E ( B A N K w i t h I / O ) , c h e c k m e m o r y f o i l l e g a l o c o d e s , a n e n t e r v a l u e s i n t o m e m o r y a P E T S C I I v a l u e s i n s t e a do h e x . T h e r e i b u i l t - i n h e c a l c u l a t o r a n w e d g e ; c a n ' tf i g u r e o u h o t m a k e z o o m ' s w e d g e w o r k f o d e v i c e 9

L e t ' s s a y o a r l o o k i n g t h r o u g h m e m o r y f o t e x t , b u y o a r n o c e r t a i n w h e t h e r i t ' s P E T S C I I , A S C I I , o s c r e e n c o d e s . Z O O Ma l l o w s y o d e f i n e s e r i e s o m a s k b y t e s s o t h a t y o a r l o o ki n f o a a r e a o m e m o r y w h e r e b y t e - 1 a n d m a s k - 1 h u n t -p a t t e r n - 1 , b y t e - 2 a n m a s k - 2 h u n t - p a t t e r n - 2 , e a l i a . Z O O M ,l i k e E x t r a m o n , h a a r e l o c a t i o n f a c i l i t y s t h a t y o c a c h a n g ea b s o l u t e a d d r e s s e s a n d / o r t a b l e s o w o r d s t d i f f e r e n t l o c at i o n . O c o u r s e , t h i s d o e s n ' t a l w a y s w o r k . R e l o c a t i o n r o u t i n e sg e n e r a l l y w i l l n o w o r k i y o h a v e t h f o l l o w i n g s o r t o c o d e :

I d # < $ 8 0 0 0s t $ 6 I d # > $ 8 0 0 0s t a $ 6 1 + 1l d # I d ( $ 6 1 ) , y

s i n c e t h e r e l o c a t i o n r o u t i n e w i l l n o f i n d t h e a c t u a l a b s o l u t ea d d r e s s $ 8 0 0 0 a n y w h e r e . H o w e v e r , z o o m ' s r e l o c a t i o n r o u t i n e sd w o r k o Z O O M i t s e l f . T h C 6 v e r s i o n l o a d s a $ C 0 0 0 0 , b u y o s h o u l d b a b l e t s e i u t w o r k a t h t o o b o t t o m o b a s i c . ( d i d n ' t g e t t h e C 6 v e r s i o n . C 6 u s e r s s h o u l d n o t et h a t t h e r e a r e s e v e r a l c h e a p o f r e e a l t e r n a t i v e s , i n c l u d i n gM i c r o m o n , f r o m p u b l i c d o m a i n s o u r c e s , a n H E S M O N ,a v a i l a b l e o c a r t r i d g e f r o m s o f t w a r e l i q u i d a t o r s . ) T h C 1 2 8v e r s i o n l o a d s a $ 8 0 0 0 a n t a k e s 6 o m e m o r y . I c a n b e r e l oc a t e d t a n y w h e r e u t o b e l o w $ A 8 0 0 - $ B F F F . ( I w o r k se i t h e r i m e m o r y c o n f i g u r a t i o n $ 0 o $ 4 B A N K o B A N KR A M , B A S I C s w i t c h e d o u t , K E R N A L R O M s s w i t c h e d i n a n I / s w i t c h e d i n T h v e r y t h i n ( 1 p a g e s f o a l t h r e e v e r s i o n s ! )m a n u a l s t a t e s t h a t z o o m c a b r e l o c a t e d b u i d o e s n o s t a t ew h e r e ; o t h a t i w i l l w o r k i n e i t h e r R A b a n k . I u s e s a b i o i n t e r f a c e c o d e i c o m m o n R A a r o u n d $ 0 2 9 0 . )

S f a r , Z O O M i t h o n l y s i n g l e - s t e p a n d / o r q u i c k t r a c e r o u t i n eh a v e b e e n a b l e t f i n d f o r C 1 2 8 m o d e . A b a c u s ' B A S I C 7 . I

t e r n a l s b o o k m e n t i o n s t h a t c e r t a i n a u t h o r h a s w r i t t e n a n o t h e ro n e , a n h a v e s e n t h i t w S A S E ' s b u t h a v e r e c e i v e d n r s p o n s e i a l e a s t y e a r .

O n o t h e r a d v a n t a g e t h a t Z O O M h a o v e r t h b u i l t - i n C 1 2 8m o n i t o r i t h a t i u s e s f o u r h e d i g i t a d d r e s s e s a n d i s p l a y s t h c o n f i g u r a t i o n r e g i s t e r r a t h e r t h a n f i v e h e d i g i t a d d r e s s e s . I y o h i B R i m a c h i n e l a n g u a g e p r o g r a m a n g e i n t o t h s t a n d a r d C 1 2 8 m o n i t o r , t h b a n k g i v e n a p a r t o t h r e g i s t e rd i s p l a y m a o m a n o h a v e a n y t h i n g t d w i t h r e a l i t ye s p e c i a l l y i y o a r p l a y i n g w i t h B A S I C R O r o u t i n e s a n g e d u m p e d i n t o o n o t h o s e n o n - s t a n d a r d b a n k s w i t h w h i c hB A S I C 7 . i s e n a m o u r e d .

Z O O M i m a r k e t e d b S u p e r s o f t i t h U . K . a n t h C o m o d o r e v e r s i o n s a r i m p o r t e d b S k y l e s E l e c t r i c W o r k s( 2 3 1 - E S W h i s m a n R d . , M o u n t a i n V i e w , C A 9 4 0 4 1 , t e l ep h o n e ( 8 0 0 ) 2 2 7 - 9 9 9 8 / ( 4 1 5 ) 9 6 5 - 1 7 3 5 ) i t h U . S .

A s s e m b l y l a n g u a g e m a c r o s

X y t e c ' s M a c r o S e ( 1 9 2 4 D i v i s i d e r o S t . , S a F r a n c i s c o , C A 9 4 1 1 5 , ( 4 1 5 ) 5 6 3 - 0 6 6 0 ) i d i s k o a s s e m b l y l a n g u a g e m a c r o sf o u s e w i t h C o m m o d o r e ' s C 6 A s s e m b l e r ( a v a i l a b l e c h e a pf r o m s o f t w a r e l i q u i d a t o r s ) o r M e r l i n . W h i l e t h M e r l i nm a c r o s , a l e a s t , w o r k w i t h t h C 1 2 8 v e r s i o n o M e r l i n , t h o j e c t c o d e g e n e r a t e d m a n o w o r k i C 1 2 8 m o d e . F o e x a m p l e ,i C 1 2 8 m o d e , b e f o r e y o u o p e n f i l e , y o h a v e t c a l l s e t b n kt t e l l t h K e r n a l w h e t h e r t h n a m e o t h f i l e i i B A N K o b a n k l G e n e r a l l y , b a s i c u s e s b a n k l b u m o s t m a c h i n e l a g u a g e p r o g r a m s u s B A N K 0 s y o c a n ' t j u s t a s s u m e t h d f a u l t i c o r r e c t .

T h m a c r o s a r g e n e r a l l y o r i e n t e d t b u s i n e s s , r a t h e r t h a ng r a p h i c s o g a m e s s o f t w a r e . A m o n g o t h e r t h i n g s , t h e r e i c o d ef o s o r t o 1 6 - b i t v i r t u a l m a c h i n e , s o m e w h a t s i m i l a r t t h m c h i n e d e f i n e d b S t e v e W o z n i a k ' s S w e e t - 1 6 , a l t h o u g h S w e e t - 1 6i a i n t e r p r e t e d l a n g u a g e . T h e r e i B C m u l t i b y t e a r i t h m e t i c ,a n o u t p u t n u m e r i c f o r m a t t i n g , p r o f e s s i o n a l - l o o k i n g k e y b o a r d

9 I s s u e 1

Page 22: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 22/84

i n p u t a n K e r n a l c a l l s . T h e r e i s o m e u s e f u l s t u f f i h e r e i y o h a v e n o t r o u b l e u s i n g d i s k f i l e s f r o m B A S I C b u h a v e t r o u b l ew i t h t h m a c h i n e l a n g u a g e c a l l s f o o p e n i n g t h f i l e s a n d c h e c ki n t h e e r r o r c h a n n e l , o r i y o w a n t t r e a d d e l i m i t e d v a r i a b l e -l e n g t h r e c o r d s , s i m i l a r t I N P U T # i B A S I C . O n o t h e r u s e f u l b i o f c o d e a l l o w s y o t o c r e a t e a s e l f - d e b u g g i n g v e r s i o n o y o u rp r o g r a m t h a t w i l l , a t s p e c i f i e d p o i n t s , d u m p t h r e g i s t e r s o a a r e a o m e m o r y , a w a i t k e p r e s s , a n t h e n r e s t o r e t h t e x ts c r e e n a n r e g i s t e r s a n c o n t i n u e . T h i s d i s k c o s t s $ 2 9 . 9 5 ( U . S . ) .

X y t e c , v e r y m u c h ' g a r a g e - t y p e ' o p e r a t i o n , a l s o s e l l s f e o t h e r p r o g r a m s , i n c l u d i n g t r e e - o r i e n t e d d a t a b a s e ( i n t e n d e d , i p a r t , f o g e n e r a t i n g a d i s k - b a s e d u s e r m a n u a l ) , r o o m m a t e a c o u n t i n g p r o g r a m , a n l o t t o n u m b e r c h o o s i n g p r o g r a m , w h i c hi s e s s e n t i a l l y , j u s t s o m e w h a t e n t e r t a i n i n g r a n d o m n u m b e rg e n e r a t o r . ( X y t e c ' s l o t t o p r o g r a m d o e s n o " h e l p y o w i t h l o t t o b a n a l y z i n g p r e v i o u s l o t t o d r a w i n g s " , b u t h e n , n s t a t i st i c i a n b e l i e v e s t h a t t h i s i m a t h e m a t i c a l l y p o s s i b l e . T h s o c a l l e d " l a w o a v e r a g e s " d o e s n o t a p p l y t i n d e p e n d e n t e v e n t s ,s u c h a s t h e t o s s i n g o c o i n o r t h d r a w i n g o l o t t o n u m b e r s . I d o e s a p p l y t B l a c k j a c k , s i n c e i t h d r a w n c a r d i n o p u b a c ki n t h e d e c k , t h o d d s o g e t t i n g c a r d s w i t h t h s a m e v a l u e i d c r e a s e d . ) X y t e c ' s c a t a l o g i f r e e ; t h e i r d e m o d i s k i $ 2 a p p l i c ab l t a o r d e r . C u r r e n t l y , X y t e c i w i l l i n g t s e n d y o d i s kn o a n a s y o f o t h m o n e y , o t h r e t u r n e d d i s k , l a t e r . T h d i s k s a r n o c o p y - p r o t e c t e d . I s t h i s t r u s t j u s t i f i e d ? W s h a l l s e e .

M a i l o r d e r l e g a l p r o b l e m s i t h e U . S .

T h m a i l o r d e r i n d u s t r y i t h U . S . i s c r e a m i n g a b o u t b i l l i C o n g r e s s . S o m e s t a t e s h a v e " u s e t a x " l a w s t h a t r e q u i r e y o t p a s a l e s t a x w h e n m a k i n g p u r c h a s e s i a n o t h e r s t a t e t u s i t h t a x i n g s t a t e . I y o b u c a i a n o t h e r s t a t e , y o u r s t a t e ' sv e h i c l e l i c e n s i n g a u t h o r i t y m a h a v e n t r o u b l e c o l l e c t i n g t h ed i f f e r e n c e , i a n y , b e t w e e n t h e t a x y o p a i d a n t h e t a x i y o u rh o m e d i s t r i c t w h e n y o g t r e g i s t e r t h c a r . I m o s t c a s e s ,m a i l o r d e r f i r m s d n o c o l l e c t t a x e s o o u t - o f - s t a t e p u r c h a s e s ,l e a v i n g t h c u s t o m e r , w h m a n o e v e n k n o w o t h e r e q u i r em e n t , t o b t a i n a o b s c u r e f o r m a n p a t h t a x .

T h s t a t e t a x c o l l e c t o r s h a v e a s k e d C o n g r e s s t f o r c e m a i l o r d e rf i r m s t o c o l l e c t a l c u s t o m e r s ' s a l e s t a x . T h i s w i l l r a i s e m a i l o rd e f i r m ' s e x p e n s e s . W h a t t h m a i l o r d e r f i r m s c a n ' t s a i t h a ti w i l l a l s o d i s c o u r a g e i n t e r s t a t e c u s t o m e r s w h h a v e b e e n t r i n t e v a d e t h e i r t a x . I f a o n e - p e r s o n g a r a g e o p e r a t i o n h a t k e e p t r a c k o a l t h s t a t e t a x e s w h i c h f r e q u e n t l y d i f f e r i n d i f e r e n t l o c a l i t i e s i n t h s a m e s t a t e ( p a 1 / p e r - c e n t t r a n s i td i s t r i c t s u r c h a r g e o m s t a t e s a l e s t a x ) - i m a j u s t d r i v e t h a to p e r a t i o n o u o b u s i n e s s . I y o l i v e i n t h U . S . a n b u o s e l lm a i l o r d e r a n d h a v e a n y o p i n i o n , p r o r c o n , y o m i g h t w i s h t c o n t a c t y o u r r e p r e s e n t a t i v e a n s e n a t o r s .

C o m p u t e r s a n r a d i o

I y o u ' r e i n t e r e s t e d i n u s i n g c o m p u t e r f o s h o r t w a v e l i s t e n i n g o a m a t e u r r a d i o , y o m i g h t b e i n t e r e s t e d i t h f r e e p a m p h l e t ,I N F O D U T C H , a v a i l a b l e f r o m R a d i o N e t h e r l a n d s h o b b y i s t s h o w ,M e d i a N e t w o r k . T h a d d r e s s i P o s t b u s 2 2 2 , 1 2 0 0 J H i l v e r s u m ,

T h N e t h e r l a n d s . A m o n g t h r e f e r e n c e s g i v e n i t h g u i d e i o n f o r t h e C o m m o d o r e R a d i o U s e r s G r o u p , 2 W h i t e f o r d A v e n u e ,B e l l s m y r e , D u m b a r t o n G 8 2 J T , U . K . , t e l e p h o n e 4 3 8 6 1 2 5 0 .I t h U . K , t h e i r m a g a z i n e c o s t s £ p e y e a r . I f y o w r i t e f o r i f o r m a t i o n f r o m o v e r s e a s , s e n d t h e m r e t u r n p o s t a g e s a t w I t e r n a t i o n a l R e p l y C o u p o n s , o B r i t i s h m i n t s t a m p s .

F i n a l l y , h e r e a r c o u p l e o q u i c k t i p s . L e t ' s s a y o w a n t t p o k e t t h C 6 t e x t s c r e e n i i n t e r p r e t e d B A S I C . Y o c a a v o i d t h e e x t r a s t e p o p o k i n g t c o l o u r m e m o r y i y o c l e a rt h s c r e e n u s i n g : p o k e 5 3 2 8 1 , l : p r i n t c h r $ ( 5 ) c h r $ ( 1 4 7 ) ; : p o k e5 3 2 8 1 , x w h e r e x i e i t h e r o 2 - 1 5 . T e x t w i l l b i w h i t e . E a c t l y h o t h i s w o r k s d e p e n d s o w h i c h m o d e l C 6 y o h a v e .

O t h e o l d e s t ( K e r n a l 1 m a c h i n e s , p r i n t i n g c h r $ ( 1 4 7 ) ( " c l r " )a l w a y s c l e a r s c o l o u r m e m o r y t w h i t e . O m i d d l e - a g e d ( K e rn a 2 m a c h i n e s , c h r $ ( 1 4 7 ) c l e a r s c o l o u r m e m o r y t t h b a c kg r o u n d c o l o u r ( p e e k ( 5 3 2 8 1 ) ) . T h u s , b p o k i n g i n t o t h b a c kg r o u n d b e f o r e w c l e a r t h e s c r e e n , w w i l l g e w h i t e c o l o u rm e m o r y .

M a n y o l d p u b l i c d o m a i n p r o g r a m s a n d e v e n f e c o m m e r c i a lp r o g r a m s c a u s e i n v i s i b l e ( b a c k g r o u n d - c o l o u r e d ) p o k e s o nK e r n a l 2 m a c h i n e s . K e r n a l m a c h i n e s , w h i c h i n c l u d e s n e w e r6 4 s , a l 6 4 C s , a n d t h 6 m o d e o 1 2 8 s , c l e a r c o l o u r m e m o r yt t h e c u r r e n t t e x t c o l o u r , w h i c h i s e t w h i t e b c h r $ ( 5 ) . T h S X - 6 4 u s e s a v e r s i o n o t h K e r n a l R O M , a l t h o u g h i h a c e t a i n d i f f e r e n c e s f o e x a m p l e , t h e d e f a u l t c o l o u r s a r b l u e o w h i t e i n s t e a d o l i g h t b l u e o b l u e , a n t r y i n g t a c c e s s t h c a s s e t t e u n i t g i v e s a i l l e g a l d e v i c e e r r o r .

T h e r e i o n m o r e o f f i c i a l N o r t h A m e r i c a n K e r n a l t h E d u c at o m o d e l . T h i s c o m p u t e r l o o k s l i k e P E T , w i t h m e t a l c a s ea n b u i l t - i n g r e e n - s c r e e n m o n i t o r , a n i w a s o l d b s o m el i q u i d a t o r s . h a v e n ' t t h f o g g i e s t i d e a w h a t d i f f e r e n c e s i h a f r o m o t h e r m o d e l s e x c e p t t h a t C o m m o d o r e / T e r r a p i n L O G Ol o o k s f o a i d e n t i f i e r b y t e a n g i v e s y o s p e c i a l s i g n - o nm e s s a g e i i i f o u n d . d o n ' t h a v e a c c e s s t t h E u r o p e a nm o d e l s b u t , s i n c e t h e N o r t h A m e r i c a n K e r n a l s c o n t a i n P A R S - 2 3 2 c o d e , a n t h E u r o p e a n d i s a s s e m b l y b o o k s s e e m t h a v e t h s a m e c o d e , a s s u m e t h a t t h i s w i l l w o r k o o v e r s e a sC 6 4 s a l s o .

T h s e c o n d h i n t c o m e s f r o m J o D a w s o n , P r e s i d e n t o X y t e cS o f t w a r e . O n e a s y m e t h o d o s e t t i n g u t e x t s c r e e n w h i c ha p p e a r s t h a v e d i f f e r e n t b a c k g r o u n d c o l o u r s i d i f f e r e n t a r e a si s i m p l y t u s r e v e r s e c h a r a c t e r s t h r o u g h o u t . F o e x a m p l e ,y o c o u l d h a v e a b l a c k b a c k g r o u n d , a b l u e b o r d e r , a n t w b o x e s f i l l e d w i t h t e x t . E v e r y w h e r e o u t s i d e t h b o x e s i f i l l e dw i t h r e v e r s e b l u e s p a c e s , w h i c h a p p e a r s t m a k e t h b o r d e re x t e n d a r o u n d t h b o x e s . T h f i r s t b o i f i l l e d w i t h w h i t e r v e r s e d s p a c e s a n t e x t w h i c h a p p e a r s t b b l a c k t e x t o w h i t e b a c k g r o u n d . T h o t h e r b o i f i l l e d w i t h r e d r e v e r s e ds p a c e s a n t e x t w h i c h a p p e a r s t b b l a c k t e x t o a r e d b a c kg r o u n d . N r a s t e r i n t e r r u p t s o r m u l t i - c o l o u r t e x t o h i g h r e s ol u t i o n s c r e e n s a r e r e q u i r e d . M o r e o v e r , t h i s m e t h o d w i l l w o r kj u s t a e a s i l y o t h 8 0 - c o l u m n s c r e e n o C 1 2 8 w i t h o u t B A S I C

o 6 4 o v i d e o R A M .

T r a n s a c t o r

Page 23: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 23/84

I n n e r G E O Sl o o k a h o G E O S o p e r a t e s

b y W i l l i a m C o l e m a n

A l t h o u g h G E O S a l l o w s y o t q u i c k l y w r i t e p r o g r a m s t h a t w o u l dt a k e s w e e k s o m o n t h s t w r i t e o n o r m a l C 6 4 / 1 2 8 , f e p e o p l ea c t u a l l y p r o g r a m w i t h i t P a r t o t h p r o b l e m i t h a t m o s t p e o p l ed o n ' t u n d e r s t a n d h o G E O S w o r k s . W h i l e t h i n n e r w o r k i n g s o G E O S a r n o h a r d t u n d e r s t a n d , t h e y d f u n c t i o n q u i t e d i f f e re n t l y f r o m w h a t m o s t 6 4 / 1 2 8 p r o g r a m m e r s a r u s e d t o

I t h i s a r t i c l e , y o w i l l l e a r n h o G E O S f u n c t i o n s a n h o i t v a r i o u s l e v e l s i n t e r a c t w i t h a a p p l i c a t i o n . O n c e y o u n d e rs t a n d t h i s i n t e r a c t i o n c r e a t i n g a n d e b u g g i n g G E O S a p p l i c at i o n s b e c o m e s m u c h , m u c h e a s i e r .

' n o r m a l ' 6 o 1 2 p r o g r a m d o e s m o s t o t h w o r k i t s e l f a n u s e s K e r n a l s u b r o u t i n e s f o t h i n g s l i k e d i s k I / O , p r i n t i n g c h a ra c t e r s , e t c . G E O S i v e r y d i f f e r e n t . B a s i c a l l y , i i c o m p o s e d o t h r e e l e v e l s :

I n t e r r u p t L e v e lT h M a i n L o o pA p p l i c a t i o n R o u t i n e s

T h f i r s t t w l e v e l s a r e t h e G E O S K e r n a l i t s e l f a n t h e y m u s tb a l l o w e d t e x e c u t e p e r i o d i c a l l y o G E O S w i l l s e e m t f r e e z e .I f a c t , i y o a r t e s t i n g a a p p l i c a t i o n a n e v e r y t h i n g s e e m st s t o p ( m o u s e w o n ' t m o v e , k e y b o a r d w o n ' t r e s p o n d , e t c . ) y o c a n b e 9 p e c e n t c e r t a i n t h a t y o u r a p p l i c a t i o n w e n t i n t o a e n d l e s s l o o p a n i n o l e t t i n g G E O S d i t ' s j o b .

I n t e r r u p t L e v e l r e a d s t h k e y b o a r d a n d c h e c k s f o n u m e r o u so t h e r c o n d i t i o n s t h a t r e q u i r e f r e q u e n t , p e r i o d i c i n s p e c t i o n . I w o n ' t a c o n w h a t i f i n d s ; t h e r e i s n ' t e n o u g h t i m e . S f l a g s a r s e t i n d i c a t e w h e n t h v a r i o u s c o n d i t i o n s a r m e t . T h M a i nL o o p t h e n c h e c k s t h e s e f l a g s a n a c t s o t h e m a c c o r d i n g l y .

G E O S i a e x a m p l e o E v e n t - D r i v e n c o d e . T h M a i n L o o p i s i m p l y s e r i e s o s u b r o u t i n e c a l l s t h a t o p e r a t e i a e n d l e s sl o o p . T h e s e s u b r o u t i n e s c h e c k i c e r t a i n e v e n t s h a v e o c c u r r e da n i s e x e c u t e S e r v i c e R o u t i n e s t h a t t h e a p p l i c a t i o n h a s e u t h a n d l e t h o s e s i t u a t i o n s .

S e r v i c e r o u t i n e s

T h e r e a r e b a s i c a l l y t h r e e t y p e s o s e r v i c e r o u t i n e s . F i r s t , t h e r ea r e t h e r o u t i n e s t h a t t h a p p l i c a t i o n a t t a c h e s t m e n u s a n

i c o n s . F o e x a m p l e : w h e n t h u s e r p r e s s e s t h m o u s e b u t t o n ,G E O S w i l l c h e c k t s e i t h m o u s e i o v e r m e n u o p t i o n o ra i c o n . I o n o t h e s e c o n d i t i o n s ( ' e v e n t s ' ) i m e t , t h M a i nL o o p w i l l c a l l t h e s e r v i c e r o u t i n e a s s o c i a t e d w i t h t h a to p t i o n / i c o n ( d e f i n e d i m e n u o r i c o n t a b l e ) .

T h n e x t t y p e o s e r v i c e r o u t i n e i c a l l e d t h r o u g h t h S y s t e mV e c t o r s . T h e s e a r w o r d l e n g t h m e m o r y l o c a t i o n s t h a t c o n t a i nt h a d d r e s s o f a s e r v i c e r o u t i n e t e x e c u t e w h e n t h c o n d i t i o na s s o c i a t e d w i t h t h a t v e c t o r o c c u r s . I a v e c t o r c o n t a i n s $ 0 0 0 0t h e n i w i l l b i g n o r e d c o m p l e t e l y . I n t h e a b o v e e x a m p l e , i t h m o u s e i n o o v e r m e n u o a i c o n , t h M a i n L o o p w i l lc h e c k o t h e r P r e s s V e c t o r . I i i n o n - z e r o , t h e r o u t i n e w h o s ea d d r e s s i i t h v e c t o r w i l l b e x e c u t e d .

T h t h i r d w a t o a c t o a e v e n t i t h r o u g h t i m e r s . T h e s ec o m e i t w f l a v o r s : S l e e p a n P r o c e s s e s .

S l e e p

S l e e p i m e t h o d o s t o p p i n g t h e x e c u t i o n o f a s u b r o u t i n e f o p r e d e t e r m i n e d a m o u n t o f t i m e w h i l e c o n t i n u i n g t e x e c u t e

t h r e s t o t h a p p l i c a t i o n . R e m e m b e r , t h M a i n L o o p m u s th a v e c o n t r o l p e r i o d i c a l l y o G E O S w i l l s t o p . S l e e p p r o v i d e s aw a t p a u s e w h i l e s t i l l p e r f o r m i n g r o u t i n e t a s k s .

T h m o s t n o t i c a b l e e x a m p l e i o n t h a t y o s e e v e r y t i m e y o u s G E O S : i c o n a n m e n u f l a s h e s . W h e n a u s e r c l i c k s o m e n u o p t i o n , t h e M e n u H a n d l e r w i l l i n v e r t t h e o p t i o n , p u i t s e l f t s l e e p , a n w h e n i a w a k e n s , s i m p l y i n v e r t t h o p t i o ns e c o n d t i m e .

S l e e p w o r k s t h r o u g h t a b l e o t i m e r s , o n f o e a c h s l e e p i n gs u b r o u t i n e . I n t e r r u p t L e v e l w i l l d e c r e m e n t e a c h t i m e r e v e r yi n t e r r u p t . T h M a i n L o o p c h e c k s t h e s e t i m e r s ; a n d , i a n h a v er e a c h e d z e r o , t h e a s s o c i a t e d r o u t i n e w i l l b e x e c u t e d . W h e nS l e e p i c a l l e d , t h r e t u r n a d d r e s s i p u l l e d o f f t h e s t a c k . T h i sa d d r e s s i w h e r e e x e c u t i o n w i l l c o n t i n u e f r o m .

P r o c e s s e s

G E O S h a f o r m o m u l t i t a s k i n g c a l l e d p r o c e s s e s . p r o c e s s i s u b r o u t i n e t h a t a a p p l i c a t i o n c a s e u t h a t w i l l b e x e c u t

e a r e g u l a r i n t e r v a l s . T h a p p l i c a t i o n p a s s e s t h a m o u n t o

9 I s s u e 2

Page 24: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 24/84

t i m e t h a t s h o u l d e l a p s e b e t w e e n c a l l s t t h p r o c e s s . G e o sm a i n t a i n s t i m e r s f o e a c h p r o c e s s , j u s t a i d o e s f o S l e e p .

O n p o i n t y o u m u s t k e e p i m i n d : w h i l e t h t i m e r s a r u p d a te d u r i n g I n t e r r u p t L e v e l , t h e x e c u t i o n o p r o c e s s i d o n ed u r i n g M a i n L o o p . T h i s m e a n s t h a t t h t i m e t h M a i n L o o pt a k e s t g t h r o u g h o n c o m p l e t e i t e r a t i o n c a v a r y s i g n i f i -g a n t l y d e p e n d i n g o h o m a n y s l e e p a n p r o c e s s r o u t i n e sn e e d t e x e c u t e a n h o l o n g e a c h o n t a k e s . T i m e r v a l u e sl e s s t h e n a b o u t t e ( 1 / 6 o f s e c o n d ) w i l l n o b v e r y a c c u r a t e .

G e o s h a n w a t s t a c k p r o c e s s . I a p r o c e s s c o m e s d u b e f o r e t h p r e v i o u s c a l l i d o n e ( i . e . p r o c e s s t i m e s o u t t w i c eb e f o r e b e i n g e x e c u t e d ) , i w i l l o n l y b e x e c u t e d s i n g l e t i m e .

O K n o t h a t w k n o w w h a t e v e n t s a r a n h o t h e y a r u s e d ,l e t ' s t a k e l o o k a t h p r o c e s s i n g l e v e l s t h e m s e l v e s .

I n t e r r u p t L e v e l

N o r m a l l y , a t i m e r i o n o t h C I c h i p s g e n e r a t e s i n t e r r u p t st h a t a r u s e d t r e a d t h k e y b o a r d , e t c . G e o s i b i d i f f e r e n t :s i x t y t i m e s p e s e c o n d r a s t e r I R i g e n e r a t e d b t h V I c h i p . T h i s I R i s e u t h i d u r i n g v e r t i c a l b l a n k i n g s d r a wi n t t h s c r e e n w i l l n o p r o d u c e f l i c k e r .

G e o s d o e s c o n s i d e r a b l y m o r e d u r i n g a i n t e r r u p t t h e n a r e g ul a 6 o 1 2 8 ; t h e r e f o r e , i d o e s n ' t h a v e t i m e t o a c t o t h i n g sl i k e m o u s e p r e s s e s a n p r o c e s s e s . T h a t i t h j o o t h M a i nL o o p . T h a d v a n t a g e o u s i n g i n t e r r u p t s t s e f l a g s a n m a a g t h e t i m e r s i t h a t t h M a i n L o o p i n o c o n s t a n t . I n t e r r u p t sp r o v i d e m e a n s t c o n s t a n t l y m o n i t o r t h s y s t e m r e g a r d l e s so w h a t e l s e i g o i n g o n

N o r m a l l y a a p p l i c a t i o n w i l l n o n e e d t m o d i f y t h i n t e r r u p t sb u i t h n e e d a r i s e s t h e r e a r e t w v e c t o r s p r o v i d e d f o a d d i n gy o u r o w i n t e r r u p t c o d e . O n e , i n t T o p V e c t o r , o c c u r s b e f o r e t h b u l k o f t h i n t e r r u p t h a o c c u r r e d . T h o t h e r , i n t B o t V e c t o r ,o c c u r s a t h e n o t h c y c l e .

S e v e r a l t h i n g s s h o u l d b e k e p t i m i n d w h e n w r i t i n g i n t e r r u p tc o d e :

D o n ' t t r t d t o m u c h d u r i n g i n t e r r u p t s . T h e G E O Si n t e r r u p t i a l r e a d y q u i t e l o n g a n y o w i l l b o d o w n t h a p p l i c a t i o n .

D o n ' t c l e a r i n t e r r u p t s , i . e . e n

D o n ' t u s G E O S r o u t i n e s i y o c a h e l p i t S o m e w i l l w o r kd u r i n g i n t e r r u p t s a n s o m e w o n ' t . C a l l R o u t i n e a n D o I n l i n e R e t u r n w i l l w o r k O K

T h M a i n L o o p

T h i s i w h e r e m o s t o t h n i t t y g r i t t y p a r t s o G E O S o c c u r .M e n u s , p r o c e s s e s , a n t h m o u s e a r a l m a n a g e d f r o m h e r e( r e m e m b e r : i n t e r r u p t s r e a d t h s t a t u s , t h M a i n L o o p a c t s

T h F i g u r e s t h a t a r i n c l u d e dw i t h t h i s a r t i c l e a r n o b y t e b

b y t e d i s a s s e m b l i e s ( w h i c hc h a n g e w i t h t i m e ) . T h e y a r

p r e s e n t e d o n l y t g i v e y o a i d e a o w h a t ' s g o i n g o n . . .

o i t ) . O n o t h b i g g e s t m i s t a k e s b e g i n n i n g G E O S p r g r a m m e r s m a k e i t h a t t h e y d o n ' t l e t h M a i n L o o p h a v ec o n t r o l .

A a p p l i c a t i o n i r e a l l y l i t t l e m o r e t h e n a g r o u p o s e r v i c e r o t i n e s . T h e y a r e c a l l e d b t h M a i n L o o p a n w h e n t h e y a r f i n i s h e d t h e y m u s t R T b a c k t i t S i n c e t h M a i n L o o p c o t r o l s t h p o s i t i o n i n g o t h m o u s e a n m a n a g i n g k e y b o a r di n p u t , t h q u i c k e s t w a t k i l l a a p p l i c a t i o n i t p r e v e n t t h M a i n L o o p f r o m e x e c u t i n g ( y o u m a h a v e n o t i c e d t h a t h a v eb e e n s t r e s s i n g t h i s ) .

I i e x t r e m e l y r a r e i n d e e d t h a t y o w i l l n e e d t a d d c o d e t t h M a i n L o o p ( u s e a p r o c e s s ) ; b u t , i y o m u s t , a v e c t o r h a t h o u g h t f u l l y b e e n p r o v i d e d , c a l l e d a p p U c a t i o n M a i n . T h i s v e t o i n o r m a l l y $ 0 0 0 0 s i w o n ' t d a n y t h i n g . I y o w e d g er o u t i n e i n t o i b s u r e t e n i w i t h a n R T S .

P u t t i n g i a l t o g e t h e r

W r i t i n g m o s t G E O S a p p l i c a t i o n s c a b d o n e i s e r i e s o s i p l s t e p s :

B u i l d t h m e n u t a b l e s . D o n ' t w o r r y a b o u t a l t h e s e r v i c er o u t i n e s a f i r s t . Y o c a p o i n t a l u n i m p l e m e n t e d e n t r i e s a

J M G o t o F i r s t M e n u .

D e s i g n i c o n s a n i c o n t a b l e s . U n i m p l m e n t e d i c o n r o u t i n e sc a p o i n t t R T S .

C o d e t h p r o c e s s r o u t i n e s i a n a r n e e d e d .

D e c i d e w h i c h v e c t o r s t h a p p l i c a t i o n w i l l n e e d t u s a n c o d e t h r o u t i n e s n e c e s s a r y .

W r i t e C o l d S t a r t r o u t i n e w h i c h w i l l i n i t i a l i z e t h s c r e e n ,d r a w a n i c o n s , s t a r t a n p r o c e s s e s , e t c . T h i s r o u t i n e s h o u l de n w i t h R T S . F r o m t h a t p o i n t o t h M a i n L o o p w i l lc o n t r o l t h e a p p l i c a t i o n .

F i g u r e s a n d 2 l i s t t h p s e u d o - c o d e f o t h I n t e r r u p t a n t h M a i n L o o p r e s p e c t i v e l y . S t u d y i n g t h e s e s h o u l d p r o v i d e y o w i t h a e x c e l l e n t f o u n d a t i o n f o w r i t i n g y o u r o w G E O S a p p l ic a t i o n s .

T r a n s a c t o r

Page 25: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 25/84

F i g u r e I n t e r r u p t L e v e l P s e u d o - c o d e

I n t e r r u p t L e v e l

F i r s t t h e s t a t e o f t h m a c h i n e i s s a v e d . T h i si n c l u d e s A X , Y , a n p l u s r O - r l 5 a n t h m e m o r y c o n f i g u r a t i o n

j s S a v e S t a t e

N o t h e I / O a r e a i s w i t c h e di n G e o s 1 2 w i l l a l s o e n s u r e t h a tb a n k i t h e a c t i v e b a n k .

j s I O I n

N o d b l C l i c k C o u n t i d e c r e m e n t e d . T h i sv a r i a b l e i u s e d t t e l l i t h e u s e r c l i c k st h m o u s e t w i c e i r a p i d s u c c e s s i o n

j s D b l C l i c k

. i 6 e o s l 2 8G e o s 1 2 s e r v i c e s t h m o u s e h e r e

j s M o u s e S e r v i c e. e n d i f

N o s c a n t h e k e y b o a r d a n d i f k e i f o u n d p l a c e i i t h e k e y b o a r d q u e .

j s K e y b o a r d

j s A l a r m / s e r v i c e a l a r m t o n e t i m e r

N o r m a l l y i n t T o p V e c t o r p o i n t st i n t e r r u p t M a i n . I f y o u w e d g e

r o u t i n e i h e r e t h e r o u t i n em u s t e n d w i t h j m I n t e r r u p t M a i n .

I d a # < i n t T o p V e c t o rl d # > i n t T o p V e c t o rj s C a l l R o u t i n e / e x e c u t e i n t e r r u p t M a i n

N o r m a l l y i n t B o t V e c t o r i s e m p t y , i . e . $ 0 0 0 0 .r o u t i n e w e d g e d i h e r e s h o u l d e n d w i t h r t

I d # < i n t B o t V e c t o rl d # > i n t B o t V e c t o rj s C a l l R o u t i n e / n o r m a l l y u n u s e d .

j s r t

R e s t o r e S t a t e ; b a c k t h w a i w a s .

I n t e r r u p t M a i n i c a l l e d d u r i n ge a c h i n t e r r u p t v i a i n t T o p V e c t o r .T h i s r o u t i n e p e r f o r m s t h e b u l k o t h

i n t e r r u p t ' s w o r k a n d m u s tt h i n g s w i l l f r e e z e u p

I n t e r r u p t M a i n

. i G e o s 6 4

b c a l l e d o

G e o s 6 s e r v i c e s t h e m o u s e h e r ej s M o u s e S e r v i c e

. e n d i f

j s U p d a t e P r o c e s s e s

j s U p d a t e S l e e p sj s U p d a t e P r o m p tj s S e r v i c e R a n d o m

r t

/ u p d a t e p r o c e s st i m e r s

/ u p d a t e s l e e p t i m e r s/ f l a s h t e x t p r o m p t/ g e t a n e r a n d o m/ n u m b e r

F i g u r e M a i n L o o p P s e u d o - c o d e

M a i n L o o p :f i r s t w e c h e c k t h e k e y b o a r d a n d l o a dk e y D a t a . A l s o c h e c k i i n p u t V e c t o r , m o u s e V e c t o r , k e y V e c t o r , o m o u s e F a u l t V e c t o r s h o u l d b e c a l l e d . I n d i r e c t l ym e n u , i c o n , o o t h e r P r e s s V e c t o rw i l l b e c a l l e d .G e o s 1 2 w i l l h a n d l e s o f t ( 8 0 - c o l )s p r i t e s h e r e .

j s K e y b o a r d S e r v i c e

n o w c h e c k i a n y p r o c e s s e s o s l e e p i n g r o u t i n e s s h o u l d b e x e c u t e d .

j s P r o c e s s S e r v i c ej s S l e e p S e r v i c e

n e x t u p d a t e t h e t i m e a n a l a r mv a r i a b l e s . I i t i s t i m e f o r t h ea l a r m t o s o u n d c a l l a l a r m T m t V e c t o r

j s T i m e S e r v i c e

a p p l i c a t i o n M a i n i n o r m a l l y $ 0 0 0 0 . Y o u c a nw e d g e y o u r o w M a i n L o o p r o u t i n e s i n h e r e

I d # < a p p l i c a t i o n M a i nl d # > a p p l i c a t i o n M a i nj s C a l l R o u t i n e

j m M a i n L o o p / f o r e v e r

9 I s s u e 2

Page 26: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 26/84

1 5 4 1 / 1 5 7 1 D O M - C o m m a n d E r r o r

c a v e a t f o m u l t i p l e b y t e r e a d s

b A n t o n T r e u e n f e l s

O n o t h f a c i l i t i e s p r o v i d e d b t h D O o t h 1 5 4 1 a n 1 5 7 1d r i v e s i t h m e m o r y r e a d ( M - R ) c o m m a n d , w h i c h a l l o w s t h u s e r t e x a m i n e a n y m e m o r y l o c a t i o n i t h d r i v e . T h s a m ep u r p o s e i s e r v e d i t h c o m p u t e r ' s m e m o r y s p a c e b B a s i c ' sp e e k f u n c t i o n : m e m o r y r e a d c a b t h o u g h t o f a p e e kf u n c t i o n f o t h d r i v e .

d i f f e r e n c e b e t w e e n t h t w i t h a t , w h i l e B a s i c ' s p e e k i l i m i t e d t e x a m i n i n g o n e m e m o r y l o c a t i o n a t i m e , s i n g l eM - c o m m a n d c a r e t u r n t h c o n t e n t s o u t 2 5 m e m o r yl o c a t i o n s . T h e r e a r t w f o r m s o t h M - c o m m a n d : s i g l e - b y t e v e r s i o n a n m u l t i p l e - b y t e v e r s i o n . C o m m o d o r e ' sd o c u m e n t a t i o n o t h M - c o m m a n d i t h 1 5 4 1 U s e r ' sG u i d e m e n t i o n s o n l y t h s i n g l e - b y t e v e r s i o n , b u s a y s t h a t i m o r e t h a n o n b y t e i r e a d t h e n s u c c e s s i v e b y t e s c o m e f r o ms u c c e s s i v e m e m o r y l o c a t i o n s . I t h 1 5 7 1 U s e r ' s G u i d e ,h o w e v e r , C o m m o d o r e s a y s t h a t , i t h m u l t i p l e - b y t e v e r s i o no t h M - c o m m a n d , r e t u r n e d b y t e s c o m e f r o m s u c c e s s i v em e m o r y l o c a t i o n s .

T h d o c u m e n t a t i o n a p p e a r s t b i n c o m p l e t e . T h s i n g l e - b y t ev e r s i o n o t h M - c o m m a n d n e v e r r e t u r n s v a l u e s f r o m m o r et h a n o n m e m o r y l o c a t i o n , a n t h e m u l t i p l e - b y t e v e r s i o n b c o m e s c o n f u s e d n e a r p a g e b o u n d a r i e s . I t h s t a r t i n g a d d r e s so t h m e m o r y r e a d p l u s t h n u m b e r o f b y t e s t r e a d a r s u c ht h a t p a g e b o u n d a r y m u s t b c r o s s e d t c o m p l e t e t h e r e q u e s t ,t h b y t e s r e t u r n e d a f t e r r e a c h i n g t h b o u n d a r y c o m e f r o ms o m e w h e r e e l s e a l t o g e t h e r .

T h a c c o m p a n y i n g p r o g r a m d e m o n s t r a t e s t h e e r r o r i t h m u t i p l e - b y t e v e r s i o n o t h M - c o m m a n d b r e q u e s t i n g r e a d s o t h s a m e l o c a t i o n s i d r i v e m e m o r y u s i n g b o t h t h e m u l t i p l e -a n s i n g l e - b y t e v e r s i o n s , t h e n c o m p a r i n g t h r e s u l t s . I f t h s u o t h s t a r t i n g a d d r e s s a n t h n u m b e r o b y t e s d o e s n o c r o s s p a g e b o u n d a r y , t h e n t h r e s u l t s m a t c h ( a l e a s t w h e nr e a d i n g R O l o c a t i o n s ) . I p a g e b o u n d a r y i c r o s s e d , t h r s u l t s d n o m a t c h .

T h e r r o r m a n i f e s t s i t s e l f d i f f e r e n t l y d e p e n d i n g o w h e t h e r o n o t h s t a r t i n g a d d r e s s w a t h l a s t b y t e o p a g e ( o f t h e f o r m$ x x F F ) . I f s o , t h e n t h s e c o n d a n s u c c e e d i n g b y t e s c o m ef r o m $ x x O O , $ x x 0 1 , a n s o ( i o t h e r w o r d s , p a g e w r a p ) .F o r a n y o t h e r s t a r t i n g a d d r e s s D O s t o p s r e t u r n i n g m e m o r y

b y t e s a t h p a g e b o u n d a r y a n s t a r t s r e t u r n i n g t h b y t e s o t h 0 0 , O K , 0 0 , 0 0 s t a t u s m e s s a g e o v e r a n o v e r u n t i l t h n u m b e r o b y t e s r e q u e s t e d i r e a c h e d .

s l i g h t v a r i a t i o n o t h m u l t i p l e - b y t e M - s u b r o u t i n e d e m o ns t r a t e s w h a t h a p p e n s w h e n m u l t i p l e b y t e s a r r e q u e s t e d a f t e rs i n g l e - b y t e M - c o m m a n d i s e n t . E l i m i n a t i o n o f t h t h i r d p r a m e t e r b y t e ( N B $ ) f r o m t h p r i n t # s t a t e m e n t s e n d s s i n g l e -b y t e c o m m a n d , t h e n e n t e r s l o o p r e q u e s t i n g m u l t i p l e r e t u r nb y t e s . T h f i r s t b y t e i c o r r e c t a n a l s u c c e s s i v e b y t e s c o m ef r o m t h 0 0 , O K , 0 0 , 0 0 s t a t u s m e s s a g e .

T h e r r o r d e m o n s t r a t i o n p r o g r a m h a b e e n u s e d t t e s t 1 5 4 1a n n e R O 1 5 7 1 w i t h i d e n t i c a l r e s u l t s .

I t i s i n t e r e s t i n g t n o t e t h a t t w d i f f e r e n t e d i t i o n s o t h 1 5 4 1U s e r ' s G u i d e d n o m e n t i o n t h m u l t i p l e - b y t e v e r s i o n o t h m e m o r y r e a d c o m m a n d , a l t h o u g h b o t h a l l u d e t a a b i l i t y t or e a d m u l t i p l e b y t e s . ( B o t h e d i t i o n s a l s o h a v e a e x a m p l e p r g r a m s h o w i n g h o t r e a d m u l t i p l e b y t e s w i t h t h s i n g l e - b y t ev e r s i o n , b u o n l y o n w i l l w o r k c o r r e c t l y . ) T h 1 5 7 1 U s e r ' sG u i d e a c k n o w l e d g e s t h e x i s t e n c e o t h m u l t i p l e - b y t e v e r s i o nb u t n o t i t l i m i t a t i o n s . P o s s i b l y t h i s w a r e s p o n s e t o t h i r dp a r t y d i s c u s s i o n s o t h m u l t i p l e - b y t e v e r s i o n i s e v e r a l b o o k sa b o u t t h 1 5 4 1 .

U n f o r t u n a t e l y , n o n e o t h b o o k s s e e m t b a w a r e o t h p r o b l e m s e i t h e r . O n c a s p e c u l a t e t h a t p e r h a p s t h e o r i g i n a ld e c i s i o n n o t d o c u m e n t t h m u l t i p l e - b y t e v e r s i o n w a m a d eb t h p e r s o n s r e s p o n s i b l e f o i m p l e m e n t i n g i i t h f i r s tp l a c e . T h a b i l i t y m a h a v e b e e n u s e d i t h e e a r l y d e v e l o pm e n t o t h D O b p e r s o n s w h w e r e a w a r e o i t l i m i t a t i o n sb u f o u n d i a d e q u a t e f o t h e i r n e e d s .

R e f e r e n c e s

A n o n y m o u s , C o m m o d o r e 1 5 4 1 D i s k D r i v e U s e r ' s G u i d e ,C o m m o d o r e B u s i n e s s M a c h i n e s E l e c t r o n i c s , L t d . , S e p t e m b e r1 9 8 2

A n o n y m o u s , V I C - 1 5 4 1 S i n g l e D r i v e F l o p p y D i s k U s e r ' s M a u a l , S e c o n d E d i t i o n , C o m m o d o r e B u s i n e s s M a c h i n e s , I n c . ,D e c e m b e r 1 9 8 2

T r a n s a c t o r

Page 27: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 27/84

A n o n y m o u s , C o m m o d o r e 1 5 7 1 D i s k D r i v e U s e r ' s G u i d e , S e o n E d i t i o n , C o m m o d o r e E l e c t r o n i c s L i m i t e d , A u g u s t 1 9 8 5 n g l i s c h , L a n S z c z e p a n o w s k i , N . T h A n a t o m y o t h

1 5 4 1 , A b a c u s S o f t w a r e , I n c . , 1 9 8 4 m m e r s , R . a n N e u f e l d , G . I n s i d e C o m m o d o r e D O S , D a t a - o s t , I n c . , 1 9 8 4" m - r . e r r o r . b a s " t h l i m i t a t i o n d e m o n s t r a t e d

I 1 0 0 P 1 0 5

1 1 1 5 1 5 1 6

G 2 0 0L 2 0 5F 2 1 0 C 2 1 5 E 2 2 0I 2 2 5F 2 3 0J 2 3 5

J 2 4 02 4 2 5 2 5

B 2 6 0B 2 6 5B 2 7 0

2 7 I 2 8 0

3 0 3 0

P 3 1 0P 3 1 5

3 2 F 3 2 5

3 3 H 3 3 5

3 4 3 4 3 5 3 5 4 0

F 4 0 5F 4 1 0

4 1 4 2 4 2

C 4 3 0P 4 3 5

4 4 4 4 4 5

D 4 5 5L 5 0 0

5 0 5 1

p r i n t " { d o w n } 1 5 4 1 / 1 5 7 1 d o ' m - r ' c o m m a n d "p r i n t " e r r o r d e m o n s t r a t i o n "

n l $ = " " z r $ = c h r $ ( 0 )d e f n h b ( x ) = i n t ( x / 2 5 6 ) : d e f f n l b ( x ) = x - i n t ( x / 2 5 6 ) * 2 5 6

p r i n t " { d o w n } s t a r t a d d r e s s o f m e m o r y r e a d "i n p u t h e x f o r < q t q u i t " ; a $i f a $ = " q " t h e n e n dg o s u b 5 0 5 : s a a i s a > 6 5 5 3 5 t h e n 2 0 i n p u t " { d o w n } h e x f o b y t e s t r e a d " ; a $g o s u b 5 0 5 : n b a i f n b < l o r n b > 2 5 5 t h e n 2 2 i f f n h b ( s a ) = f n h b ( s a + n b - l ) t h e n p r i n t " { d o w n } m a t c h e x p e c t e d > " ; : g o t o 2 4 0p r i n t " { d o w n } m i s m a t c h e x p e c t e d > " ;g o s u b 3 0 g o s u b 4 0 i m b $ = s b $ t h e n p r i n t m a t c h f o u n d " : g o t o 2 6 p r i n t m i s m a t c h f o u n d "f o r i = l t o n bp r i n t f n h b ( s a + i - l ) , a s c ( m i d $ ( s b $ , i , 1 ) ) , a s c ( m i d $ ( m b $ , i , 1 ) )n e x tg o t o 2 0

r e m * m u l t i - b y t e r e a dm b $ = n l o p e n 1 5 , 8 , 1 5l b $ = c h r $ ( f n l b ( s a ) ) : h b $ = c h r $ ( f n h b ( s a ) ) : n b $ = c h r $ ( n b )p r i n t ! 1 5 , " m - r " ; l b $ ; h b $ ; n b $f o r i = l t o n bg e t ! 1 5 , a $ : i f a $ = n l $ t h e n a $ z r m b $ = m b $ + a $n e x tc l o s e 1 r e t u r n

r e m * s i n g l e - b y t e r e a ds b § = n l $o p e n 1 5 , 8 , 1 5f o r i = l t o n bl b $ = c h r $ ( f n l b ( s a + i - l ) ) : h b $ = c h r $ ( f n h b ( s a + i - l ) )p r i n t i 1 5 , " m - r " ; l b $ ; h b $g e # 1 5 , a $ : i a $ = n l $ t h e n a $ = z r s b $ = s b $ + a $n e x tc l o s e l 5r e t u r n

r e m * h e x - > d e ca = 0 : f o r i = l t o l e n ( a $ ) : b a s c ( m i d $ ( a $ , i , l ) ) - 4 8 : a = a * 1 6 + b + 7 * ( b > 9 ) : n e x tr e t u r n

U L T L TT o p - T e c h I n t e r n a t i o n a l , I n c .

A d v a n c e d C o m p u t e r S y s t e m s

I N D U S T R Y F I R S T L I F E T I M E C O M P U T E R 1L i f e t i m e W a r r a n t y — a v a i l a b l e f o r a n C - 6 4 c o m p u t e r s e r v i c e d a n d / o r s o l d b u s ! !

F l a t S e r v i c e R a t e s F A S T , P r o f e s s i o n a l S e r v i c eF u l l l i n e o C B c o m p u t e r s , p e r i p h e r a l s p a r t s ; C - 6 4 P o w e r S u p p l y w i t h 3 - y r w a r r a n t y ;

1 5 3 1 D a t a s e t t e $ 1 9 . 9 5 ; H a r d - t o - f i n d p a r t s ( S T R - 5 4 0 4 1 ) ; S e r v i c e M a n u a l s ; V I C - 2 0 a n C - 6 4 C a r t r i d g e s T a p e s : $ 3 . 0 0 e a . ; 1 0 f o r $ 2 5 . 0 0 ( " P o t L u c k " N e x c h a n g e s / r e t u r n s ) .V I S A , M A S T E R C A R D , D I S C O V E R , A M E X

O r d e r s O N L Y : F A ( 2 1 5 ) 3 8 9 - 5 9 2 0 o r C A L L ( 8 0 0 ) 8 4 3 - 9 9 0 1N e x t r a c h a r g e s f o r o u r G I s ! W w a n t y o u r b u s i n e s s ! ! !( 2 1 5 ) 3 8 9 - 9 9 0 1 • 1 1 1 2 S D e l a w a r e A v e . , P h i l a d e l p h i a , P 1 9 1 4 7 • ( 2 1 5 ) 3 8 9 - 9 9 0 1

A R T - 1 : c o m p l e t e i n t e r f a c e s y s t e mf o r s e n d a n d r e c e i v e o n C W , R T T Y( B a u d o t A S C I I ) a n d A M T O R , f o r

u s w i t h t h C o m m o d o r e 6 4 / 1 2 8c o m p u t e r . O p e r a t i n g p r o g r a m o d i s k i n c l u d e d . $ 1 9 9 . 0 0

A I R - 1 : c o m p l e t e i n t e r f a c e s y s t e mf o r s e n d a n d r e c e i v e o C W R T T Y( B a u d o t A S C I I ) a n d A M T O R , f o

u s w i t h C o m m o d o r e V I C - 2 0 .O p e r a t i n g p r o g r a m i n R O M . $ 9 9 . 9 5

S W L : r e c e i v e o n l y c a r t r i d g e f o rC W R T T Y ( B a u d o t A S C I I ) f o u s w i t h C o m m o d o r e 6 4 / 1 2 8 . O p e r a t i n gp r o g r a m i n R O M . $ 6 4 . 0 0

A I R D I S K : A n A I R - 1 t y p eo p e r a t i n g p r o g r a m f o u s w i t h y o u r i n t e r f a c eh a r d w a r e . B o t h V I C - 2 0a n d C 6 4 / 1 2 8 p r o g r a m s o no n d i s k . $ 3 9 . 9 5A I R - R O M : C a r t r i d g ev e r s i o n o A I R D I S K f o C 6 4 / 1 2 8 o n l y . $ 5 9 . 9 5

M O R S EC O A C H

M O R S E C O A C H : A C o m p l e t e t e a c h i n ga n d t e s t i n g p r o g r a m f o l e a r n i n gt h M o r s e c o d e i c a r t r i d g e .F o C 6 4 o r C 1 2 8 . $ 4 9 . 9 5V E C S P E C I A L $ 3 9 . 9 5

T h e s e p r o d u c t s f o r m e r l y m a n u f a c t u r e d b A A / C R O L O Oa n G E L E C T R O N I C S

O M A R Y L A N D8 5 2 4 D A K O T A D R I V E , G A I T H E R S B U R G , M 2 0 8 7 7

( 3 0 1 ) 2 5 8 - 7 3 7 3

F a s t e r t h a n S p e e d i n g C a r t r i d g eM o r e P o w e r f u l t h a n a T u r b o R O

I t ' s F a s t , I t ' s C o m p a t i b l e , I t ' s C o m p l e t e , I t ' s . . .

J j f f v M K\ U l t r a - F a s t D i s k O p e r a t i n g S y s t e m f o t h C - 6 4 , S X - 6 4 C - 1 2 8

S p e e d s u p a l d i s k o p e r a t i o n s . L o a d , S a v e , F o r m a t , S c r a t c h , V a l i d a t e , a c c e s sP R G , S E Q , R E U S f i l e s u t 1 5 t i m e s f a s t e r !U s e s n o p o r t s , m e m o r y , o e x t r a c a b l i n g . T h J i f f y O O S R O M s u p g r a d e y o u rc o m p u t e r a n d r i v e ( s ) i n t e r n a l l y f o m a x i m u m s p e e d a n c o m p a t i b i l i t y .G i i a r a n t o e d 1 0 0 % c o m p a t i U o w i t h a l l s o f t w a r o a n d h a r d w a r e . J i f f y O O S s p e e d su t h l o a d i n g a r x l i m e m a l f i l e - a c c e ^B u i l t - i n D O W e d g e p l u s 1 a d d i t i o n a l c o m m a n d s a n c o n v e n i e n c e f e a t u r e si n c l u d i n g o n e - k e y i o a o V s a v e / s c r a t c h , d i r e c t o r y m e n u a n s c r e e n d u m p .E a s y d o - i t - y o u r s e l f i n s t a l l a t i o n . N e l e c t r o n i c s e x p e r i e n c e o s p e c i a l t o o l s r eq u i r e d . I l l u s t r a t e d s t e p - b y - s t e p i n s t r u c t i o n s i n c l u d e d .

A v a i l a b l e f o C - 6 4 , 6 4 C , S X - 6 4 , C - 1 2 8 C - 1 2 8 D ( J i f f y D O S / 1 2 8 s p e e d s u p b o t h 6 a n 1 2 8 m o d e s ) a n d 1 5 4 1 , 1 5 4 1 C , 1 5 4 1 - 1 , 1 5 7 1 , 1 5 8 1 , F S D - 1 & 2 , M S S D - 1 & 2 ,E x c e l 2 0 0 1 , E n h a n c e r 2 0 0 0 , A m t e c h , S w a n , I n d u s & B l u e c h i p d i s k d r i v e s . S y s t e mi n c l u d e s R O M s f o c o m p u t e r a n d i s k d r i v e , s t o c k / J i f f y D O S s w i t c h i n g s y s t e m ,i l l u s t r a t e d i n s t a l l a t i o n i n s t r u c t i o n s , U s e r ' s M a n u a l a n d M o n e y - B a c k G u a r a n t e e .

9 I s s u e 2

Page 28: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 28/84

C 1 2 8 S i m p l e D i s k M o n i t o r

E x t e n d i n g t h b u i l t - i n m o n i t o r

b A n t o n T r e u e n f e l s

T h e r e a r t i m e s ( o f t e n s h o r t l y a f t e r s c r a t c h i n g f i l e r e a l l yd i d n ' t m e a n t o w h e n f i n d i v e r y u s e f u l t h a v e d i s km o n i t o r p r o g r a m h a n d y . U s i n g o n e o t h e s e w i d e l y a v a i l a b l ep r o g r a m s c a e x a m i n e a n d , i w i s h , m o d i f y t h c o n t e n t s o a n d i s k s e c t o r . O t h o t h e r h a n d , f o u n d t h a t m a n y o t h e s ep r o g r a m s w e r e b i g , c l u m s y , r i g i d , a n i n c o n v e n i e n t t o u s e . T h p r o g r a m p r e s e n t e d h e r e w a d e s i g n e d t o v e r c o m e t h e s ep e r c e i v e d p r o b l e m s . A l t h o u g h i p e r h a p s d o e s n o d e v e r yt h i n g t h a t c o u l d p o s s i b l y b w i s h e d f o r , i i r e l a t i v e l y s m a l l ,n i m b l e , f l e x i b l e , a n e a s y t u s e .

d i s k m o n i t o r p r o g r a m m u s t a t l e a s t b a b l e t r e a d , d i s p l a y ,e d i t a n w r i t e d i s k s e c t o r s . T h p r o b l e m s o d i s p l a y a n e d i ti n a r s h a r e d b m o n i t o r p r o g r a m s i g e n e r a l , a n D i s k m o n l 2 8 d e a l s w i t h t h e m b y w e d g i n g i t s e l f i n t o t h m a i nc o m m a n d l o o p o t h C 1 2 8 ' s b u i l t - i n m a c h i n e l a n g u a g em o n i t o r . T h i s r e d u c e s d i s p l a y a n e d i t i n g t p r o b l e m s t h a th a v e a l r e a d y b e e n s o l v e d ( a l w a y s u s e f u l p r o g r a m m i n g t e c hn i q u e ) .

A b o n u s e s D i s k m o n l 2 8 g a i n s u s e o f t h d i s k w e d g e c o m a n d a n t h a b i l i t y t o e x a m i n e a n m o d i f y s e c t o r s b d i s a ss e m b l y a n d a s s e m b l y a w e l l a b s i m p l e m e m o r y d u m p . A t e e m p l o y i n g s m u c h o t h p o w e r o t h b u i l t - i n m o n i t o r ,a b o u t a l t h a t i l e f t f o D i s k m o n l 2 8 t c o n c e r n i t s e l f w i t h i t h p r o p e r r e a d i n g a n w r i t i n g o d i s k s e c t o r s t a n f r o m t h C 1 2 8 ' m e m o r y .

U s i n g t h p r o g r a m

D i s k m o n l 2 8 m a b l o a d e d a n i n s t a l l e d f r o m e i t h e r B A S I C7 . o t h b u i l t - i n m o n i t o r . F r o m B A S I C : b l o a d" d i s k m o n l 2 8 " , s y d e c ( " 1 3 0 0 " ) , m o n i t o r . F r o m t h m o n it o r : " d i s k m o n l 2 8 " , 1 3 0 0 .

O n c e i n s t a l l e d , t h p r o g r a m f u n c t i o n s a a e x t e n s i o n o t h C 1 2 8 ' s b u i l t - i n m o n i t o r . T h e r e a r f o u r n e w c o m m a n d s ( i a d d i t i o n t a l t h n o r m a l o n e s ) :

/ [ < t r a c k > < s e c t o r > ]/ [ < t r a c k > < s e c t o r > ]/ < d e v i c e > [ < d r i v e > ]/

r e a d s e c t o rw r i t e s e c t o rs e d e v i c e a n d r i v e n u m b e r sd i s a b l e d i s k m o n i t o r w e d g e

A l p a r a m e t e r s a r n u m e r i c a n ( s i n c e b u i l t - i n m o n i t o r R O r o u t i n e i u s e d t o c o l l e c t t h e m ) m a b s p e c i f i e d i a n c o n v en i e n t b a s e ( h e x a d e c i m a l , d e c i m a l , o c t a l , o b i n a r y ) . S q u a r eb r a c k e t s i n d i c a t e o p t i o n a l p a r a m e t e r s .

T h r e a d c o m m a n d ( / R ) c o p i e s a d i s k s e c t o r i n t o b u f f e r i t h C 1 2 8 ' s m e m o r y . O n c e i t h C 1 2 8 ' s m e m o r y , t h c o n t e n t s o t h s e c t o r m a b d i s p l a y e d i h e x a d e c i m a l a n A S C I I f o r m b u s i n g t h b u i l t - i n m o n i t o r ' s m e m o r y d u m p c o m m a n d ( m ) . T h b u f f e r i l o c a t e d a $ B 0 0 i R A b a n k 0 s t h c o m m a n d t o d i sp l a y t h e n t i r e s e c t o r i b O b f ( $ B 0 0 i t h a u t o b o o t d i s ks e c t o r b u f f e r . N o t e t h a t t h i s p a g e o m e m o r y i a l s o u s e d f o r t h ec a s s e t t e b u f f e r , a n s i i n c o m p a t i b l e w i t h a n r o u t i n e s w h i c hm i g h t w a n t t r e s i d e t h e r e ) . I f d e s i r e d , t h m e m o r y d i s p l a y m a y ,o c o u r s e , b e d i t e d i t h n o r m a l m a n n e r . A l t e r a t i o n s m a d e i t h i s w a a f f e c t o n l y t h c o p y o t h e s e c t o r i t h C 1 2 8 ' sm e m o r y h o w e v e r , a n d n c h a n g e s a r m a d e t a n a c t u a l d i s ks e c t o r u n t i l t h c o n t e n t s o t h d i s k s e c t o r b u f f e r a r e d e l i b e r a t e l yc o p i e d b a c k t d i s k u s i n g t h w r i t e c o m m a n d ( / W ) .

B o t h t h r e a d a n w r i t e c o m m a n d s m a o p t i o n a l l y b f o l o w e d b y d i s k t r a c k a n s e c t o r n u m b e r s . I t r a c k a n s e c t o ra r e s p e c i f i e d t h e y a r c h e c k e d o n l y t s e i t h e y a r e a c h i t h r a n g e 0 - 9 9 , w h i c h a l l o w s t h p r o g r a m t c r e a t e s y n t a c t ic a l l y l e g a l d i r e c t a c c e s s c o m m a n d . I i l e f t u t d r i v e ' s D O t c o m p l a i n i t h c o m m a n d c a n n o t b e c o m p l i e d w i t h ( u s u a l l yb e c a u s e t h D O d o e s n o r e c o g n i z e t h e x i s t e n c e o t h r q u e s t e d t r a c k a n s e c t o r ) . T h i s a p p r o a c h i d e s i g n e d t a v o i dh a v i n g t h a r d c o d e i n t o t h p r o g r a m t h i n t e r n a l a r r a n g e m e n to a n p a s t , p r e s e n t o f u t u r e d i s k f o r m a t b t a k i n g a d v a n t a g eo t h e u s e r ' s k n o w l e d g e a n t h D O S ' i n t e l l i g e n c e .

I t r a c k a n s e c t o r a r n o s p e c i f i e d , b o t h t h r e a d a n w r i t ec o m m a n d s u s d e f a u l t t r a c k a n s e c t o r v a l u e s . I n t h e c a s e o t h r e a d c o m m a n d t h c o n t e n t s o t h f i r s t t w b y t e s o t h d i s k s e t o b u f f e r a r t a k e n t b t h t r a c k a n s e c t o r t r e a d . T h i s i b a s e d o n t w o a s s u m p t i o n s : t h a t t h c o n t e n t s o t h b u f f e r r e p r es e n t o n s e c t o r i s e r i e s o s e c t o r s l o g i c a l l y l i n k e d t o g e t h e r i

s i n g l e f i l e , a n t h a t t h f i r s t t w b y t e s i t h e b u f f e r r e p r e s e n tt h l i n k t t h e t r a c k a n s e c t o r o t h n e x t s e c t o r o t h f i l e .T h e s e a s s u m p t i o n s a r o f t e n t r u e , m a k i n g i p o s s i b l e t o e a s i l yt r a c e f o r w a r d t h r o u g h t h s y s t e m o l i n k s t y i n g f i l e s t o g e t h e ru n d e r C o m m o d o r e D O S . P a r t i c u l a r c o n d i t i o n s u n d e r w h i c h t h

2 T r a n s a c t o

Page 29: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 29/84

a s s u m p t i o n s a r u n t r u e i n c l u d e r e a c h i n g t h l a s t s e c t o r o f i l ea n b e f o r e t h p r o g r a m h a s r e a d i t f i r s t s e c t o r .

T h w r i t e c o m m a n d d e f a u l t s t u s i n g t h v a l u e s f o u n d i n t h ec u r r e n t t r a c k a n c u r r e n t s e c t o r v a r i a b l e s m a i n t a i n e d b t h p r o g r a m . S i n c e t h e s e v a r i a b l e s w i l l u s u a l l y h a v e l a s t b e e n s e b t h m o s t r e c e n t r e a d c o m m a n d , t h e d e f a u l t a c t i o n n o r m a l l ya m o u n t s t p u t t i n g t h ( p o s s i b l y m o d i f i e d ) s e c t o r c u r r e n t l y i t h d i s k s e c t o r b u f f e r b a c k w h e r e i c a m e f r o m .

T h / c o m m a n d i u s e d t s e t h d e v i c e a n d r i v e t w h i c ht h p r o g r a m w i l l r e a d a n w r i t e . T h p r o g r a m d e f a u l t s t d e v i c e 8 d r i v e 0 T h e / Q c o m m a n d r e s e t s t h b u i l t - i n m o n it o r ' s c o m m a n d i n d i r e c t v e c t o r t t h v a l u e i h a w h e n t h d i s k m o n i t o r w a f i r s t i n s t a l l e d , w h i c h e f f e c t i v e l y d i s a b l e s t h ed i s k m o n i t o r .

A b o u t t h p r o g r a m

T h m a i n c o m m a n d l o o p o f t h b u i l t - i n m o n i t o r i d e s i g n e d t a c c e p t a l i n e o i n p u t , f i n d t h e f i r s t n o n - s p a c e c h a r a c t e r o t h l i n e , a n t h e n j u m p t h r o u g h a i n d i r e c t v e c t o r . N o r m a l l y t h i sv e c t o r p o i n t s t r o u t i n e w h i c h t r i e s t m a t c h t h a t f i r s t c h a r a ct e r t o t h c o m m a n d s t h m o n i t o r k n o w s . D i s k m o n l 2 8 r e - p o i n t st h i n d i r e c t v e c t o r t i t o w m a t c h r o u t i n e , w h i c h c h e c k s i t h c h a r a c t e r f o u n d i t h d i s k m o n i t o r w e d g e c h a r a c t e r ( / ) . I n o t ,c o n t r o l p a s s e s t t h o r i g i n a l c o m m a n d m a t c h r o u t i n e .

I i i t h w e d g e c h a r a c t e r , t h p r o g r a m a t t e m p t s t m a t c ht h s e c o n d n o n - s p a c e c h a r a c t e r o t h i n p u t l i n e t o k n o w nd i s k m o n i t o r c o m m a n d , a n r e p o r t s a e r r o r i i c a n n o t d s ( t w o - c h a r a c t e r r a t h e r t h a n o n e - c h a r a c t e r c o m m a n d s a r r q u i r e d m a i n l y b e c a u s e t h l e t t e r i a l r e a d y e m p l o y e d b t h b u i l t - i n m o n i t o r f o i t R e g i s t e r c o m m a n d a n d n o a l t e r n at i v e o n e - c h a r a c t e r c o m m a n d s e e m e d t m a k e a m u c hi n t u i t i v e s e n s e a / R e a d ) .

D i s k m o n l 2 8 o p e n s a n c l o s e s d i r e c t a c c e s s c h a n n e l t d r i v e f o e v e r y r e a d o w r i t e a t t e m p t r a t h e r t h a n o p e n i n g a n dc l o s i n g o n c e f o e a c h s e s s i o n w i t h d i s k . T h t i m e c o s t o d i n t h i s i v i r t u a l l y u n n o t i c e a b l e , a n i a c t u a l l y s a v e s c o d es p a c e s i n c e s e s s i o n m a n a g e m e n t c o m m a n d s ( e g . , c h a n g i n gd i s k s ) a r e n o n e e d e d .

H i g h - l e v e l K e r n e l f i l e r o u t i n e s a r e u s e d e x c l u s i v e l y r a t h e r t h a ng o i n g t t h l o w - l e v e l K e r n e l s e r i a l b u r o u t i n e s . T h e r e a r n u m b e r o f m a s s - s t o r a g e d e v i c e s w h i c h p a t c h t h e m s e l v e s i n t ot h i n d i r e c t v e c t o r s o t h h i g h - l e v e l r o u t i n e s , a n t h p r o g r a ms h o u l d w o r k w i t h a n o t h e m w h i c h r e c o g n i z e t h n o r m a lC o m m o d o r e D O d i r e c t a c c e s s c o m m a n d s ( e g . , a S F D - 1 0 0 1d r i v e w i t h p a r a l l e l c a b l e s h o u l d , b u a R E w i t h a C o m o d o r e R A M D O S p r o g r a m w o n ' t ) . [ R a m d o s d o e s n o i m p l em e n t t r a c k a n s e c t o r m e t h o d o d a t a s t o r a g e . E d . ]

G e t t i n g i a n g e t t i n g o u

I t i s u n f o r t u n a t e t h a t a f t e r h a v i n g p r o v i d e d d o c u m e n t e dm e t h o d o i n t e r c e p t i n g t h b u i l t - i n m o n i t o r , C o m m o d o r e d i

n o p r o v i d e d o c u m e n t e d m e t h o d o r e t u r n i n g t i t T h p o i n to i n t e r c e p t i o n i t h c o m m a n d d i s p a t c h r o u t i n e . I n t h e b u i l t - i nm o n i t o r t h i s r o u t i n e i a t h s a m e l e v e l a s t h m a i n l o o p , s c a l l s f r o m a n d r e t u r n s t t h m a i n l o o p a r h a n d l e d a d i r e c tj u m p s ( a o p p o s e d t b a s i c 7 . 0 ' s c o m m a n d d i s p a t c h r o u t i n e ,w h i c h i s u b r o u t i n e o t h m a i n l o o p . A f t e r b e i n g i n t e r c e p te d c o n t r o l c a b r e t u r n e d t t h m a i n l o o p s i m p l y b e x e c u ti n a n R T S i n s t r u c t i o n ) .

T h i s i w o r k a b l e , i n o e x a c t l y a c a d e m i c a l l y s a n c t i o n e d ,m e t h o d o d o i n g t h i n g s . H o w e v e r i w o u l d b h a n d i e r i C o m o d o r e h a p r o v i d e d a n o t h e r e n t r y i t h j u m p t a b l e a t h s t a r to t h b u i l t - i n m o n i t o r ' s R O M ; o n t h a t p o i n t e d t t h s t a r t o t h m a i n c o m m a n d l o o p . T h i s w o u l d m a k e r e t u r n i n g a f t e r i n t e r c e pt i o n l e s s o f r i s k y b u s i n e s s . A i i s D i s k m o n l 2 8 i v u l n e r a b l et R O r e v i s i o n ( i f o p e n n y , i f o p o u n d t h d e c i s i o nt u s R O r o u t i n e t c o l l e c t n u m e r i c p a r a m e t e r s m u s t b b l a m e d s o l e l y o d e s i r e t s a v e a b o u t 8 b y t e s o c o d e . I t i sj u s t a s v u l n e r a b l e t R O r e v i s i o n s , a n t h e r e i r e a l l y n e x c u s ef o i t s i m p l y y i e l d e d t t e m p t a t i o n o t h i s o n " a l o n g a h a v e t u s a u n d o c u m e n t e d r e t u r n c a l l a n y w a y . . . " ) .

O b s e r v a t i o n s a n p o s s i b i l i t i e s

c o u p l e o f i n a l o b s e r v a t i o n s . T h f i r s t i t h a t D i s k m o n l 2 8 i l e s s t h a n 7 0 b y t e s l o n g , a n t h b u i l t - i n m o n i t o r ' s 4 R O c o n t a i n s o v e r 1 1 0 0 u n u s e d b y t e s . p o s s i b l e u s e o f t h i s e m p t ys p a c e i m m e d i a t e l y s u g g e s t s i t s e l f ( a t l e a s t t m e ) ; a l t h o u g ht h i s m i g h t b e o m o r e i n t e r e s t t o h o b b y i s t s t h a n t C o m m o d o r ei t s e l f . . . . T h p o s s i b i l i t y i l e f t o p e n b y m a k i n g s u r e t h a t , a s i d ef r o m t h p r o g r a m c o d e a n d d i s k s e c t o r b u f f e r , a l R A u s a g e i c o n f i n e d t a r e a s a l r e a d y u t i l i z e d b t h b u i l t - i n m o n i t o r( m o s t l y v a r i a b l e s a $ 6 0 4 6 8 a n $ A 8 0 - $ A B F , b u a l s o t h e i np u b u f f e r a $ 2 0 0 a n t h e s t a c k p o i n t e r r e g i s t e r s a v e a $ 0 9 ) .

T h o t h e r o b s e r v a t i o n i t h a t t h C 1 2 8 ' s K e r n e l c o n t a i n sl i m i t e d d i r e c t t r a c k a n s e c t o r r e a d a b i l i t y i n t h B O O T C A L Lr o u t i n e a $ F F 5 3 . T h i s r o u t i n e c a r e a d t r a c k 1 s e c t o r o f d i s k i a n d r i v e i n t o t h a u t o b o o t s e c t o r b u f f e r a $ B 0 0 . I w o u l d n ' t t a k e m a n y o t h o v e r 6 0 u n u s e d b y t e s i t h K e r n e l R O p a t c h a r e a t a d r o u t i n e c a p a b l e o r e a d i n g a n w r i t i n g a n t r a c k a n s e c t o r o d i s k i a n d r i v e , a l o n g w i t h

j u m p t a b l e e n t r y t t h r o u t i n e . A l t h o u g h t h u t i l i t y o f s u c hr o u t i n e t a n y t h i n g o t h e r t h a n d i s k m o n i t o r p r o g r a m m i g h tb q u e s t i o n a b l e , i w o u l d o f f e r s l i g h t l y h i g h e r - l e v e l a p p r o a c ht o d i r e c t t r a c k a n s e c t o r r e a d s a n w r i t e s t h a n r e q u i r i n g s u c h

m o n i t o r t b e a w a r e o t h m e s s y d e t a i l s i t s e l f .

L i s t i n g 1 M e r l i n s o u r c e f o D i s k m o n l 2 8

c l 2 8 s i m p l e d i s k m o n i t o rl a s t r e v i s i o n : 0 9 / 2 3 / 8 8

w r i t t e n b a n t o n t r e u e n f e l s5 2 4 8 h o r i z o n d r i v ef r i d l e y , m i n n e s o t a u s a 5 5 4 2 16 1 2 / 5 7 2 - 8 2 2 9

p r o g r a m c o n s t a n t s

9 I s s u e 2

Page 30: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 30/84

a s m a d r = $ 1 3 0 0 / a s s e m b l y a d d r e s s i n s t a l l

c = $ 0 dc s r = $ l ds p $ 2 q u e = $ 3

d a d f = 1 c m d l f = 1

/ d i r e c t a c c e s s c h a n n e l f i l e t/ c o m m a n d c h a n n e l f i l e t

b n k ! 5 = % 0 0 0 0 0 0 0 0 / b a n k 1 5

p r o g r a m m e m o r y

d u m $ 6 0a d d r d

d e n d

r e a w r i = $ 0 a 9 8

d u $ 0 a b ao l d m o n d c r r d v c d c r r d r v d c r r t r k d c r r s c t d

d e n d

u s

; ( m o n i t o r m e m o r y )/ p o i n t e r

/ r e a d / w r i t e f l a g

; ( m o n i t o r m e m o r y )/ o l d c o m m a n d v e c t o r/ c u r r e n t d e v i c e/ c u r r e n t d r i v e/ c u r r e n t t r a c k/ c u r r e n t s e c t o r

d s k b u f = $ 0 b 0 0 / d i s k b u f f e r ( b o o t b l o c k b u f f e r )

m o n i t o r m e m o r y u s e

s t k p t r $ 0 a c $ 6 m o n p t r = $ 7 a

b u f = $ 0 2 0 0

i m o n $ 0 3 2 e

/ s t a c k p o i n t e r s a v e/ n u m e r i c a c c u m u l a t o r/ i n p u t b u f f e r p o i n t e r

/ i n p u t b u f f e r

/ c o m m a n d e x e c u t e v e c t o r

m s g b u f = $ 0 a 8 0 / d i s k c o m m a n d b u f f e r

m o n i t o r r o m

/ m o n i t o r m a i n l o o p/ g e t n u m e r i c p a r a m e t e r

m n l o o p =n u m p r m = $ b 7 c e

k e r n e l v e c t o r s

c l s a l l = $ f f 4 a / d o s e a l f i l e s o n d e v i c es e t b n k $ £ £ 6 8 / s e t i / b a n kp r i m m = $ £ f 7 d / p r i n t i m m e d i a t e

s e t l f s = $ f f b as e t n a m = $ f f b do p e n $ f f c 0c h k i n = $ f f c 6c h k o u t $ f f c 9

/ s e t f i l e t , d e v i c e , c o m m a n d/ s e t f i l e n a m e/ o p e n f i l e/ s e t i n p u t f i l e/ s e t o u t p u t f i l e

c l r c h n = $ f f c c / s e t d e f a u l t i / f i l e sc h r o u t $ f f d 2 / o u t p u t b y t eg e t i n = $ f f e 4 / i n p u t b y t e

h a r d w a r e r e g i s t e r s

m m u c r = $ £ £ 0 0 / m e m o r y c o n f i g u r a t i o n

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

o r g a s m a d r

i n s t a l I d a m m u c rp h I d a t b n k l 5s t a m m u c rl d # 3 - 1I d # $ 0 0

] b b l s t c r r d r v , x / c u r r e n t d r i v e , t r a c k , s e c t o rs t a d s k b u f , x / f o r / r o r / w w i t h o u t p a r a m sd e b p ] b b lI d # s t a c r r d v cc l j s s e t v c t / s e t w e d g e v e c t o rj s p r i m md f b c r , c rt x ' d i s k m o n l 2 8 v O 9 2 3 8 8 'd f c t x ' b a n t o n t r e u e n f e l s 'd f c r , 0 0p l s t m m u c rr t

l o o k f o r d i s k m o n i t o r c o m m a n d

d s k m o n c m p t ' / ' / w e d g e t o k e n ?b e m o n t o k ; b : y e sj m ( o l d m o n ) / t n o r m a l h a n d l e r

m o n t o k j s b e l d

g e t s p c / l o o k f o r m o n i t o r c o m m a n dr e t e r rt m o n a d r - m o n c m d - 1

] b b l c m m o n c m d , xb e d e b p

r e t e r r l d xt x

h a v c m d / b i f o u n d c o m m a n d

] b b ls t k p t r / r e s t o r e s t a c k

j s p r i m m / r e p o r t p r o b l e md f c s r , q u e , $ 0 0

r e t m o n j m m n l o o p / b a c k t o m a i n l o o p

f o u n d c o m m a n d

h a v c m d t x aa s t a I d p h I d p h r t

m o n i t o r

m o n c m d t x t

m o n a d r d ad d d

e x e c u t e

e x q u i t s e cj s j m

m o n a d r + l , x

m o n a d r , x

c o m m a n d s

' q r w t '

e x q u i t - 1e x r e a d - 1e x w r i t - 1e x d e v c - 1

j u i t

s e t v c tr e t m o n

T r a n s a c t o r

Page 31: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 31/84

s e t i n d i r e c t v e c t o r ( s )

s e t v c t] b b l

:

r p l v c t

l d x # 2 - 1I d a o l d m o n , xb c : I d i m o n , xs t o l d m o n , xI d r p l v c t , xs t a i m o n , xd e b p ] b b lr t

d a d s k m o n

e x e c u t e r e a d / w r i t e

e x r e a d

e x w r i t

:

o p e n

o p n d i r

:

d a c n a m

o p e n

o p n f i l

:

I d V I d f $ 2 I d f ' 2 1s t a r e a v r ij s t r k s c tj s m a k d a cj s d s f i lj s o p n d i rb c : j s r r w s e c tj s d s f i lj m p r e t m o n

d i r e c t a c c e s s

I d # $ 0 0j s s e t n a mI d a f c n d l fj s o p n f i lb c : l d x i < d a c n a ml d y i > d a c n a mI d # j s s e t n a mI d I d a d fj s o p n f i lr t

t x ' #

d i s k f i l e

t a l d c r r d v cj s r s e t l f sI d a # $ 0 0t a j s r s e t b n kj s o p e nb c : j s d i s k s tb c : j s d s f i ls e r t

c l o s e d i s k f i l e s

d s f i l I d a c r r d v cj s c l s a l lr t

; b : r e p l a c e o l d v e c t o r; s a v e o l d v e c t o r

; s e t n e w v e c t o r

; ' u l '

; ' u 2 '; r e a d / w r i t e f l a g; g e t t r a c k / s e c t o r; m a k e c o m m a n d; c l o s e f i l e s o n d e v i c e; o p e n d i r e c t a c c e s s f i l e; b : c a n ' t o p e n; r e a d / w r i t e s e c t o r

d i s k f i l e

/ c o m m a n d f i l e

; b : e r r o r

/ d i r e c t a c c e s s f i l e

/ s e c o n d a r y a d d r e s s

/ c h e c k s t a t u s m e s s a g e/ b : o k/ d o s e f i l e s

; c l o s e e v e r y t h i n g o n d e v i c e

r e a d / w r i t e s e c t o r

r w s e c t

:

:

c o p y

r d d b u f

] b b l

* c o p y

w r d b u f

] b b l

m a k e

m a k d a c] b b l

s e n d

s n d b u f

I d a r e a w r ic m p f ' 2 'b e q : 2j s s n d b u fb c : j s r d d b u fr t

j s w r d b u fb c : j s s n d b u fr t

d i s k b u f f e r t

l d x f d a c l fj s c h k i nb c : l d # j s g e t i ns t a d s k b u f , yi n b n ] b b lj s c l r c h nd r t

/ w r i t e ?; b : y e s/ c o m m a n d r e a d; b : e r r o r/ r e a d b u f f e r

/ w r i t e b u f f e r

/ c o m m a n d w r i t e

c o m p u t e r

/ ' t a l k '

/ i n p u t b y t e

/ ' u n t a l k '

c o m p u t e r t o d i s k b u f f e r

l d x t < d c p t r Ol d y t > d c p t r Oj s d s k c m db c : l d t d a d fj s c h k o u tl d t I d a d s k b u f , yj s c h r o u ti n b n ] b b lj s r c l r c h nc l r t

d i r e c t a c c e s s

l d x Hi n I d d c r e a d , xs t m s g b u f , xb n ] b b lI d a r e a w r is t a m s g b u f + 1I d a c r r d r vo r a # $ 3 0s t a m s g b u f + 6I d a c r r t r kj s h e x d e cs t m s g b u f + 8s t a m s g b u f + 9I d a c r r s c tj s r h e x d e cs t x m s g b u f + 1 1s t m s g b u f + 1 2r t

c o m m a n d i t h

l d x t < m s g b u fl d y t > m s g b u f

/ b u f f e r p o i n t e r t s t

/ ' l i s t e n '

/ o u t p u t b y t e

/ ' u n l i s t e n '

c o m m a n d

/ c o p y c o m m a n d t e m p l a t e

/ s e t c o m m a n d

/ s e t d r i v e

/ s e t t r a c k

/ s e t s e c t o r

m e s s a g e b u f f e r

9 I s s u e 2

Page 32: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 32/84

s e n d d i s k c o m m a n d w i t h e r r o r c h e c k

s n d c m d j s d s k c m db c : j s r d i s k s t

: r t

s e n d d i s k c o m m a n d

d s k c m d s t x a d d rs t y a d d r + 1l d f c m d l fj s r c h k o u t / ' l i s t e n 'b c : ; b : e r r o rl d ! I d ( a d d r ) , y / f i r s t c h a r

] b b l j s r c h r o u ti n I d a ( a d d r ) , yb n ] b b lj s d r c h n / ' u n l i s t e n 'c l

: r t

d i s k c o m m a n d m e s s a g e sd c r e a d t x t ' u l : 1 3 , 0 , ld c p t r O t x t ' b - p : 1 3 , 0 '

c h e c k d i s k s t a t u s

d i s k s t l d x f c n d l fj s r c h k i nb c : j s g e t i nc m p ! ' 2 'b c : j s p r i m md f c r , $ 0 0

] b b l j s r c h r o u tj s r g e t i nc m j j c rb n ] b b l

: p h j s d r c h np i

: r t

e x e c u t e d e v i c e !

e x d e v c j s g e t b y tb c n u m e r rc m b c n u m e r rc m # 3 0 + 1b c s n u m e r rs t a c r r d v cj s g e t b y tb c : c m p f 1 + 1b c n u m e r rs t c r r d r v

: j m p r e t m o n

D l , 0 0 ' , 0 0' , 0 0

/ ' t a l k '; b : e r r o r/ f i r s t b y t e o f s t a t u s m e s s a g e/ i t h i s a e r r o r m e s s a g e ?; b : n o

/ d i s p l a y e r r o r m e s s a g e

/ s e t s c a r r y w h e n t r u e

/ ' u n t a l k '

/ g e t d e v i c e !; b : n o t f o u n d/ c h e c k s e r i a l b u s d e v i c e !

; 3 i b a d n u m b e r

/ g e t d r i v e !; b : n o t f o u n d; o

c o n v e r t b y t e t o a s c i i d e c i m a l

h e x d e c c m p # 9 9 + 1b c n u m e r rl d x ! ' 0 ' - ls e

/ w o r k s f o r 0 - 9 9; b : t o o b i

] b b l i n xs b b c a d r t

n ] b b l! ' 0 ' + 1 0

g e t r a c k a n d s e c t o r

t r k s c t j s b c s t j s b c

n u m e r r j m

t k s l I d ac m b e I d s t I d

t k s 2 s t at k s 3 r t

g e b y t e

g e t b y t j s b c I d b n I d b n I d

: r t

g e t b y tt k s lc r r t r kg e t b y tt k s 2r e t e r r

r e a w r i! ' 2 't k s 3d s k b u fc r r t r kd s k b u f + 1c r r s c t

v a l u e

g e t n u m:

a c c l + 2n u m e r ra c c l + 1n u m e r ra c c l

g e n u m e r i c v a l u e

g e t n u m j s b c b n s e

: p h j s b n p i r t

c h a r a c t e ]

g o t d l m d e g e t d l m j s

b e c m b e c m

: r t

g e t s p c j s b e c m b e

: r t

g e t c h r l d x

n u m p r mn u m e r r:

g o t d l mn u m e r r

f e t c h e s

m o n p t rg e t c h r:

! s p c:

I g e t c h r: ! s p cg e t s p c

m o n p t rI d b u f , xb e c m b e c m

b e i n : r t

: ! ' : ':

! q u e:

m o n p t r

/ g e t t r a c k !; b : n o t f o u n d

/ g e t s e c t o r !/ b : f o u n d

/ w r i t e ?; b : y e s u s e c u r r e n t v a l u e s/ f o l l o w l i n k t o n e x t s e c t o r

/ g e t n u m b e r; b : n o n u m b e r

/ b : t o o b i g

/ g e t n u m e r i c p a r a m e t e r; b : t o o b i ; b : f o u n d n u m b e r/ f l a g n o t f o u n d/ s a v e f l a g/ c h e c k l a s t c h a r; b : n o t l e g a l t e r m i n a t o r

; b : e n d o f i n p u t/ c h e c k f o f i e l d s e p a r a t o r s

; b : e n d o i n p u t

; b : e a t s p a c e s

; b : e n d o l i n e/ c h e c k f o o t h e r t e r m i n a t o r s

/ n e x t c h a r

T r a n s a c t o

Page 33: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 33/84

L i s t i n g 2 B A S I C g e n e r a t o r f o r ' d i s k m o n l l S . o f

J P 1 0 0 r e m g e n e r a t o r f o r " d i s k m o n l 2 8 . o "N 1 1 n $ = " d i s k m o n l 2 8 . o " : r e m n a m e o p r o g r a m0 1 1 2 0 n d = 6 4 8 : s a = 4 8 6 4 : c h = 6 5 5 7 4

( f o r l i n e s 1 3 0 - 2 6 0 , s e e t h e s t a n d a r d g e n e r a t o r o p a g e 5

M 1 0 0 0H P 1 0 1 0K 1 0 2 0D 1 0 3 0J G 1 0 4 0K 1 0 5 0P I 1 0 6 0O 1 0 7 0F N 1 0 8 0I N 1 0 9 0O 1 1 0 0F 1 1 1 0P 1 1 2 0

P 1 1 3 0K 1 1 4 0A P 1 1 5 0N 1 1 6 0L P 1 1 7 0D 1 1 8 0E C 1 1 9 0P 1 2 0 0A 1 2 1 0H O 1 2 2 0A 1 2 3 0F F 1 2 4 0J F 1 2 5 0H 1 2 6 0B I 1 2 7 0O 1 2 8 0L 1 2 9 0C E 1 3 0 0H 1 3 1 0J F 1 3 2 0P 1 3 3 0D 1 3 4 0E 1 3 5 0D 1 3 6 0E l 1 3 7 0E 1 3 8 0A 1 3 9 0O 1 4 0 0A 1 4 1 0E 1 4 2 0D 1 4 3 0D 1 4 4 0N 1 4 5 0I M 1 4 6 0H L 1 4 7 0M 1 4 8 0F 1 4 9 0L C 1 5 0 0M 1 5 1 0H 1 5 2 0M 1 5 3 0

8 4 7 6 9 6

7 6 1 9 8 2

d a t a 1 7 3 ,d a t a 2 5 5 ,d a t a 1 5 7 ,d a t a 1 4 1 ,d a t a 1 2 5 ,d a t a 7 7 d a t a 4 8 d a t a 8 9 d a t ad a t ad a t ad a t a 3 2 d a t a 1 2 7 ,

d a t a 9 d a t ad a t ad a t ad a t a 1 9 d a t a 1 1 2 ,d a t a 9 d a t a 1 6 9 ,d a t a 9 6 d a t a 1 4 1 ,d a t a 2 0 d a t a 6 d a t a 1 1 2 ,d a t a 1 5 d a t a 1 6 0 ,d a t a 1 3 d a t a 1 8 8 ,d a t a 3 2 d a t a 3 2 d a t a 5 6 d a t a 9 6 d a t a 3 2 d a t a 9 6 d a t a 2 0 d a t a 1 5 d a t a 1 1 d a t a 9 6 d a t a 1 7 6 ,d a t a 0 d a t a 2 0 8 ,d a t a 2 5 5 ,d a t a 2 0 8 ,d a t a 1 7 3 ,d a t a 1 7 3 ,d a t a 1 0 d a t a 1 1 d a t a 9 6 d a t a 1 7 6 ,d a t a 1 3 2 ,d a t a 1 6 d a t a 2 0 0 ,

0 2 5 5 ,1 6 2 , 2

0 1 1 1 8 8 , 1 0 2 5 5 , 1 3

7 9 , 7 8 ,5 7 5 0 3 2 , 6 5 ,8 2 6 9 8 3 , 1 3 ,

2 0 1 , 4 7 1 0 8 , 2 1

1 9 2 4 0 ,1 5 4 , 3 2 1 3 9 , 1 7 6 ,

7 2 1 8 9 ,8 7 3 5

2 3 5 , 2 0 1 9 1 6 2 ,

1 8 9 , 4 6 1 9 1 5 7 ,8 1 , 1 9 ,

1 5 2 , 1 0 3 2 2 3 2 9 1 9 1 6 9 ,3 2 2 3 0 ,1 9 1 6 9 ,3 2 2 3 0 ,1 0 , 3 2 ,

1 0 4 , 2 5 5 ,2 0 1 , 2 0

9 6 1 7 3 ,1 7 3 , 1 5 2 ,1 3 7 , 2 0

3 2 , 5 7 ,9 6 1 6 2 ,

1 6 0 , 0 2 0 0 , 2 0 8 ,1 6 2 , 1 9 2 ,

2 0 , 1 6 2 ,1 8 5 , 0 2 4 7 , 3 2 2 3 2 , 1 8 9 ,2 4 7 , 1 7 3 ,1 8 9 , 1 0 1 9 0 , 1 0 1 4 1 , 1 3 7 ,

2 1 1 4 2 ,1 6 2 , 1 2 8 ,

3 3 2 9 7 1 6 2 ,

1 6 0 , 0 1 7 7 , 9 6

7 2 1 6 9 , 0 1 6 9 , 0 1 5 7 ,2 0 2 , 1 6 2 4 7 ,

2 4 , 3 2 , 1 4 6 ,1 3 , 6 8 , 7 3 ,4 9 5 0 , 5 6 ,5 1 , 5 6 , 5 6 ,7 8 , 8 4 , 7 9 ,8 5 , 6 9 , 7 8 ,

0 1 0 4 , 1 4 1 ,2 4 0 , 3 1 0 8 ,2 4 0 , 1 0 1 6 2 ,

1 5 2 0 2 , 1 6 1 2 5 , 2 5 5 , 2 9 ,1 3 8 , 1 0 , 1 7 0 ,1 3 1 , 1 9 , 7 2 ,1 3 8 , 1 9 1 7 0 ,

5 6 , 3 2 , 1 4 6 ,1 1 8 9 , 1 8 6 ,3 1 5 7 , 1 8 6 ,

4 6 3 2 0 2 ,1 6 9 , 4 9 , 4 4 ,

3 2 2 6 , 2 1 ,2 0 3 2 2 0 2 ,2 0 3 2 2

0 3 2 1 8 9 ,1 9 1 7 6 , 1 4

1 3 2 1 8 9 ,1 9 , 9 6 , 3 5 ,

1 8 6 , 2 5 5 , 1 6 9 ,3 2 1 9 2 , 2 5 5 ,

1 4 4 , 4 3 2 1 8 8 , 1 0 , 3 2 ,

1 0 2 0 1 , 5 0 1 7 6 , 3 3 2

2 0 1 7 6 , 3 1 3 3 2 1 9 8 ,3 2 2 2 8 , 2 5 5 ,

2 4 7 , 3 2 2 0 4 ,1 6 0 , 2 0 3 2

1 3 , 3 2 , 2 0 1 ,1 1 , 3 2 , 2 1 0 ,

2 0 4 , 2 5 5 , 2 4 1 7 8 , 2 0 1 5 7 ,1 5 2 , 1 0 1 4 1 ,

9 4 8 1 4 1 ,3 2 , 1 1 , 2 1 ,1 0 1 7 3 , 1 9 1 ,

1 3 9 , 1 0 1 4 1 ,1 6 0 , 1 0 , 3 2 ,2 0 1 , 2 0 , 9 6 ,

1 5 , 3 2 , 2 0 1 ,1 7 7 , 9 6 , 3 2 ,2 0 8 , 2 4 8 , 3 2

1 1 4 1 ,1 8 9 ,1 6 9 ,

1 9 3 8 3 7 3 2 8 6 1 3 6 7 8 3 7 0 , 6 9

0 2 5 1 8 6 , 1

3 2 2 2 4 8 , 1 6

6 3 , 01 8 9 , 1 3

9 6 8 1 9 1 7 1 9 7 1 0 1 7 1 0 1 8 1 6 2 3

1 6 9 , 5 3 2 8 1 9 1 7 2 0 7

2 5 5 , 1 6 1 6 2 , 2 2 2 5 5 , 1 6 1 6 8 , 1 7

0 1 7 1 7 6 ,

2 2 7 4 2 5

2 4 0 ,3 4 2 3 2 1 3

2 5 5 , 1 7 1 5 3 , 02 5 5 , 2 1 5 0 , 2 2 5 5 , 1 6 2 5 5 , 2 0

9 6 1 6 1 2 8 , 1 1 2 9 , 1 1 3 4 , 1 1 4 2 , 1 3

1 0 3 1 4 0 , 1 1 5 0 , 2 1 3 4 , 9 2 5 5 , 1 7 2 1 0 , 2 5 2 0 4 , 2 5

E 1 5 4 0J D 1 5 5 0M 1 5 6 0N 1 5 7 0I F 1 5 8 0K 1 5 9 0L I 1 6 0 0H 1 6 1 0M 1 6 2 0M 1 6 3 0O 1 6 4 0K 1 6 5 0C 1 6 6 0K 1 6 7 0B 1 6 8 0B 1 6 9 0O 1 7 0 0N 1 7 1 0A 1 7 2 0E 1 7 3 0H 1 7 4 0N 1 7 5 0P 1 7 6 0M P 1 7 7 0M 1 7 8 0P 1 7 9 0C B 1 8 0 0

d a t a 2 4 d a t a 4 8 d a t a 6 6 d a t a 0 d a t a 3 2 d a t a 1 2 5 ,d a t a 2 2 8 ,d a t a 2 0 4 ,d a t a 5 4 d a t a 4 6 d a t a 7 d a t a 7 6 d a t a 4 7 d a t a 5 8 d a t a 1 9 0 ,d a t a 1 0 3 ,d a t a 1 2 d a t a 1 d a t a 2 1 d a t a 9 7 d a t a 1 8 3 ,d a t a 9 4 d a t a 3 2 d a t a 2 d a t a 4 d a t a 1 8 9 ,d a t a 6

9 6 , 8 5 ,4 4 , 4 8 ,4 5 , 8 0 ,

1 6 2 , 1 5 2 2 8 , 2 5 5 ,2 5 5 , 1 3 2 5 5 , 2 0 1 ,2 5 5 , 4 0 2 0 1 , 4 1 4 1 , 1 8 8 ,2 0 1 , 2 1 1 2 , 1 9

5 6 2 3 2 ,9 6 , 3 2 ,1 0 , 3 2 ,1 9 1 7 3 ,

1 7 3 , 0 1 1 1 4 1 ,

1 7 6 , 1 0 2 0 8 , 2 2 0 ,1 7 6 , 2 1 2 ,

2 1 2 0 8 ,1 1 8 , 2 1 2 0 1 , 4 4 2 0 1 , 3 2

0 , 2 ,2 0 1 , 6 3

4 9 5 8 4 9 4 9 4 4 , 4 8 ,5 8 , 4 9 , 5 1 ,3 2 1 9 8 , 2 5 5 ,

2 0 1 , 5 0 1 4 4 ,0 3 2 2 1 0 ,

1 3 2 0 8 , 2 4 6 ,9 6 , 3 2 , 6 2 ,

1 4 4 , 5 0 2 0 1 ,1 0 3 2 6 2

1 7 6 , 3 4 1 4 1 ,2 0 1 , 1 0 0 , 1 7 6 ,2 3 3 , 1 0 1 7 6 ,

6 2 , 2 1 , 1 7 6 ,6 2 2 1 1 4 4 ,

1 5 2 , 1 0 2 0 1 ,1 1 1 4 1 , 1 9 0 ,

1 9 1 , 1 0 , 9 6 ,1 6 5 , 9 8 , 2 0 8 ,1 6 5 , 9 6 , 9 6 ,2 0 8 , 1 5 6 2 0 3 , 4 0 , 9 6 ,2 4 0 , 6 2 0 1 ,

9 6 , 3 2 , 1 1 8 ,2 4 0 , 2 4 7 , 9 6

. 2 4 0 , 1 0 2 0 1 ,2 4 0 , 2 2 3 0 ,

5 1 4 4 8 , 04 4 4

1 7 6 , 2 1 5 3

2 5 5 , 3 28 3

2 1 1 7 3 1 1 7 2 1 1 7

1 8 9 , 1 2 4 1 6

2 5 1 , 1 0 1 1 1 4 1 9 7 5 0 2 4 1 0 1 7 3 2 7

2 2 4 , 1 6 3 2 2 0

8 3 1 9 8 , 1 2

3 2 2 4 2 1 2 4

1 6 6 , 1 2 5 8 2 4

1 2 2 , 9

D i a m o n d T e x t E d i t o r

T h F i r s t P r o f e s s i o n a l Q u a l i t y E d i t o rF o r t h e C 1 2 8

L o o k a t h e s e f e a t u r e s ! ! ! !O v e r 1 4 c o m m a n d s i 1 6 b u f f e r .

f i l e b u f f e r s a n d 3 2 r e s i z a b l e , r e l o c a t a b l e w i n d o w s .I n s e r t a n d e l e t e c h a r a c t e r s , w o r d s , l i n e s , a n b l o c k s .P e r f o r m d i f f e r e n t o p e r a t i o n s o t e x t b l o c k s .P o w e r f u l s e a r c h / r e p l a c e w i t h o p e r a t i n g m o d e s .P o w e r f u l m a c r o r e c o r d a n p l a y b a c k f a c i l i t y i n c l u d e s c o n d i t i o n a lI F / T H E N / E L S E m a c r o s .E d i t , d e b u g , a n e x e c u t e B A S I C p r o g r a m s o e d i t t e x t .T e x t m o d e f e a t u r e s w o r d - w r a p o p r o g r a m m e r ' s l i n e - o r i e n t e d m o d e .C o m p a t i b l e w i t h m a n y a s s e m b l e r s a n c o m p i l e r s .B A S I C m o d e a l l o w s y o t u s t h p o w e r o t e x t e d i t o r t c r e a t e , e d i t ,a n d d e b u g B A S I C 7 . p r o g r a m s .S p e c i a l f e a t u r e a l l o w s e d i t o r t r e m a i n c o - r e s i d e n t i R A w i t hC o m m o d o r e ' s H C D 6 5 m a c r o a s s e m b l e r a n l o a d e r . A s s e m b l e , e x e c u t et h l o a d e r , a n s a v e p r o g r a m o b j e c t f i l e s f r o m w i t h i n t h e e d i t o r .C o m p a t i b l e w i t h R A d i s k s o f t w a r e .A u t o - i n d e n t a t i o n . 2 b o o k m a r k s . R e d e f i n a b l e k e y s .M u c h , m u c h m o r e !

( 8 0 - c o l u m n m o d e o n l y )

A v a i l a b l e n o w : O n l y $ 4 2 . 9 5 U o $ 4 9 . 9 5 C a n .S e n d c h e c k o m o n e y o r d e r . ( F o r e i g n a d $ 5 . 0 0 )

P e r s o n a l c h e c k s r e q u i r e a t h r e e - w e e k w a i t i n g p e r i o d .

R o b e r t R o c k e f e l l e r , P . O . B o 1 1 3 , L a n g t o n , O n t . N O 1 G ( 5 1 9 ) 8 7 5 - 2 5 8 0

9 I s s u e 3

Page 34: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 34/84

H C D 6 5 A s s e m b l e r M a c r o s

M a k i n g u s o f a s s e m b l e r p s e u d o - o p s

b y R o b e r t R o c k e f e l l e r

C o m m o d o r e r e c e n t l y p u b l i s h e d t h e i r n e C 1 2 8 H C D 6 5 m a c r oa s s e m b l e r . S i n c e t h H C D 6 5 m a n u a l e x p l a i n s t h e b a s i c f u n c t i o no H C D 6 5 p s e u d o - o p s b u d o e s n o d e m o n s t r a t e h o t u s t h e m , i s e e m s p o s s i b l e t h a t s o m e p o t e n t i a l u s e r s o t h i sa s s e m b l e r m a n o b a b l e t m a k e f u l l u s e o f t h m a c r o c a p ab i l i t y . T h i s a r t i c l e i l l u s t r a t e s f e m a c r o s t h a t t h a u t h o r h a f o u n d u s e f u l .

M a c r o s a r c r e a t e d w i t h t h M A C R O p s e u d o - o p a n t e r m i n a t e dw i t h t h . E N D M p s e u d o - o p . N o t h i n g n e t h e r e . T h M o v e Wm a c r o i a e x a m p l e o s i m p l e m a c r o w h i c h t r a n s f e r s 1 b i t sf r o m o n e v a r i a b l e t a n o t h e r .

T h L o a d W m a c r o i m o r e c o m p l i c a t e d i t h a t i h a t w b e h a v i o u r s . L o a d W v a r l , v a r 2 i e q u i v a l e n t t t h s i m p l eM o v e W m a c r o . W i t h L o a d W v a r l , C O N S T A N T , # t h p r e s e n c eo t h c h a r a c t e r a s t h e t h i r d p a r a m e t e r c a u s e s v a r l t b l o a d e d w i t h a i m m e d i a t e v a l u e . H C D 6 5 ' s a b i l i t y t o t e s t f o b l a n k f i e l d w i t h t h A f n b ( i n o t b l a n k ) p s e u d o - o p m a k e s i p o s s i b l e t c r e a t e m a c r o w h i c h h a d i f f e r e n t a c t i o n s d e p e n di n o t h p r e s e n c e o a b s e n c e o a p a r a m e t e r .

T h e L i n e A d r s m a c r o u s e s t h . r e p t ( r e p e a t ) p s e u d o - o p t c r a t t a b l e o s t a r t a d d r e s s e s f o t e x t s c r e e n , c o l o r m a t r i x , o f o a b i t m a p . F o e x a m p l e , a s s u m i n g g r a p h i c s b i t m a p s c r e e ns t a r t s a a d d r e s s $ 6 0 0 0 , L i n e A d r s $ 6 0 0 0 , 3 2 0 w o u l d c r e a t et a b l e o r o s t a r t a d d r e s s e s .

T h M a r k m a c r o s t o r e s u t o s i x s t r i n g s w i t h t h l a s t c h a r a ct e h a v i n g t h e s i g n b i s e t . U p p e r c a s e c h a r a c t e r s a n s o m ep u n c t u a t i o n c h a r a c t e r s w h i c h n o r m a l l y h a v e v a l u e s r a n g i n gf r o m $ C t $ D a r a u t o m a t i c a l l y c o n v e r t e d t e q u i v a l e n tv a l u e s r a n g i n g f r o m $ 6 t $ 7 F . A e r r o r m e s s a g e i p r i n t e d i g r a p h i c s c h a r a c t e r s ( v a l u e s $ A t $ B F ) a r e n c o u n t e r e d . T h C o u n t m a c r o c a s t o r e u t o s i x s t r i n g s w i t h t h l e n g t h o e a c h s t r i n g s t o r e d a s t h e f i r s t b y t e . B o t h t h e s e m a c r o s m a k eu s e o f t h A r p s e u d o - o p t p r o c e s s e a c h o t h s i p o s s i b l es t r i n g s i t u r n . T h A r p c p s e u d o - o p i u s e d t p r o c e s s e a c hc h a r a c t e r o e a c h s t r i n g o n c h a r a c t e r a t i m e .

T h F l o a t m a c r o s t o r e s s i g n e d v a l u e s r a n g i n g f r o m - 3 2 7 6 8 t 3 2 7 6 7 a f l o a t i n g p o i n t n u m b e r s c o m p a t i b l e w i t h B A S I C 2 . a n B A S I C 7 . 0 . I t u s e s a . r e p t l o o p t n o r m a l i z e t h m a n t i s s a a n a d j u s t t h e e x p o n e n t . T n o r m a l i z e m e a n s t s h i f t t h m a n t i s s a

l e f t u n t i l t h m o s t s i g n i f i g a n t b i i 1

T h D e f C t r l s m a c r o c r e a t e s s y m b o l s c o r r e s p o n d i n g t t h v a u e o t h c o n t r o l k e y s .

" m a c r o s . s r c " - f o r C o m m o d o r e ' s H C D 6 5 a s s e m b l e r

* $ 1 3 0 0. n c l i s t. b l i s t

v a r l . w o rv a r 2 . w o rC O N S T A N T = $ 1 2 3 4B I T 1 5 U O O O O O O O O O O O O O O OP O S I T I V EN E G A T I V E $ 8

; m o v e 1 b i t s .

M o v e W . m a c r o % v l a , % v l bI d a % v l bs t a t o l aI d a % v l b + ls t a % v l a + l. e n d m

M o v e W v a r l , v a r 2 / s a m p l e u s a g e .

; t h i s m a c r o t r a n s f e r s 1 6 b i t s . A c c u m u l a t o r i s u s e d .

L o a d W . m a c r o % v l a , % v l b , % v l c

. i f n b < % v l c > ; i 3 r a r g u m e n t i p r e s e n t. i f e ' % v l c ' - ' i ' i 3 r d a r g u m e n t e q u a l sI d a | < % v l b t h e n l o a d i m m e d i a t e v a l u e .s t a % v l aI d a | > % v l bs t a % v l a + l. e l s e e l s e p r i n t e r r o r m e s s a g e .. m s s g * * * * * b a a r g u m e n t i L o a d W m a c r o * * * * *. e n d i f

. e l s eI d a % v l b ; e l s e m o v e 1 6 b i t s .s t a % v l a

T r a n s a c t o

Page 35: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 35/84

I d a % v l b + ls t a % v l a + l. e n d i f

. e n d m

L o a d W v a r l , C O N S T A N T S ; s a m p l e

. i r p c % v 3 , < % v 2 > / c o u n t e a c h c h a r a c t e r w i t h a . i r p c l o o p .L E L E N + 1

. e n d r

. b y t e L E N , ' % v 2 ' / a s s e m b l e s t r i n g , l e n g t h b y t e f i r s t .. e n d i f. e n d r

; t h i s m a c r o c r e a t e s a t a b l e o r o s t a r t a d d r e s s e s; f o r t h s c r e e n o r c o l o r m e m o r y o b i t m a p .

L i n e A d r s . m a c r o % v l a , % v l bM % v l a

. r e p t 2 . w o r A D

A D A D R + % v l b. e n d r

L i n e A d r s $ 0 4 0 0 , 4 0 ; c r e a t e a s a m p l e t a b l e .

; T h i s m a c r o s t o r e s s t r i n g w i t h t h e l a s t c h a r a c t e r/ h a v i n g t h 7 b i t s e t . T h e a n g l e b r a c k e t s e n c l o s i n g t h e m a c r o/ l o c a l v a r i a b l e s s e e m t o b e n e c e s s a r y t h a n d l e s p a c e s ./ M a r k c a h a n d l e u p t a r g u m e n t s .

M a r k . m a c r o % v l a , % v l b , % v l c , % v l d , % v l e , % v l f

. i r p

. i f n b < % v 2 > / d o n ' t a s s e m b l e n u l l s t r i n g s .

. i r p c % v 3 , < % v 2 >

. i f g e ' % v 3 ' - $ 8 0 / i c h a r a c t e r v a l u e 1 2 . i f g e ' % v 3 ' - $ c O i c h a r a c t e r i u p p e r c a s e r a n g e $ c O . . $ d fC H A R ' % v 3 ' ! x $ a O t h e n c o n v e r t t r a n g e $ 6 0 . . $ 7 f .. b y t e C H A R. e l s e e l s e p r i n t e r r o r m e s s a g e .. m s s g * * * * * i l l e g a l g r a p h i c s c h a r a c t e r i M a r k a r g u m e n t * * * * *. e n d i f. e l s e

C H A R = ' % v 3 ' / e l s e a s s e m b l e c h a r a c t e r v a l u e < 1 2 8 .. b y t e ; % v 3 '. e n d i f

. e n d r/ a e n t i r e s t r i n g h a s b e e n a s s e m b l e d ,

* = * - l / n o w b a c k u p P C t o l a s t c h a r a c t e r o f s t r i n g ,. b y t e C H A R ! + 1 2 8 / n o w s e t 7 b i t o f l a s t c h a r a c t e r ,. e n d i f

. e n d r

. e n d m

M a r k < A b > , < D > / s a m p l e u s a g e .

/ T h i s m a c r o s t o r e s a s t r i n g w i t h t h e c o u n t i n t h e f i r s t b y t e ./ I a c c e p t s u t o p e r a n d s .

C o u n t . m a c r o % v l a , % v l b , % v l c , % v l d , % v l e , % v l f

. i r p. i f n b < % v 2 > / d o n ' t a s s e m b l e n u l l s t r i n g s .

L E N = / i n i t i a l i z e s t r i n g c o u n t t 0

. e n d m

C o u n t < T e x t > , < m o r e ! ! ! > / s a m p l e u s a g e .

/ a s s e m b l e a f l o a t i n g p o i n t n u m b e r c o m p a t i b l e w i t h/ B A S I C 2 . o r B A S I C 7 . f l o a t i n g p o i n t r o u t i n e s ./ F l o a t a c c e p t s u t a r g u m e n t s .

F l o a t . m a c r o % v l a , % v l b , % v l c , % v l d , % v l e , % v l f. i r p % v 2 , % v l a , % v l b , % v l c , % v l d , % v l e , % v l f. i f n b < % v 2 > / i a r g u m e n t i n o b l a n k

E X P = $ 9 0 E X P = c o r r e c t b i n a r y e x p o n e t f o r 1 b i t i n t e g e r .M A % v M A = 1 s t b y t e s o f m a n t i s s a .

. i f e M A i m a n t i s s a =. b y t 0 , 0 , 0 , 0 , 0 t h e n a s s e m b l e a z e r o .

. e l s e

. i f I t M A e l s e d e t e r m i n e c o r r e c t s i g n a n S I G N = N E G A T I V E t a k e a b s o l u t e v a l u e o f M A N .M A - M A N

. e l s eS I G N = P O S I T I V E

. e n d i f

. r e p t 1 5 n o w n o r m a l i z e m a n t i s s a w h i l e a d j u s t i n g E X P .. i f e B I T 1 5 I . M A N

M A M A N * 2E X P = E X P - 1

. e n d i f. e n d r

M A = M A N ! . ! n B I T 1 5 c l e a r s i g n b i t o f m a n t i s s a a n d a s s e m b l e n u m b e r ,. b y t E X P , > M A N ! + S I G N , < M A N , 0 , 0

. e n d i f

. e n d i f. e n d r. e n d m

F l o a t 1 , - 1 , - 3 0 1 4 5 / s a m p l e u s a g e .

/ c r e a t e s y m b o l s w i t h v a l u e s c o r r e s p o n d i n g t o t h e C O N T R O L/ w o r k s w i t h a l a l p h a b e t i c C O N T R O L c h a r a c t e r s .

D e f C t r l s . m a c r o % v l. i r p c < % v 2 > , < % v l >

C T R L $ % v 2 ' % v 2 ' ! . $ l f. e n d r. e n d m

. m l i s tD e f C t r l s a b c z / s a m p l e u s a g e .

. e n d

9 I s s u e 3

Page 36: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 36/84

I m p l e m e n t i n g R A M d i s k

F o A b a c u s ' S u p e r O T h C 6

b K e r r y G r a y

S u p e r - C , t h ' o t h e r ' c o m p i l e r , i s o l d i t w v e r s i o n s : o n f o t h 6 a n a n o t h e r f o t h 1 2 8 . T h s y s t e m i n c l u d e s s u p o r t f o ' R A M d i s k ' , a a r e a o m e m o r y t h a t a p p e a r s t t h s y s t e m a a d i s k d r i v e , t h u s a l l o w i n g f a s t e r a c c e s s t f i l e s . T h i n t r o d u c t i o n o t h 1 7 6 4 R A E x p a n s i o n U n i t h a s m a d eR A M d i s k s p o s s i b l e o t h e 6 4 , b u s i n c e t h e a u t h o r s o S u p e r - Ch a v e n o y e s e e n f i t c r e a t e s u c h c a p a b i l i t y , i h a d e v o l v e du p o n h a c k e r s t c r o w b a r i i n

I n s t a l l a t i o n p r o b l e m s

T h 1 7 6 4 r e i s o l d w i t h r a m d o s s o f t w a r e t h a t e m u l a t e sC o m m o d o r e d i s k d r i v e . I o r d e r t m a k e R A M d i s k s i m p l ee n o u g h f o a n y o n e t i n s t a l l , i i h i g h l y d e s i r a b l e t m a k e u s o t h i s s o f t w a r e r a t h e r t h a n e x p a n d t h e C - s h e l l . S i m p l y s e t t i n gu t h R A M D O S b e f o r e l o a d i n g t h C - s y s t e m w o n ' t w o r k , s i n c et h a u t o b o o t p a r t o t h C - s h e l l p r o g r a m o v e r w r i t e s t h v e c t o r si n s t a l l e d b R A M D O S . T h e r e f o r e , t a v o i d e x c e s s i v e m o d i f i c at i o n o t h C - s h e l l , R A M d i s k m u s t b i n s t a l l e d f r o m w i t h i n t h

e n v i r o n m e n t . O n c e t h R A M D O S i e n a b l e d , t h m e m o r y -r e s i d e n t i n t e r f a c e p a g e a n d t h e a l t e r e d s y s t e m v e c t o r s m u s t b p r o t e c t e d f r o m t h s h e l l a n p r o g r a m s .

U s i n g i n s t a l l c

T h i n s t a l l c p r o g r a m ( L i s t i n g 1 w i l l e x e c u t e C o m m o d o r e ' sR A M D O S i n s t a l l a t i o n p r o g r a m f r o m w i t h i n t h e n v i r o n m e n ta n o p t i o n a l l y c o p y t h d e v e l o p m e n t p r o g r a m s , c c c a n c t t h R A M d i s k . I a l s o c h a n g e s t h t o p - o f - m e m o r y p o i n t e r t p r o t e c t t h R A M D O S i n t e r f a c e p a g e ( $ C F 0 0 - $ C F F F ) . T h i s p r g r a m c a n b e r u a a n t i m e , b u b s u r e t h e 1 7 6 4 i i n s t a l l e d !T y p e t h p r o g r a m i n c o m p i l e i a n l i n k i w i t h t h l i b r a r y f i l el i b e l . U s $ 6 f o r t h e t o m e m o r y p a g e . H a v e y o u r 1 7 6 4R A M D O S i n s t a l l a t i o n p r o g r a m h a n d y ( t h e l a t e s t o n i r a m -d o s 6 4 . b i n 4 . 2 ) . R u t h p r o g r a m a n i n s e r t t h R A M D O S i n s t a ll a t i o n d i s k w h e n p r o m p t e d . I y o w a n t t c o p y t h d e v e l o pm e n t f i l e s , h a v e y o u r o r i g i n a l S u p e r - C d i s k h a n d y t o o . T h e s ef i l e s a r c o p i e d w i t h a a s s e m b l e r l a n g u a g e s u b r o u t i n e b c a u s e t h i n s t a l l p r o g r a m i d e s t r o y e d w h e n t h p r o g r a m sa r l o a d e d . ( T h e a s s e m b l y s o u r c e i i L i s t i n g i t ' s i n c l u d e do n l y f o r t h e c u r i o u s . Y o n e e d n ' t t y p e i i b e c a u s e i t ' s i n c l u de i L i s t i n g 1 . O n c e t h t r a n s f e r i c o m p l e t e , t h p r o g r a mr e s t a r t s t h s h e l l a n y o u ' r e r e a d y t g o

T h i s i n o - f r i l l s p r o g r a m ; e r r o r c h e c k i n g i m i n i m a l . I y o l i k e p r e t t y c o l o u r s , f a n c y m e n u s o h o n e s t - t o - g o o d n e s s e r r o rc h e c k i n g , f e e l f r e e t a d t h e m y o u r s e l f .

T h a s t u t e r e a d e r m a h a v e n o t i c e d t h a t t h p r o g r a m m o v e st h e t o p m e m o r y p a g e d o w n t w p a g e s t $ C r a t h e r t h a n$ C a o n e m i g h t e x p e c t . T h i s i m a d e n e c e s s a r y b b u i t h c o m p i l e r : i m a k e s w i l d P O K E i h i g h m e m o r y w h e ni s t a r t s u p N o r m a l l y i l a n d s h a r m l e s s l y i a u n u s e d a d r e s s i I / s p a c e . W i t h t h m e m o r y t o m o v e d d o w n ,t h o u g h , t h p r o g r a m c l o b b e r s t h R A M D O S r e s i d e n t p r o g r a m .I y o d o n ' t i n t e n d t u s t h c o m p i l e r w h e n t h R A M d i s k i e n a b l e d , y o m a c h a n g e t h t o p a g e t $ C F . I f a c t , a l b u t h l a r g e s t p r o g r a m s w i l l l e a v e t h i s a r e a a l o n e . J u s t t b s a f e , t h o u g h , y o s h o u l d r e - l i n k y o u r p r o g r a m s ( i n c l u d i n gt h p r o g r a m s f o u n d o n y o u r S u p e r - C d i s k ) w i t h t h n e l o w e r m e m o r y t o p .

R A M d i s k e n t o m o l o g y

T h R A M d i s k i s a l a s , n o p e r f e c t f i t . T h R A M D O S p r o g r a md i f f e r s i s o m e s u b t l e w a y s f r o m 1 5 4 1 D O S , a n t h e r e a r ef e o u t r i g h t b u g s t b o o t . T h d i f f e r e n c e t h a t c o n c e r n s u s h e r ei t h u s e o f d i s k c h a n n e l o n e , t h e S A V E c h a n n e l . T h i s c h a n n e li t r e a t e d s p e c i a l l y b t h 1 5 4 1 D O S . I a s s u m e s t h a t a n f i l eo p e n e d o n t h i s c h a n n e l i f i l e t b e s a v e d a n d c r e a t e s w r i t ef i l e . T h 1 7 6 4 t r e a t s t h i s s a v e c h a n n e l l i k e a n o t h e r c h a n n e l ;i k n o w s w h e t h e r t h f i l e i s a v e f i l e b e c a u s e i k n o w s w h e ny o u r p r o g r a m c a l l e d S A V E r a t h e r t h a n O P E N ( t h e y a r d i f f e r e n te n t r y p o i n t s i R A M D O S ) . T h E d i t o r a n L i n k e r b o t h c r a t o u t p u t f i l e s b m e a n s o t h i s s a v e c h a n n e l . W h y ? S i m p l yb e c a u s e i s a v e s t h e m t h e t r o u b l e o a p p e n d i n g , w t t h f i l en a m e .

W h e n t h e e d i t o r s a v e s y o u r s o u r c e f i l e i o p e n s t h s a v ec h a n n e l u s i n g f i l e n a m e s u c h a s o u r c e . c , u . T h 1 5 4 1k n o w s t h i s i w r i t e f i l e a n t r e a t s i a c c o r d i n g l y . R A M D O S ,h o w e v e r , t r e a t s a l f i l e s n o e x p l i c i t l y o p e n e d f o w r i t i n g( i . e . , n o o p e n e d t h r o u g h S A V E a n n o t s u f f i x e d w i t h , o , a a r e a d f i l e s . I t h f i l e e x i s t s , R A M D O S w i l l o p e n i f o r e a di n a n t h e n o b j e c t w h e n t h e e d i t o r t r i e s t w r i t e t i t I t h f i l e d o e s n ' t e x i s t , t h R A M D O S w i l l r e t u r n , " 6 2 , f i l e n o f o u n d " . F o r t u n a t e l y , w c a a v o i d t h i s d i s a s t e r w i t h o u t

T r a n s a c t o

Page 37: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 37/84

s u r g e r y o t h f i l e s b a p p e n d i n g t h m i s s i n g l e t t e r s t t h f i l e n a m e o u r s e l v e s .

T s a v e s o u r c e f i l e t t h R A M d i s k y o n e e d t a p p e n d , t t h f i l e n a m e . T h i s k e e p s b o t h t h e d i t o r a n R A M D O S h a p p y .T h l i n k e r e n g a g e s i t h s a m e v i c e : i t r i e s t S A V E y o u ro b j e c t p r o g r a m t h r o u g h O P E N . T h e r e f o r e , t c r e a t e a o b j e c tf i l e o t h R A M d i s k y o u s h o u l d a p p e n d , p , w t i t n a m e .

T h R A M D O S p r o g r a m s t o r e s a l f i l e s c o n t i g u o u s l y i i t m e m o r y r a t h e r t h a n i m i t a t i n g r a n d o m a c c e s s t r a c k a n s e c t o rc o n f i g u r a t i o n . T h i s m a k e s f o i m p r e s s i v e l y f a s t l o a d i n g b u tc a m a k e t r o u b l e i p r o g r a m s t h a t w r i t e t m o r e t h a n o n f i l ea t i m e . E v e r y t i m e y o a p p e n d t f i l e , a l t h f i l e s s t o r e d i h i g h e r m e m o r y m u s t b m o v e d u t a c c o m o d a t e t h n e d a t a . I f y o u r p r o g r a m i w r i t i n g t s e v e r a l f i l e s , i m a t a k el o n g e r t r u t h a n i t h f i l e s w e r e o f l o p p y d i s k !

Y o c a a v o i d a l t h e s e p r o b l e m s i y o u s t h R A M d i s k a y o w o u l d u s y o u r o r i g i n a l S u p e r d i s k : i s h o u l d b s e u a d r i v e ' a ( d e v i c e 8 ) c o n t a i n a l t h s y s t e m f i l e s ( c o m p i l e r ,l i b r a r i e s , e t c . ) , a n i g e n e r a l b t r e a t e d a s r e a d - o n l y d e v i c e .T h i s s e t u p w i l l m a k e p r o g r a m d e v e l o p m e n t m u c h l e s s a g g r av a t i n g , s i n c e y o m a y n o w e s c h e w d i s k - s w a p p i n g a n t h g r i n d i n g l y s l o w p r o c e s s o f c o m p i l i n g a n l i n k i n g , w i t h o u t t h h e a r t b r e a k o r e a l i z i n g y o f o r g o t t s a v e y o u r d a y ' s w o r k t r e a l d i s k b e f o r e y o s h u t t h c o m p u t e r o f f .

T h u s u a l d i s c l a i m e r s . . .

0 x 9 1 b d , 0 x 2 0 c 0 , 0 x f f d 2 , 0 x d c 9 , 0 x f 5 d 0 , 0 x 5 d 4 c ,O x l l c O , 0 x 2 0 4 9 , 0 x 4 1 4 3 , 0 x 2 7 4 e , 0 x 2 0 5 4 , 0 x 4 £ 4 3 ,0 x 5 9 5 0 , 0 x 4 3 2 0 , 0 x d 4 3

m a i n ( )

f = S T D I O ;

w h i l e ( f = S T D I O )

p u t s ( " \ n l n s e r t d i s k w i t h R A M D O S " ) ;p u t s ( " b o o t p r o g r a m i d r i v e \ n " )p u t s ( " T h e n p r e s s a k e y \ n " ) ;g e t c h a r ( ) ;

f = f o p e n ( " r a m d o s 6 4 . b i n * " , " r , p " ) ;

m ( i n t ) f g e t c ( f ) ;| ( ( i n t ) f g e t c ( f ) ) 8

i ( m ! = 0 x 6 3 0 0 )

p u t s ( " \ n R A M D O S i n t a l l a t i o n p r o g r a m n o t f o u n d . \ n " ) ;f c l o s e ( f ) ; f = S T D I O ;

e l s e

f g e t f ( m , 0 x 2 0 0 0 , f ) i ( o 0

h a v e t e s t e d t h i s p r o g r a m o m o w c o p y o S u p e r - C V ( t h e s t a r t u p s c r e e n s h o w s # 2 . 0 2 ) a n w i t h m c o p y o C o m o d o r e ' s R A M D O S v e r s i o n 4 . 2 . E a r l i e r v e r s i o n s o R A M D O Sh a v e s o m e s e r i o u s b u g s t h a t c a c r a s h y o u r c o m p u t e r a a n t i m e . I y o d o n ' t h a v e t h l a t e s t v e r s i o n y o c a g e i f r o mC o m m o d o r e , o i c a n b e d o w n l o a d e d f r o m s o m e o n l i n e s e v i c e s i n c l u d i n g C o m p u S e r v e ( C B M C O M l i x x a n Q u a n t u m -L i n k . h a v e n r e a s o n t b e l i e v e t h i s p r o g r a m w i l l w o r k w i t ha n o t h e r v e r s i o n o S u p e r - C o R A M D O S .

i s t i n g 1 : i n s t a l l . c i n d u d e " s t d i o . h "

i l e f

n i c * m

p u t s ( " \ n l c a n ' t r e a d t h e R A M D O S p r o g r a m . \ n "f d o s e ( f ) ; f = S T D I O ;

n p r o g r a m [ 8 2 ]

0 x 4 3 a 9 ,0 x 2 a 9 ,0 x f f d 5 ,0 x 6 e 0 ,0 x 8 b 5 ,O x l a O ,O x f f b d ,0 x l 4 a 4 ,0 x 4 3 c 9 ,0 x a 9 0 8 ,0 x 3 8 4 c ,

0 x a 0 8 d ,0 x 9 f a 2 ,0 x 6 2 b 0 ,0 x f 8 d 0 ,O x d O c a ,0 x b a 2 0 r0 x l a 9 ,0 x 2 b a 9 ,O x 5 d O ,0 x 8 d 4 c ,0 x 4 c c O ,

0 x a 9 c 0 ,O x c O a O ,0 x a 2 1 8 ,0 x e 6 c 9 ,0 x 6 c f 7 ,0 x a 9 f f ,0 x 2 b 8 5 ,0 x d 8 2 0 ,0 x 4 5 a 9 ,O x c O a O ,Q x c Q 7 e ,

0 x a a 0 8 ,0 x b d 2 0 ,0 x 8 a 0 0 ,0 x 5 2 d 0 ,0 x 8 0 1 ,0 x a 2 0 2 ,0 x 8 a 9 ,O x b O f f ,0 x 6 f 4 c ,0 x 5 4 c ,0 x c c 2 0 ,

0 x 2 0 a 8 ,0 x a 9 f f ,0 x b 6 7 d ,0 x 7 7 b d ,0 x 5 a d ,0 x a 0 9 f ,0 x 2 c 8 5 ,0 x a d 2 1 ;0 x c 9 c 0 ,0 x 4 c c O ,0 x a 2 f f ,

O x f f b a ,0 x 2 0 0 0 ,0 x e 8 0 8 ,0 x 9 d c 0 ,O x a a c f ,0 x 2 0 0 0 ,0 x l 3 a 6 ,O x c O a O ,0 x d 0 4 5 ,0 x 4 0 0 ,0 x e 8 £ f ,

f d o s e ( f ) ;

d

p u t s ( " \ n E n t e r d e s i r e d d e v i c e ( 8 - 1 4 ) : "s c a n f ( " % d " , & i ) ;

w h i l e ( i < 8 | i > 1 5 ) ;

p u t c h a r ( C R ) ;

/ s e t - r e g s p r o g r a m a $ 6 2 0 0

( * ( c h a r * )( * ( c h a r * )( * ( c h a r * )( * ( c h a r * )( * ( c h a r * )( * ( c h a r * )( * ( c h a r * )

0 x 6 2 0 0 ) 0 x a 9 ;0 x 6 2 0 1 ) ( c h a r ) i 0 x 6 2 0 2 ) 0 x a 2 ;0 x 6 2 0 3 ) O x c f ;0 x 6 2 0 4 ) 0 x 4 c ;0 x 6 2 0 5 ) 0 x 0 6 ;0 x 6 2 0 6 ) 0 x 6 3 ;

*

/ / / / / / /

I d d e v i c el d p a g ej m < $ 6 3 0 6> $ 6 3 0 6

* * * * * * *

/ e x e c u t e R A M D O S i n i t p r o g r a m *

c a l l ( ( c h a r * ) 0 x 6 2 0 0 ) ;

/ r e s t o r e C s y s t e m ' s N M I v e c t o r *

n m i o n ( ) ;

9 I s s u e 3

Page 38: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 38/84

/ s e n e w m e m o r y t o p *

* ( c h a r * ) 0 x 0 4 ( c h a r ) O x c e ;

p u t s ( " \ n R A M D O S i n s t a l l e d . \ n " ) ;

p u t s ( " \ n \ n D o y o w i s h t o i n s t a l l C S y s t e m f i l e s ? " )

d o g e t c h a r f ) ;w h i l e ( c ! = ' y ' & & ! ' n ' ) ;

p u t c h a r ( c ) ;p u t c h a r ( C R ) ;

i ( ' y ' )

p u t s ( " \ n l n s e r t C - s y s t e m d i s k i d r i v e a n d p r e s sc m o v e ( c h a r * ) O x c O O O , 1 7 0 , p r o g r a m ) ;

g e t c h a r ( ) ;

c a l l ( ( c h a r * ) O x c O O O ) ;

/ s u b r o u t i n e d o e s n o t r e t u r n *

p u t s ( " P r e s s k e . . . " ) ;

g e t c h a r ( ) ;

L i s t i n g 2 s o u r c e c o d e f o M i i n s t a l l . c

l o a d e r f o r h i d d e ns y s t e m f i l e s

c l r c h n = $ f f c cc h r o u t $ f f d 2l o a d = $ f f d 5s a v e = $ f f d 8s e t l f s = $ f f b as e t n a m $ f f b dc b o o t $ 0 4 0 0 ; s h e l lp a t c h = $ 0 8 b 6 ; i n f a s t l o a d e rp r s t r t $ 0 8 0 1 ; p r s t a r t a d d rt x t t a b $ 2 b ; s a v e p a r a md e v n u m $ c f 0 5 ; i n s i d e i n t e r f p

$ c 0 0 0

y . \ n \ n " )

; c a l l e n t r y p

s t a r t I d a f ' c 's t a n a m e + 1

; f i l e n a m e; i ' c c '

r e a d i n f a s t l o a d e r

r e s t r t I d a 1 t a t a j s r s e t l f sI d 1 l d x | < n a m el d y | > n a m ej s s e t n a mI d 1 j s l o a db c e r r o r

; d e v i c e

; f i l e t c o p y

p a t c t

l o o p

I o o p 2

w h e n

f a s t l o a d e r

d l d i t x a d p a t c h , xi n c p x § 6b n l o o pc m p # $ e 6b n e r r o rI d a n p a t c h - l , xs t p a t c h - l , xd e b n I o o p 2j m ( p r s t r t )

i t f i n i s h e s , f a s tl o a d e r w i l l j u m p h e r e

r e t u r nr a m d e v

n e x t

t r y l

X

d o n e

n p a t c h

p r i n i

e r r o r

I o o p 3

m s n a m e

. e n d

I d a d e v n u mt a l d # j s s e t l f sI d # l d j f c n a m el d y # > n a m ej s s e t n a mI d K p r s t r ts t t x t t a bI d f > p r s t r ts t t x t t a b + 1l d $ 1 l d $ 1 I d K t x t t a bj s s a v eb c s e r r o r

I d a n a m e + 1c n p f ' c 'b n t r y lI d f ' e 'j m x c m § ' e 'b n d o n eI d V s t a n a m e + 1j m r e s t r t

j m p c b o o t

j m p r e t u r nj m e r r o r

e r r o r m e s s a g e

j s c l r c h nl d # $ f fi n I d a m s g , xj s r c h r o u tc m p f $ db n I o o p 3j m p n e x t. b y t e 1 7 ' i c a n '. b y t e ' c c ' , $ d

; c o m p u t e c h e c k s u m; t e n s u r e; y o u r v e r s i o n

m a t c h e s m i n e

; c h k s u m

; n e w c o d e t ; s e n d c o n t r o l; b a c k t o m e

; e x e c u t e l o a d e r

; r a m d i s k d v c

; s a m e n a m e

; p r g b e g i n s; a p r s t r t

; f a s t l o a d e r l e a v e s; e n d a d d r e s s h e r e

; c o m p i l e r

e d i t o r

; l i n k e r

; c o n t i n u e

; r e b o o t c s h e l l

; n e w c o d e f o r; f a s t l o a d e r

, 3 9 , ' t c o p y

3 T r a n s a c t o

Page 39: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 39/84

S u p e r N u m b e r s I I

S t i c k y v a r i a b l e s f o C 1 2 8 , C 6 V I C - 2 0

b R i c h a r d C u r c i o

H a v i n g s u c c e s s f u l l y m o d i f i e d S u p e r N u m b e r s t r u o m V I C - 2 0 , d e c i d e d t a t t e m p t a C 1 2 8 c o n v e r s i o n . I y o u ' r e u f a m i l i a r w i t h S u p e r N u m b e r s , i i a n e a t u t i l i t y b y J o h n R B e n n e t t w h i c h a p p e a r e d i T r a n s a c t o r , V o l u m e 6 I s s u e b a c ki J u l y 1 9 8 5 . I p r o v i d e s t h C 6 w i t h a n e c l a s s o n u m e r i cv a r i a b l e . T h e s e n e v a r i a b l e s , w h i c h a r e s i n g l e l e t t e r s p r e c e de b t h B r i t i s h p o u n d s y m b o l ( £ ) , h a v e f i x e d l o c a t i o n s i m e m o r y a n a r i n v u l n e r a b l e t p r o g r a m f a i l u r e , C L R , a n r s e t . T h e y a r e a l s o f a s t e r v a r i a b l e s s i n c e B A S I C d o e s n ' t h a v e t s e a r c h t h r o u g h i t o t h e r v a r i a b l e s t f i n d p a r t i c u l a r s u p e r -n u m b e r .

T h " i l l " i n t h t i t l e o t h i s a r t i c l e r e f l e c t s t h e i n c l u s i o n o t h r e e v e r s i o n s o f n e S u p e r N u m b e r s p r o g r a m , f o t h C 1 2 8 ,C 6 4 , a n d V I C - 2 0 .

C 6 4 / V I C - 2 0

O r e - e x a m i n i n g t h o r i g i n a l s o u r c e p r o g r a m , n o t i c e d t w n e a r l y i d e n t i c a l s e c t i o n s o c o d e . T h e s e c o m b i n e d i n t o o n s u b r o u t i n e i t h n e s o u r c e l i s t i n g s l a b e l l e d , n o u e x p e c t e d l y , S U B R T N . T h i s g a v e m r o o m t a d s o m e s i m p l ev e c t o r m a n a g e m e n t t t h i n i t i a l i z a t i o n . W h e n S u p e r N u m b e r si i n i t i a l i z e d , t h c o n t e n t s o E R R O R i s t o r e d a r e a l e r r , t h e nI E R R O R i c h a n g e d t p o i n t t N E W E R R . I I E R R O R i a l r e a d yp o i n t i n g t N E W E R R , t h i n i t i a l i z a t i o n e x i t s . T h i s a l l o w s S u p e r -N u m b e r s t c o - e x i s t w i t h a n o t h e r e r r o r - i n t e r c e p t i n g w e d g e .T h c o n t e n t s o t h e v e c t o r I E V A L , h o w e v e r , a r s i m p l y r e p l a c e db N E W E V A L .

I n t h e o r i g i n a l a r t i c l e , t h E d i t o r n o t e d t h a t t h e r e a r e a p p a re n t l y m o r e t h a n 2 s u p e r n u m b e r s ( S N s ) . T h r o u t i n e w i l l a c e p t £ 1 £ a n d e v e n £ < s h i f t - a > . U n f o r t u n a t e l y , t h e s e e x t r aS N a r l o c a t e d o u t s i d e t h a r e a o m e m o r y t h a t t h m a c h i n el a n g u a g e s e a s i d e f o r t h e 2 a l p h a b e t i c S N s . I t h a r e a i u u s e d , n p r o b l e m . I f o t h o t h e r h a n d , t h a t a r e a o r a i b i n u s e d b a n o t h e r r o u t i n e , a s s i g n i n g a v a l u e t £ o £ c o u l d c a u s e b a t h i n g s t h a p p e n . L i k e c r a s h .

T h c a l l t t h R O r o u t i n e C K A L P H , n e a r t h s t a r t o S U B R T N ,r e t u r n s w i t h c a r r y s e i C H R G E T f o u n d l e t t e r i t h B A S I Ct e x t . T h B C a r o u n d J M S Y N T A X e n s u r e s t h a t S u p e r N u m b e r sw i l l o n l y a c c e p t t h 2 u n s h i f t e d a l p h a b e t i c c h a r a c t e r s .

T w e n t y - s i x n e v a r i a b l e s i p l e n t y . B e s i d e s , t h e r e i a n o t h e rw a t g e m o r e t h a n 2 s u p e r n u m b e r s . T h i s i o n r e a s o nw h t h n e C L R R A M s u b r o u t i n e i s e e m i n g l y m o r e c o m p l e xt h a n n e c e s s a r y . S t a y t u n e d .

M f i r s t V I c o n v e r s i o n w a d o n e t h e ' h a r d w a y ' . T h o r i g i n a lB A S I C l o a d e r w a r u n w i t h a p r o t e c t e d a r e a o f V I C m e m o r y a t h d e s t i n a t i o n . t h e n P O K E d t h R O c a l l s a n a b s o l u t e a d r e s s e s w i t h t h p r o p e r v a l u e s . ( I n c i d e n t a l l y , V i c ' s l o c a t i o n f o m e m t o i r e a l l y d o e s h a v e t h t w m i d d l e d i g i t s t r a n s p o s e df r o m t h C 6 l o c a t i o n . T h a t ' s n o t y p o . )

F o t h e s e n e c o n v e r s i o n s , h a t g e a r o u n d t h f a c t t h a t t h a s s e m b l e r w a u s i n g , L A D S 6 4 , d o e s n ' t h a v e W O R D p s e u d o -o p T h o r i g i n a l r o u t i n e c o n t a i n e d t a b l e o 2 t w o - b y t ev a l u e s r e p r e s e n t i n g t h a d d r e s s e s o f t h 2 f i v e - b y t e s u p e r -n u m b e r s . c o u l d n ' t u s B Y s i n c e L A D S o n l y a c c e p t s d e c i m a la n A S C , n o e x p r e s s i o n s f o t h a t p s e u d o - o p , a n d i d n ' t k n o ww h a t t h t a b l e e n t r i e s w o u l d b u n t i l t h w h o l e t h i n g w a a s s e m b l e d .

T h t a b l e w a h a l v e d t 2 s i n g l e - b y t e v a l u e s . S u b r t n a d d st h a p p r o p r i a t e t a b l e e n t r y t N U M S t f i n d t h e l o c a t i o n o t h s u p e r n u m b e r B A S I C i l o o k i n g f o r . T h e r e i s l i g h t l o s s o s p e e d u s i n g t h i s m e t h o d . H o w e v e r , t h i s k e p t t h M L w i t h t h a d d e d v e c t o r m a n a g e m e n t , e r r o r c h e c k , a n l o n g e r C L R R A Mf r o m g r o w i n g m u c h l o n g e r t h a n t h o r i g i n a l r o u t i n e . I f a c t ,t h C 6 a n V i v e r s i o n s a r t w b y t e s s h o r t e r 1 6 b y t e s .L i k e t h o r i g i n a l , t h e s e r o u t i n e s r e q u i r e a a d d i t i o n a l 1 3 b y t e s i m m e d i a t e l y a f t e r t h M t h o l d t h 2 5 - b y t e f l o a t i n gp o i n t v a r i a b l e s .

C 1 2 8

F o t h C 1 2 8 , m i n t e n t i o n w a t s t o r e t h u e v a r i a b l e s w i t ht h M i b a n k 1 5 R A 0 a n g a i n m o p e e d b y a v o i d i n gt h b a n k s w i t c h i n g t h i n t e r p r e t e r p e r f o r m , b e t w e e n p r o g r a mt e x t i n r a 0 a n v a r i a b l e s i r a 1 B a 7 . w o u l d m e e tm o n l y h a l f - w a y o t h i s b r i l l i a n t i d e a , w i l l i n g l y r e t u r n i n gv a l u e s f r o m r a 0 b u r e f u s i n g t s t o r e v a l u e s t h e r e . W i t hm u c h g r u m b l i n g , m a d e t h n e c e s s a r y c h a n g e s a r i d p l a c e d t h n e v a r i a b l e s h i g h i R A a $ F F 4 5 . T h i s a r e a i i m m e d ia t e l y a f t e r t h e I R Q , N M a n r e s e t p r e l i m i n a r i e s t h e s y s t e m

9 I s s u e 3

Page 40: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 40/84

c o p i e s t a l b a n k s , i s o l a t e d f r o m n o r m a l v a r i a b l e s a n d u n u s e db t h s y s t e m . K n o w i n g t h s t o r a g e l o c a t i o n s h o u l d h a v e e l i mi n a t e d t h e t a b l e e n t r y q u e s t i o n . T h l o o k u p - a n d - A D C m e t h o dw a r e t a i n e d f o r r e a s o n s t h a t w i l l b e x p l a i n e d s h o r t l y .

T h s o u r c e l i s t i n g f o C 1 2 8 S u p e r N u m b e r s i v e r y s i m i l a r t t h C 6 4 / V I C v e r s i o n . T h C L R R A M s u b r o u t i n e i l o n g e r b c a u s e o f t h n e e d t u s t h K e r n a l i n d s t a r o u t i n e t g e a t h o t h e r b a n k . A n o t e d , t h o u g h A S C F L T i l o c a t e d a $ 8 D 2 2 , e n t r ya $ 7 8 E 3 p e r f o r m s a n e e d e d e x t r a s t e p . T h i s e x t r a s t e p i w h y ,i t h e v a r i a b l e i n o s u p e r n u m b e r , N O D I G I T j u m p s t O L D E -v a l + 1 4 i t h e 1 2 8 , a n o l d e v a l + 1 i t h 6 4 / v i c s o u r c el i s t i n g .

E v e n w i t h t h u n a v o i d a b l e b a n k s w i t c h i n g , C 1 2 8 s u p e r n u m -b e r s a r e c o n s i d e r a b l y f a s t e r t h a n n o r m a l v a r i a b l e s , e s p e c i a l l ys i F A S T m o d e . O n t h i n g t h e 1 2 r e a l l y n e e d s i f a s t e rv a r i a b l e s .

T h L o a d e r s

A l t h r e e l o a d e r s w i l l r e l o c a t e t h e M t a a d d r e s s o y o u rc h o i c e b c h a n g i n g t h e v a r i a b l e s i n l i n e 1 2 0 . T h V i v e s i o n p o k e s t h M i n t o R A i B l o c k 5 t h s l o t f o r a u t o - s t a r tc a r t r i d g e s . F o o t h e r V I C - 2 0 l o c a t i o n s , t h e u s u a l t o p o m e m o r yl o w e r i n g p o k e s s h o u l d b p e r f o r m e d b e f o r e r u n n i n g t h l o a de r C 6 4 / V I C S u p e r N u m b e r s r e q u i r e s 2 9 b y t e s f o r t h e M a n v a r i a b l e s t o r a g e .

T h l o a d e r f o S u p e r N u m b e r s 1 2 8 p u t s 1 7 b y t e s o M a a d r e s s 4 8 6 4 / $ 1 3 0 0 , i t h e ' a p p l i c a t i o n s ' a r e a . T h v a r i a b l ea r e a d e f a u l t s t 6 5 4 3 9 / $ F F 4 5 i R A 1 H o w e v e r , a l t h r e ev e r s i o n s c a h a v e t h e i r v a r i a b l e s e l s e w h e r e , w h i c h b r i n g s u s t t h n e x t t o p i c .

M o r e T h a n X X V I

T h l o o k u p - a n d - A D C m e t h o d o f i n d i n g t h a d d r e s s o v a r i a b l e h a t h h a p p y s i d e b e n e f i t o f a l l o w i n g t h s t o r a g ea r e a t b m o v e d w i t h j u s t t w p o k e s . B p e r f o r m i n g t h e s eP O K E S o t h f l y , S u p e r N u m b e r s c a b m a d e t h a v e m o r et h a n o n s e o v a r i a b l e s . I s e q u a l s t h s t a r t a d d r e s s o t h r o u t i n e , t h l o b y t e o f t h e s t o r a g e a r e a i c o n t a i n e d i s + 1 0 8 , a n t h h i g h b y t e a s + 1 1 0 . P e e k t h e s e l o c a t i o n s a n p u t h v a l u e s i n t o n o r m a l v a r i a b l e s i y o i n t e n d t r e s t o r e t h d e f a u l t s t o r a g e a r e a .

F o t h 1 2 8 , t h e s t o r a g e a r e a m u s t b i R A 1 S e t t i n g a s i d em e m o r y i R A i s i m p l e e n o u g h . L o c a t i o n s 4 7 / 4 8 c o n t a i nt h p o i n t e r f o r t h e s t a r t o v a r i a b l e s ; a n 5 7 / 5 8 , t h p o i n t e r f o t h e n o s t r i n g s . I d i r e c t m o d e , o a t h s t a r t o B A S I Cp r o g r a m , b e f o r e a n v a r i a b l e s a r e a s s i g n e d , p o k e 4 7 0 p o k e4 8 r a i s e s t h n o r m a l s t a r t o v a r i a b l e s b y 2 5 6 b y t e s a n p o k e 5 7 0 p o k e 5 8 2 5 l o w e r s t h e n o s t r i n g s b 2 5 b y t e s . T h e s e p o k e s s h o u l d b f o l l o w e d b C L R .

W h e n y o w a n t t s w i t c h t d i f f e r e n t s e o f s u p e r n u m b e r s ,y o u r p r o g r a m w o u l d f i r s t P O K E s + 1 0 8 a n s + 1 1 0 w i t h t h

v a l u e s c o r r e s p o n d i n g t t h l o b y t e a n h i g h b y t e o t h s t a r to t h n e s t o r a g e a r e a . ( O b v i o u s l y , v a r i a b l e s c a n ' t b u s e df o t h e s e P O K E S . ) I e n o u g h m e m o r y h a b e e n s e a s i d e f o r t h ep u r p o s e , B A S I C s u b r o u t i n e s c o u l d h a v e t h e i r o w s e t s o s u p e r -n u m b e r s l o c a l v a r i a b l e s l i k e h i g h e r l e v e l l a n g u a g e s . L o c a ls u p e r n u m b e r s c o u l d b p a s s e d t t h m a i n p r o g r a m ( t h e g l o b a lv a r i a b l e s ) b £ A T w p o k e s j u s t b e f o r e t h s u b r o u t i n e r t u r n s w i l l r e s t o r e t h f i r s t s t o r a g e a r e a o r a n o t h e r s e o s p e r n u m b e r s .S u p e r N u m b e r s ' ' c o l d ' s t a r t c l e a r s t h e s t o r a g e a r e a p o i n t e d t b s + 1 0 8 a n s + 1 1 0 . I S u p e r N u m b e r s i t h o n l y e r r o rw e d g e i p l a c e , o t h f i r s t i a c h a i n ( t h e l a s t o n e n a b l e d ) ,C O L D c a n b e c a l l e d a g a i n t c l e a r t h e a l t e r n a t e s t o r a g e a r e a .T h C L R R A M r o u t i n e c a b c a l l e d s e p a r a t e l y w i t h s y s + 1 1 9o a l t h r e e v e r s i o n s .

F i n a l l y

T h a n k s m u s t g o t J o h n R B e n n e t t f o m a k i n g h i p r o g r a ma v a i l a b l e t T r a n s a c t o r r e a d e r s . C o n v e r t i n g h i s o r i g i n a l w o r kf r o m t h C 6 t t h C 1 2 8 , m a k i n g c h a n g e s a e n c o u n t e r e d o s t a c l e s a l o n g t h w a y , p r o v i d e d m w i t h a i n t e r e s t i n g p r o j e c t .

L i s t i n g 1 S o u r c e . 1 2 8 L A D S f o r m a t

1 0 0 0 * = $ 1 3 0 0 c l 2 8 . o r g1 0 1 01 0 2 0 . s n l 2 8 . o b j1 0 3 0 . 1 0 4 01 0 5 0 ; s u p e r n u m b e r s r e v i s i t e d1 0 6 01 0 7 0 / a d a p t e d b y r . c u r c i o1 0 8 0 ; f r o m p r o g r a m b y J o h n b e n n e t t ( v o l . 6 i s s . 0 1 1 0 9 01 1 0 0 ; l a d s f o r m a t1 1 1 01 1 2 01 1 3 0 c h r g e t = $ 0 3 8 01 1 4 01 1 5 0 v a l t y p $ 0 1 1 6 0 i n t f l g $ 1 1 1 7 01 1 8 0 i e r r o r = $ 0 3 0 01 1 9 0 i e v a l $ 0 3 0 a1 2 0 01 2 1 0 o l d e v a l $ 7 8 d a1 2 2 01 2 3 0 r o u t i n e w h i c h s e t s c a r r y i a c c u m u l a t o r h o l d s a l e t t e r1 2 4 0 c k a l p h = $ 7 b 3 c1 2 5 01 2 6 0 / r o u t i n e t o l o a d f a w i t h n u m b e r i n r a m l p o i n t e d t b a , 1 2 7 0 m e m t o l = $ 7 a 8 51 2 8 01 2 9 0 / r o u t i n e t o c h a n g e a s c i i t o f l o a t i n g p o i n t1 3 0 0 a s c f l t $ 7 8 e 31 3 1 0 / r o u t i n e i r e a l l y a t $ 8 d 2 2 . e n t r y h e r e f i r s t p e r f o r m s l d x # $ 0 01 3 2 01 3 3 01 3 4 0 s y n t a x $ 7 9 6 c1 3 5 0 i n d s t a = $ f f 7 71 3 6 01 3 7 0 n u m s $ f f 4 5 / s t o r a g e f o v a r i a b l e s1 3 8 0

3 T r a n s a c t o

Page 41: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 41/84

1 3 9 01 4 0 01 4 1 01 4 2 01 4 3 01 4 4 01 4 5 01 4 6 01 4 7 01 4 8 01 4 9 01 5 0 01 5 1 01 5 2 01 5 3 01 5 4 01 5 5 01 5 6 01 5 7 01 5 8 01 5 9 01 6 0 01 6 1 01 6 2 01 6 3 01 6 4 01 6 5 01 6 6 01 6 7 01 6 8 01 6 9 01 7 0 01 7 1 01 7 2 01 7 3 01 7 4 01 7 5 01 7 6 01 7 7 01 7 8 01 7 9 01 8 0 01 8 1 01 8 2 01 8 3 01 8 4 01 8 5 01 8 6 01 8 7 01 8 8 01 8 9 01 9 0 01 9 1 01 9 2 01 9 3 01 9 4 01 9 5 01 9 6 01 9 7 01 9 8 01 9 9 02 0 0 02 0 1 02 0 2 02 0 3 02 0 4 02 0 5 02 0 6 02 0 7 02 0 8 02 0 9 02 1 0 02 1 1 0

c o l d

w a r m

c h n g v e c

l e a v e

n e w e r r

r e a l e r r

f o u n d

n e w e v a l

n o d i g i t

f o u n d l

s u b r t n

o k a y

n u m a d r

e n d s u b

c l r r a m

j s

I d l d c m b n c p b e s t s t I d l d s t s t I d l d s t s t r t

c p b n c m b e

j m

j s l d s t s t r t

I d s t j s b c j m

c m b e j m

j s j m

j s j s b c j m s b t a j s I d l d c l a d b c i n r t

l d j s s t s t I d s t l d

c l r r a m

i e r r o ri e r r o r + 1# < n e w e r rc h n g v e cf > n e w e r rl e a v er e a l e r r + 1r e a l e r r + 2§ < n e w e r r# > n e w e r ri e r r o ri e r r o r + 1§ < n e w e v a l§ > n e w e v a li e v a li e v a l + 1

1 1 r e a l e r rf " \ "f o u n d

$ f f f f

s u b r t n1 v a l t y pi n t f l g

1 v a l t y pc h r g e tn o d i g i ta s c f l t

f " \ "f o u n d lo l d e v a l + 1 4

s u b r t nm e m t o l

c h r g e tc k a l p ho k a ys y n t a xf a

c h r g e t# < n u m sf > n u m s

a d d t a b , xe n d s u b

# n u m a d r$ c $ c # $ c 3$ 0 2 b 9# $ 0 0

; z e r o s t o r a g e a r e a

; t e s t i e r r o r a l r e a d y; p o i n t s t o n e w e r r

; s y n t a x " ?

; n o t s u p e r n u m b e r

; n o t s u p e r n u m b e r

; n o t s u p e r n u m b e r

; g e t c h a r a c t e r; m a k e s u r e i t s a l e t t e r

/ p o i n t t o n e x t/ c a l c u l a t e a d d r e s s/ o s u p e r n u m b e r

/ s e t s u p e r n u m b e r s; t z e r o

/ s e t u p p o i n t e r

/ c o u n t e r

2 1 2 0 z e r o2 1 3 02 1 4 02 1 5 02 1 6 02 1 7 02 1 8 0

I d a # $ 0 0l d # $ 0 1j s i n d s t ai n c p y 1 1 3 0b n e z e r or t

/ b y t e t o s t o r e/ b a n k

2 1 9 02 2 0 0 / t a b l e o f v a l u e s u s e d t o c a l c u l a t e2 2 1 0 / a d d r e s s o s u p e r n u m b e r2 2 2 0

1 0 1 5 2 2 2 3 0 a d d t a b2 2 4 02 2 5 02 2 6 02 2 7 02 2 8 02 2 9 0

. b y t. b y t. b y t. b y t

4 6 9

. b y t 1 0 0 1 0 1 1 0 1 1 5 1 2 . b y t 1 2 5

L i s t i n g 2 S o u r c e . 6 4 v L A D S f o r m a t1 0 0 01 0 1 01 0 2 01 0 3 01 0 4 01 0 5 01 0 6 01 0 7 01 0 8 01 0 9 01 1 0 01 1 1 01 1 2 01 1 3 01 1 4 01 1 5 01 1 6 01 1 7 01 1 8 01 1 9 01 2 0 01 2 1 01 2 2 01 2 3 01 2 4 01 2 5 01 2 6 01 2 7 01 2 8 01 2 9 01 3 0 01 3 1 01 3 2 01 3 3 01 3 4 01 3 5 01 3 6 01 3 7 01 3 8 01 3 9 01 4 0 01 4 1 01 4 2 01 4 3 01 4 4 01 4 5 01 4 6 01 4 7 01 4 8 01 4 9 01 5 0 01 5 1 01 5 2 01 5 3 01 5 4 0

* = $ c 8 0 0

' . d.

c 6 4 . o r g

s n 6 4 . o b j

/ s u p e r n u m b e r s r e v i s i t e d/ a d a p t e d b y r . c u r c i o/ f r o m a p r o g r a m b J o h n b e n n e t t ( v o l . 6 i s s . 0 1

/ l a d s f o r m a t

c h r g e t = $ 0 0 7 3

v a l t y p = $ 0 di n t f l g $ 0

i e r r o ri e v a l

$ 0 3 0 0$ 0 3 0 a

o l d e v a l = $ a e 8 6 ; $ c e 8 6 f o r v i

/ r o u t i n e w h i c h s e t s c a r r y i a c c u m u l a t o r h o l d s l e t t e rc k a l p h = $ b l l 3 ; $ d l l 3 f o r v i

/ r o u t i n e t o l o a d f a c l w i t h n u m b e r p o i n t e d t b a , m e m t o l = $ b b a 2 ; $ d a b 2 f o r v i e

/ r o u t i n e t o c h a n g e a s c i i t o f l o a t i n g p o i n ta s c f l t = $ b c f 3 ; $ d c f 3 f o r v i

s y n t a x = $ a f O 8

c o l d j s c l r r a m

w a r m I d i e r r o rl d y i e r r o r + 1c m p | < n e w e r rb n e c h n g v e cc p | > n e w e r rb e l e a v e

c h n g v e c s t r e a l e r r + 1s t r e a l e r r + 2I d a # < n e w e r rl d | > n e w e r rs t i e r r o rs t y i e r r o r + 1I d J K n e w e v a ll d y § > n e w e v a l

; $ c f 0 8 f o r v i

/ s e t r a m t o z e r o

/ t e s t i e r r o r a l r e a d y/ p o i n t s t o n e w e r r

9 I s s u e 3

Page 42: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 42/84

1 5 5 01 5 6 01 5 7 01 5 8 01 5 9 01 6 0 01 6 1 01 6 2 01 6 3 01 6 4 01 6 5 01 6 6 01 6 7 01 6 8 01 6 9 01 7 0 01 7 1 01 7 2 01 7 3 01 7 4 01 7 5 01 7 6 01 7 7 01 7 8 01 7 9 01 8 0 01 8 1 01 8 2 01 8 3 01 8 4 01 8 5 01 8 6 01 8 7 01 8 8 01 8 9 01 9 0 01 9 1 01 9 2 01 9 3 01 9 4 01 9 5 01 9 6 01 9 7 01 9 8 01 9 9 02 0 0 02 0 1 02 0 2 02 0 3 02 0 4 02 0 5 02 0 6 02 0 7 02 0 8 02 0 9 02 1 0 02 1 1 02 1 2 02 1 3 02 1 4 02 1 5 02 1 6 02 1 7 02 1 8 02 1 9 02 2 0 02 2 1 02 2 2 02 2 3 02 2 4 02 2 5 02 2 6 02 2 7 02 2 8 02 2 9 02 3 0 0

s t a i e v a ls t i e v a l + 1

l e a v e r t

n e w e r r c p x # 1 1b n e r e a l e r rc m p § " \ "b e f o u n d

r e a l e r r j m $ f f f f

f o u n d j s s u b r t nl d # s t v a l t y ps t i n t f l gr t

n e w e v a l I d a # s t v a l t y pj s c h r g e tb c n o d i g i tj m a s c f l t

n o d i g i t c m p # " \ "b e f o u n d lj m o l d e v a l + 1 2

f o u n d l j s r s u b r t nj n t p m e m t o l

s u b r t n j s c h r g e tj s c k a l p hb c o k a yj m s y n t a x

o k a y s b c f " a "t a j s c h r g e t

n u m a d r I d i < n u m sl d y | > n u m sc l a d a d d t a b , xb c c e n d s u bi n

e n d s u b r t

d r r a m l d § j s n u m a d rs t a $ c 3s t $ c t x t a

z e r o s t a ( $ c 3 ) , yi n c p y # 1 3 0b n z e r or t

t a b l e o v a l u e s u s e d t o c a l c u l a t ea d d r e s s o f s u p e r n u m b e r

a d d t a b . b y t 1 0 1 5 2 . b y t 2 5 3 0 3 5 4 0 4 5. b y t 5 0 5 6 0 6 5 7 0. b y t 7 8 0 8 5 9 0 9 5. b y t 1 0 0 1 0 5 1 1 0 1 1 5 1 2 0. b y t 1 2

/ s y n t a x " ?

; n o t s u p e r n u m b e r

; n o t s u p e r n u m b e r

; n o t s u p e r n u m b e r

; g e t c h a r a c t e r; s e t c a r r y i l e t t e r

/ p o i n t t o n e x t/ c a l c u l a t e a d d r e s s; o s u p e r n u m b e r

; g e t s t a r t o f s t o r a g e

L i s t i n g 3 C 1 2 8 . l d r

M 1 0 r e * * s u p e r n u m b e r s l o a d e r * * O 1 1 r e * * d 2 v e r s i o n * * D D 1 2 0 s n = 4 8 6 4 : b a n k l 5 : r e m w i l l r e l o c a t eB 1 3 0 c k = 0D 1 4 r e a d d : c k = c k + d : i f d = 9 9 9 t h e n l 6 0L 1 5 g o t o K OJ 1 6 i f c k < > 1 5 8 7 2 t h e n p r i n t " e r r o r i d a t a " : e n dC 1 7 0 r e s t o r eK 1 8 n a = s nJ 1 9 0 r e a d d : i f d = 9 9 9 t h e n 2 4 0G 2 0 i f d = > 0 t h e n p o k e n a , d : g o t o 2 3 0C 2 1 0 a d = s n + a b s ( d ) : g o s u b 3 5 0K 2 2 p o k e n a , l b : n a = n a + l : p o k e n a , h bC 2 3 n a = n a + l : g o t o l 9 0D 2 4 0 a d = s n + 4 4 : g o s u b 3 5 0M 2 5 p o k e s n + 1 0 , l b : p o k e s n + 2 4 , l bE 2 6 p o k e s n + 1 4 , h b : p o k e s n + 2 6 , h bK 2 7 a d = s n + 6 5 : g o s u b 3 5 0E 2 8 p o k e s n + 3 4 , l b : p o k e s n + 3 6 , h bA 2 9 r e K 3 0 r e P 3 1 0 p r i n t " s u p e r n u m b e r s i n s t a l l e d " : p r i n t s n " t o " n a - lL 3 2 p r i n t " c o l d s t a r t = s y s " s nJ D 3 3 0 p r i n t " w a r m s t a r t = s y s " s n + 3E F 3 4 0 e n A 3 5 h b = a d / 2 5 6 : l b = a d - i n t ( a d / 2 5 6 ) * 2 5 6 : r e t u r nB 1 0 0 0 d a t a 3 2 , - 1 1 9 , 1 7 3 , 0 3 1 7 2 , 1 B 1 0 1 0 d a t a 2 0 1 , 4 4 2 0 8 , 4 1 9 2 , 1 9 2 4 0 ,H 1 0 2 0 d a t a 1 4 1 , - 5 3 , 1 4 0 , - 5 4 , 1 6 9 ,0 1 0 3 0 d a t a 1 4 1 , 0 , 3 , 1 4 0 , 1 L 1 0 4 0 d a t a 1 6 0 , 1 9 , 1 4 1 , 1 0 O 1 0 5 0 d a t a 9 6 2 2 4 , 1 1 2 0 8 ,O 1 0 6 0 d a t a 3 7 6 2 5 5 , 2 5 5 ,G D 1 0 7 0 d a t a 1 3 4 , 1 5 1 3 4 , 1 6 I 1 0 8 0 d a t a 1 3 3 , 1 5 , 3 2 , 1 2 8 , 3 1 7 6 ,K 1 0 9 0 d a t a 2 2 7 , 1 2 0 , 2 0 1 , 9 2 2 4 0 , 3 P 1 1 0 0 d a t a 1 2 0 , 3 2 - 9 0 , 7 6 1 3 3 , 1 2 2 ,H 1 1 1 0 d a t a 3 3 2 , 6 0 , 1 2 3 , 1 7 6 , 3 7 6 1 0 E 1 1 2 0 d a t a 1 2 1 , 2 3 3 , 6 5 1 7 0 , 3 2 1 2 8 , 3 1 6 M 1 1 3 0 d a t a 6 9 1 6 0 , 2 5 5 , 2 4 1 2 5 , - 1 4 8 , 1 4 4 ,O 1 1 4 0 d a t a 2 0 0 , 9 6 1 6 2 , 0 3 2 , - 1 0 7 , 1 3 3 , 1 9 B 1 1 5 0 d a t a 1 3 2 , 1 9 6 , 1 6 9 , 1 9 5 , 1 4 1 , 1 8 5 , 2 1 6 D P 1 1 6 0 d a t a 0 1 6 9 , 0 1 6 2 , 1 3 2 , 1 1 9 , 2 5 N 1 1 7 0 d a t a 2 0 0 , 1 9 2 , 1 3 0 , 2 0 8 , 2 4 4 , 9 6 0 E 1 1 8 0 d a t a 1 0 , 1 5 , 2 0 , 2 5 , 3 0 , 3 5 , 4 0 , 4 O 1 1 9 0 d a t a 5 0 , 5 5 , 6 0 , 6 5 , 7 0 , 7 5 , 8 0 , 8 N 1 2 0 0 d a t a 9 0 I 1 2 1 0 d a t a 9 9

3

2 4 4 1 6 0 , 1

3 1 6 9 , 6 1 4 0 , 1 1 , 3

4 2 0 1 , 9 2 2 4 3 2 - 9 0 , 1 6 2 ,9 6 1 6 9 ,

3 7 7 6 2 3 3 2 1 2

9 5 1 0 0 , 1 0 5 , 1 1 0 , 1 1 5 , 1 2 0 , 1 2

n u m s . b y t / s t o r a g e s t a r t s h e r e

L i s t i n g 4 C 6 4 . l d r

M I 1 0 0 r e * * * s u p e r n u m b e r s l o a d e r * * *N 1 1 r e * * * c 6 4 v e r s i o n * * F 1 2 s n = 5 1 2 0 0 : r e m w i l l r e l o c a t eB 1 3 c k = 0D 1 4 r e a d d : c k = c k + d : i f d = 9 9 9 t h e n l 6 0L D 1 5 0 g o t o l 4 0B C 1 6 0 i f c k < > 1 5 5 8 5 t h e n p r i n t " e r r o r i n d a t a " : e n dC 1 7 r e s t o r eK 1 8 n a = s nJ I 1 9 0 r e a d d : i f d = 9 9 9 t h e n 2 4 0G 2 0 i f d = > 0 t h e n p o k e n a , d : g o t o 2 3 0C B 2 1 0 a d = s n + a b s ( d ) : g o s u b 3 5 0K 2 2 p o k e n a , l b : n a = n a + l : p o k e n a , h bC 2 3 n a = n a + l : g o t o l 9 0D 2 4 0 a d = s n + 4 4 : g o s u b 3 5 0M 2 5 p o k e s n + 1 0 , l b : p o k e s n + 2 4 , l bE 2 6 p o k e s n + 1 4 , h b : p o k e s n + 2 6 , h bK 2 7 a d = s n + 6 5 : g o s u b 3 5 0E 2 8 p o k e s n + 3 4 , l b : p o k e s n + 3 6 , h b

T r a n s a c t o

Page 43: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 43/84

2 9 a d = s n + 1 6 4 : g o s u b 3 5 03 0 p o k e s n + 1 0 8 , l b : p o k e s n + 1 1 0 , h b3 1 p r i n t " s u p e r n u m b e r s i n s t a l l e d " : p r i n t s n " t o " n a - 13 2 p r i n f ' c o l d s t a r t = s y s " s n

D 3 3 0 p r i n t " w a r m s t a r t = s y s " s n + 33 4 e n 3 5 h b = a d / 2 5 6 : l b = a d - i n t ( a d / 2 5 6 ) * 2 5 6 : r e t u r n

P 1 0 0 0 d a t a 3 2 , - 1 1 9 , 1 7 3 , 0 3 1 7 2 , 1 1 0 1 0 d a t a 2 0 1 , 4 4 , 2 0 8 , 4 1 9 2 , 2 0 0 , 2 4 0 , 2 1 0 2 0 d a t a 1 4 1 , - 5 3 , 1 4 0 , - 5 4 , 1 6 9 , 4 4 1 6 0 , 2 0 1 0 3 0 d a t a 1 4 1 , 0 , 3 , 1 4 0 , 1 , 3 , 1 6 9 , 6 5

P 1 0 4 0 d a t a 1 6 0 , 2 0 0 , 1 4 1 , 1 0 3 1 4 0 , 1 1 ,1 0 5 0 d a t a 9 6 2 2 4 , 1 1 2 0 8 , 4 2 0 1 , 9 2 2 4

D 1 0 6 0 d a t a 3 7 6 2 5 5 , 2 5 5 , 3 2 - 9 0 , 1 6 2 ,1 0 7 0 d a t a 1 3 4 , 1 3 , 1 3 4 , 1 4 9 6 , 1 6 9 , 0 1 3 1 0 8 0 d a t a 1 3 3 2 , 1 1 5 , 0 1 7 6 , 3 7 6 2 4 1 0 9 0 d a t a 1 8 8 , 2 0 1 , 9 2 2 4 0 , 3 7 6 , 1 4 6 , 1 7

C 1 1 0 0 d a t a 3 2 - 9 0 , 7 6 1 6 2 , 1 8 7 , 3 2 1 1 5 ,B 1 1 1 0 d a t a 3 2 , 1 9 , 1 7 7 , 1 7 6 , 3 7 6 8 1 7 J 1 1 2 0 d a t a 2 3 3 , 6 5 1 7 0 , 3 2 1 1 5 , 0 1 6 9 , 1 6 6 1 1 3 0 d a t a 1 6 0 , 2 0 0 , 2 4 1 2 5 , - 1 3 8 , 1 4 4 , 1 2 0

1 1 4 0 d a t a 9 6 1 6 2 , 0 3 2 , - 1 0 7 , 1 3 3 , 1 9 5 , 1 3 1 1 5 0 d a t a 1 9 6 , 1 3 8 , 1 6 8 , 1 4 5 , 1 9 5 , 2 0 0 , 1 9 2 , 1 3

L 1 1 6 0 d a t a 2 0 8 , 2 4 9 , 9 6 0 , 5 , 1 0 , 1 5 , 2 L 1 1 7 0 d a t a 2 5 , 3 0 , 3 5 , 4 0 , 4 5 5 0 , 5 5 , 6

1 1 8 0 d a t a 6 5 7 0 , 7 5 , 8 0 , 8 5 , 9 0 , 9 5 , 1 0 1 1 9 0 d a t a 1 0 5 , 1 1 0 , 1 1 5 , 1 2 0 , 1 2 5 , 9 9

5 : v i c . l d r1 0 r e * * s u p e r n u m b e r s l o a d e r * * 1 1 r e * * v i v e r s i o n * * 1 2 s n = 4 0 9 6 0 : r e m w i l l r e l o c a t e1 3 c k = 01 4 r e a d d : c k = c k + d : i f d = 9 9 9 t h e n l 6 01 5 g o t o l 4 01 6 i f c k < > 1 5 6 0 0 t h e n p r i n t " e r r o r i d a t a " : e n d1 7 r e s t o r e1 8 n a = s n

I 1 9 0 r e a d d : i f d = 9 9 9 t h e n 2 4 0B 2 0 0 i f d = > 0 t h e n p o k e n a , d : g o t o 2 3 0B 2 1 0 a d = s n + a b s ( d ) : g o s u b 3 5 0

2 2 p o k e n a , l b : n a = n a + l : p o k e n a , h b2 3 n a = n a + l : g o t o l 9 0

H 2 4 0 a d = s n + 4 4 : g o s u b 3 5 02 5 p o k e s n + 1 0 , l b : p o k e s n + 2 4 , l b2 6 p o k e s n + 1 4 , h b : p o k e s n + 2 6 , h b2 7 a d = s n + 6 5 : g o s u b 3 5 02 8 p o k e s n + 3 4 , l b : p o k e s n + 3 6 , h b2 9 a d = s n + 1 6 4 : g o s u b 3 5 03 0 p o k e s n + 1 0 8 , l b : p o k e s n + 1 1 0 , h b3 1 p r i n t " s u p e r n u m b e r s i n s t a l l e d " : p r i n t s n " t o " n a - l3 2 p r i n f ' c o l d s t a r t = s y s " s n

D 3 3 0 p r i n t " w a r m s t a r t = s y s " s n + 3F 3 4 0 e n 3 5 0 h b = a d / 2 5 6 : l b = a d - i n t ( a d / 2 5 6 ) * 2 5 6 : r e t u r n 1 0 0 0 d a t a 3 2 , - 1 1 9 , 1 7 3 , 0 3 1 7 2 , 1 1 0 1 0 d a t a 2 0 1 , 4 4 2 0 8 , 4 1 9 2 , 1 6 0 , 2 4 0 , 2

1 0 2 0 d a t a 1 4 1 , - 5 3 , 1 4 0 , - 5 4 , 1 6 9 , 4 4 1 6 0 , 1 6 1 0 3 0 d a t a 1 4 1 , 0 , 3 , 1 4 0 , 1 , 3 , 1 6 9 , 6 5

1 0 4 0 d a t a 1 6 0 , 1 6 0 , 1 4 1 , 1 0 3 1 4 0 , 1 1 , 31 0 5 0 d a t a 9 6 2 2 4 , 1 1 2 0 8 , 4 2 0 1 , 9 2 2 4 1 0 6 0 d a t a 3 7 6 2 5 5 , 2 5 5 , 3 2 - 9 0 , 1 6 2 ,

1 0 7 0 d a t a 1 3 4 , 1 3 , 1 3 4 , 1 4 , 9 6 , 1 6 9 , 0 1 3 1 0 8 0 d a t a 1 3 3 2 1 1 5 , 0 1 7 6 , 3 7 6 2 4 1 0 9 0 d a t a 2 2 0 , 2 0 1 , 9 2 2 4 0 , 3 7 6 1 4 6 , 2 0 1 1 0 0 d a t a 3 2 - 9 0 , 7 6 1 7 8 , 2 1 8 , 3 2 1 1 5 ,

B 1 1 1 0 d a t a 3 2 1 9 2 0 9 , 1 7 6 , 3 7 6 8 2 0 1 1 2 0 d a t a 2 3 3 , 6 5 1 7 0 , 3 2 1 1 5 , 0 1 6 9 , 1 6

1 1 3 0 d a t a 1 6 0 , 1 6 0 , 2 4 1 2 5 , - 1 3 8 , 1 4 4 , 1 2 0 1 1 4 0 d a t a 9 6 1 6 2 , 0 3 2 , - 1 0 7 , 1 3 3 , 1 9 5 , 1 3 1 1 5 0 d a t a 1 9 6 , 1 3 8 , 1 6 8 , 1 4 5 , 1 9 5 , 2 0 0 , 1 9 2 , 1 3

L 1 1 6 0 d a t a 2 0 8 , 2 4 9 , 9 6 0 5 1 0 1 5 2 1 1 7 0 d a t a 2 5 3 0 , 3 5 , 4 0 4 5 5 0 , 5 5 , 6 1 1 8 0 d a t a 6 5 7 0 , 7 5 , 8 0 8 5 9 0 , 9 5 , 1 0

O 1 1 9 0 d a t a 1 0 5 , 1 1 0 , 1 1 5 , 1 2 0 , 1 2 5 , 9 9

C H I P C H E C K E R

O v e r 6 5 D i g i t a l I C 8 0 0 0 N a t i o n a l S i g .7 5 / 5 4 T T ( A l s , a s , f , h , l , l s , s ) 9 0 0 0 T T 7 4 / 5 4 C M O S ( C . h c , h c t , s c 1 4 - 2 4 P i C h i p s1 4 / 4 C M O S . 3 . 6 I W i d t h sP r e s s i n g s i n g l e k e i d e n t i f i e s / t e s t s c h i p s w i t h A N

t y p e o o u t p u t i s e c o n d s . T h C H I P C H E C K E R n o a l s o t e s t s p o p u l a r R A c h i p s . T h C H I P C H E C K E R i a v a i l a b l e f o t h C 6 o C 1 2 8 f o $ 1 5 9 . T h P c o p a t i b l e v e r s i o n i $ 2 5 9 .

D U N E S Y S T E M S2 6 0 3 W i l l a D r i v e

S t J o s e p h , M 4 9 0 8 5( 6 1 6 ) 9 8 3 - 2 3 5 2

N O T H I N G L O A D S Y O U R P R O G R A M S F A S T E RT H Q U I C K B R O W N B O

N E C O N C E P T I C O M M O D O R E C A R T R I D G E SS t o r e u t 3 o y o u r f a v o r i t e p r o g r a m s B a s i c M / L , G a m e sU t i l i t i e s , W o r d P r o c e s s o r s T e r m i n a l s i s i n g l e b a t t e r y - b a c k e dc a r t r i d g e . R E A D Y T R U A T T H E T O U C H O F K E Y .H U N D R E D S O T I M E S F A S T E R T H A N D I S K . C h a n g e c o n t e n t sa o f t e n a y o w i s h . T h Q B a c c e p t s m o s t u n p r o t e c t e d p r o g r a m si n c l u d i n g " T h e W r i t e S t u f f t h o n l y w o r d p r o c e s s o r t h a t s t o r e s y o u rt e x t a s y o t y p e . U s a p e r m a n e n t R A M - D I S K , p r o t e c t e d w o r ka r e a , a a u t o b o o t u t i l i t y . I n c l u d e s u t i l i t i e s f o C 6 a n C - 1 2 8 m o d e .P a c k a g e s a v a i l a b l e w i t h " T h e W r i t e S t u f f , " " U l t r a t e r m I I I , " " Q D i s k "( C P / M R A D i s k ) , o Q B U t i l i t i e s D i s k . P r i c e : 3 2 $ 9 9 ; 6 4 $ 1 2 9 .( + $ 3 S / H ; $ o v e r s e a s a i r ; M a s s r e s i d e n t s a d 5 % ) . Y e a r W a r r a n t y .B r o w n B o x e s , I n c , 2 C o n c o r d R d B e d f o r d , M 0 1 7 3 0 : ( 6 1 7 ) 2 7 5 -0 0 9 0 ; 8 6 2 - 3 6 7 5

Page 44: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 44/84

I n s i d e T h 1 7 6 4 R E H a l f w a y t o n m e 6

b P a u l B o s a c k i

T h i s a r t i c l e w a w r i t t e n i t w p a r t s . T h f i r s t b i w a w r i t t e n i e a r l y J a n u a r y , j u s t a f t e r t h m a i l s t a r t e d t o c o m e i o n C a r e a n F e e d i n g o t h C 2 5 6 . T h r e s t o i w a w r i t t e n f o u r m o n t h s l a t e rw h e n s o m e a d d i t i o n a l i n f o r m a t i o n l e m t q u e s t i o n o n o m e a r l y s p e c u l a t i o n s . B u I ' v e l e f t t h f i r s t p a r t m o s t l y a i w a b e c a u s e t h o u g h t y o m i g h t a p p r e c i a t e r e a d i n g a b o u t t h m e t a s t r e t c h i n g t h a t o w n i n g c o m p u t e r h a r e q u i r e d .

E v e r s i n c e T r a n s a c t o r p u b l i s h e d C a r e a n F e e d i n g o t h C 2 5 6 , I ' v e b e e n r e c e i v i n g l i t t l e m a i l . M o s t o i h a h a t d w i t h m m e 6 4 a n h o t h i s w a a c h i e v e d . T h a n s w e rl i e s i t h m a r r i a g e o t w d i s t i n c t m e m o r y e x p a n s i o n s t r a t eg i e s . T h f i r s t i c o m m e r c i a l 5 1 2 K R A E x p a n s i o n U n i t t h a tu s e s h i g h s p e e d , d i r e c t m e m o r y a c c e s s t e c h n i q u e s ; t h e s e c o n d ,5 1 2 k o u s e r i n s t a l l e d , s l o w e r , b a n k - s w i t c h e d R A a l o n g t h l i n e s o t h 2 5 6 K p r o j e c t f r o m T r a n s a c t o r , V o l u m e 9 I s s u e 2 . w o n ' t b d i s c u s s i n g t h b a n k s w i t c h e d R A p r o j e c t h e r e .T h a t ' s f o l a t e r . R a t h e r , i t ' s t h 5 1 2 K R E t h a t w a n t t o t a l ka b o u t . I t ' s 1 7 6 4 R E U . Y o k n o w , t h 2 5 6 K t y p e .

T h e r e c a n b e l i t t l e d o u b t t h a t t h 1 7 6 4 r e i o n o t h m o s ts i g n i f i c a n t p e r i p h e r a l s t h a t C o m m o d o r e e v e r o f f e r e d f o t h 6 4 I l i e u o f a s t e r p r o c e s s o r , i i t h b e s t t h i n g g o i n g f o s p e e d i n g u a o t h e r w i s e s l o w p r o g r a m . A l o n g , t h a t i s a t h p r o g r a m t a k e s a d v a n t a g e o f t h R E U . G e o s i o n o t h o s e p r g r a m s . A n n o n e , i m a g i n e , w o u l d b f o o l i s h e n o u g h t s u g g e s t t h a t a r e o s o m e s o r t i s n ' t n e c e s s a r y w h e n r u n n i n gG E O S a n t h b i g g e r t h b e t t e r . P u 2 5 6 K R E o G E O S , a n y o u ' r e s o o n w i s h i n g y o u h a d 5 1 2 K . T h i m p r o v e m e n t s a R E o f f e r s a r e j u s t s h o r t o a m a z i n g .

T h i s i t h e s t o r y o c u r i o s i t y a n t h c a t , i n c l u d i n g t h s a t i s f a ct i o n p a r t . W h a t f o l l o w s i l o o k i n s i d e t h R E a n d , b e s t o a l l , t h i n f o r m a t i o n n e c e s s a r y t e x p a n d t h 1 7 6 4 R E t 5 1 2 K . h a v e h e a r d t h a t s o m e o t h i s i n f o r m a t i o n i a v a i l a b l ee l s e w h e r e ; h o w e v e r , i t ' s i m p o r t a n t e n o u g h t b e a r r e p e a t i n g .

R E I n t e r n a l s

A n y o n e w h o ' s e v e r b e e n b r a v e e n o u g h t o p e n 1 7 6 4 h a b e e n g r e e t e d w i t h f e v e r y i n t r i g u i n g w o r d s o n t h p r i n t e dc i r c u i t b o a r d : C 1 2 8 R A E x p a n s i o n . I s e e m s t h a t C o m m o d o r eu s e s o n r e ( r a m E x p a n s i o n C o n t r o l l e r ) b u t p o p u l a t e s e a c h

R E w i t h v a r y i n g q u a n t i t i e s o r t y p e s o R A M . S i m p l y p u t , t h 1 7 6 4 i 1 7 5 0 R E w i t h o n l y o n b a n k o 4 1 2 5 6 - 1 5 D R A M a n

d i f f e r e n t n a m e s t e n c i l e d o t h c a s e . I f a c t , t h 1 7 0 0 R E i d i f f e r e n t f r o m i t b e e f i e r s i b l i n g s o n l y i t h a t i u s e s t h 4 1 6 4d r a m r a t h e r t h a n t h 4 1 2 5 6 .

B u a l t h a t ' s i n t r i g u i n g d o e s n ' t s t o p t h e r e . A t h l o w e r r i g h to t h P b o a r d i a e m p t y l a y o u t f o 2 8 - p i n c h i p : e i t h e r a 8 1 o 3 2 e p r o m . C l o s e i n s p e c t i o n o t h b o a r d r e v e a l s t h a tt h d a t a b u a n t h l o 1 3 a d d r e s s l i n e s a r b r o u g h t o u t t h l a y o u t . A w e l l , A 1 c a b s e l e c t e d b r e s e t t i n g j u m p e r o t h b o a r d . O t h t w E P R O M s e l e c t l i n e s , o n i d i r e c t l y c o n e c t e d t t h R E C ; t h o t h e r i c o n n e c t e d t g r o u n d . Y e t , h o t h R O i a c c e s s e d b t h 6 i p a r t i a l m y s t e r y t m e

L e m o u t l i n e s o m e o m o b s e r v a t i o n s . F i r s t , t h R E i t s e l fs e l e c t s t h E P R O M i r e s p o n s e t l o w o n e i t h e r t h / R O M H o / R O M L l i n e o t h e c a r t r i d g e p o r t . T h e r e ' s f l i t h a t o i n t m e n tt h o u g h . c a r t r i d g e s i g n a l s t h e p r e s e n c e o f a E P R O M t t h C 6 b p u l l i n g l o t h / E X R O M o / G A M E l i n e ( o r b o t h ) o t h e x p a n s i o n p o r t . T h e s e l i n e s a r d i r e c t l y c o n n e c t e d t t h p l a n d e f a u l t h i g h . B u t , t h / E X R O M a n / G A M E l i n e s a r n o m a n i p u l a t e d b t h R E U . P u t a n o t h e r w a y , t h E P R O M w o n ' t b s e l e c t e d b e c a u s e t h R E h a s n ' t i n d i c a t e d t t h 6 t h a t t h e r e ' sa E P R O M p r e s e n t ! N o t h i s c o n f o u n d s m e W h t h e l a y o u tf o a E P R O M , b u n w a t a c c e s s i t

T h e r e a r t w p o s s i b i l i t i e s h e r e . O n e , I ' m i s s i n g s o m e t h i n go b v i o u s . O t w o , a e a r l y d e s i g n a s p e c t d i d n ' t m a k e i a l t h w a t t h p r o d u c t i o n s t a g e s . Y o s e e , i i p o s s i b l e t o s e l e c tt h E P R O M , b u w h a v e t c h e a t . O t h R E b o a r d , c o n n e c tt h / E X R O M l i n e t o g r o u n d . A 8 E P R O M i t h e n s e l e c t e d i t h $ 8 0 0 0 r a n g e . O c o n n e c t t h / G A M E l i n e t g r o u n d a l o n gw i t h / E X R O M t a l l o w 1 6 E P R O M . N o a E P R O M w o u l d b s e l e c t e d f r o m $ 8 0 0 0 t $ b f f f . H o w e v e r , w e ' r e a l w a y s g o i n g t b o u 8 o f s y s t e m R A M . A n i t h s e c o n d c a s e , w m u s ts u p p l y B A S I C , h o w e v e r m o d i f i e d ( o t h e r w i s e , w h b o t h e r w i t h

1 6 E P R O M ? ) .

S p e c u l a t i o n s

N o w , h e r e ' s a p i e c e o f s p e c u l a t i o n f o y o u . T h E P R O M i o b v i o u s l y s e l e c t e d b t h R E b a s e d o t h s t a t u s o / R O M L

Page 45: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 45/84

a n d / R O M H . B u t i t h E P R O M w e r e a l w a y s t b s e l e c t e d , w h n o c o n n e c t t h l i n e s d i r e c t l y t o t h E P R O M ? T w p o s s i b l er e a s o n s . N e g l e c t i n g f o m o m e n t t h a t A 1 4 c a n b e r o u t e d t t h l a y o u t , t h E P R O M c a n b e e i t h e r a 8 o 1 6 c h i p . T h i s w a t h R E h a n d l e s t h d e c o d i n g . O p e r h a p s t h e r e i t h o p t i o n t m a i t h E P R O M . l o o k a t h R E r e g i s t e r s r e v e a l s t h a tt h r e e b i t s i n t h c o m m a n d r e g i s t e r a r e m a r k e d r e s e r v e d . P e h a p s t h e s e b i t s s e r v e t h a t f u n c t i o n . T h i s m e a n s t h a t a o u t p u tf r o m t h R E m i g h t c o n n e c t d i r e c t l y t o t h / E X R O M l i n e ,a n o t h e r t / g a m e . B s e t t i n g o c l e a r i n g b i t , l o w o n t h c o r r e s p o n d i n g l i n e w o u l d s i g n a l t t h 6 w h e t h e r a E P R O Mw e r e p r e s e n t . H o w e v e r , c o u l d n ' t g e a n c o m b i n a t i o n o t h o s e b i t s t o a c t i n t h a t f a s h i o n . A g a i n , m a y b e I ' m i s s i n gs o m e t h i n g .

T h e n t h e r e ' s t h f a c t t h a t b c h a n g i n g J 2 A 1 4 c a n b b r o u g h to u t t h E P R O M . T h i s a l l o w s a 3 2 E P R O M t o c c u p y t h e l a yo u t . B u h o i t h u p p e r 1 6 s e l e c t e d ? D w a g a i n l o o k t t h s u s p e c t b i t s i t h c o m m a n d r e g i s t e r ? I t h a t f u n c t i o ns o m e h o w h i d d e n t h e r e a w e l l ?

S o w h a t w a s t h E P R O M t c o n t a i n ? Y o u r g u e s s i a g o o d a m i n e . S p e c u l a t i o n : m a y b e c u s t o m R E r o u t i n e s . P e r h a p s C o m o d o r e i n t e n d e d a c u s t o m R A M D O S t b p l a c e d t h e r e . I t ' s o l c o n j e c t u r e . A n a s a i d , i s e e m s i m p o s s i b l e f o r t h e R E t s e l e c t t h E P R O M w i t h o u t s o m e f o r m o i n t e r v e n t i o n o o u p a r t ; i . e . , c o n n e c t i n g e i t h e r / E X R O M , o b o t h / E X R O M o / G A M E ,t g r o u n d . T h e n , w h a t e v e r c o d e a E P R O M c o n t a i n e d w o u l d b u t t h e i n d i v i d u a l . U n f o r t u n a t e l y , i s e e m s t h a t t h l a y o u tm a d e i t t h b o a r d b u s u p p o r t i n g C 6 s e l e c t f u n c t i o n sd i d n ' t . A n y b o d y k n o w f o r c e r t a i n ?

W e ' r e h e r e t p u m p R E U s u

I n t r i g u i n g p o i n t n u m b e r 3 o t h s o l d e r s i d e o t h c i r c u i tb o a r d i j u m p e r w i t h t h p r o m i s i n g w o r d s : 5 1 2 K - c u t . W h e nt h i s l i n e i c u t , i s i g n a l s t t h R E t h a t 2 5 6 K b i D R A M s a r p r e s e n t . W h a t t h i s s u g g e s t s i t h a t a l t h o s e p e o p l e o u t h e r ew h b o u g h t t h 1 7 0 0 R E a n n o c r a v e 5 1 2 K o e x p a n s i o nR A n e e d o n l y u n s o l d e r t h t w b a n k s o 4 1 6 4 s a n d i n s t a l l4 1 2 5 6 s a n c u t h j u m p e r , o c o u r s e . O n b a n k o 4 1 2 5 6 -1 5 ' s w o u l d y i e l d 2 5 6 K , a n o t h e r w o u l d t a k e t h R E t i t m a i m u m 5 1 2 k . H o w e v e r , i t ' s o n l y f a i r t w a r n y o u t h a t h a v e n o d o n e t h i s , a n c a n n o t , t h e r e f o r e , a s s u r e y o o t h r e s u l t s . A n i w o u l d b f i n i c k y j o d e s o l d e r i n g 2 5 p i n s ! I a n y o n ed o e s s u c c e e d a t h i s , l e m k n o w !

F o t h o s e w h o w 1 7 6 4 s t h p r o c e s s i s i m p l e r . B e c a u s e t h 5 1 2 K j u m p e r i a l r e a d y c u t , a l t h a t n e e d s t b d o n e i i n s t a l la n o t h e r b a n k o 4 1 2 5 6 - 1 5 s . F i r s t , c a r e f u l l y d i s a s s e m b l e y o u r1 7 6 4 ( n e e d l e s s t s a y , s u c h a c t i o n w i l l v o i d y o u r w a r r a n t y ) .T h c a s e i h e l d t o g e t h e r b f o u r p l a s t i c p o s t s s e t i n s o c k e t s .I t ' s b e s t t s t a r t a t h e x p a n s i o n p o r t c o n n e c t o r a n p r u w i t h a s m a l l s c r e w d r i v e r . W o r k y o u r w a a r o u n d t h R E a t h c a s e g i v e s . I n s i d e i t h R s h i e l d w h i c h j u s t p r i e s o f f , t h e ny o u ' r e a t h b o a r d i t s e l f . C o m p a r e t h b o a r d a g a i n s t t h d r a wi n g . I f t h e y ' r e n o s i g n i f i c a n t l y t h s a m e , p r o c e e d a y o u r o w r i s k .

H o w e v e r , i t h a t i t h c a s e , a l i n o l o s t . C h e c k c o u p l e o t h i n g s o u t . L o o k f o r t h e j u m p e r o n t h s o l d e r s i d e o t h b o a r d .I t ' s b e n e a t h t h R E C . I i t ' s t h e r e , c h a n c e s a r t h a t s i m p l ya d d i n g t h e e x t r a r a w i l l w o r k e v e n i y o u r b o a r d i d i f f e r e n t .A n c h e c k f o t h C 1 2 8 R A E x p a n s i o n t i t l e . I c a n ' t h e l p b u tf e e l t h a t ' s d e a d g i v e a w a y .

I e v e r y t h i n g c h e c k s o u t , l o o k b e l o w t h b a n k o 4 1 2 5 6 sl a b e l e d B a n k 1 Y o w i l l s e t h l a y o u t s f o e i g h t s i x t e e n - p i nc h i p s ; j u s t t o t h r i g h t o t h l a y o u t s w i l l b t h w o r d s " B a n k2 ( a n o t h e r d e a d g i v e a w a y ) . C l e a r e a c h o t h e s o l d e r p a d s u i n e i t h e r v a c u u m d e s o l d e r o s o l d e r b r a i d a n i n s t a l l e i g h t4 1 2 5 6 - 1 5 s t h e r e . Y o u ' l l w a n t t o b s e r v e t h u s u a l a n t i - s t a t i cp r e c a u t i o n s . G r o u n d y o u r s e l f f i r s t ! W i t h D R A M c o s t i n g $ 1 2 . 0 0

c h i p , m i s t a k e s a r e x p e n s i v e . Y o m a w a n t t i n s t a l l t h d r a m s i s o c k e t s t m i n i m i z e t h p o s s i b i l i t y o d a m a g e . U s l o p r o f i l e s o c k e t s . W i t h t h R s h i e l d b a c k i p l a c e , t h e r e ' sj u s t e n o u g h r o o m . B u t c h e c k f i r s t , j u s t t o b c e r t a i n .

O n c e t h e c h i p s a r i n s t a l l e d , y o u ' r e d o n e . P u t h u n i t b a c k t g e t h e r a n p u l l o u y o u r c o p y o G E O S 1 . 3 / 2 . 0 o t h u t i l i t yd i s k t h a t c a m e w i t h y o u r R E U . T h R A M d i s k u t i l i t y f r o m t h a td i s k w i l l c o n f i g u r e a l 5 1 2 K ( m i n u s s o m e r o o m f o c o d e ) a R A M d i s k . I t ' s w o r t h n o t i n g h o w e v e r , t h a t t h R E t e s t p r o g r a mt e s t s o n l y t h f i r s t 2 5 6 K .

U n d e r G E O S , y o u r o p t i o n s a r s o m e w h a t v a r i e d . U n d e r 1 . 3 ,y o c a c o n f i g u r e a R A 1 5 4 1 a n S h a d o w 1 5 4 1 , o r i y o h a v e t w 1 5 4 1 ' s t w S h a d o w 1 5 4 1 ' s U n d e r 2 . 0 , c o n f i g u r e aR A 1 5 7 1 o w h a t e v e r . I y o u w a n t t t e s t t h a d d i t i o n a l R A M ,l o a d u R A 1 5 7 1 a n c l i c k o v a l i d a t e . I y o u r R A M d i s kv a l i d a t e s t h e n y o u r n e r a p a s s e s . I t ' s n o t a c o m p l e t e t e s t :o n l y t r a c k a n s e c t o r l i n k s a r b e i n g f e t c h e d , s y o u ' r e r e a l l yo n l y t e s t i n g t h f i r s t t w b y t e s o f e a c h R A p a g e . H o w e v e r , i m o s t c a s e s , t h a t t e s t a l o n e w i l l t e l l y o i t h e r e ' s p r o b l e m .

A n t h a t , l a d i e s a n g e n t l e m e n , i s a l l t h e r e i t i t A n d , a n i c e l i t t l e b o n u s , y o u r R E i ( a n d a l w a y s h a s b e e n ) c o m p a t ib l w i t h t h C 1 2 8 .

A f o r t h e E P R O M , i t ' s o n o t h m o r e c u r i o u s a s p e c t s o t h R E U . I s e e m s t h a t m u c h w a i n t e n d e d , b u i w a u l t i m a t e l ya b a n d o n e d . A l w e ' r e l e f t w i t h i t h e l a y o u t a n t h o p p o r t u n i t yt g r o u n d / E X R O M o b o t h / G A M E a n / E X R O M . A l e a s t , t h a tw o u l d a l l o w 8 o 1 6 o E P R O M . B u t h a t s e e m s p r e t t y p o o rf a r e w h e n 3 2 i a o p t i o n , a n t h a t t h e r e m i g h t b e l u r k i n gt h e r e , s o m e w h e r e , m o r e e l e g a n t s e l e c t m e c h a n i s m .

F o l l o w i n g u

F u n n y , t h w a t h i n g s c h a n g e . T h a b o v e p o r t i o n o t h i s a r t ic l w a w r i t t e n i e a r l y J a n u a r y , j u s t w h e n i w a s b e c o m i n gc l e a r t h a t l o o p e o p l e w e r e i n t e r e s t e d i o n m e 6 4 I s e e m e d o b v i o u s a t h t i m e t h a t a a r t i c l e c o n c e r n i n g t h 1 7 6 4w a a g a i n d u e . k n e w n o n h a e v e r a t t a c k e d t h E P R O Mq u e s t i o n , a n w a n t e d t o p e n f o r u m o s o r t s . T h e n i t h F e b r u a r y i s s u e o C o m m o d o r e M a g a z i n e , B r i a n D o u g h e r t y ( o B e r k e l e y S o f t w o r k s ) s t a t e d t h a t a E P R O M c o u l d j u s t b

Page 46: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 46/84

1 7 ( 4 B o a r d L a y o u t

C C 1 2 8 R A E X P A N S I O N F A N # 3 1 2 5 3 5

C C C C C

U U

O

U U U U U U C 2

C 2 1 6 m f

S * 1 6 p i l a y o u t s f o a d d i t i o n a l b a n ko f 4 1 2 5 6 - 1 5 D R A M S . L a b e l e d U 1 8 - U 1 7 . . R P

R P

1 2 9 8 A 1 5 - 8 7

C 2

C 1 C 1

F B F B

R P

U a c a n t 2 p i l a y o u t f o 3 2 k * 3 b i R O M . S e t e x t .

R P F P / C G / T F

A S S V N O 3 1 2 5 3 3

R P R P

F B F B F F B F B 0 D ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■

N o t e s :i R 4 , . p r e s e n t o s o m e e a r l y 1 7 5 6 a n 1 7 0 e ' s , i a b s e n t .

i i F B h a b e c o m e 4 3 o h r e s i s t o r .

B o t h c h a n g e s p o i n t t t h s p e c u l a t i o nt h a t t h R E b o a r d h a s n o t b e e ns i g n i f i c a n t l y r e d e s i g n e d ( i a a l l ) s i n c e i t i n t r o d u c t i o n .Q u e s t i o n : i s o w h d i i t a k eC o m m o d o r e s l o n g t c o u g h u t h 1 7 6 4 ?

N o t e s :i R E i s h o u j nc o m p o n e n t s i d e u p i i / G A M E / E X R O M a r l e a d s r e s p e c t i v e l y .i i i ) S N a s h o w n i D P S T a n d u i h e nc l o s e d , m a p s 1 6 E P R O M i n t o t h S 8 Q 8 0 t S b f f f r a n g e . F o a 8 E P R O M u s a S P S T s w i t c ho t h / E X R O M l i n e . T h E P R O Mt h e n m a p s i a S 8 8 8 8 .

C E P R O M S e l e c t S o l u t i o n s( f o r t h 1 7 x x R E U ' s )

p u u p u u S N

Page 47: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 47/84

d r o p p e d i n t o a 1 7 6 4 . W e l l , t h a t g o m g o i n g a n t h a b o v e i t h r e s u l t .

N o f o u r m o n t h s l a t e r , s t i l l s t a n d b t h a b o v e c o n c l u s i o n s . B u t , l i k e s a i d , t h i n g sh a v e t h i s f u n n y h a b i t o f c h a n g i n g . A n d ,w l e a r n i t h e p r o c e s s . m i s s e d a v a l ua b l e p o i n t i t h a b o v e n o t e s , t h a t s o m et h i n g o b v i o u s c o m p l a i n e d a b o u t : t h e1 7 6 4 i s d o w n d e e p i n s i d e , s t i l l a p r o d u c tt h a t w a d e v e l o p e d f o r t h e C 1 2 8 . A n a s u c h , t h e E P R O M q u e s t i o n n e e d s t b e - e x a m i n e d . U n k o w n t m a t h a t t i m e

a t h s e l e c t m e c h a n i s m b y w h i c h t h 1 2 8 ' l o g s i n e x t e r n a l ( a n d f o t h a t m a

e r , i n t e r n a l ) e x p a n s i o n R O M . F o t h i a t e d , a n t h o s e w h o w 6 4 ' s , I ' l l

s k e t c h i o u t .

t h Z 8 a n i t p a r t i 1 2 8 ' st u p r o u t i n e , w a r l e f t w i t h o n l y t w

s i t h 1 2 8 ' s n a t i v e m o d e : P O L Ln d P H O E N I X . B o t h r o u t i n e s a r e a c -

t h r o u g h t h m u c h e x p a n d e dj u m p t a b l e . O s t a r t u p o r e s e t ,

d o e s j u s t w h a t i t n a m e s u g g e s t s .t h e r o u t i n e c h e c k s t h s t a t e o t h

a n / E X R O M l i n e s . I e i t h e r i l o w , g o 6 4 i e x e c u t e d a n w

n u i 6 m o d e . F a i l i n g t h a t , t h i n t e ra a n e x t e r n a l c a r t r i d g e s l o t s a r p o l l e do r t h e R O s i g n a t u r e C B ( a R O M -w h e r e R O M b a s e e q u a l s e i t h e r

o $ C 0 0 0 ) . I c a r t r i d g e i d e t e c td i t I ( R O M b a s e + 6 ) i t h e n l o g g e d i h P h y s i c a l A d d r e s s T a b l e ( P A T ) . I f t h I

1 t h e n a a u t o - s t a r t c a r t r i d g e i r e c o ga n i t c o l d s t a r t e n t r y ( a R O M -

i c a l l e d i m m e d i a t e l y . O t h e r w i s e ,t a s k i l e f t t p h o e n i x w h i c h c h e c k s

h P A a n t h e n c a l l s t h c o l d s t a r t r o o e a c h c a r t r i d g e l o g g e d t h e r e . T h a t ' s

m u c h i t T h / G A M E a n / E X R O Ma r c o n s i d e r e d o n l y i n s o f a r a s t h e y

d i c a t e t h e p r e s e n c e o f a C 6 s t y l e c a I n t e r e s t i n g .

w h a t d o e s a l t h i s m e a n ? B a s i c a l l y t h i s :h E P R O M s l o t i t h 1 7 x x R E U ' s w a

m e a n t f o r t h e C 1 2 8 o n l y . C o w a o u s i n g t h e x p a n s i o n p o r t

u l e a v i n g i f r e e f o r f u r t h e r R O e x p a nc l e v e r ! I b r i e f e x p e r i m e n t ,

1 6 E P R O M i n t o m R E a n i i n t o C 1 2 8 . R e s u l t : m a p p e d i

$ 8 8 0 0 0 a n $ 9 8 0 0 0 ( t h e f i r s t h e d i g i tt h b a n k a d d r e s s ) w a m E P R O M . N o n e

t h f a n c y s e l e c t m e c h a n i s m s s u g g e s t e d

a b o v e , n o t h i n g . J u s t t h e 1 2 8 ' s w a o c h e c k i n g w h o ' s o u t h e r e . T h a t ' s w h t h / G A M Ea n / e x r o m l i n e s a r l e f t u n c o n n e c t e d . I t h e y w e r e , w e ' d e n u w i t h g o 6 4 a n a R E t h a t o n l y w o r k e d o n C 6 o i 6 4 m o d e . M a y b e t h o s e u n u s e d b i t s d f u n c t i o nj u s t a s s p e c u l a t e d f o u r m o n t h s a g o . T h f o r m a t o c a r t r i d g e ' R O M s i g n a t u r e ' o t h C 1 2 8 a n C 6 d i f f e r s i g n i f i c a n t l y , m a k i n g t h e m i n c o m p a t i b l e . P e r h a p s s o m e i c o m p a t i b i l i t y i s s u e i r e s o l v e d t h r o u g h t h o s e b i t s . c a r t r i d g e d e s i g n e d f o r t h e 6 a f f e c t s t h e 1 2 i w a y s n o a l w a y s d e s i r e d , a n 1 2 c a r t r i d g e w o u l d n ' t b r e c o gn i s e d b t h 6 a a l l ! T h o s e u n u s e d b i t s ' f u n c t i o n , t h o u g h s t i l l h i d d e n , m a s o m eh o b t i e d u i a l t h i s . A n d w h e r e d o e s t h a t l e a v e u s t h o w n e r s o t h e s e R E U s ?I y o u ' r e C 6 o w n e r t h e n c h e c k o u t h f o l l o w i n g d i a g r a m s . s w i t c h c o u l d e a s i l yb a d d e d t a R E t h a t w o u l d a l l o w a E P R O M t b m a p p e d i o o u o p o w e r u o r e s e t . I y o u ' r e C 1 2 8 o w n e r , j u s t i n s t a l l a p r o p e r l y f o r m a t t e d E P R O M .

I n k w e l l S y s t e m s i n v i t e s y o t o S E U S A TO C U H _ w o r l d o f c o m m o d o r e b o o t h 4 0 L O S A N G E L E S C O N V E N T I O N C E N T E RM A 1 9 - 2 1 , 1 9 8 9" B n y i a t h S h o w " s p e c i a l s • p r i c e s i n c l u d e t a x

U u l H i g h t < P e nw i t h A m i g a L i g h t P e D r i v e r

N O G E T Y O U R F A V O R I T E L I G H T P E A N D R I V E R B U N D L E D W I T H G R A P H I C S P K G S .W I T H W I T H

b o t h f o o n l y

$ 1 5 9 . 9 5

O

b o t h f o o n l y

$ 1 9 9 . 9 5

B i S a v i n g s o C - 6 4 P r o g r a m s , t o o !S P E C I A L . . . P I X P A

G R A P H I C S G A L L E R I A I D i s k s o C l i p A r t )

3 S P E C I A L . . . S U P E R P A F L E X I F O N T , G R A P H I C S I N T E G R A T O RA N G R A P H I C S G A L L E R I A I

6

I n k w e l l S y s t e m sC R E A T O R S O P E N W A R E ™1 0 5 0 - R P i o n e e r W a E C a j o n . C 9 2 0 2 0 6 1 9 / 4 4 0 - 7 6 6 6 F A X : 6 1 9 / 4 4 0 - 8 0 4 8

Page 48: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 48/84

C a p i t a l s : B a s i c Q u i z P r o g r a m

U s i n g l i n k e d l i s t s

b J i B u t t e r f i e l d

T h p r o g r a m i n c l u d e d a t h e n o t h i s a r t i c l e r u n s o n C o m m o d o r e 6 4 C o m m o d o r e 1 2 8 , P l u s - 4 , C o m m o d o r e 1 6 B 1 2 8 , P E T , C B M .

D y o k n o w t h c a p i t a l c i t i e s o t h f i f t y s t a t e s a n t e p r o v i n c e s ? T h i s p r o g r a m w i l l c h e c k y o u r k n o w l e d g e . I w i l lg i v e y o f u l l p o i n t s f o a c o r r e c t a n s w e r ; b u t i y o m i s s w i t hy o u r f i r s t a t t e m p t , i w i l l t r t h e l p y o w i t h m u l t i p l e c h o i c e s .A n i g i v e s h i n t s .

P r o g r a m C A P I T A L S i w r i t t e n i B A S I C , a n y o m i g h t l i k e t ol o o k a t h c o d e f o s o m e i n t e r e s t i n g p r o g r a m m i n g m e t h o d s . I u s e s c a r e f u l l y p l a n n e d e d u c a t i o n a l t e c h n i q u e s ; y o m i g h t l i k et c h e c k t h e s e .

S i n c e t h p r o g r a m i i B A S I C , i w i l l b n s p e e d d e m o n . C o s i d e r i n g t h e w o r k i d o e s , h o w e v e r , i c l i p s a l o n g a a a c c e p ta b l e p a c e . I y o h a p p e n t h a v e a c c e s s t c o m p i l e r , y o m a u s t h i s t s p e e d u C A P I T A L S .

W h e n y o r u t h p r o g r a m , y o u ' l l f i n d i t o p e r a t i o n t b f a i r l ys e l f - e x p l a n a t o r y . T h s i m p l e B A S I C l a n g u a g e d o e s n ' t p r o t e c ta g a i n s t w i l d k e y b o a r d u s a g e f o e x a m p l e , y o c o u l d r a m b l ea r o u n d t h s c r e e n u s i n g c u r s o r m o v e m e n t s w h e n y o w e r e b i n a s k e d f o a i n p u t . B u i d o e s s e n s i b l e t h i n g s i m o s t c a s e s .

E d u c a t i o n a l c o n s i d e r a t i o n s

T h p r o g r a m p r e s e n t s s t a t e s a n p r o v i n c e s i ' s h u f f l e d * o r d e r .E a c h r u w i l l b d i f f e r e n t . A w r i t t e n , i w i l l g t h r o u g h t h e n t i r e l i s t o 6 p r o v i n c e s a n s t a t e s , b u t h u s e r m a r e s p o n de n a a n t i m e t t e r m i n a t e t h q u i z .

h i n t i o f f e r e d t h e l p w i t h f u t u r e q u e s t i o n . T h h i n t i s e t g i v e t h a n s w e r t t h q u e s t i o n t h a t i f o u r i t e m s a h e a d . A a t t e n t i v e s t u d e n t ' s s h o r t - t e r m m e m o r y w i l l u s u a l l y r e t a i n t h i s .W h e n t h i s l e a d s t c o r r e c t a n s w e r l i t t l e l a t e r , t h i n f o r m at i o n i r e i n f o r c e d ; b e t t e r l e a r n i n g t a k e s p l a c e .

I t h s t u d e n t m i s s e s t h q u e s t i o n , h o s h i o f f e r e dm u l t i p l e c h o i c e s u p p l e m e n t a r y q u e s t i o n . T h e r e a r t w k i n d so m u l t i p l e c h o i c e ; w h i c h o n e t h e s t u d e n t s e e s w i l l d e p e n d o nt h w a t h q u e s t i o n w a f i r s t a n s w e r e d .

I t h e s t u d e n t ' s r e p o n s e i w r o n g , b u s t a r t s w i t h t h e c o r r e c tl e t t e r o t h e a l p h a b e t , t h e c o m p u t e r w i l l p r e s e n t a l i s t o a l c i t i e s s t a r t i n g w i t h t h a t l e t t e r . P e r h a p s i w a s p e l l i n g m i t a k e ; o r t h s t u d e n t m a h a v e t h r i g h t i d e a b u t t h w r o n g a s w e r . F o r e x a m p l e : s u p p o s e t h c o m p u t e r a s k s f o t h c a p i t a lo K a n s a s , a n t h s t u d e n t r e p l i e s T u l s a . S i n c e t h e c o r r e c t a s w e r s t a r t s w i t h t h l e t t e r T t h c o m p u t e r w i l l l i s t a l c i t i e ss t a r t i n g w i t h T

O t h o t h e r h a n d , i t h e s t u d e n t ' s r e s p o n s e d o e s n o m a t c hn o e v e n t h f i r s t l e t t e r t h c o m p u t e r p r e p a r e s d i f f e r e n tk i n d o m u l t i p l e c h o i c e . I n t h i s c a s e , e x a c t l y s i c h o i c e s a r p r e s e n t e d . T h c o m p u t e r h a q u i t e a s e a r c h t f i n d ' g o o d 'c h o i c e s ; t h e r e m a b s h o r t p a u s e h e r e . T h c h o i c e s w i l l i nc l u d e t h e c o r r e c t a n s w e r , o c o u r s e , p l u s a n o t h e r c i t y i n t h s a m e s t a t e .

W h i c h e v e r m u l t i p l e c h o i c e m e t h o d i u s e d , t h s t u d e n t i a s k e d t t y p e i t h c o r r e c t a n s w e r r a t h e r t h a n n u m b e r o l e t e r . I t ' s g o o d e x e r c i s e , a n w i l l h e l p t h m e m o r y p r o c e s s .

I t h s t u d e n t ' s f i r s t r e s p o n s e t a q u e s t i o n i w r o n g , b u n a m e sv a l i d c i t y k n o w n t t h c o m p u t e r , t h c o m p u t e r w i l l s a s o

F o e x a m p l e , i s t u d e n t r e s p o n d s w i t h T u l s a w h e n a s k e d f o t h c a p i t a l o K a n s a s , t h c o m p u t e r w i l l a d v i s e t h a t T u l s a i c i t y i n O k l a h o m a . T h s t u d e n t i m m e d i a t e l y r e c e i v e s t h c o r e c t a s s o c i a t i o n f o r t h e c i t y n a m e .

T h D A T A L i s t

Y o c a s h o r t e n o r l e n g t h e n t h l i s t o d a t a i t e m s , u t m a x i m u m o 9 9 Y o c a r e p l a c e i c o m p l e t e l y w i t h a n o t h e rs e o d a t a , f o e x a m p l e , E u r o p e a n c o u n t r i e s a n t h e i r c a p i t a l s .D a t a g o e s f r o m l i n e 1 0 t o l i n e 8 0 0 ; t h l a s t l i n e s a y s D A T AE N D , w h i c h s i g n a l s t h c o m p u t e r t h a t t h e r e a r n m o r e i t e m s .

T h f o r m a t o t h d a t a s t a t e m e n t s i e a s y t o f o l l o w , b u t h e r ea r e t h e d e t a i l s . T h f i r s t i t e m o e a c h l i n e i t h s t a t e o p r o v i n c e ; t h e n t h c a p i t a l c i t y ; t h e n a n o t h e r c i t y i t h a t s t a t e .T h s e c o n d c i t y i o f t e n c h o s e n b e c a u s e i i l a r g e o w e l l -k n o w n , b u s o m e , s u c h a S p r i n g f i e l d o r S a l e m , m i g h t b p i c k e d b e c a u s e o n a m e t h a t m a t c h e s c a p i t a l c i t y o d i f e r e n t s t a t e .

Page 49: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 49/84

D e t a i l s L i n k e d l i s t s

p r o g r a m c a r e f u l l y h o o k s t o g e t h e r a l c i t i e s w h o s e n a m ew i t h t h s a m e l e t t e r o t h e a l p h a b e t . T h u s , c a p i t a l c i t i e s

e n i x , P r o v i d e n c e a n P i e r r e a r e l i n k e d , a s a r e n o n - c a p i t a lP o c a t e l l o , P h i l a d e l p h i a , a n P o r t l a n d . U s i n g t h e s e

l i s t s ' , t h p r o g r a m c a r a p i d l y s e a r c h o u t m u l t i p l e -c a n d i d a t e s . M o r e d e t a i l o l i n k e d l i s t s i g i v e n b e l o w .

v a r y t h o r d e r o q u e s t i o n s , ' s h u f f l e ' m u s t t a k e p l a c e a p r o g r a m s t a r t s . M o v i n g s t r i n g s a r o u n d i t e d i o u s b u s i

s s ; i n s t e a d , t a b l e o ' q u i c k p o i n t e r s ' , a r r a y Q ( ) , i s h u f f l e d .a r r a y w i l l t e l l u s t h e o r d e r i w h i c h e a c h s t a t e o

w i l l b u s e d . Y o m a r e a d t h e s h u f f l i n g c o d e i 1 1 0 0 t 1 1 4 0 . N o t e t h a t w u s r a n d o m f u n c t i o n r n d ( 0 )

o n l y , t s c r a m b l e t h r a n d o m s e q u e n c e ; a f t e r t h a t , w u s t g e n e r a t e u n p r e d i c t a b l e v a l u e s .

h p r o g r a m s t a r t s a l i n e 9 0 0 , w h e r e i d e f i n e s t h e a r r a y s ( t a n l i s t s ) . T a b l e S $ ( s t a t e , c o l u m n ) g i v e s u t h s t r i n g v a

f o e a c h s t a t e : c o l u m n f o r t h e s t a t e n a m e , c o l u m n f o c a p i t a l c i t y , a n c o l u m n f o r t h e s e c o n d c i t y . T a b l e s A ( L ( a r u s e d t k e e p t h l i n k e d l i s t s ; m o r e a b o u t t h o s e i

A n l i s t Q ( ) , a w h a v e m e n t i o n e d , s e t s u t h o r d e rw h i c h w w i l l a s t h q u e s t i o n s .

l i n e 1 2 0 0 , w e ' v e c o m p l e t e d r e a d i n g i t h d a t a a n s h u fa n w c a s t a r t a s k i n g q u e s t i o n s . I t h f i r s t a n s w e r i

c o r r e c t , w e ' l l c a l l t h s u b r o u t i n e a 3 0 0 0 t d o u m u l t i p l ew o r k f o u s L i n e 1 5 0 0 c o v e r s t h e n d i n g s u m m a r y .

s u b r o u t i n e a 2 0 0 0 o f f e r s t h m u l t i p l e c h o i c e m e n u t t h T h m e n u h a b e e n b u i l t i n a d v a n c e . T h i s s u b r o u t i n e

i t a s k s f o r t h e a n s w e r , a n c h e c k s t s e i t h r e s p o n s ec o r r e c t .

3 0 0 0 i a s u b r o u t i n e t h a t i u s e d w h e n e v e r t h s t u d e n t h a w r o n g i n i t i a l a n s w e r . I d e c i d e s w h i c h t y p e o m u l t i p l e

q u e s t i o n w i l l b a p p r o p r i a t e .

s u b r o u t i n e a 4 0 0 0 l o o k s t h r o u g h l i s t s o c i t i e s b o t h c a p ia n o t h e r s . I t h s t u d e n t ' s f i r s t r e s p o n s e i n o t h e c o r r e c t

w e r , b u t i v a l i d c i t y n a m e , t h a t i n f o r m a t i o n i p r i n t e d . T h i st i n e a l s o b u i l d s a m u l t i p l e c h o i c e t a b l e o c i t i e s w h o s e

s t a r t w i t h t h s a m e l e t t e r a s t h e i n p u t n a m e . T h i s t a b l eb u s e d , o i m i g h t b r e p l a c e d b a n o t h e r m u l t i p l et a b l e ; t h d e c i s i o n w i l l b m a d e b a c k i s u b r o u t i n e 3 0 0 0 .

5 0 0 0 c o n t a i n s a b r i e f s u b r o u t i n e t a d c i t y t o t h m u c h o i c e l i s t . I t m a i n f u n c t i o n i t r e m o v e d u p l i c a t e c i t y

6 0 0 0 w h a v e a n e l a b o r a t e s u b r o u t i n e t s e l e c t m u l t i p l ec a n d i d a t e s . A a n e x a m p l e : f o s t a t e A r i z o n a , w h e r e t h i P h o e n i x a n t h e o t h e r c i t y i T u c s o n , t h c o m p u t e r

p i c k t h r e e c i t i e s t h a t s t a r t w i t h a n t h r e e t h a t s t a r t w i t ht h r e e w i l l b c a p i t a l s a n t h r e e n o t ; a n o f c o u r s e t h l i s t

i n c l u d e P h o e n i x a n d T u c s o n t h e m s e l v e s .

T h i s i p o w e r f u l p r o g r a m m i n g m e t h o d t h o o k s i m i l a r i t e m st o g e t h e r . T h p r o g r a m u s e s i t o l i n k c i t i e s w h o s e n a m e s s t a r tw i t h t h s a m e l e t t e r . T h a t m a k e s s e a r c h e s m u c h f a s t e r : f o e a m p l e , t f i n d a l c a p i t a l c i t i e s s t a r t i n g w i t h t h l e t t e r T w d o n ' t n e e d t s e a r c h a n c o m p a r e a l 5 0 i n s t e a d , w f o l l o wt h " T c h a i n .

E a c h c i t y h a s , a s p a r t o i t d a t a , p o i n t e r o r ' l i n k ' t t h n e x tc i t y t h a t b e l o n g s i t h g r o u p . A t h e n o t h c h a i n , t h e r ew i l l b a z e r o p o i n t e r t s a y , " n m o r e " . T t e l l y o u w h e r e t h c h a i n s t a r t s , t h e r e a r e s e o s t a r t i n g p o i n t e r s f o r e a c h l e t t e r .

T f i n d a l t h c a p i t a l c i t i e s t h a t s t a r t w i t h l e t t e r T f o e x a mp l e , w l o o k a t h s t a r t i n g p o i n t e r f o ( t h a t ' s i a r r a y A r o 2 f o l e t t e r T c o l u m n f o c a p i t a l c i t i e s ) . T h a t g i v e s u t h n u m b e r o t h f i r s t c i t y i n t h i s c h a i n . I i s h o u l d h a p p e n t h a tt h e r e a r e n c i t i e s s t a r t i n g w i t h t h e s e l e c t e d l e t t e r ( a i t h c a s e w i t h t h l e t t e r X f o e x a m p l e ) , w w o u l d g e v a l u e o z e r o .

T m o v e o t t h n e x t c i t y s t a r t i n g w i t h t h a t l e t t e r , w l o o k a t h p o i n t e r i a r r a y ( f o r " l i n k " ) . I g i v e s u s t h n u m b e r o t h n e x t c i t y , o r a z e r o t s i g n a l " n o m o r e c i t i e s " .

H o d w b u i l d s u c h l i n k e d l i s t s ? I t ' s n o h a r d . B e f o r e w r e a d o u d a t a , w s e a l t h s t a r t i n g p o i n t e r s t o z e r o . T h a t , o c o u r s e , m e a n s " n o c i t i e s i n t h i s l i s t " s f a r .

W h e n w r e a d i c i t y , w p i c k o u i t f i r s t l e t t e r . W w i l l g t t h c o r r e s p o n d i n g p o i n t i t h s t a r t i n g t a b l e ; i n m o m e n t ,w e ' l l p u t h i d e n t i t y o t h i s n e c i t y t h e r e . B u f i r s t , t a k e t h ec o n t e n t s o t h a t p o i n t e r a n m o v e i i n t o t h l i n k o t h n e c i t y . A f t e r t h a t w m a k e t h e n t r y i t h s t a r t i n g t a b l e .

H o d o e s t h i s w o r k ? I t h i s i t h f i r s t c i t y b e g i n n i n g w i t hg i v e n l e t t e r , w e ' l l p o i t n u m b e r i n t o t h s t a r t i n g t a b l e , a n p u t h z e r o ( f r o m t h s t a r t i n g t a b l e ) i n t o t h c i t y ' s l i n k . R s u l t : t h i s c i t y b e c o m e s t h f i r s t i t h l i n k e d l i s t , a n i t l i n kv a l u e o f z e r o s a y s t h a t t h e r e a r n m o r e c i t i e s i n t h c h a i n .J u s t w h a t w w a n t .

I f o t h e o t h e r h a n d , t h n e c i t y i n o t h f i r s t t h a t b e g i n sw i t h t h a t l e t t e r , o u w o r k w i t h t h s t a r t i n g t a b l e a n l i n k w i l la d t h i s c i t y t o t h t o o t h e c h a i n . T h s t a r t i n g t a b l e w i l l n o p o i n t a t t h i s n e c i t y , w h i c h i t u r n w i l l p o i n t t o t h e r e s t o t h c h a i n .

L i n k e d l i s t s a r f l e x i b l e , a n m a b u s e d t h o o k t o g e t h e rm a n y t y p e o f d a t a . I g e n e a l o g i c a l d a t a b a s e , s u c h l i s tm i g h t b e u s e d t b u i l d a c h a i n o f c h i l d r e n i g i v e n f a m i l y ;u s i n g t h i s k i n d o f d a t a r e l a t i o n s h i p m e a n s t h a t t h e r e w o u l d b n f i x e d l i m i t t o t h n u m b e r o m e m b e r s o t h e f a m i l y . I g e e r a l d a t a u s a g e , a l i s t o n a m e s l i n k e d b t h e i r f i r s t l e t t e r , s i m il a r t o t h s y s t e m w h a v e u s e d h e r e , c a n b e g o o d w a t s e a r c h f o s p e c i f i c p e r s o n ; i w o u l d o f t e n b f a s t e r a n m o r ef l e x i b l e t h a n a a l p h a b e t i z e d l i s t s e a r c h .

Page 50: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 50/84

C o n c l u s i o n

T h p r o g r a m i g o o d w a t t e s t y o u r s k i l l s . I m a b e a s i l ym o d i f i e d t t e s t o t h e r a r e a s o k n o w l e d g e . I u s e s v a l i d e d u c at i o n a l m e t h o d s t d m o r e t h a n q u i z : i h i n t s , i s u p p l i e s e x t r ai n f o r m a t i o n , a n i g i v e s t h e s t u d e n t m o r e t h a n o n t r f o c o r r e c t a n s w e r .

A n i y o u ' r e i n t e r e s t e d i p r o g r a m m i n g , y o u ' l l f i n d p o w e rf u t e c h n i q u e h e r e , l i n k e d l i s t s , t h a t c a m a k e y o u r p r o g r a m sm o r e f l e x i b l e a n e f f i c i e n t .

C A P I T A L S : A e d u c a t i o n a l p r o g r a m t h a t d e m o n s t r a t e s u s o l i n k e d l i s t s .

A 1 0 d a t a C a l i f o r n i a , S a c r a m e n t o , l o s a n g e l e sJ 1 1 d a t a n e y o r k , a l b a n y , n e w y o r k c i t yL 1 2 d a t a t e x a s , a u s t i n , h o u s t o nN 1 3 d a t a P e n n s y l v a n i a , h a r r i s b u r g , P h i l a d e l p h i aJ B 1 4 0 d a t a i l l i n o i s , S p r i n g f i e l d , C h i c a g oN 1 5 d a t a o h i o , c o l u m b u s , C l e v e l a n dI D 1 6 0 d a t a f l o r i d a , t a l l a h a s s e e , m i a n dA 1 7 d a t a m i c h i g a n , l a n s i n g , d e t r o i tN 1 8 d a t a n e w j e r s e y , t r e r i t o n , j e r s e y c i t y6 1 9 d a t a n o r t h C a r o l i n a , r a l e i g h , c h a r l o t t eF 2 0 d a t a m a s s a c h u s e t t s , b o s t o n , s a l e mP 2 1 d a t a g e o r g i a , a t l a n t a , c o l u m b u sG 2 2 d a t a V i r g i n i a , r i c h m o n d , n o r f o i kK 2 3 d a t a i n d i a n a , i n d i a n a p o l i s , g a r yD I 2 4 0 d a t a m i s s o u r i , J e f f e r s o n c i t y , s a i n t l o u i sE D 2 5 0 d a t a W i s c o n s i n , m a d i s o n , m i l w a u k e eE D 2 6 0 d a t a t e n n e s s e e , n a s h v i l l e , m e m p h i sA 2 7 d a t a l o u i s i a n a , b a t o n r o u g e , n e w O r l e a n sG 2 8 d a t a m a r y l a n d , a n n a p o l i s , b a l t i m o r eC 2 9 d a t a W a s h i n g t o n , o l y m p i a , S e a t t l eE 3 0 d a t a m i n n e s o t a , s a i n t p a u l , m i n n e a p o l i sI E 3 1 0 d a t a a l a b a m a , n o n t g o m e r y , b i r m i n g h a m6 3 2 d a t a k e n t u c k y , f r a n k f o r t , l o u i s v i l l eI 3 3 d a t a s o u t h C a r o l i n a , C o l u m b i a , C h a r l e s t o nN 3 4 d a t a O k l a h o m a , O k l a h o m a c i t y , t u l s aB 3 5 d a t a C o n n e c t i c u t , h a r t f o r d , b r i d g e p o r tP 3 6 d a t a C o l o r a d o , d e n v e r , C o l o r a d o s p r i n g sE 3 7 0 d a t a i o w a , d e s m o i n e s , c e d a r r a p i d sN 3 8 d a t a a r i z o n a , p h o e n i x , t u c s o nJ 3 9 d a t a O r e g o n , s a l e m , p o r t l a n dN 4 0 d a t a m i s s i s s i p p i , j a c k s o n , b i l o x iE 4 1 0 d a t a k a n s a s , t o p e k a , k a n s a s c i t yD P 4 2 0 d a t a a r k a n s a s , l i t t l e r o c k , f o r t s m i t hO 4 3 d a t a w e s t V i r g i n i a , C h a r l e s t o n , h u n t i n g t o nP 4 4 d a t a n e b r a s k a , l i n c o l n , o m a h aG 4 5 d a t a u t a h , s a l t l a k e c i t y , o g d e nG 4 6 d a t a n e m e x i c o , s a n t a f e , a l b u q u e r q u eJ 4 7 d a t a m a i n e , a u g u s t a , p o r t l a n dE 4 8 d a t a h a w a i i , h o n o l u l u , h i l oP 4 9 d a t a i d a h o , b o i s e , p o c a t e l l oP 5 0 d a t a r h o d e i s l a n d , p r o v i d e n c e , n e w p o r tD 5 1 0 d a t a n e w H a m p s h i r e , c o n c o r d , m a n c h e s t e rF 5 2 d a t a n e v a d a , c a r s o n c i t y , l a v e g a sH 5 3 0 d a t a m o n t a n a , h e l e n a , b i l l i n g sB 5 4 d a t a s o u t h d a k o t a , p i e r r e , s i o u x f a l l sJ 5 5 d a t a n o r t h d a k o t a , b i s m a r k , f a r g oF 5 6 d a t a d e l a w a r e , d o v e r , W i l m i n g t o nM 5 7 d a t a V e r m o n t , m o n t p e l i e r , b u r l i n g t o nK 5 8 d a t a W y o m i n g , c h e y e n n e , c a s p e rN 5 9 d a t a a l a s k a , j u n e a u , a n c h o r a g eP 6 0 d a t a O n t a r i o , t o r o n t o , O t t a w aF 6 1 d a t a q u e b e c , q u e b e c c i t y , m o n t r e a l

M 6 2 d a t a b r i t i s h C o l u m b i a , v i c t o r i a , V a n c o u v e rP 6 3 d a t a a l b e r t a , e d m o n t o n , c a l g a r yM 6 4 d a t a m a n i t o b a , W i n n i p e g , b r a n d o nP 6 5 d a t a S a s k a t c h e w a n , r e g i n a , s a s k a t o o nK 6 6 d a t a n o v a s c o t i a , h a l i f a x , S y d n e yC 6 7 d a t a n e w b r u n s w i c k , f r e d e r i c t o n , s a i n t J o h nF 6 8 d a t a n e w f o u n d l a n d , s a i n t J o h n ' s , g a n d e rB 6 9 d a t a p r i n c e e d w a r d i s l a n d , c h a r l o t t e t o w n , s u m m e r s i d eB 8 0 d a t a e n dG 9 0 d i s $ ( 9 9 , 2 ) , 1 ( 9 9 , 2 ) , q ( 9 9 ) , a ( 2 6 , 2 )A 9 1 d i c ( 2 0 )N 9 2 j = 0 : p r i n t " p l e a s e w a i t f o r d a t a l o a d "A 9 3 0 j = j + lP 9 4 r e a d s $ ( j , O ) : i f s $ ( j , 0 ) = " e n d " g o t o 1 0 4 0M 9 5 r e a d s $ ( j , l ) , s $ ( j , 2 )J 9 6 f o r k = 0 t oM 9 7 a = a s c ( s $ ( j , k ) ) - 6 4K 9 8 i a < o r a > 2 6 t h e n p r i n t s $ ( j , k ) ; " ? " : s t o pM 9 9 0 l ( j , k ) = a ( a , k )F 1 0 0 0 a ( a , k ) = jH 1 0 1 0 n e x tJ 1 0 2 0 q ( j ) = jP L 1 0 3 0 g o t o 9 3 M 1 0 4 0 s 9 = j - lF 1 1 0 0 j = r n d ( 0 )E F 1 1 1 0 f o r j = t s I C 1 1 2 0 k = i n t ( r n d ( l ) * s 9 ) + lH U 3 0 q = q ( k ) : q ( k ) = q ( j ) : q ( j ) = qG F 1 1 4 0 n e x tP 1 1 5 0 p r i n t c h r $ ( 1 4 7 ) ; c h r $ ( 1 4 2 )O 1 1 6 0 p r i n t " c a p i t a l c i t y q u i z "B 1 1 7 0 p r i n t j i m b u t t e r f i e l d "O 1 2 0 0 f o j = t s B P 1 2 1 0 q l = j + 4H D 1 2 2 0 i f q l < s 9 t h e n p r i n t " h i n t : c a p i t a l o f " ; s $ ( q ( q l ) , 0 ) ; " i " ; s $ ( q ( q l ) , l )A 1 2 3 0 p r i n tF P 1 2 4 0 q O = q ( j )N 1 2 5 0 p r i n t " w h a t i s t h e c a p i t a l o f " ; s $ ( q 0 , 0 ) ; " ? "I D 1 2 6 0 r $ = " i " : i n p u t r $ : p r i n t c h r $ ( 1 4 2 ) ; : i f r $ = " e n d " g o t o 1 5 0 0F 1 2 7 0 n = 0 : m l = 0A 1 2 8 0 i f r $ = s $ ( q 0 , l ) t h e n m = 1 0I 1 2 9 0 r = a s c ( r $ ) : r O = r - 6 4K 1 3 0 0 i f m = 0 t h e n g o s u b 3 0 0 0B 1 3 1 0 i f k f O t h e n p r i n t " n o p o i n t s ! a n s w e r i s " ; s $ ( q 0 , l )L 1 3 2 0 s = s + m : i f m > 0 t h e n p r i n t " r i g h t ! " ; : i f m < 1 0 t h e n p r i n t ( f o r p a r t p o i n t s ) " ;G 1 3 3 0 p r i n t : p r i n tP 1 3 4 0 s 0 = s 0 + 1 0I 1 3 5 0 p r i n t " s c o r e : " ; s ; " o u o f p o s s i b l e " ; s 0G 1 3 6 0 i f j / 1 0 = i n t ( j / 1 0 ) t h e n p r i n t " ( r e p l y ' e n d ' t q u i t ) "M 1 3 7 0 n e x tO G 1 3 8 0 g o t o 1 5 1 0G 1 5 0 0 p r i n t " ( a n s w e r : n ; s $ ( q 0 , l ) ; " ) "G 1 5 1 0 p r i n t " y o u r s c o r e : "A 1 5 2 0 s $ = " a v e r y p o o r " : i f s 0 = 0 g o t o 1 5 9 0G 1 5 3 0 i f s / s O > . 5 t h e n s $ = " a m e d i o c r e "B 1 5 4 0 i f s / s O > . 7 t h e n s $ = " * a p a s s a b l e "D I 1 5 5 0 i f s / s O > . 8 t h e n s $ = " * * d e c e n t "P H 1 5 6 0 i f s / s O > . 9 t h e n s $ = " * * * g o o d "N 1 5 7 0 i f s / s O > . 9 5 t h e n s $ = " * * * * a f a n t a s t i c "E D 1 5 8 0 i f s = s 0 t h e n s $ = " * * * * * p e r f e c t "D 1 5 9 0 p r i n t s $ ; s ; " o u t o f " ; s 0A 1 6 0 0 e n E 1 9 9 9 r e m : o f f e r c h o i c e m e n uM 2 0 0 0 m l = l : p r i n t : p r i n t " t h e c a p i t a l o f " ; s $ ( q 0 , 0 ) ; " i s : "K I 2 0 1 0 f o r j l = l t I 2 0 2 0 k = i n t ( r n d ( l ) * c ) + lH D 2 0 3 0 q = c ( j l ) : c ( j l ) = c ( k ) : c ( k ) = qO 2 0 4 0 n e x t j C L 2 0 5 0 f o r j l = l t N 2 0 6 0 c O = c ( j l ) : c l = lB 2 0 7 0 i f c 0 < 0 t h e n c 0 = 0 - c 0 : c l = 2D 2 0 8 0 p r i n t n ; s $ ( c 0 , c l )A 2 0 9 0 n e x t j

Page 51: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 51/84

" ; r $ ; " i s a c i t y i n " ; s $ ( l , 0 ) ; " ! "

2 1 0 0 p r i n t2 1 1 0 p r i n t " t y p e i t h a n s w e r , c o r r e c t l y s p e l l e d . . 1 12 1 2 0 x $ = " # " : i n p u t x $ : p r i n t c h r $ ( 1 4 2 ) ; : i f r $ = " e n d " g o t o 1 5 0 02 1 3 0 i f x $ = s $ ( q O , l ) t h e n m = m O2 1 4 0 r e t u r n

E 2 9 9 9 r e m : a n s w e r s e a r c h s t r a t e g yD 3 0 0 0 r l = a s c ( s $ ( q 0 , l ) ) - 6 4 : r 2 = a s c ( s $ ( q 0 , 2 ) ) - 6 4

3 0 1 0 r e m : s e a r c h n a m e f o r a n y m a t c h3 0 2 0 i f r 0 > 0 a n r O < 2 6 t h e n g o s u b 4 0 0 0

6 3 0 3 0 r e m : f i r s t l e t t e r m a t c h e s ; m e n uE 3 0 4 0 i f m = 0 a n d r 0 = r l t h e n m 0 = 7 : g o s u b 2 0 0 0

3 0 5 0 r e m : n l u c k , t r y g e n e r a l m e n uB 3 0 6 0 i f m = a n m l = 0 t h e n g o s u b 6 0 0 0B 3 0 7 0 r e t u r n

3 9 9 9 r e m : c h e c k f o a n m a t c h , b u i l d t a b l eP 4 0 0 0 c = 0

4 0 1 0 1 = a ( r 0 , l ) : 1 0 = l : l l = l4 0 2 0 i f 1 = 0 g o t o 4 0 7 04 0 3 0 i f r $ = s $ ( l , l ) t h e n p r i n t r $ ; " i s t h e c a p i t a l o f " ; s $ ( l , 0 ) ; " ! "4 0 4 0 g o s u b 5 0 0 04 0 5 0 1 = 1 ( 1 , 1 )4 0 6 0 g o t o 4 0 2 0

L 4 0 7 0 1 = a ( r O , 2 ) : 1 0 = - l : l l = 2 4 0 8 0 i r $ = s $ ( l , 2 ) t h e n p r i n t

4 0 9 0 i f 1 = 0 o r c > 1 5 g o t o 4 1 3 04 1 0 0 g o s u b 5 0 0 04 1 1 0 1 = 1 ( 1 , 2 )4 1 2 0 g o t o 4 0 8 04 1 3 0 r e t u r n4 9 9 9 r e m : b u i l d t a b l e o f n o n d u p n a m e s5 0 0 0 i f c = g o t o 5 0 5 05 0 1 0 f o r j l = l t o5 0 2 0 1 2 4 : i f c ( j l ) < 0 t h e n 1 2 = 25 0 3 0 i f s $ ( a b s ( c ( j l ) ) , 1 2 ) = s $ ( l , l l ) g o t o 5 0 7 05 0 4 0 n e x t j 5 0 5 0 c = c + l5 0 6 0 c ( c ) = 1 * 1 05 0 7 0 r e t u r n5 9 9 9 r e m : b u i l d g e n e r a l m u l t i p l e c h o i c e6 0 0 0 c = 2 : c ( l ) = q O : c ( 2 ) = - q O6 0 1 0 l = a ( r l , l ) : 1 0 = l : l l = l6 0 2 0 i f 1 = 0 g o t o 6 0 6 06 0 3 0 g o s u b 5 0 0 06 0 4 0 1 = 1 ( 1 , 1 )6 0 5 0 g o t o 6 0 2 06 0 6 0 i f c = 2 t h e n I = i n t ( r n d ( l ) * s 9 ) + 1 : g o s u b 5 0 0 0 : g o t o 6 0 6 06 0 7 0 c l = c ( i n t ( ( c - 2 ) * r n d ( l ) ) + 3 )6 0 8 0 c = 3 : c ( 3 ) = d6 0 9 0 1 = a ( r l , 2 ) : 1 0 = - l : l l = 26 1 0 0 i f 1 = 0 o r c > 1 5 g o t o 6 1 4 06 1 1 0 g o s u b 5 0 0 06 1 2 0 1 = 1 ( 1 , 2 )6 1 3 0 g o t o 6 1 0 06 1 4 0 i c = t h e n I = i n t ( r n d ( l ) * s 9 ) + 1 : g o s u b 5 0 0 0 : g o t o 6 1 4 06 1 5 0 c l = c ( i n t ( ( c - 3 ) * r n d ( l ) ) + 4 )6 1 6 0 c = 4 : c ( 4 ) = c l6 1 7 0 l = a ( r 2 , l ) : 1 0 = l : l l = l6 1 8 0 i f 1 = 0 g o t o 6 2 2 06 1 9 0 g o s u b 5 0 0 06 2 0 0 1 = 1 ( 1 , 1 )6 2 1 0 g o t o 6 1 8 06 2 2 0 i f c = 4 t h e n I = i n t ( r n d ( l ) * s 9 ) + 1 : g o s u b 5 0 0 0 : g o t o 6 2 2 06 2 3 0 c l = c ( i n t ( ( c - 4 ) * r n d ( l ) ) + 5 )6 2 4 0 c = 5 : c ( 5 ) = c l6 2 5 0 1 = a ( r 2 , 2 ) : 1 0 = - l : l l = 26 2 6 0 i f 1 = 0 o c > 1 5 g o t o 6 3 0 06 2 7 0 g o s u b 5 0 0 06 2 8 0 1 = 1 ( 1 , 2 )6 2 9 0 g o t o 6 2 6 06 3 0 0 i f c = 5 t h e n I = i n t ( r n d ( l ) * s 9 ) + 1 : g o s u b 5 0 0 0 : g o t o 6 3 0 06 3 1 0 d = c ( i n t ( ( c - 5 ) * r n d ( l ) ) + 6 )6 3 2 0 c = 6 : c ( 6 ) = d6 3 3 0 m O = 5 : g o s u b 2 0 0 06 3 4 0 r e t u r n

N e w ! I m p r o v e d !T R A N S B A S I C 2

w i t h S Y M A S S 1

" u s e d t b s a s h a m e d o m d u l l , m e s s y c o d e , b u n m a t t e r w h a t t r i e d j u s t c o u l d n ' t g e r i o t h o s es t u b b o r n s p a g h e t t i s t a i n s ! " w r i t e s M r s . J e n n y R o R i c h m o n d H i l l , O n t a r i o . " T h e n t h T r a n s a c t o r p e o p l ea s k e d m t t r n e T r a n s B A S I C 2 w i t h S y m a s s ® .T h e y e x p l a i n e d h o T r a n s B A S I C 2 w i t h i t s c o r e s o t i n y ' t o k e n s ' , w o u l d g e m c o d e l o o k i n g c l e a n , f a s t !

" w a s c e p t i c a l , b u f i g u r e d t h e r e w a n h a r m i g i v i n g i t r y . W e l l , a l i t o o k w a o n l o a d a n w a c o n v i n c e d ! T r a n s B A S I C w e n t t w o r k a n g o m c o d e l o o k i n g c l e a n a n e i s e c o n d s ! N o I ' t e l l i n ga l m f r i e n d s t o t r T r a n s B A S I C i t h e i r m a c h i n e s ! "

T r a n s B A S I C 2 w i t h S y m a s s , t h s y m b o l i c a s s e m b l e r .P a c k a g e c o n t a i n s a l 1 s e t s o T r a n s B A S I C m o d u l e sf r o m t h m a g a z i n e , p l u s f u l l d o c u m e n t a t i o n . M a k e y o u rB A S I C p r o g r a m s r u f a s t e r a n b e t t e r w i t h o v e r 1 4 a d d e d s t a t e m e n t a n f u n c t i o n k e y w o r d s .

D i s k a n d M a n u a l $ 1 7 . 9 5 U S $ 1 9 . 9 5 C d n .( s e e o r d e r c a r d a c e n t e r a n N e w s B R f o m o r e i n f o )

T r a n s B A S I C" C l e a n e r c o d e , l o a d a f t e r l o a d ! "

Page 52: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 52/84

P r o b l e m s , T i p s a n O b s e r v a t i o n s

C o m p i l e r a n o m a l i e s a n d r i v e u s a g e

b L a r r y G a y n i e r

h a v e t h P o w e r c o m p i l e r s f o b o t h t h C 6 a n t h C 1 2 8 .S i n c e f i r s t p u r c h a s e d t h P o w e r c o m p i l e r , h a v e d i s c o ve r e d s o m e p r o b l e m s t h a t w i l l s h a r e w i t h y o u . O v e r a l l , a f a v o u r a b l y i m p r e s s e d b t h p a c k a g e . H o p e f u l l y , c a h e l py o a v o i d f u t u r e a g g r a v a t i o n a n d w a s t e d e f f o r t i y o c o m e u a g a i n s t o n o t h e s e p r o b l e m s . I t h i s a r t i c l e , a s s u m e P o w e r

f r o m S p i n n a k e r i i d e n t i c a l t P o w e r f r o m P r o - L i n e .

C o m m a n d l i n e a r g u m e n t s ( C 1 2 8 a n C 6 4 )

K e e p t h e s e l i m i t s i n m i n d w h e n y o u s c o m m a n d l i n e a r g um e n t s , e s p e c i a l l y o t h C 1 2 8 . T h C 6 s h e l l s u p p o r t s 2 a r g u m e n t s ; a r g v [ 0 ] t h r o u g h a r g v [ 2 1 ] . h a v e f o u n d t h i s t b a d e q u a t e . T h e C 1 2 8 s h e l l i m o r e r e s t r i c t i v e , s u p p o r t i n g o n l y1 0 a r g u m e n t s ; a r g v [ 0 ] t h r o u g h a r g v [ 9 ] . f i n d t h i s t b i n a d eq u a t e a n a g g r a v a t i n g w h e n u s i n g p r o g r a m s t h a t a l l o w l o t s o s w i t c h e s a n a r g u m e n t s . E x c e e d i n g t h l i m i t c a l o c k u t h m a c h i n e , w h i c h m a n o r e c o v e r a f t e r s o f t r e s e t ( R U N / S T O P -R E S T O R E ) .

c o m p i l e r b u ( C 1 2 8 a n C 6 4 )

T h c o m p i l e r h a a e l u s i v e b u t h a t w a v e r y d i f f i c u l t t t r a c k d o w n . O r i g i n a l l y , n o t i c e d i n c o n s i s t e n t r e s u l t s i n p r g r a m t h a t u s e d t h f o l l o w i n g I s t a t e m e n t :

i ( ( p t r - > c c a l l o c ( 1 0 , 1 ) ) ! 0

I t h i s e x a m p l e , p t p o i n t s t s t r u c t u r e c o n t a i n i n g c a p o i n te t o c h a r . T h r e s u l t o t h c a l l t C A L L O C i a s s i g n e d t t h s t r u c t u r e v a r i a b l e c T h I s t a t e m e n t t e s t s t h a s s i g n m e n tr e s u l t t s e i n o n - z e r o p o i n t e r a d d r e s s w a r e t u r n e d b C A L O C . C a l l o c r e t u r n s z e r o i t h e r e i n o e n o u g h f r e e m e m o r yt o s a t i s f y t h r e q u e s t . I s i t u a t i o n s w h e r e p l e n t y o f r e em e m o r y w a a v a i l a b l e , m p r o g r a m w o u l d r a n d o m l y b e h a v ea i C A L L O C h a r e t u r n e d z e r o . A f t e r m o n t h s o h a p h a z a r dr e s e a r c h i n t o t h p r o b l e m , d i s c o v e r e d i h a s o m e t h i n g t d w i t h t h e i n d i r e c t i o n o p e r a t o r ( p t r - > c i s h o r t h a n d f o ( * p t r ) . c ) .

T h b u g . c p r o g r a m ( L i s t i n g a t h e n o t h i s a r t i c l e ) d e m o ns t r a t e s t h e b a s i c p r o b l e m . T h k e s t a t e m e n t i t h i s p r o g r a m i t h m u l t i p l e a s s i g n m e n t . T h i n t e g e r i a n t h e i n t e g e r p o i n t e dt b i p a r e t b s e t t o t h e i n t e g e r i l O n w o u l d e x p e c t i l

* i a n i t a l w a y s b e e q u a l . T h i s i b a s e d o t h c o n s eq u e n c e t h a t t h r e s u l t o a n a s s i g n m e n t i h a s a v a l u e t h a ti a v a i l a b l e f o s u b s e q u e n t u s e . H e r e i s a m p l e o t h o u t p u tf r o m t h i s p r o g r a m :

i - 5 1 2i - 5 1 1i - 5 1 0i - 5 0 9

* i - 5 1 2* i - 5 1 1* i - 5 1 0* i - 5 0 9

i i i i

i - 2 5 8 * i - 2 5 8 i 2 5 i - 2 5 7 * i - 2 5 7 i 2 5 i - 2 5 6 * i - 2 5 6 i i - 2 5 5 * i - 2 5 5 i i - 2 5 4 * i - 2 5 4 i

i - i - i - i i i i

i 2 5 i 2 5 i 2 5 i 2 5 i 2 5 i 2 5 i 2 5

i 5 1 i 5 1 i 5 1

* i - * i - * i - * i * i * i * i

* i 2 5 * i 2 5 * i 2 5 * i 2 5 * i 2 5 * i 2 5 * i 2 5

* i 5 1 * i 5 1 * i 5 1

i 2 5 i 2 5 i 2 5 i i i i

i 2 5 i 2 5

i 2 5 i i i i

i 2 5 i 2 5 i

T h i s c l e a r l y s h o w s t h a t s o m e t h i n g i w r o n g . T h o n l y v a l u e st h a t s e e m t b c o r r e c t a r e i t h r a n g e t 2 5 5 . A l l n e g a t i v ev a l u e s a n v a l u e s g r e a t e r 2 5 p r o d u c e b a r e s u l t s . T h c a u s eo t h i s b u c a b s e e n w h e n s a m p l e c o d e i d i s a s s e m b l e d .

Page 53: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 53/84

m a i n ( )

i n * i p , i l , i 2 ;

i * i i l

s i m p l e e x a m p l e p r o d u c e s t h f o l l o w i n g C 1 2 8 o b j e c t c o d ec o m p i l a t i o n :

m a i n8 f 0 1 8 0 3 s t $ f a 0 6 0 0 1 8 0 5 I d # $ 0 6a 0 0 0 0 1 8 0 7 l d x # $ 0 0a O 0 0 0 0 1 8 0 9 l d y # $ 0 02 0 2 0 2 0 1 8 0 b j s C $ 1 0 5a 0 4 0 0 1 8 0 e l d x $ 0 a 4 0 5 0 1 8 1 0 l d $ 0

b e g i n i n d i r e c t * i 9 0 0 0 0 1 8 1 2 t y a 0 0 1 8 1 3 l d # $ 0 19 0 2 0 0 1 8 1 5 s t ( $ 0 2 ) , Y8 0 0 1 8 1 7 t x 8 8 0 0 0 0 1 8 1 8 d e 9 0 0 1 8 1 9 s t ( $ 0 2 ) , Y

e n i n d i r e c t * i i n c o r r e c t l y a s s u m e d

t c o n t a i n t h e h i g h b y t e8 0 0 1 8 1 b s t x $ 0 8 0 0 1 8 1 d s t $ 0

a l w a y s z e r oa 9 0 6 0 1 8 1 £ I d # $ 0 6a 0 0 0 0 1 8 2 1 l d # $ 0 0a 0 0 0 0 1 8 2 3 l d # $ 0 04 c 4 c 4 c 1 8 2 5 j m p C $ 1 0 6

i n t e g e r v a r i a b l e s . C h a r a c t e r v a r i a b l e s d n o e x h i b i t t h e p r o bl e b e c a u s e t h u p p e r b y t e i n a t u r a l l y z e r o . F l o a t v a r i a b l e sa r h a n d l e d d i f f e r e n t l y t h r o u g h s p e c i a l s u b r o u t i n e s . M e a r l i e re x a m p l e s c a b r e w r i t t e n t a v o i d t h p r o b l e m :

i * i i l

f u n c t i o n p r e p a r a t i o ng e l o w b y t e o i g e h i g h b y t e o i

$ 0 2 , $ 0 3 h a s a d d r e s s

c a n b e r e w r i t t e n a s

* i i l i * i p ;

a n d ,

i ( ( p t r - > c = c a l l o c ( 1 0 , 1 ) ) ! 0

c a b r e w r i t t e n a s

p t r - > c c a l l o c ( 1 0 , 1 ) ;i ( p t r - > c ! 0

s a v e h i g h b y t e i n d i r e c t P E E K , P O K E , S Y ( C 1 2 8 O n l y )

a t h i s p o i n t Y i z e r os a v e l o b y t e i n d i r e c t

s a v e l o w b y t e o i s a v e h i g h b y t e o i

f u n c t i o n w r a p - u p

h C 6 o b j e c t c o d e i i d e n t i c a l e x c e p t f o z e r o p a g e l o c aF o i n t e g e r - t y p e v a r i a b l e s , t h c o m p i l e r a s s u m e s t h

o a n a s s i g n m e n t r e m a i n s a v a i l a b l e i t h X , r e g i s t e r sb y t e , h i g h b y t e ) . D u r i n g t h i n d i r e c t a s s i g n m e n t t h r o u g h

p o i n t e r , t h r e g i s t e r i u s e d f o i n d i r e c t a d d r e s s i n g . B u i d o n e t r e s t o r e t h e h i g h b y t e t t h r e g i s t e r . A

t h h i g h b y t e i a l w a y s z e r o .

h c o m p i l e r s h o u l d r e s t o r e t h e h i g h b y t e a f t e r s a v i n g t h l o s a m p l e f i i s

i n I d ( $ 0 2 ) , Yt a

s h o u l d b i n s e r t e d a f t e r t h s e c o n d s t ( $ 0 2 ) , Y i n s t r u c t i o n .f i w o u l d m a k e t h c o m p i l e r b e h a v e l i k e ' s t a n d a r d ' a

e x p e n s e o a d d i n g f o u r b y t e s t a l i n d i r e c t a s s i g n m e n t s .

a d v i s e y o n o t u s t h r e s u l t o a i n d i r e c t a s s i g n m e n t .i c a l l y , t h e o f f e n d i n g l i n e m u s t b e b r o k e n u p i n t o s e p a r a t e

t s . T h r e s t r i c t i o n o n l y a p p l i e s t s i g n e d a n u n s i g n e d

A t h h e a r t o t h C 1 2 8 i p o w e r f u l b a n k s w i t c h i n g s c h e m et o s e l e c t b e t w e e n R A b a n k s , B A S I C R O M , K e r n a l R O M , a n t h I / O r e g i s t e r s . A d d i t i o n a l c a p a b i l i t i e s i n c l u d e z e r o p a g e r e l o c at i o n a n s h a r i n g c o m m o n R A a t h e t o p o b o t t o m o t h R A b a n k s . T h e s e f e a t u r e s a r c o n t r o l l e d b t h m e m o r y m a n a g em e n t u n i t ( M M U ) w i t h c o n f i g u r a t i o n r e g i s t e r s l o c a t e d a $ D 5 0 0 -$ D 5 0 B a n $ F F 0 0 - $ F F 0 4 . T h e s e r e g i s t e r s a r c r i t i c a l t t h c o r e c t o p e r a t i o n o t h C 1 2 8 a n r e q u i r e c a r e f u l m a n i p u l a t i o n .O t h e r w i s e , p r o g r a m m a l o s e c o n t r o l o t h m a c h i n e a n da p p e a r t b l o c k e d u p

T h e n v i r o n m e n t m a k e s f u l l u s e o f t h C 1 2 8 b a n k i n gf e a t u r e s . T h s h e l l a n R A d i s k r e s i d e i R A b a n k 0 w h i l ep r o g r a m s r e s i d e a n e x e c u t e f r o m R A b a n k 1 T h l o w e s t I o m e m o r y i s h a r e d b e t w e e n b o t h b a n k s . D u r i n g p r o g r a me x e c u t i o n , t h m e m o r y p a g e ( 2 5 6 b y t e s ) a $ 1 3 0 0 i u s e d a z e r o p a g e R A M . T h e f i r s t 3 b y t e s o f a u t o m a t i c v a r i a b l e sd e c l a r e d i f u n c t i o n a r p l a c e d i t h z e r o p a g e . T h t r u ez e r o p a g e i s w i t c h e d b a c k a z e r o p a g e R A f o a n c a l l s t r o u t i n e s t h a t d n o r e s i d e w i t h i n t h p r o g r a m , s u c h a t h K e r n a l , B A S I C o s h e l l r o u t i n e s . T h t r u e z e r o p a g e c o n t a i n sm a n y r e g i s t e r s n e e d e d f o r c a l l i n g t h e K e r n a l o B A S I C r o u t i n e s .

T h P E E K , P O K E , a n S Y f u n c t i o n s s u p p l i e d w i t h t h f u n c t i o nl i b r a r y h a v e b e e n a p p r o p r i a t e l y m o d i f i e d f o C 1 2 8 m e m o r ym a n a g e m e n t . H o w e v e r , t h e r e i p r o b l e m t h a t c a b e a s i l yd e m o n s t r a t e d b t h p e e k t e s t . c p r o g r a m ( L i s t i n g 2 ) T h i sp r o g r a m p e e k s a b y t e f r o m a n y C 1 2 8 b a n k . W h e n r u n , i p r d u c e s s t r a n g e r e s u l t s . Y o c a e a s i l y s e t h i s i y o a t t e m p t t p e e k l o c a t i o n s w i t h k n o w n v a l u e s s u c h a s t h e K e r n a l j u m pt a b l e . T h p r o b l e m l i e s i t h P E E K a n P O K E f u n c t i o n s .

B u f i r s t , s o m e b a c k g r o u n d . T h s h e l l a n p r o g r a m s u s t w s p e c i a l r o u t i n e s i c o m m o n R A t s w i t c h c o n t r o l b e t w e e nC 1 2 8 b a n k s .

Page 54: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 54/84

T h s u b r o u t i n e a $ 0 1 2 4 d o e s J S R F A R t a n b a n k .

a 0 f 0 1 2 4 I d $ f f 0 04 0 0 0 1 2 7 p h s a v e c o n f i g u r a t i o na 0 0 0 1 2 8 I d a # $ 0 08 0 f 0 1 2 a s t a $ f f 0 0 s e t b a n k 1 2 0 6 e f 0 1 2 d j s $ f f 6 e J S R F A R6 8 0 0 0 0 0 1 3 0 p l 8 0 0 f f 0 1 3 1 s t a $ f f 0 0 r e s t o r e c o n f i g u r a t i o n6 0 0 0 1 3 4 r t s

T h z e r o p a g e r e g i s t e r s $ 0 2 - $ 0 8 m u s t b s e u a c c o r d i n g t J S R F A R p r e p a r a t i o n b e f o r e t h c a l l t o $ 0 1 2 4 .

T h s u b r o u t i n e a $ 0 1 3 5 s t o r e s v a l u e t a c o n f i g u r a t i o n r e g i s t e r .

a 0 0 0 1 3 5 t a ya 0 f 0 1 3 6 I d $ f f 0 04 8 0 0 0 0 0 1 3 9 p h a 0 0 0 1 3 a I d a # $ 0 08 0 0 f f 0 1 3 c s t a $ f f 0 09 0 0 0 1 3 f t y 9 0 0 d 5 0 1 4 0 s t $ d 5 0 0 , X6 0 0 0 1 4 3 p l 8 0 f 0 1 4 4 s t a $ f f 0 06 0 0 0 1 4 7 r t s

s a v e c o n f i g u r a t i o n

s e b a n k 1

s e c o n f i g r e g i s t e r

r e s t o r e c o n f i g u r a t i o n

c o n f i g u r a t i o n v a l u e t o s t o r eo f f s e t f r o m $ D 5 0 0 , w h i c h d e t e r m i n e s t h e

c o n f i g u r a t i o n r e g i s t e r t o b e u p d a t e d ,u s e d i n t e r n a l l y b y t h e $ 0 1 3 5 r o u t i n e .

T h b a s i c p r o c e d u r e t e x e c u t e r o u t i n e i a n o t h e r b a n k i s

1 S w i t c h z e r o p a g e b a c k t $ 0 0 0 0 u s i n g t h e $ 0 1 3 5 r o u t i n e .

2 S e u r e g i s t e r s $ 0 2 - $ 0 8 f o r t h e K e r n a l r o u t i n e J S R F A R .

3 C a l l $ 0 1 2 4 i c o m m o n R A w h i c h c a l l s J S R F A R .

4 C a p t u r e r e s u l t s f r o m r e g i s t e r s $ 0 2 - $ 0 8 a s a p p r o p r i a t e .

5 S w i t c h t h z e r o p a g e t $ 1 3 0 0 u s i n g t h $ 0 1 3 5 r o u t i n e .

T h p r o b l e m i t h p e e k a n p o k e f u n c t i o n s i t h a t t h e y f a i l t s e u t h r e g i s t e r b e f o r e t h c a l l t o $ 0 1 3 5 . T h n e r e s u l t i t h a t z e r o p a g e d o e s n o g e p r o p e r l y s w a p p e d . I a f u n c t i o ni n v o k e s P E E K o P O K E , t h f i r s t s i b y t e s o v a r i a b l e s d e c l a r e dw i t h i n t h f u n c t i o n w i l l b c o r r u p t e d b e c a u s e t h z e r o p a g el o c a t i o n s $ 0 2 - $ 0 8 a r o v e r w r i t t e n d u r i n g t h s e t u p a n e x e c ut i o n o J S R F A R . T h p r o g r a m P O K E . A ( L i s t i n g 3 c o n t a i n s t h u p d a t e d s o u r c e c o d e f o t h P E E K a n P O K E f u n c t i o n s . O l a n n e c o d e i h i g h l i g h t e d .

T h S Y f u n c t i o n d o e s n o e x h i b i t t h e z e r o p a g e s w a p p i n gp r o b l e m l i k e P E E K a n P O K E . H o w e v e r , S Y S d o e s d i r e c t l ym a n i p u l a t e t h e c o n f i g u r a t i o n r e g i s t e r s . O n p r o b l e m o d i r e c tm a n i p u l a t i o n o t h c o n f i g u r a t i o n r e g i s t e r s i t h a t a e x e c u t i n g

p r o g r a m m a b s w i t c h e d o u t a n l o s e c o n t r o l . S i n c e p r e f e rr o b u s t a n c o n s i s t e n t d e s i g n s , m o d i f i e d S Y t e l i m i n a t e a l d i r e c t m a n i p u l a t i o n o t h c o n f i g u r a t i o n r e g i s t e r , m a k i n g i b e h a v e l i k e P E E K a n d P O K E . T h p r o g r a m S Y S . A ( L i s t i n g 4 )c o n t a i n s t h u p d a t e d s o u r c e c o d e f o r t h e S Y f u n c t i o n . O l a n n e c o d e i i n d i c a t e d .

P e e k . a a n S Y S . A c a n b e a s s e m b l e d u s i n g a n a s s e m b l e r t h a tp r o d u c e s c o m p a t i b l e o b j e c t . A l t e r n a t i v e l y , B A S I C g e n e r a t o rp r o g r a m s ( L i s t i n g s a n 6 h a v e b e e n s u p p l i e d t c r e a t e t h eo b j e c t f i l e s f o p e e k , P O K E a n d S Y S u s i n g D A T A s t a t e m e n t s .D e l e t e t h e o r i g i n a l o b j e c t f i l e s P E E K . O B J a n S Y S . O B J o y o u rf u n c t i o n l i b r a r y d i s k a n r e p l a c e t h e m w i t h t h u p d a t e d o b j e c tf i l e s . M a k e s u r e t h e n e o b j e c t f i l e s u s t h s a m e f i l e n a m e sa t h o r i g i n a l s . O t h e r w i s e , y o w i l l n e e d t u s e a o b j e c tl i b r a r y e d i t o r t c h a n g e t h f i l e n a m e s i t h e o b j e c t l i b r a r i e s .A a p r e c a u t i o n , u s b a c k u p c o p y f o t h i s a n s a v e t h o r i g in a f u n c t i o n l i b r a r y d i s k .

p a i n f u l e x p e r i e n c e ( C 1 2 8 o n l y )

n e v e r p a i d m u c h a t t e n t i o n t m a g a z i n e d e s c r i p t i o n s o 1 5 7 1d i s k d r i v e p r o b l e m s . T h i n f o r m a t i o n a l w a y s s e e m e d t o v a g u e t a p p l y t m e a s s u m e t h p r o b l e m t h a t p a i n f u l l yd i s c o v e r e d c a m e a r e s u l t o o n o t h 1 5 7 1 b u g s . I s t r o n g l y r e i n f o r c e d m h a b i t o d o i n g p e r i o d i c b a c k - u p s a n o r g a n i z i n g d i s k s t m i n i m i z e m r e l i a n c e o a n o n d i s k .

W h e n f i r s t o b t a i n e d t h P o w e r c o m p i l e r f o m C 1 2 8 ,c o n f i g u r e d m e n v i r o n m e n t u s i n g t w 1 5 7 1 d i s k d r i v e s a f o l l o w s :

1 W o r k d r i v e w a s e t d i s k u n i t a n h e l d t h f l o p p yd i s k c o n t a i n i n g p r o g r a m s u n d e r d e v e l o p m e n t .

2 S y s t e m d r i v e w a s e t t o t h R A d i s k u n i t 7 A p a r t o m s t a r t u p p r o c e d u r e , c o p i e d t h e c o m p i l e r , e d i t o r a n v a r i o u su t i l i t i e s t t h R A d i s k , a m u c h a w o u l d f i t . T h e n w o u l ds w i t c h t h s y s t e m d r i v e b e t w e e n t h R A d i s k a n d i s k u n i t

d e p e n d i n g u p o n w h a t u t i l i t y n e e d e d .

W i t h t h i s a p p r o a c h , e d i t i n g a n c o m p i l i n g w e r e d o n e t a n f r o m d i s k . a d o p t e d t h i s c o n f i g u r a t i o n b e c a u s e i w a t h f a s t e s t w a t l o a d t h e c o m p i l e r , a b o u t t w s e c o n d s . C 1 2 8c o m p i l e t i m e b a s i c a l l y a m o u n t e d t r e a d i n g t h s o u r c e p r og r a m f r o m d i s k a n w r i t i n g b a c k t h o b j e c t . T h e s e d e l a y sc o u l d b s u b s t a n t i a l w h e n y o c o n s i d e r t h e w r i t i n g s p e e d o 1 5 7 1 i i d e n t i c a l t o t h 1 5 4 1 . B u h a b e e n c o n d i t i o n e d b t h s l o w l o a d i n g t i m e o t h C 6 v e r s i o n o t h c o m p i l e r o p e ra t i n g f r o m 1 5 4 1 d i s k d r i v e . o p e r a t e d c o m f o r t a b l y i t h i sm o d e f o a b o u t s i m o n t h s b e f o r e e n c o u n t e r e d t h p r o b l e m .

T h p r o b l e m o c c u r s w h e n t h d i s k b l o c k t o t a l c r o s s e s t h e s i d et s i d e b o u n d a r y . T h c o m p i l e r c a g i n t o a i n f i n i t e

l o o p , e a t i n g u d i s k s p a c e , a n c o r r u p t i n g t h s o u r c e f i l e a n p o s s i b l y o t h e r f i l e s . W h e n t h p r o b l e m o c c u r r e d , h a t o r e s e tt h c o m p u t e r , l e a v i n g t h d i s k c o r r u p t . A f t e r v a l i d a t i n g t h ed i s k , f o u n d t w ' s p l a t ' f i l e s t e m p x x x i a n T E M P X X X 2 .

Page 55: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 55/84

t h T E M P X X X f i l e s w e r e w r i t t e n b t h c o m p i l e r . I w o r k d r i v e 0 f o l l o w e d b s y s t e m d r i v e 1 u n l e s s t h d r i v ei t i o n , t h e s o u r c e f i l e w a c o m p l e t e l y c o r r u p t e d . n u m b e r i e x p l i c i t l y g i v e n i t h f i l e n a m e . T h b a s i c p r o c e

s a s i m i l a r p r o b l e m s w h e n p r o g r a m w a s e x e c u t i n gt h f o l l o w i n g c o n d i t i o n s :

T h d i s k b l o c k t o t a l w a a o n e a r t t h e s i d e t s i d eb o u n d a r y .

T h e r r o r c h a n n e l w a o p e n .

T w f i l e s w e r e o p e n e d b f o p e n .

C o m m a n d l i n e I / r e d i r e c t i o n s e n t t h e s t a n d a r d o u t p u t t d i s k f i l e .

t h t o t a l i t h r e e o p e n f i l e s p l u s t h e e r r o r c h a n n e l o d i s k d r i v e , w h i c h i t h l i m i t a c c o r d i n g t t h 1 5 7 1 U s e r ' s

A l t h o u g h d n o h a v e t h d e t a i l s , r e c a l l t h a t o n o 1 5 7 1 b u g s i r e l a t e d t t h e s i d e t s i d e t r a n s i t i o n .

c o r r e c t e d b t h n e 1 5 7 1 R O a r d o c u m e n t e d i t h D e v e l o p e r ' s P a c k a g e f r o m C o m m o d o r e . E d . ]

f u r t h e r i n v e s t i g a t i o n , c o n c l u d e d t h a t t h p r o b l e m n e v e rc u r s w i t h a n y t h i n g l e s s t h a n t h r e e o p e n f i l e s . A n p r o g r a m

t w o p e n f i l e s o l e s s p l u s t h e e r r o r c h a n n e l a p p e a r s t c o r r e c t l y a c r o s s t h e s i d e t s i d e b o u n d a r y . T h

m a h a v e p r o d u c e d t h s a m e s i t u a t i o n w i t h t h e e r r o rp l u s t h r e e o p e n f i l e s : t e m p x x x i , T E M P X X X 2 , a n

t h s o u r c e f i l e o r t h e o b j e c t f i l e .

a r o u n d t h b u

c o n s i d e r e d m a n y a l t e r n a t i v e s t a v o i d t h i s p r o b l e m . O n w a t k e e p d i s k s p a c e l o t p r e v e n t c r o s s i n g t h e

t s i d e b o u n d a r y . H o w e v e r , t h i s d e f e a t e d t h a d v a no a d o u b l e - s i d e d d i s k d r i v e .

a p p r o a c h e v e n t u a l l y t o o k w a t a v o i d a l d i s k d r i v e s i t h a t w o u l d h a v e t h r e e o p e n f i l e s p l u s t h e e r r o r c h a n n e l .

d i t h i s b y m a k i n g b e t t e r u s o t h R A d i s k .

s o m e e x p e r i m e n t i n g , f i n a l l y c o n f i g u r e d m e n v i r o na f o l l o w s :

W o r k d r i v e i s e t t h R A d i s k u n i t a n h o l d s t h p r o g r a m s u n d e r d e v e l o p m e n t .

S y s t e m d r i v e i s e t t h d i s k u n i t a n h o l d s t h f l o p p yd i s k c o n t a i n i n g t h c o m p i l e r , e d i t o r a n v a r i o u s u t i l i t i e s .

D r i v e 2 i s e t t h d i s k u n i t a n h o l d s t h f l o p p y d i s kc o n t a i n i n g p r o g r a m s u n d e r d e v e l o p m e n t .

t h i s a p p r o a c h , e d i t i n g a n c o m p i l i n g a r d o n e t a n t h R A d i s k . T h p r o c e d u r e i s i m p l e a n q u i c k . K e e p

m i n d t h a t t h e n o r m a l s e a r c h o r d e r f o p r o g r a m s a n f i l e s i

d u r e i s

1 S e u t h R A d i s k c o n f i g u r a t i o n u s i n g t h c o m m a n d sr d o n , s e t u 7 0 a n d s e t u 2 0

2 C o p y t h a p p r o p r i a t e f i l e s f r o m d r i v e ( f l o p p y ) t d r i v e( R A M ) u s i n g t h c o m m a n d c 2 : f i l e 0 B s u r e t c o p y a n h e a d e r f i l e s n e e d e d b t h s o u r c e f i l e s .

3 E d i t t h f i l e s u s i n g t h c o m m a n d e f i l e . Y o c a e v e n p u l lf i l e s d i r e c t l y i n t o t h e d i t o r f r o m d r i v e ( f l o p p y ) u s i n g t h c o m m a n d e 2 : f i l e o u s i n g t h c o m m a n d g e 2 : f i l e f r o mw i t h i n t h e d i t o r . T h e d i t o r c o m m a n d p u f i l e w r i t e s t h ef i l e b a c k t d r i v e ( R A M ) . S i m i l a r l y , t h c o m m a n d p u 2 : f i l e w r i t e s t h e f i l e d i r e c t l y b a c k t d r i v e ( f l o p p y ) .

4 C o m p i l e t h f i l e f r o m d r i v e ( R A M ) u s i n g t h c o m m a n dc f i l e . T h o b j e c t f i l e w i l l b w r i t t e n t d r i v e ( R A M ) .

5 W h e n f i n i s h e d , d e l e t e t h o l d c o p i e s f r o m d r i v e u s i n g t h c o m m a n d r 2 : f i l e . T h e n , c o p y t h u p d a t e d f i l e s f r o md r i v e ( R A M ) b a c k t d r i v e ( f l o p p y ) u s i n g t h c o m m a n dc 0 : f i l e 2 W i l d c a r d c h a r a c t e r s i t h f i l e n a m e a r v e r yu s e f u l h e r e . B c a r e f u l ! I t i s v e r y e a s y t l o s e h o u r s o w o r kd u r i n g t h i s s t e p .

T h i s c o n f i g u r a t i o n i q u i t e f a s t . I / t t h R A d i s k i d o n e a b l i n d i n g s p e e d s b 1 5 4 1 s t a n d a r d s . A n d e l a y s c o m e f r o ml o a d i n g t h e d i t o r , c o m p i l e r o r o t h e r u t i l i t i e s . H o w e v e r , c o s i d e r t h e s e d e l a y s t b m i n o r s i n c e t h p r o g r a m s a r l o a d e d i 1 5 7 1 b u r s t m o d e . F o e x a m p l e , t h c o m p i l e r t a k e s a b o u t 1 0s e c o n d s t l o a d a n t h t r a n s l a t o r f o r t h e c o m p i l e r t a k e s a b o u t

s e c o n d s .

I m p o r t a n t : D o n ' t f o r g e t t c o p y f i l e s b a c k t d r i v e ( f l o p p y )w h e n y o u r w o r k i c o m p l e t e . A l c h a n g e s m a d e t f i l e s r e s i di n i d r i v e ( R A M ) w i l l b l o s t w h e n t h p o w e r i t u r n e d o f f .

L i s t i n g 1 b u g . c/ * b u g . c*

* d e m o n s t r a t e c o m p i l e r b u g* * L a r r y J G a y n i e r* J u n e 2 5 1 9 8 8* m a i n ( )

i n * i p , i O , i l , i 2 ;

i S i O ;

f o ( i - 5 1 2 ; i l < 5 1 2 ;

i * i p = i l p r i n t f { " i l % * i p = % i % d \ n " , i l , * i p ,

Page 56: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 56/84

L i s t i n g 2 p e e k t e s t c/ * p e e k a n a d d r e s s f r o m C 1 2 8 b a n k* * L a r r y J G a y n i e r* J u n e 2 5 1 9 8 8* m a i n ( a r g c , a r g v )u n s i g n e d a r g c ;c h a r * * a r g v ;

u n s i g n e d b a n k , a d d r e s s ;c h a r b y t e , p e e k ( ) ;

i ( a r g c = 3

s s c a n f ( * + + a r g v , " % x " , f i b a n k ) ;s s c a n f ( * + + a r g v , " % x " , f i a d d r e s s ) ;

b y t e p e e k ( b a n k , a d d r e s s ) ;p r i n t f ( " b a n k = % 0 2 x a d d r e s s = % 0 4 x b y t e = % 0 2 x \ n "

, b a n k , a d d r e s s , b y t e ) ;

e l s e

p r u s a g e ( ) ;e x i t ( ) ;

p r u s a g e ( )

p r i n t f ( " u s a g e : p e e k t e s t b a n k a d d r e s s \ n " ) ;

L i s t i n g 3 p e e k . a r e v i s e d s o u r c e f o p e e k . o; m o d i f i e d t c o r r e c t z e r o p a g i n g; a d d e d l d x # $ 0 7 b e f o r e e v e r y j s r $ 0 1 3 5

; L a r r y G a y n i e r; M a r c h 1 0 , 1 9 8 7

. d e f p e e k , p o k e. r e f c $ f u n c t j . n i t

p e e kj s c $ f u n c t i n i ts t $ a t x p h I d a # $ 0 0

; n e w o l dl d # $ 0 7; e n d e n dj s $ 0 1 3 5p l t a I d a $ 0 4 0 2 , Xs t a $ f cI d a $ 0 4 0 3 , Xs t a $ f dI d a # $ 0 fs t $ 0 I d a # $ f fs t a $ 0 3I d a # $ 7 4s t $ 0 p h p l s t a $ 0 5I d a # $ f c

s t $ 0 I d a $ 0 4 0 0 , Xs t $ 0 I d a # $ 0 0s t $ 0 j s $ 0 1 2 4I d $ 0 p h I d a # $ 1 3; n e w o l dl d # $ 0 7

; e n d e n dj s $ 0 1 3 5p l l d $ a s t $ 0 4 0 0 , XI d a # $ 0 0s t $ 0 4 0 1 , Xr t

p o k ej s c $ f u n c t i n i ts t $ a t x p h I d a # $ 0 0; n e w o l dl d # $ 0 7

; e n d e n dj s $ 0 1 3 5p l t a I d $ 0 4 0 2 , Xs t a $ f cI d a $ 0 4 0 3 , Xs t $ f I d a # $ f cs t a $ 0 2 b 9I d a # $ 0 fs t $ 0 I d a # $ f fs t $ 0 I d a # $ 7 7s t $ 0 p h p l s t $ 0 I d a $ 0 4 0 4 , Xs t $ 0 I d a $ 0 4 0 0 , Xs t a $ 0 7I d a # $ 0 0s t $ 0 j s $ 0 1 2 4I d a # $ 1 3

; n e o l l d # $ 0 7

; e n d e n dj m $ 0 1 3 5

L i s t i n g 4 s y s . a r e v i s e d s o u r c e f o s y s . o; m o d i f i e d t o u s e $ 0 1 3 5 r o u t i n e l i k e p e e k a n d p o k e; e l i m i n a t e d r e s e t t i n g t h e c o n f i g u r a t i o n r e g i s t e r; n n e e d t o e n a b l e t h e k e r n a l a n d i / ; h a n d l e d b t h $ 0 1 3 5 r o u t i n e

; L a r r y G a y n i e r; M a r c h 1 4 1 9 8 7

. d e f s y . r e f c $ f u n c t i n i t

Page 57: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 57/84

y j s c $ f u n c t _ i n i ts t $ a I d a $ 0 4 0 4 , Xs t $ a I d a $ 0 4 0 5 , Xs t a $ a 3I d $ 0 4 0 6 , Xs t a $ a 4 d a $ 0 4 0 7 , X

s t $ a d $ 0 4 0 8 , Xt $ a

d a $ 0 4 0 9 , Xt $ a

d y # $ 0 0d ( $ a 2 ) , Yh

a ( $ a 4 ) , Yh d ( $ a 6 ) , Yh

n e x h

a # $ 0 0x # $ 0 7r $ 0 1 3 5

l a

e n d $ 0 4 0 0 , Xt $ 0

a $ 0 4 0 3 , Xt $ 0 d $ 0 4 0 2 , Xt $ 0 l

a $ 0 8l a $ 0 7l t a $ 0 6h l t $ 0 s $ 0 1 2 4d $ 0 h d $ 0 h d $ 0 h d $ 0 h d # $ 1 3

n e d # $ 0 7

r $ 0 1 3 5

e n y # $ 0 0

l a ( $ a 6 ) , Y

l t l t ( $ a 2 ) ,i d # $ 0 0

c s k i pa # $ 0 1

o l I d a # $ 4 es t $ £ £ 0 0I d a # $ 0 0s t a $ d 5 0 7

o l s t $ D 5 0 7I d a # $ 7 Fs t a $ £ £ 0 0

e n

( $ a 4 ) , Y

s k i pl d $ a s t $ 0 4 0 0 , XI d # $ 0 0s t $ 0 4 0 1 , Xr t

L i s t i n g 5 p e e k . g e n B A S I C g e n e r a t o r f o p e e k . oB 1 0 r e m g e n e r a t o r f o r " p e e k . o "J 1 1 n $ = " p e e k . o " : r e n a m e o p r o g r a mD 1 2 n d = 2 0 9 : s a = 1 5 1 : c h = 1 5 8 3 7

( F o r l i n e s 1 3 0 - 2 6 0 , s e e t h e s t a n d a r d g e n e r a t o r o n p a g e 5 .

F D 1 0 0 0B P 1 0 1 0H D 1 0 2 0M 1 0 3 0H B 1 0 4 0F D 1 0 5 0C P 1 0 6 0E 1 0 7 0J D 1 0 8 0K 1 0 9 0J 1 1 0 0F F 1 1 1 0L 1 1 2 0J 1 1 3 0E 1 1 4 0G 1 1 5 0C 1 1 6 0H 1 1 7 0C 1 1 8 0K 1 1 9 0G 1 2 0 0P 1 2 1 0D 1 2 2 0E 1 2 3 0C 1 2 4 0J M 1 2 5 0C I 1 2 6 0

d a t a 3 2 0 d a t a 0 1 6 2 ,d a t a 1 8 9 , 2 d a t a 1 3 3 , 2 5 3 ,d a t a 1 3 3 , 3 d a t a 1 3 3 , 5 d a t a 4 1 3 3 ,d a t a 3 6 1

7 3 2 0 , 4 ,

d a t ad a t ad a t a 3 2 0 d a t a 0 1 6 2 ,d a t a 1 8 9 , 2 d a t a 1 3 3 , 2 5 3 ,d a t a 1 5 1 3 3 ,d a t a 1 1 9 , 1 3 3 ,d a t a 4 , 4 ,d a t a 7 1 6 9 ,d a t a 1 6 9 ,

0 1 1

d a t ad a t ad a t ad a t a 8 5 d a t a 8 4 d a t a 7 0 d a t a 7 3 d a t a

1 9 2 0

8 0 7 8

0 8 5 8 4

0 7 4

1 6 9 ,1 6 9 ,1 6 9 ,

7 1 6 5 ,

5 3 1 6 9 ,

0 7 4

1 6 9 ,2 4

1 3 3 ,0

1 6 2 ,0 0 0

6 7 0

7 8 0

1 3 4 , 1 6 0 , 1 3 8 ,3 2 , 5 3 , 1

1 3 3 , 2 5 2 , 1 8 9 ,1 5 1 3 3 , 2

1 1 6 , 1 3 3 , 4 2 5 2 , 1 3 3 , 6 1 6 9 , 0 1 3 3 ,

6 7 2 1 6 9 ,1 1 0 4 , 1 6 6 ,0 1 5 7 , 1

1 3 4 , 1 6 0 , 1 3 8 ,3 2 , 5 3 , 1

1 3 3 , 2 5 2 , 1 8 9 ,2 5 2 , 1 4 1 , 1 8 5 ,1 6 9 , 2 5 5 , 1 3 3 ,

8 1 0 4 , 1 3 3 ,6 1 8 9 , 0

1 3 3 , 8 3 2 7 7 6 , 5 3 ,

8 0 6 9 , 6 9 ,8 0 7 9 , 7 5 ,

2 , 0 , 6 7 8 4 1 6 4 , 7 3

0 , 0 , 0 6 7 , 8 4 , 1 6 4 ,

0 , 0 , 8 0

7 2 1 6 1 0 4 , 1 7

3 1 6 9 , 2 5

8 1 0 1 8 9 ,

8 3 1 9 1 6

1 6 0 , 1 5 4 9

7 2 1 6 1 0 4 , 1 7

3 , 2 1 6 3 1 6 5 1 8 4 1 3

3 6 1

7 5 6 9 3 6 7 7 8 7 6 7 3 7 3 7

0

L i s t i n g 6 s y s . g e n B A S I C g e n e r a t o r f o s y s . oJ 1 0 r e m g e n e r a t o r f o " s y s . o "G 1 1 0 n $ = " s y s . o " : r e n a m e o f p r o g r a mP 1 2 0 n d = 1 6 8 : s a = 1 3 6 : c h = 1 3 1 3 0

( F o r l i n e s 1 3 0 - 2 6 0 , s e t h e s t a n d a r d g e n e r a t o r o n p a g e 5 .

I A 1 0 0 0C E 1 0 1 0I D 1 0 2 0O 1 0 3 0J 1 0 4 0D 1 0 5 0I C 1 0 6 0K F 1 0 7 0B 1 0 8 0G C 1 0 9 0E 1 1 0 0F I 1 1 1 0C G 1 1 2 0A 1 1 3 0E 1 1 4 0O 1 1 5 0A 1 1 6 0I H 1 1 7 0N 1 1 8 0F 1 1 9 0K 1 2 0 0

d a t a 3 2 0 d a t a 1 3 3 , 1 6 2 ,d a t a 6 4 d a t a 1 6 5 , 1 8 9 ,d a t a 4 1 3 3 ,d a t a 1 7 7 , 1 6 4 ,d a t a 1 6 9 , 0 d a t a 1 7 0 , 1 8 9 ,d a t a 4 1 3 3 ,d a t a 1 0 4 , 1 3 3 ,d a t a 6 8 d a t a 1 6 5 , 5 d a t a 7 2 1 6 5 ,d a t a 3 2 5 3 d a t a 1 0 4 , 1 4 5 ,d a t a 0 1 4 4 ,d a t a 0 4 d a t a 0 d a t a 1 d a t a 8 5 d a t a 8 4

0 0

7 8 0

0 1 8 9 ,1 3 3 ,

8 1 6 7 ,

7 2 1 6 2 ,

0 3 8

1 0 4 ,7 2

8 1

1 6 4 ,2

1 6 9 ,1 0

6 7 0

1 3 4 , 1 6 0 ,5 4

1 6 4 , 1 8 9 ,4 1 3 3 ,

1 6 0 , 0 1 7 7 , 1 6 6 ,

7 3 2 4 1 3 3 ,

1 8 9 , 2 1 0 4 , 1 3 3 ,1 3 3 , 5 1 6 5 , 6

7 2 1 6 9 ,1 6 0 , 0 1 0 4 , 1 4 5 ,1 6 9 , 1

0 1 5 7 ,0 8 3 1 , 0 ,

8 4 1 6 4 ,0 , 0 ,

1 8 9 , 4 1 3 3 , 1 6 3 , 1 8

7 , 4 , 1 3 1 6 6 , 1 8 9 ,1 7 7 , 1 6 2 , 7 2

7 2 1 3 8 , 7 25 3 1 1 0

2 1 8 9 ,4 1 3 3 ,7 1 0 4 , 1 3

3 2 , 3 6 ,7 2 , 1 6 5 ,1 9 1 6 2 ,

1 0 4 , 1 4 5 , 1 6 1 6 2 , 4 0 1 6 1 6 6 , 1 6 0 , 1 5

1 , 4 , 9 8 9 8 3 6 7 3 6 , 7 07 3 , 7 8 , 7

0 , 0 ,

Page 58: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 58/84

P r o g r a m m i n g G E O S I c o n s

S o m e t r i c k s f o u s i n g m o r e t h a n 3 i c o n s

b J a m e s C o o k

O n o t h m o s t f u n d a m e n t a l u s e r i n t e r f a c e t o o l s i t h G E O So p e r a t i n g s y s t e m i t h i c o n . A i c o n i a g r a p h i c i m a g e o n t h m o n i t o r t h a t c a u s e s p r o g r a m r o u t i n e t b c a l l e d w h e n t h u s e r c l i c k s t h m o u s e p o i n t e r o v e r i t I c o n s , a l o n g w i t h t h m o u s e a n d p u l l d o w n m e n u s , a l l o w t h u s e r t o p e r a t e t h c o m p u t e r i c o m f o r t a b l e , e a s y t g r a s p w a y . L o a d i n g a n dr u n n i n g p r o g r a m i a s i m p l e a m o v i n g t h p o i n t e r o v e r t h f i l e i c o n o t h D e s k T o p a n d o u b l e - c l i c k i n g . T h u s e r d o e sn o n e e d t r e m e m b e r a n t y p e c o m p l i c a t e d , o f t e n c o n f u s i n gc o m m a n d s .

G E O S - s p e c i f i c a p p l i c a t i o n p r o g r a m s m a k e e x t e n s i v e u s o t h G E O S K e r n a l , w h i c h i l o a d e d f r o m t h b o o t d i s k a n c o n s i s t so l a r g e n u m b e r o s e r v i c e r o u t i n e s . T h e s e s e r v i c e r o u t i n e st a k e c a r e o f m o s t o t h c o m m o n n e e d s o a a p p l i c a t i o n s u c ha d i s k a n f i l e h a n d l i n g , g r a p h i c m a n i p u l a t i o n , t h u s e r i n t e rf a c e , e t c . T h m e m o r y - r e s i d e n t r o u t i n e s w a i t p a t i e n t l y f o ru s e r e v e n t t o c c u r , s u c h a c l i c k i n g o a i c o n , b e f o r e s w i n gi n i n t o a c t i o n . T h G E O S p r o g r a m m e r c a f r e e l y u s t h e s er o u t i n e s i a n G E O S a p p l i c a t i o n .

S u p r i s i n g l y , a i m p o r t a n t a i c o n s a r t G E O S , t h e r e i o n l yo n i c o n - s p e c i f i c r o u t i n e , D o l c o n s . T h i s s i n g l e r o u t i n e , h o e v e r , p a c k s l o o f p u n c h . A l o t h f i l e a n d i s k i c o n s o t h D e s k T o p u s i t A l o t h e t o o l r o u t i n e s i g e o P a i n t a r c a l l e db i t S i m p o r t a n t i t h i s r o u t i n e t h a t B e r k e l e y S o f t w o r k s 'O f f i c i a l G E O S P r o g r a m m e r s R e f e r e n c e G u i d e w a r n s t h a t G E O Sa s s u m e s a a p p l i c a t i o n w i l l a l w a y s h a v e a t l e a s t o n i c o n .S i n c e m o s t a p p l i c a t i o n s d e p e n d h e a v i l y o t h u s e o f i c o n s , i

i w o r t h a i n - d e p t h l o o k a h o t u s t h e m i y o u r o w p r g r a m s .

T h D o l c o n s r o u t i n e i a l m o s t a l w a y s p a r t o a a p p l i c at i o n ' s i n i t i a l i z a t i o n s e q u e n c e . T h i s s e q u e n c e c a l l s n u m b e r o G E O S g r a p h i c s a n m e n u r o u t i n e s t c r e a t e t h e u s e r i n t e r f a c es c r e e n . T h e s e r o u t i n e s , a s w e l l a m o s t o t h e o t h e r a v a i l a b l es e r v i c e r o u t i n e s , a r a c c e s s e d b J S t a e n t r y i j u m pt a b l e . T h j u m p t a b l e c o n t a i n s t h a c t u a l a d d r e s s i m e m o r y o t h e r o u t i n e t h e p r o g r a m m e r w i s h e s t o a c c e s s . W h i l e d i f f e r e n tv e r s i o n s o f G E O S m a l o c a t e t h e s e r v i c e r o u t i n e s a d i f f e r e n ta d d r e s s e s , t h j u m p t a b l e r e m a i n s t h s a m e b e t w e e n v e r s i o n s .S i n c e G E O S h a b e e n f r e q u e n t l y u p d a t e d , t h j u m p t a b l e p r v i d e s a s t a b l e p a t h t t h r o u t i n e . T h e G E O S j u m p t a b l e a d d r e s sf o D o l c o n s i $ C 1 5 A .

W h e n D o l c o n s i c a l l e d , t h G E O S K e r n a l e x p e c t s t h t w o - b y t e. w o r d f o l l o w i n g t h J S i m e m o r y t c o n t a i n t h p o i n t e r t t h i c o n t a b l e . T h i c o n t a b l e t e l l s G E O S h o m a n y i c o n s a r r e q u i r e d , t h e i r l o c a t i o n o t h e s c r e e n , t h e i r s i z e , t h e l o c a t i o n o t h c o m p a c t e d b i t - m a p i m a g e f o e a c h i c o n , t h e s e r v i c e r o u t i n et c a l l a f t e r t h i c o n i s e l e c t e d , a n t h e p o s i t i o n t p l a c e t h m o u s e p o i n t e r a f t e r t h i c o n s a r d r a w n . H e r e i a e x a m p l eo D o l c o n s a n t h i c o n t a b l e :

; I c o n t a b l e e x a m p l eJ S D o l c o n s ; C a l l t h e i c o n r o u t i n e ,. w o r d I c o n T a b l e / P o i n t e r t o t h e i c o n t a b l e .

I c o n T a b l e : ; H e r e i s t h e i c o n t a b l e .

; i c o n s o n t h e s c r e e n .; T h e m o u s e t o b e i n t h e c e n t e r o f/ s c r e e n a f t e r i c o n s a r d r a w n ./ P o i n t e r t o b i t - m a p f o i c o n # 1 ; P o s i t i o n o t h e i c o n i n b y t e s .; P o s i t i o n o t h i c o n i p i x e l s ./ W i d t h o f i c o n i n b y t e s ./ H e i g h t o f i c o n i n p i x e l s ./ P o i n t e r t o s e r v i c e r o u t i n e f o # 1 / P o i n t e r t o b i t - m a p f o r i c o n # 2 ; P o s i t i o n o t h e s e c o n d i c o n .; P o s i t i o n o t h s e c o n d i c o n ./ W i d t h o f i c o n i n b y t e s ./ H e i g h t o f i c o n i n p i x e l s ./ P o i n t e r t o s e r v i c e r o u t i n e f o # 2 / m o r e i c o n e n t r i e s .

L e t ' s t a k e c l o s e r l o o k a t h i c o n t a b l e . A n o t e d , e v e r y a p p l ic a t i o n m u s t h a v e a l e a s t o n i c o n s o t h e r e w i l l a l w a y s b a l e a s t o n c a l l t D o l c o n s a n a i c o n t a b l e i e v e r y a p p l i c at i o n . T h m i n i m u m n u m b e r i t h f i r s t e n t r y o t h i c o n t a b l e ,t h e r e f o r e , i 1 T h m a x i m u m n u m b e r o a c t i v e i c o n s p o s s i b l eo t h s c r e e n i 3 1

Y o m a c a l l D o l c o n s s e v e r a l t i m e s i a a p p l i c a t i o n , b u t o n l yt h m o s t r e c e n t l y c a l l e d g r o u p o i c o n s w i l l b a c t i v e . G E O S w i l ln o e r a s e t h p r e v i o u s l y d r a w n i c o n g r a p h i c s f r o m t h s c r e e n .Y o m a r e - c a l l D o l c o n s a n d r e a c t i v a t e i t g r o u p o i c o n s i y o w i s h . I t h i c o n s h a v e n o b e e n w r i t t e n o v e r o e r a s e d , t h eu s e r w i l l n o d e t e c t t h a t t h e y h a v e a c t u a l l y b e e n r e d r a w n .

. b y t e. w o r d. b y t e. w o r d. b y t e. b y t e. b y t e. b y t e. w o r d. w o r d. b y t e. b y t e. b y t e. b y t e. w o r d

1 6 1 0 I c o n P i c l1 1

1 D o l c o n lI c o n P i c 21 1

1 D o l c o n 2

Page 59: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 59/84

h n e x t t w e n t r i e s a l l o w y o t p l a c e t h m o u s e p o i n t e ro t h s c r e e n a f t e r t h e i c o n s a r d r a w n . F o l l o w i n g

t h r e e p i e c e s o i n f o r m a t i o n , D o l c o n s e x p e c t s s i d a t af o e a c h i c o n .

i m a g e a n p o s i t i o n d a t a

h f i r s t . w o r d c o n t a i n s t h p o i n t e r f o t h b i t - m a p d a t a o t h i m a g e i t s e l f . A t h m e m o r y l o c a t i o n i n d i c a t e d b t h

y o u m u s t h a v e t h b i t - m a p i m a g e c o d e d u s i n g G E O S 'i o n r u l e s . I f y o a r u s i n g G e o P r o g r a m m e r y o n e e d

p a s t e t h p h o t o s c r a p i m a g e o t h i c o n i n t o y o u r s o u r c eT h i s m a k e s i e a s y t u s t h g r a p h i c t o o l s i G e o P a i n t t

a t e j u s t a b o u t a n i m a g e y o u l i k e w i t h o u t h a v i n g t w o r r yt h e r a t h e r c o m p l i c a t e d c o m p a c t i o n t e c h n i q u e s .

s u r e y o c a r e f u l l y f o l l o w t h i n s t r u c t i o n s i t h G e o P r om a n u a l . O t h e r w i s e , y o u ' l l h a v e t b r e a k t h i m a g e

m a n u a l l y a c c o r d i n g t t h c o m p a c t i o n f o r m a t s d e s c r i b e dp a g e 8 9 - 9 0 o t h O f f i c i a l G E O S P r o g r a m m e r s R e f e r e n c e

h n e x t t w . b y t e s a r u s e d t l o c a t e t h e i c o n o t h e s c r e e n .t h a t t h h o r i z o n t a l p o s i t i o n o t h i c o n i r e s t r i c t e d t oe v e n b y t e . T h i s m e a n s t h a t y o u ' l l o n l y b a b l e t l o c a t e

i c o n s t 4 d i f f e r e n t p o s i t i o n s h o r i z o n t a l l y . T h i s m a b i m p o r t a n t c o n s t r a i n t i s o m e a p p l i c a t i o n s . T h v e r t i c a l

o t h i c o n c a n b e o a n o t h 2 0 s c a n l i n e s

h f i f t h a n s i x t h b y t e s d e s c r i b e t h s i z e o i c o n . T h f i f t ht e l l s G E O S t h w i d t h o t h i c o n a n b y t e s i i t h h e i g h t

s c a n l i n e s . A w i t h t h p o s i t i o n o t h e i c o n , t h s i z e o t h h o r i z o n t a l l y i m i n i m u m o e i g h t p i x e l s . T h m i n i m u m

o n h e i g h t i o n s c a n l i n e . T h m a x i m u m i c o n s i z e i e i g h tw i d e a n 3 s c a n l i n e s h i g h . T h i s m e a n s t h a t y o c a

o s t c o m p l e t e l y c o v e r t h s c r e e n w i t h a d j a c e n t i c o n s .

s e r v i c e r o u t i n e s

h f i n a l i c o n e n t r y i t h i c o n t a b l e i t h . w o r d p o i n t e r t h s e r v i c e r o u t i n e t c a l l w h e n t h i c o n i a c t i v a t e d . T h s e

c e r o u t i n e c a d a l m o s t a n y t h i n g b u i s h o u l d u s u a l l y e n J S s t h a t c o n t r o l i r e t u r n e d t t h D o l c o n s r o u t i n e .c o u r s e , i y o n e e d e d t o y o c o u l d a c t i v a t e a i c o n w h i c h

n e D o l c o n s ; t h e r e b y m o d i f y i n g , o c o m p l e t e l y r t h i c o n t a b l e .

i p r o b a b l y w h a t h a p p e n s , f o i n s t a n c e , w h e n y o c l i c k o h p a t t e r n c h a n g e b o i t h l o w e r l e f t c o r n e r o t h G e o P a i n t

n e D o l c o n s i c a l l e d t h a t u s e s d i f f e r e n t i c o n t a b l eo r t h e p a t t e r n i c o n s . A f t e r p a t t e r n i s e l e c t e d t h e o r i g i n a l

i c a l l e d t r e a c t i v a t e t h e t o o l b o x . R e m e m b e r , a l p r d r a w n i c o n i m a g e s w i l l r e m a i n i n t a c t w h e n n e i c a l l e d u n l e s s t h i c o n t a b l e u s e d r e w r i t e s t h e m .

I c o n t r i c k s

H e r e i o n e a s y w a t a c c o m p l i s h t h i s t h a t h a v e u s e d i m o w p r o g r a m s . R e m e m b e r t h a t a f t e r c l i c k i n g o t h t o o l t c h a n g e t h e p a t t e r n o a f t e r s e l e c t i n g t h c h a n g e b r u s h m e n ui t e m , t h e m o u s e i c o n s t r a i n e d t a a r e a i t h l o w e r e d g e o t h e s c r e e n t h a t i c o m p l e t e l y f i l l e d w i t h a d j a c e n t i c o n s . T h i s i t h k e y ! B e c a u s e t h m o u s e i r e s t r i c t e d t t h e s e l e c t i o n a r e a ,y o a r f o r c e d t m a k e a d e c i s i o n b e f o r e t h m o u s e c a m o v eo u o t h a r e a . T h i s m e a n s t h a t o n o t h e p a t t e r n o r b r u s hi c o n s d o e s n ' t r e a l l y h a v e t b a i c o n .

W h e n e v e r t h m o u s e b u t t o n i c l i c k e d a n t h p o i n t e r i n o o v e r a n i c o n o r m e n u i t e m , G E O S a u t o m a t i c a l l y c a l l s r o u t i n ep o i n t e d t b o t h e r P r e s s V e c t o r . T h r o u t i n e c a l l e d b o t h e r -P r e s s V e c t o r i d e f i n e d b t h e a p p l i c a t i o n s p r o g r a m m e r . U p o ns y s t e m i n i t i a l i z a t i o n , G E O S l o a d s a i n t o t h i s a d d r e s s a n i s u c h a n e v e n t i n e e d e d i i u t t h p r o g r a m m e r t l o a d t h a d d r e s s o t h l o c a t i o n o t h r o u t i n e . I w o u l d b r e l a t i v e l ys i m p l e m a t t e r t w r i t e a r o u t i n e p o i n t e d t b o t h e r P r e s s V e c t o rt h a t w o u l d d e t e c t a n r e a c t a c c o r d i n g l y t t h m o u s e b u t t o nb e i n g p r e s s e d o v e r t h o n p a t t e r n o b r u s h i c o n t h a t i s n ' t r e a ll y i n t h e D o l c o n s t a b l e .

A l t h o u g h m o s t a p p l i c a t i o n s w i l l s e l d o m n e e d m o r e t h a n 3 i c o n s a c t i v e a o n t i m e , G E O S p r o v i d e s y e a n o t h e r w a t i n c l u d e a f e m o r e . T h r o u t i n e I s M s e l n R e g i o n t e s t s i t h p o i n t e r i i n s i d e r e c t a n g u l a r a r e a o a n s i z e t h a t y o d e f i n e .W i t h t h i s r o u t i n e y o u ' r e n o r e s t r i c t e d t e v e n b y t e h o r i z o n t a lp o s i t i o n o w i d t h . Y o l o a d t h v e r t i c a l s i z e a n p o s i t i o n o t h r e g i o n i r a n t h e h o r i z o n t a l s i z e a n p o s i t i o n i r a n r p r i o r t c a l l i n g t h r o u t i n e . I t h p o i n t e r i i n s i d e t h r e g i o nw h e n t h i s r o u t i n e i c a l l e d , t h a c c u m u l a t o r w i l l s i g n a l T R U E ( 1 o t h e r w i s e t h a c c u m u l a t o r w i l l b e F A L S E ( 0 ) . C a l l t h i s r o u t i n ei y o u r o t h e r P r e s s r o u t i n e , b r a n c h o t h a c c u m u l a t o r b e i n gt r u e a n y o h a v e y o u r o w n , c u s t o m , ' D o l c o n s ' r o u t i n e !

R e m e m b e r t h w a r n i n g t a l w a y s i n c l u d e a i c o n i y o u r p r g r a m ? I y o d e c i d e t h a t a i c o n i s i m p l y n o n e e d e d i y o u ra p p l i c a t i o n , b s u r e t p l a c e a ' i n v i s i b l e ' i c o n i i a n y w a y .S i m p l y u s t h f o l l o w i n g i c o n t a b l e :

/ H e r e i t h e m a n d a t o r y ' i n v i s i b l e ' i c o n r o u t i n eJ S R D o l c o n s / A l w a y s a t l e a s t o n e D o l c o n s. w o r d D u m m y I c o n / P o i n t e r t o t h e d u m m y i c o n t a b l e .

D u m m y l c o n : / S t a r t o f t h e d u m m y i c o n t a b l e ,. b y t e / H e r e ' s t h s i n g l e i c o n ,. w o r d 1 6 0 / w h e r e v e r y o u w a n t t h e m o u s e t o. b y t e 1 0 / b a f t e r t h i s r o u t i n e i f i n i s h e d ,. w o r d I c o n P i c / P o i n t e r t o a e m p t y a d d r e s s ,. b y t e / P l a c e t h b l a n k i c o n i n t h u p p e r. b y t e / l e f t c o r n e r o f t h e s c r e e n ,. w o r d N e x t A d d r e s s / P o i n t e r t o t h e n e x t s e c t i o n .

N e x t A d d r e s s :/ T h e r e s t o f y o u r c o d e f o l l o w s .

w a i t a s e c o n d ! I o n l y 3 1 i c o n s a r a l l o w e d h o c o m ee r e a r e 3 p a t t e r n i c o n s i G e o P a i n t l "

W h a t a r s o m e o t h e r w a y s i c o n s a r u s e d ? H o a b o u t t h i c o nu s e d t p o s i t i o n t h e G e o W r i t e w i n d o w o p a r t i c u l a r s e c t i o n

Page 60: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 60/84

o p a g e ? W h e n t h u s e r c l i c k s o t h i s i c o n t h e s e r v i c e r o t i n e c a l l e d p r o b a b l y c r e a t e s s p r i t e w i t h t h c u r s o r - b o x a i t g r a p h i c d a t a a n f o r c e s i t f o l l o w t h v e r t i c a l p o s i t i o n o t h m o u s e . T h m o u s e i c o n s t r a i n e d t m o v i n g u a n d o w n o n l yw i t h i n t h l i m i t s o t h b o t h a t r e p r e s e n t s t h p a g e . W h e n t h m o u s e i c l i c k e d a g a i n , t h e s p r i t e i d i s a b l e d a n t h n e p o s it i o n o t h w i n d o w o t h p a g e i c a l c u l a t e d a n t h s c r e e nm o v e d t t h p r o p e r l o c a t i o n .

T h e r e a r a l k i n d s o f i n t e r e s t i n g w a y s t u s G E O S r o u t i n e sa n t h i s o n i n p a r t i c u l a r . E v e n i y o u ' v e n e v e r g i v e n a s s e mb l l a n g u a g e t r b e f o r e , G E O S m a k e s t h e s t r u g g l e t l e a r n i l o t e a s i e r . W i t h t h m a n y , m a n y s e r v i c e r o u t i n e s G E O S p r v i d e s , y o d o n ' t n e e d t w o r r y a b o u t t h m e s s y , d i f f i c u l ta s p e c t s o d e v e l o p i n g t h u s e r i n t e r f a c e . Y o n e e d o n l y w o r r ya b o u t e x a c t l y w h a t t h c a l l e d s e r v i c e r o u t i n e i g o i n g t d w h e n i t i c o n i c l i c k e d o n

E v e n i y o a l r e a d y h a v e g o o d 6 5 0 2 a s s e m b l e r , r e c o m m e n db u y i n g B e r k e l e y S o f t w o r k s ' G e o P r o g r a m m e r . I t s t r o n g p o i n t sa r t h s a m p l e a p p l i c a t i o n s t h e y h a v e i n c l u d e d , t h e a s e w i t hw h i c h y o c a i n c l u d e g r a p h i c i m a g e s w i t h o u t h a v i n g t b r e a kt h e m d o w n i n t o t h e i r c o m p a c t e d h e x a d e c i m a l e q u i v a l e n t s a n t h a b i l i t y t d i r e c t l y c r e a t e t h e s p e c i a l G E O S f i l e h e a d e r . G e o -P r o g r a m m e r p r o d u c e s r e l o c a t a b l e c o d e s i a l s o i n c l u d e s al i n k e r . A n d , s i n c e p r o g r a m s s e l d o m r u r i g h t t h f i r s t t i m e ,B e r k e l e y S o f t w o r k s p r o v i d e s a m e m o r y r e s i d e n t d e b u g g e r .

W h i l e m e x p e r i e n c e s w i t h G e o P r o g r a m m e r ' s A s s e m b l e r a n dL i n k e r h a v e b e e n v e r y p o s i t i v e , I ' a f r a i d c a n ' t s a y t h e s a m ea b o u t t h D e b u g g e r . S i n c e m e m o r y o t h 6 i l i m i t e d ,m i n i - d e b u g g e r i p r o v i d e d t h a t c a n b e l o a d e d i n t o t h d i r e c t l ya c c e s s e d s y s t e m m e m o r y o t h e r e i s u p e r - d e b u g g e r t h a t c a b l o a d e d i n t o R A e x p a n s i o n u n i t . T h s u p e r - d e b u g g e r i m u c h m o r e p o w e r f u l b u t , i y o d o n ' t h a v e a c c e s s t a R E y o c a n ' t u s i t

M e x p e r i e n c e w i t h t h m i n i - d e b u g g e r h a b e e n v e r y f r u s t r a ti n g . E v e n w h e n f o l l o w i n g t h d o c u m e n t a t i o n e x a m p l e s w o r d -f o r - w o r d , t h m i n i - d e b u g g e r w o u l d f r e q u e n t l y l o c k t h e s y s t e mu p r e c o m m e n d a v o i d i n g t h m i n i - d e b u g g e r a n b u y i n g o b o r r o w i n g a R E i y o c a n .

I y o a r g o i n g t b u s i n g G e o P r o g r a m m e r , b a w a r e t h a t i d o e s n o i n c l u d e a e d i t o r w i t h w h i c h t o a c t u a l l y c r e a t e y o u rs o u r c e f i l e . r e c o m m e n d u s i n g o n o t h m o r e p o w e r f u l v e r s i o n so G e o W r i t e a y o u r e d i t o r . W h i l e G e o P r o g r a m m e r w i l l n o w o r kw i t h G E O S 1 2 8 [ S e e " I n s i d e G E O S 1 2 8 " i n t h i s i s s u e . M O ] , y o c a s t i l l c r e a t e G E O S 1 2 8 p r o g r a m s . u s W r i t e r ' s W o r k s h o p 1 2 8f o e d i t i n g . B e s i d e s t h s e a r c h a n r e p l a c e f u n c t i o n s w h i c h a r v e r y u s e f u l i l o n g l i s t i n g s , t h 8 0 - c o l u m n s c r e e n a n f a s t e r s p e e da r g r e a t t i m e s a v e r s . W h e n y o a r e f i n i s h e d e d i t i n g , s i m p l y c o p yy o u r s o u r c e f i l e t t h a s s e m b l e r d i s k a n r e - b o o t y o u r 1 2 8 i 6 m o d e w i t h G E O S 6 4

G e o P r o g r a m m e r i n o t h o n l y w a t g h o w e v e r . ( a n dm a n y o t h e r p r o g r a m m e r s ) h a v e s u c c e s s f u l l y u s e d C o m m o d o r e ' so w M a c r o A s s e m b l e r D e v e l o p m e n t S y s t e m , a m o u n g o t h e r

a s s e m b l e r s . O n l y B e r k e l e y ' s i d e s i g n e d s p e c i f i c a l l y f o G E O Sa p p l i c a t i o n s , h o w e v e r . T h o t h e r C 6 a s s e m b l e r s y s t e m s w i l lr e q u i r e a l o m o r e w o r k i d e v e l o p i n g a p p l i c a t i o n s o f t w a r e .

N m a t t e r w h a t a s s e m b l e r y o u s y o u ' l l n e e d c o p y o t h O f f i c i a l G E O S P r o g r a m m e r s G u i d e p u b l i s h e d b B a n t a m .S i n c e B e r k e l e y S o f t w o r k s i c o m p l e t e l y r e v i s i n g t h i s g u i d e , i y o d o n ' t a l r e a d y h a v e c o p y , t r t b o r r o w o n e . E v e n i y o h a v e G e o P r o g r a m m e r a n i t s a m p l e a p p l i c a t i o n s , t r c r e a t i n gy o u r o w n . I d e a s f o p r o g r a m s u s i n g i c o n s a r l i t e r a l l y e v e r yw h e r e . L o o k h o t h e y a r u s e d t c a l l G e o P a i n t t o o l s , p a t e r n s , b r u s h p a t t e r n s , c o l o r s , e t c .

A p p l i c a t i o n s c a u s i c o n s i v e r y u n u s u a l w a y s . T h a s s e mb l e r s o u r c e l i s t i n g t h a t f o l l o w s , f o r i n s t a n c e , u s e s i c o n s a p i a n o k e y s . W h e n t h m o u s e p o i n t e r i p o s i t i o n e d o v e r k e i c o n a n t h b u t t o n p r e s s e d , t h e c o r r e s p o n d i n g n o t e w i l l p l a y .I y o u ' r e i n t e r e s t e d , t h i s k e y b o a r d c o u l d e a s i l y b e x p a n d e d t i n c l u d e c h a n g i n g t h w a v e f o r m , v o l u m e , e n v e l o p e , e t c . D e v e lo p y o u r o w m o u s e - d r i v e n s y n t h e s i z e r !

I ' v e a l s o i n c l u d e d t h G e o P r o g r a m m e r l i n k e r a n h e a d e r l i s ti n g s . N o t e t h a t t h i c o n u s e d i t h g e o K e y b o a r d . h d r f i l e c a b s u b s t i t u t e d b t h s a m p l e s e q u e n t i a l p r o g r a m i c o n i n c l u d e dw i t h G e o P r o g r a m m e r . Y o c a t h e n u s a i c o n e d i t o r t o e d i tt h i c o n a n y w a y y o w i s h . I y o u ' r e n o g o i n g t b u s i n gG e o P r o g r a m m e r , t h l i s t i n g s m a h a v e t b e d i t e d t s u i ty o u r o w a s s e m b l e r . [ D e s k T o p i c o n s a r e t h r e e b y t e s w i d e a n 2 s c a n l i n e s h i g h . I y o u ' r e u s i n g d i f f e r e n t a s s e m b l e r y o c a c r e a t e t h i c o n w i t h a s p r i t e e d i t o r a n i n s e r t t h d a t a i n t oy o u r s o u r c e a . b y t e s t a t e m e n t s . M O

h o p e y o u ' l l n o h a v e b e t t e r u n d e r s t a n d i n g o h o t u s G E O S i c o n s a n w i l l e n j o y G e o K e y b o a r d . I y o u ' v e n e v e r t r i e da s s e m b l y p r o g r a m m i n g b e f o r e g e s t a r t e d ! E v e n i y o h a v ew o r k e d w i t h i a s s e m b l y l a n g u a g e b u a r u n s u r e o f h o t u s t h r o u t i n e s p r o v i d e d i t h G E O S k e r n a l , g i v e i t r y .D o n ' t b a f r a i d t e x p e r i m e n t w i t h y o u r o w i d e a s . P a t i e n c ea n i m a g i n a t i o n a r i m p o r t a n t i d e v e l o p i n g a n a p p l i c a t i o n .G e t t i n g s t a r t e d i a l w a y s t h e h a r d e s t p a r t !

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

g e o K e y b r d f l d r

C o p y r i g h t 1 9 8 9 B y J i m C o o k* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

. i P a s s l. i n c l u d e g e o s S y m. e n d i f. h e a d e r. w o r d. b y t e. b y t e 2

; t h e D e s k T o p i c o n .

/ I n c l u d e g e o s S y m d u r i n g a s s e m b l e r ' s; l s t p a s s t h r o u g h t h e h e a d e r f i l e .; E n d t h ' I F ' c l a u s e .; F l a g t h e s t a r t o f h e a d e r s e c t i o n .; T h e f i r s t t w o b y t e s a r e a l w a y s 0 ; W i d t h i n b y t e s . ; . a n d h e i g h t i s c a n l i n e s o f

Page 61: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 61/84

. b y t e $ 8 0 U S . b y t e A P P L I C A T I O N. b y t e S E Q U E N T I A L. w o r d $ 4 0 0. w o r d $ 3 f f. w o r d $ 4 0 0. b y t e " g e o K e y b o a r d V I . b y t e " J a m e s E C o o k ,. e n d h

; C B M f i l e t y p e , w i t h b i t s e t .; G e o s p r o g r a m t y p e .; G e o s f i l e s t r u c t u r e t y p e .; L o a d p r o g r a m a t h i s a d d r e s s .; E n d a d d r e s s f o r d e s k a c c e s s o r i e s ./ S t a r t p r o g r a m e x e c u t i o n h e r e .

0 , 0 , 0 , $ 0 0 ; 2 c h a r a c t e r s f o r f i l e n a m e ." , 0 ; 2 0 c h a r a c t e r s f o r a u t h o r ' s n a m e .

; E n d o f h e a d e r b l o c k .

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

g e o K e y b o a r d

C o p y r i g h t 1 9 8 9 B y J i m C o o k

. i n c l u d e g e o s S y m. i n c l u d e g e o s M a c

v l f r e q l ov l f r e q h iv l p w l ov l p w h iv l c n t r lv l a t t d e cv l s u s r e lm o d e v o lc i a l p r ac i a l p r b

. p s e c tj s j s j s j s

I d j s j s . b y t e. b y t e. w o r d. w o r d

L o a d Wj s

I d L o a d Wj s r t

M A I N T O m a i n " b o tm a i n " l f tm a i n " r t

P O S T O Px j o s j t o p

K e y b o a r d :. b y t e. w o r d. b y t e

C

$ D 4 0 0= $ D 4 0 1

$ D 4 0 2$ D 4 0 3$ D 4 0 4$ D 4 0 5$ D 4 0 6$ D 4 1 8

= $ D C 0 0$ D C 0 1

N e w D i s kM o u s e U pC l e a r S I D R e g i s t e r sL o a d S I D R e g i s t e r s

# 0 S e t P a t t e r n

R e c t a n g l e0 1 9

3 1

r O , K e y b o a r dD o l c o n s

t r 0 , G e o s M e n uD o M e n u

1

2 I C O N 2

" I C O N

2 1 6 1 0

n a t u r a l. w o r d N a t u r a l. b y t e. b y t e. b y t e. w o r d

C . w o r d

X P O S T O P I C O NY ~ P O S ~ T O P " l C O N + 3 22 7 3 2 "D o C N 4

s h a r pS h a r p

; T h e s e f i l e s n e e d t b e i n c l u d e d w h e n a s s e mb l i n g , p r o v i d e d w i t h G e o P r o g r a m m e r p a c k a g e .

; T h e s e g l o b a l v a r i a b l e s w e r e l e f t o u t o f t h / g e o S y m f i l e . I y o u ' r e p l a n n i n g o e x p a n d i n g; o t h i s p r o g r a m y o u s h o u l d i n c l u d e a l l o f t h e; S I D a n d C I A r e g i s t e r s i a . i n c l u d e f i l e; c a l l e d g e o s I O .

/ S i g n a l t h s t a r t o t h p r o g r a m ./ N e w D i s k i n e e d e d f o e a r l y v e r s i o n s o f 6 E 0 S ./ A c t i v a t e a n d i s p l a y t h e m o u s e p o i n t e r ./ C l e a r a n y l e f t o v e r d a t a i n S I D r e g i s t e r s ./ L o a d S I D r e g i s t e r s f o r v o i c e o n e o n l y .

/ C l e a r t h s c r e e n a n s e u p t h e b a c k g r o u n d .

/ A d d r e s s o f i c o n d a t a t a b l e ./ D i s p l a y t h i c o n s a n d a c t i v a t e t h e m .

/ P u t m o u s e o n g e o s m e n u i t e m ./ P u t t h e a d d r e s s o t h e m e n u t a b l e i r O / D i s p l a y m e n u t o q u i t a n d r e t u r n t o D e s k T o p .

/ S o m e c o n s t a n t s f o t h e m e n u s t r u c t u r e .

/ S o m e c o n s t a n t s f o t h e i c o n s t r u c t u r e .

/ T h i s i t h e s t a r t o f t h e i c o n d a t a t a b l e .; N u m b e r o f i c o n s .; p o s i t i o n o m o u s e a f t e r i c o n s a r e d r a w n .; p o s i t i o n o m o u s e a f t e r i c o n s a r e d r a w n .

/ g r a p h i c d a t a f o t h n a t u r a l o w h i t e k e y s .; p o s i t i o n o f t h e u p p e r l e f t c o r n e r .; p o s i t i o n o f t h e u p p e r l e f t c o r n e r ,/ w i d t h i b y t e s a n d h e i g h t i n s c a n l i n e s ./ r o u t i n e t o p l a y n a t u r a l , f o u r t h o c t a v e .

/ G r a p h i c d a t a f o r t h e s h a r p o r b l a c k k e y s .

. b y t e P O S T O P I C O N + 1. b y t e Y ~ P O S ~ T O P ~ I C O N. b y t e 2 3 2 . w o r d D o C S 4

D n a t u r a l. w o r d N a t u r a l. b y t e P O T O P I C O N + 2. b y t e Y " P O S " T O P " l C O N + 3 2. b y t e 2 3 2 . w o r d D o D N 4

D 4 s h a r p. w o r d S h a r p. b y t e P O S T O P I C O N + 3. b y t e Y ~ P O S " T O P " l C O N. b y t e 2 3 2 . w o r d D o D S 4

E n a t u r a l. w o r d N a t u r a l. b y t e P O T O P I C O N + 4. b y t e Y " P O S " T O P " l C O N + 3 2. b y t e 2 7 3 2 ". w o r d D o E N 4

F n a t u r a l. w o r d N a t u r a l. b y t e P O T O P I C O N + 6. b y t e Y " P O S " T O P " l C O N + 3 2. b y t e 2 7 3 2 ". w o r d D o F N 4

F 4 s h a r p. w o r d S h a r p. b y t e X P O S T O I C O N + 7. b y t e Y " P O S " T O P " l C O N. b y t e 2 3 2 . w o r d D o F S 4

6 n a t u r a l. w o r d N a t u r a l. b y t e P O T O P I C O N + 8. b y t e Y " P O S ~ T O P " l C O N + 3 2. b y t e 2 7 3 2 ". w o r d D o G N 4G s h a r p. w o r d S h a r p. b y t e P O T O P I C O N + 9. b y t e Y " P O S ~ T O P " l C O N. b y t e 2 7 3 2 ". w o r d D o G S 4 ;

A n a t u r a l. w o r d N a t u r a l. b y t e P O S T O P I C O N + 1 0. b y t e Y ~ P O S " T O P " l C O N + 3 2. b y t e 2 7 3 2 ". w o r d D o A N 4

A 4 s h a r p. w o r d S h a r p. b y t e P O S T O P I C O N + 1 1. b y t e Y ~ P O S " T O P " " l C O N. b y t e 2 3 2 . w o r d D o A S 4

B n a t u r a l. w o r d N a t u r a l. b y t e P O S T O P I C O N + 1 2. b y t e Y " P O S " T O P " l C O N + 3 2. b y t e 2 3 2 . w o r d D o B N 4

C n a t u r a l. w o r d N a t u r a l. b y t e X P O S T O P J C O N + 1 4. b y t e Y ~ P O S ~ T O P I C O N + 3 2. b y t e 2 3 2 . w o r d D o C N 5

C s h a r p. w o r d S h a r p

. b y t e X _ P O S _ T O P J C O N + 1 5. b y t e Y " P O S " T O P " I C O N. b y t e 2 7 3 2 ~. w o r d D o C S 5

D 5 n a t u r a l. w o r d N a t u r a l. b y t e X _ P O S _ T O P _ I C O N + 1 6. b y t e Y " P 0 S ~ T 0 P " l C 0 N + 3 2. b y t e 2 7 3 2 ". w o r d D o D N 5

D s h a r p. w o r d S h a r p. b y t e X _ P O S _ T O P _ I C O N + 1 7. b y t e Y ~ P O S ~ T O P ~ I C O N. b y t e 2 7 3 2 ". w o r d D o D S 5

E 5 n a t u r a l. w o r d N a t u r a l. b y t e X _ P O S J T O P _ I C O N + 1 8. b y t e Y ~ P O S ~ T O P ~ I C O N + 3 2. b y t e 2 7 3 2 ". w o r d D o E N 5

F n a t u r a l. w o r d N a t u r a l. b y t e X _ P O S J T O P _ I C O N + 2 0. b y t e Y ~ P O S ~ T O P ~ I C O N + 3 2. b y t e 2 3 2 . w o r d D o F N 5

F 5 s h a r p. w o r d S h a r p. b y t e X J P O S J T O P J C O N + 2 1. b y t e Y " P O S " T O P " I C O N. b y t e 2 7 3 2 ". w o r d D o F S 5

G n a t u r a l. w o r d N a t u r a l. b y t e P O T O I C O N + 2 2. b y t e Y " P O S ~ T O P " l C O N + 3 2. b y t e 2 7 3 2 ". w o r d D o G N 5

G 5 s h a r p. w o r d S h a r p. b y t e X P O S T O P I C O N + 2 3. b y t e Y " P O S " T O P " I C O N. b y t e 2 3 2 . w o r d D o G S 5

A n a t u r a l. w o r d N a t u r a l. b y t e X J O S J T O P J C O N + 2 4. b y t e Y " P 0 S " T 0 P " l C 0 N + 3 2. b y t e 2 7 3 2 ". w o r d D o A N 5

A 5 s h a r p. w o r d S h a r p. b y t e X _ P O S J T O P _ I C O N + 2 5. b y t e Y " P O S " T O P ~ I C O N. b y t e 2 7 3 2 ~. w o r d D o A S 5

B n a t u r a l. w o r d N a t u r a l. b y t e X P O S T O I C O N + 2 6. b y t e Y " P 0 S ~ T 0 P " l C 0 N + 3 2. b y t e 2 7 3 2 ". w o r d D o B N 5

C n a t u r a l. w o r d N a t u r a l. b y t e P O S T O P I C O N + 2 8. b y t e Y " P O S " T O P " l C O N + 3 2. b y t e 2 7 3 2 "

Page 62: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 62/84

. w o r d D 0 C N 6

G e o s M e n u :. b y t e M A I N J F O P. b y t e M A I N J O . w o r d M A I N J L F T. w o r d M A I N ~ R T. b y t e H O R I Z O N T A L I 1

. w o r d G e o s T e x t. b y t e S U B J E N U. w o r d Q u i t M e n u

G e o s T e x t :. b y t e " g e o s " , 0

Q u i t M e n u :. b y t e M A I N J O . b y t e M A I N J O T + 1 5. w o r d M A I N J L F T. w o r d M A I N J T. b y t e V E R T I C A L 1 1

. w o r d Q u i t T e x t. b y t e M E N U _ A C T I O N. w o r d Q u i t "

Q u i t T e x t :. b y t e " q u i t " , 0

; T h e e n o t h i c o n d a t a t a b l e . ;

; M e n u t a b l e t o q u i t t h e p r o g r a m .; P u t m e n u b o x i u p p e r l e f t c o r n e r .

; O n l y o n e m e n u b o x d i s p l a y e d h o r i z o n t a l l y .

/ L o c a t i o n o f t e x t f o r m e n u b o x ./ C l i c k i n g o n b o w i l l d i s p l a y s u b m e n u ./ L o c a t i o n o f s u m e n u r o u t i n e .

/ H e r e i s t h e t e x t f o t h e b o x . .

/ T h e s u b m e n u r o u t i n e t o q u i t ./ o p e n t h e m e n u d i r e c t l y b e l o w t h e m a i n m e n u .

/ O n l y o n e s u b i t e m , o p e n e d v e r t i c a l l y .

/ L o c a t i o n o f t e x t f o s u i t e m ./ C l i c k i n g o n t h i s c a l l s E n t e r D e s k T o p . . / . r o u t i n e t h a t i l o c a t e d h e r e .

/ H e r e i t h e t e x t f o t h e s u b i t e m b o . .

S h a r p : / T h e s e a r e g r a p h i c d a t a f o r t h e i c o n s .. b y t e 2 2 4 , 3 2 , 1 , $ 7 F , 1 , $ F E / T h e y a r s i m p l e e n o u g h t o e a s i l y

N a t u r a l : / c o m p a c t a n d o n o t n e e d t h e n i c e G e o -. b y t e 2 2 4 , 3 1 , 1 , $ 8 0 , 1 , $ 0 0 , 2 , $ F F / P r o g r a m m e r g r a p h i c a s s e m b l y f e a t u r e .

D o C N 4 :I d a # 1 9 5s t a O I d a # 1 6s t a O j m P l a y

D o C S 4 :I d a # 1 9 5s t a a O LI d # 1 s t a a O Hj m P l a y

D o D N 4 :I d a # 2 0 9s t a a O LI d # 1 s t a O j m P l a y

D o D S 4 :I d a # 2 3 9s t a a O LI d a # 1 9s t a O j m p P l a y ;

/ T h i s i s t h s t a r t o f t h e r o u t i n e s c a l l e d b / c l i c k i n g t h e a p p r o p r i a t e i c o n s . T h v a l u e s/ t p l a y t h e n o t e d e s i r e d a r l o a d e d i n t o/ p s e u d o - r e g i s t e r . T h e s u b r o u t i n e " P l a y "/ i c a l l e d t o a c t u a l l y s o u n d t h e n o t e ./ T h i s i s r e p e a t e d f o e a c h o f t h e 2 5 k e y s .

I d a # 9 6s t a O I d a # 2 2s t a O j m P l a y

D o F S 4 :I d a # 1 8 1s t a O I d a # 2 3s t a O j m P l a y

D o G N 4 :I d a # 3 0s t a O I d a # 2 5s t a O j m P l a y

D o G S 4 :I d # 1 5 6s t a O I d a # 2 6s t a O j m P l a y

D o A N 4 :I d a # 4 9s t a O I d a # 2 8s t a O j m P l a y

D o A S 4 :I d a # 2 2 3s t a O I d a # 2 9s t a O j m P l a y

I d # 3 s t a a O LI d a # 2 1s t a O j m P l a y

I d # 1 6 5s t a O I d a # 3 1s t a O j m P l a y

D o C N 5 :I d a # 1 3 5s t a a O LI d # 3 s t a a O Hj m P l a y

D o C S 5 :I d # 1 3 4s t a O I d a # 3 5s t a O j m P l a y

D o D N 5 :I d a # 1 6 2s t a O I d a # 3 7s t a O j m P l a y

D o D S 5 :I d a # 2 2 3s t a O I d a # 3 9s t a O j m P l a y

D o E N 5 :I d # 6 s t a O I d # 4 s t a O j m P l a y

Page 63: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 63/84

D o F N 5 :I d s t I d s t j m

D o F S 5 :I d s t I d s t j m

U O w Q .I d s t I d s t j m

D o G S 5 :I d s t I d s t j m

D o A N 5 :I d s t I d s t j m

D o A S 5 :I d s t I d s t j m

D o B N 5 :I d s t I d s t j m

D 0 C N 6 :I d s t I d s t j m

P l a y :j s I d s t I d s t I d s t I d s t l d

2 0 l d

1 0 n o n o d e b n d e b n

# 1 9 3a O # 4 a O P l a y

# 1 0 7a O # 4 a O P l a y

# 6 a O # 5 a O P l a y

# 5 a O # 5 a O P l a y

# 9 a O # 5 a O P l a y

# 1 9 0a O # 5 a O P l a y

# 7 a O # 6 a O P l a y

# 1 a O # 6 a O P l a y

I n i t F o r l O# $ 4 0v l c n t r la O v l f r e q l oa O v l f r e q h i# $ 4 1v l c n t r l# $ 4 0

# $ f f

1 0

2 0

3 0

; M u s t b e c a l l e d t o a c c e s s S I D o r C I A .

; M a k e s u r e v o i c e o n e i s o f f .

; P u t t h e f r e q u e n c y d a t a v a l u e s i t h S I D .

; P l a y t h e n o t e !

; l o o p t o g i v e t h e n o t e a m i n i m u m d u r a t i o n .; N o t e t h e u s e o f l o c a l l a b e l s 1 0 a n 2 0 $ .; R e a d m o r e a b o u t t h e m i t h e g e o P r o g r a m m e r/ m a n u a l .

L o a d lI d e o a n c m b e I d s t j s r t

c i a l p r a , % l l l l l l l lc i a l p r b# $ F F# 1 0 0 0 1 0 0 0 0# 1 0 0 0 1 0 0 0 03 0 # $ 4 0v l c n t r lD o n e W i t h I O

C l e a r S I D R e g i s t e r s :j s I d l d

1 0 s t d e b n j s r t

I n i t F o r l O# $ # $ 1 8

v l f r e q l o , X

1 0 D o n e W i t h I O

L o a d S I D R e g i s t e r s :j s I d s t I d s t I d s t I d s t I d s t I d s t j s r t

Q u i t :j m

I n i t F o r l O# $ 4 0v l c n t r l# $ 0 fm o d e v o l# $ 0 9v l a t t d e c# $ 0 1v l s u s r e l# 1 v l p w h i# 3 v l p w l oD o n e W i t h I O

E n t e r D e s k T o p

/ D i s a b l e k e y b o a r d m a t r i x c o l u m n s s o n l y t h e/ m o u s e b u t t o n i e x a m i n e d . U s e e x c l u s i v e o r/ t c o m p l e m e n t d a t a . T m a s k o u t h / o t h e r i n p u t s , A N o n e o n t h d a t a l i n e/ f o r t h e b u t t o n i n p u t a n c o m p a r e .

. . b r a n c h i b u t t o n i s s t i l l b e i n g h e l d ./ M o u s e b u t t o n r e l e a s e d . . s t o p p l a y i n g !

/ R e s t o r e s t a n d a r d 6 E 0 S c o n f i g u r a t i o n ./ R e t u r n t o l o o k i n g a t h i c o n s . ;

/ T h i s r o u t i n e i u s e d t o f l u s h o u a n y o l d/ d a t a s t o r e d i a l t h S I D r e g i s t e r s ,/ l o o p t z e r o e a c h r e g i s t e r a n e x e c u t e s/ ' D o n e W i t h I O j s r w h e n d o n e l o o p i n g .

/ M u s t b e c a l l e d i t o a c c e s s S I D a n d C I A ' s .

/ M a k e c e r t a i n v o i c e i o f f .

/ S e t v o l u m e f u l l .

/ S e t a t t a c k a n d d e c a y t o p i a n o e n v e l o p e .

/ S e t s u s t a i n a n d r e l e a s e t o p i a n o e n v e l o p e .

/ S e t p u l s e w i d t h r e g i s t e r s t o p i a n o w a v e f o r m .

/ F i n i s h e d w i t h I / O o p e r a t i o n s r e t u r n t o 6 E 0 S .

/ L e a v e g e o K e y b o a r d a n d r e t u r n t o t h e D e s k T o p .

g e o K e y b o a r d . I n k

C o p y r i g h t 1 9 8 9 B y J i m C o o k

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

. o u t p u t g e o K e y b o a r d / N a m e f o r s e q u e n t i a l o u t p u t f i l e ,. h e a d e r g e o K e y b r d H d r . r e l / N a m e o f f i l e c o n t a i n i n g h e a d e r b l o c k ,. s e q / F l a g L i n k e r , t h i s i a s e q u e n t i a l p r o g r a m ,. p s e c t $ 0 4 0 0 / P r o g r a m c o d e s t a r t s a a d d r e s s $ 0 4 0 0 .

g e o K e y b o a r d . r e l / T h e n a m e o f t h e r e l o c a t a b l e f i l e w h i c h/ c o n t a i n s c o d e a n d d a t a c r e a t e d b y G e o -; A s s e m b l e r . N o t e t h a t G e o A s s e m b l e r a u t o m a t i ca l l y a p p e n d s a . r e l t o y o u r s o u r c e f i l e n a m e .

Page 64: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 64/84

Page 65: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 65/84

h o t h e r p r o b l e m i h o t f l a g w h i c h w a t o r d e r t h a r r a y .i c e r t a i n l y e a s y t r e q u i r e t h i r d p a r a m e t e r , b u t i i a l s o

t o j u s t l e t h s o r t r o u t i n e c o m p a r e t h t w p o i n t e r s a n f o i t s e l f .

h h e a r t o s o r t r o u t i n e c a b r e g a r d e d a g r o u p o f o u rt a s k s r e p e a t e d l y e x e c u t e d i l o o p s t r u c t u r e : d e c i d et w o b j e c t s t c o m p a r e , f i n d t h e m , c o m p a r e t h e m a n d ,

n e c e s s a r y , e x c h a n g e t h e m ( o t h e t h i n g s u s e d t f i n d t h e m ) .h m a i n d i f f e r e n c e b e t w e e n v a r i o u s s o r t a l g o r i t h m s i t h o d e c i d i n g w h i c h t w o b j e c t s t c o m p a r e . O t h

h a n d , t h m a i n d i f f e r e n c e s i s o r t i n g d i f f e r e n t o b j e c t s a r o t h e y a r f o u n d , c o m p a r e d a n e x c h a n g e d .

h p r o g r a m p r e s e n t e d h e r e d i v i d e s t h f o u r b a s i c t a s k s i n t oD e c i d e r o u t i n e f o r a l o b j e c t s a n s e p a r a t e F i n d , C o

a n E x c h a n g e r o u t i n e f o e a c h d i f f e r e n t o b j e c t . A l t h o u g ht h i n t e r e s t o f s a v i n g s p a c e t h e r e a r s e v e r a l p l a c e s i t h

w h e r e s h a r i n g o r o v e r l a p o c c u r s , i p r i n c i p l e t h e r e a r ee s e p a r a t e r o u t i n e s ( D e c i d e , F i n d , C o m p a r e , E

a n t h e r e i n o t h i n g t p r e v e n t a n y o n e o t h e m f r o mr e p l a c e d i n d e p e n d e n t l y o a n o t h e r ( t g a i n s p e e d a t h

o s i z e , f o e x a m p l e ) . T h p o s s i b i l i t y o a d d i n gt o s o r t o t h e r o b j e c t s o i m p l e m e n t i n g o t h e r s o r t

a l t o g e t h e r i a l s o o p e n .

h D e c i d e r o u t i n e ( t h e a c t u a l s o r t a l g o r i t h m ) i S h e l l s o r t . I r e a s o n a b l y c o m p a c t , f a s t , a n u n d e r s t a n d a b l e a l g o r i t h mp e r f o r m s w e l l o n r a n d o m a n d e v e n b e t t e r o o r d e r e d

o o b j e c t s . A l t e r n a t i v e a l g o r i t h m s t h a t m i g h t b eh e r e a r t h e I n s e r t i o n s o r t ( a b o u t t h s a m e c o d e s i z e ;

b e s t o n e a r l y o r d e r e d c o l l e c t i o n s ) a n t h Q u i c k( l a r g e r c o d e s i z e ; a u s u a l l y i m p l e m e n t e d p e r f o r m s b e s t

r a n d o m c o l l e c t i o n s ) .

h F i n d r o u t i n e s l o c a t e t h e o b j e c t s t b c o m p a r e d , t a k i n ga c c o u n t o b j e c t s i z e s a n t h f a c t t h a t , w h i l e t h c o n t e n t s

r e a l a n i n t e g e r a r r a y s a r r e a l s a n i n t e g e r s , t h c o n t e n t s o a r r a y s a r n o s t r i n g s b u i n s t e a d s t r i n g d e s c r i p t o r s . T h

e s s o t h F i n d s t e p i a o f t e n o v e r l o o k e d p a r t o r o u t i n e . I B A S I C 2 . 0 , f o e x a m p l e , v a r i a b l e i a u t o m a t i

l o c a t e d w h e n e v e r i o c c u r s i t h p r o g r a m t e x t , s t h a t i nB a s i c 2 . s o r t r o u t i n e w h a t l o o k s l i k e C o m p a r e o p e r a t i o nr e a l l y c o m b i n e d F i n d a n d C o m p a r e o p e r a t i o n .

e C o m p a r e r o u t i n e s a s s u m e t h a t , g i v e n a n t w o b j e c t s o h s a m e t y p e , t h s t a t e m e n t c a n a l w a y s b m a d e t h a t i s o m e

t h f i r s t i l e s s t h a n , e q u a l t o g r e a t e r t h a n t h s e c o n dT h C o m p a r e r o u t i n e s d e t e r m i n e w h i c h i t h c a s e a n

f l a g b y t e i w h i c h s e t b i t s r e p r e s e n t l o g i c a l r e l a t i o nt h a t a r T R U E . F o r e x a m p l e , i t h f i r s t o b j e c t i l e s s t h a n

h s e c o n d , t h e n a l o t h e l o g i c a l r e l a t i o n s ' l e s s ' , ' l e s s o a n ' n o t e q u a l ' a r e t r u e .

s y s t e m o r e t u r n v a l u e s f r o m t h C o m p a r e r o u t i n e s i m o r e c o m p l e x t h a n t h a t u s e d b c o m p a r e r o u t i n e s i

o t h e r s o r t s ( o f t e n s i m p l y a n e g a t i v e v a l u e f o l e s s t h a n ,f o e q u a l , p o s i t i v e f o g r e a t e r ) . T h a d v a n t a g e i t h a t t h

s a m e c o d e c a s o r t i e i t h e r d i r e c t i o n b s e t t i n g f e f l a g s a t h s t a r t o t h D e c i d e r o u t i n e , r a t h e r t h a n h a v i n g t w r i t es e p a r a t e r o u t i n e f o e a c h d i r e c t i o n . F o r e x a m p l e , t h D e c i d er o u t i n e o S h e l l s o r t c a l l s t h C o m p a r e r o u t i n e s l o o k i n g f o e i t h e r ' g r e a t e r o r e q u a l ' o r ' l e s s o e q u a l ' ( d e p e n d i n g o n w h i c hd i r e c t i o n t h e s o r t r u n s ) , a n d e x c h a n g e s e l e m e n t s i t h d e s i r e dr e l a t i o n i N O T R U E .

T h E x c h a n g e r o u t i n e s a r s t r a i g h t f o r w a r d . I t i s i n t e r e s t i n g t on o t e t h a t , e v e n t h o u g h t h p r o c e s s o f l o c a t i n g s t r i n g s r e q u i r e s

l e v e l o i n d i r e c t i o n , e x c h a n g e i s i m i l a r t o t h a t o r e a l s a n i n t e g e r s . O c o u r s e , i i t h s t r i n g d e s c r i p t o r s r a t h e r t h a n t h s t r i n g s t h e m s e l v e s t h a t a r e b e i n g e x c h a n g e d .

T h i d e a o s o r t i n g d e s c r i p t o r s o o b j e c t s i n s t e a d o t h e o b j e c t st h e m s e l v e s c a n b t a k e n m o r e g e n e r a l l y . F o r e x a m p l e , i n t e g e r si o n a r r a y c a b t r e a t e d a s r e p r e s e n t i n g e l e m e n t n u m b e r s o

s e c o n d a r r a y . k e y s o r t a r r a n g e s t h i n t e g e r s i t h f i r s t a r r a ya c c o r d i n g t t h v a l u e s i t h s e c o n d , s t h a t t h f i r s t a r r a y b c o m e s a ' i n d e x ' t t h s e c o n d . I w o u l d r e q u i r e o n l y a s l i g h tm o d i f i c a t i o n o t h F i n d a n C o m p a r e r o u t i n e s o S h e l l s o r t t i m p l e m e n t k e y s o r t o a n a r r a y t y p e . I w o u l d e v e n b eh a n d y : t h e r e a r e o f t e n o c c a s i o n s w h e r e i i m o r e u s e f u l t h a v e a s o r t e d i n d e x t a a r r a y t h a n a s o r t e d a r r a y .

I e f f e c t , a n o t h v a r i o u s m o d i f i c a t i o n s t h a t m i g h t b m a d et e x t e n d o c h a n g e S h e l l s o r t a m o u n t t o s t r i k i n g a n o t h e r o t h m a n y d i f f e r e n t p o s s i b l e b a l a n c e s a m o n g s o r t r e q u i r e m e n t s .R e a d e r s a r w e l c o m e t u s a n o t h m a t e r i a l p r e s e n t e d h e r ei n t h e i r o w e f f o r t s t o s t r i k e u s e f u l b a l a n c e s .

L i s t i n g 1 s h e l l s o r t . s M e r l i n f o r m a t

b a s i c 2 . a r r a y s h e l l s o r tl a s t r e v i s i o n : 0 9 / 2 8 / 8 8

w r i t t e n b y a n t o n t r e u e n f e l s5 2 4 8 h o r i z o n d r i v ef r i d l e y , m i n n e s o t a6 1 2 / 5 7 2 - 8 2 2 9

p r o g r a m c o n s t a n t s

a s m a d r $ c 0 0 0

t s t n e U O O O O Ot s t g t % 0 1 0 0 0 0t s t g e = 1 0 0 1 0 0 0t s t e q = % 0 0 0 1 0 0t s t l e = % 0 0 0 0 1 0t s t l s = % 0 0 0 0 0 1

u s 5 5 4 2 1

/ a s s e m b l y a d d r e s s

/ n o t e q u a l/ g r e a t e r/ g r e a t e r o r e q u a l/ e q u a l/ l e s s o r e q u a l/ l e s s

i s g r t = t s t n e . t s t g t . t s t g ei s e q u = t s t g e . t s t e q . t s t l ei s l e s = t s t n e . t s t l e . t s t l s

p r o g r a m z e r o - p a g e u s a g e

e l p t r = $ 2 e 2 p t r = $ 2 4e l m l = $ 2 e l m 2 = $ 2 8

/ p o i n t e r - > 1 s t e l e m e n t/ p o i n t e r - 2 n d e l e m e n t; l s t e l e m e n t i n d e x/ 2 n d e l e m e n t i n d e x

Page 66: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 66/84

e l m c n t = $ 5 p r o d u c = $ 5

e l l e n = $ 6 e l a d r = $ 6 e 2 1 e n = $ 6 e 2 a d r $ 6

t s t f l g $ 6 d e l t a = $ 6 al s t e l m = $ 6 c r r e l m = $ 6

b a s i c 2 . 0 z e r o - p a g <

a r y s t a $ 2 v a r n a m = $ 4 v a r a d r = $ 4

b a s i c 2 . i n d i r e c t

b a s e r r = $ 3 0 0

b a s i c 2 . r o

c h k c o m = $ a e f df n d v a r $ b O 8 bm e m f a c = $ b b a 2c m p f a c = $ b c 5 b

* * * * * * * * * * * * * * * * * * * * :

o r g a s m a d r

/ i e l e m e n t s/ m u l t i p l i c a t i o n p r o d u c t

/ l s t s t r i n g d e s c r i p t o r

; 2 n d s t r i n g d e s c r i p t o r

/ t e s t - t y p e f l a g/ c o m p a r i s o n d i s t a n c e/ l a s t e l e m e n t t h i s p a s s/ c u r r e n t e l e m e n t t h i s p a s s

u s a g e

; s t a r t - o f - a r r a y s/ c u r r e n t v a r i a b l e n a m e/ c u r r e n t v a r i a b l e a d d r e s s

v e c t o r s

/ e r r o r r e p o r t

/ c h e c k a n d s k i p c o m m a/ l o c a t e v a r i a b l e/ t r a n s f e r m e m o r y t o f a / c o m p a r e m e m o r y t o f a

i t * * * * * * * * * * *

b a s i c 2 . 0 i n t e r f a c e

j s c h k c o mj s f n d v a rl d # j s s a v p t rI d a v a r n a m + 1p h I d v a r n a mp h j s c h k c o mj s f n d v a rl d | j s s a v p t rl d | 8 * 3p l b p l p a r ll d 1 8 * 1

p a r l e o r v a r n a mb n e t y p e r rp l b m p a r 2l d § 8 * 2

p a r 2 e o r v a r n a m + 1b n e t y p e r rl d # 8 * 1

] b b l I d a i s o r t - l , xs t e l m s i z - 1 , ]d e d e b n ] b b lj s a r y s r tr t

/ g e t l s t p a r a m e t e r

/ s a v e v a r i a b l e a d d r e s s

/ s a v e v a r i a b l e n a m e

/ g e t 2 n d p a r a m e t e r

/ a s s u m e s t r i n g/ l s t c h a r o f l s t n a m e; b : r e a l o r s t r i n g/ i n t e g e r/ n a m e s m a t c h ? .; b : n o; 2 n d c h a r o l s n a m e; b : s t r i n g o r i n t e g e r/ r e a l

/ s e t r e m a i n i n g p a r a m e t e r s

/ e x e c u t e s o r t

c m p a r y s t a / v e r i f y a r r a y e l e m e n tI d v a r a d r + 1s t b e g e l m + l , xs b c a r y s t a + 1b c c t y p e r r ; b : n o t a r r a y e l e m e n tr t

r e p o r t e r r o r

t y p e r r l d # 2 / ' t y p e m i s m a t c h 'j m ( b a s e r r )

s o r t p a r a m e t e r t a b l e s

i s o r tf n d i n ta n p i n te x c i n t

/ f b y t e s / e l e m e n t/ f i n d r o u t i n e/ c o m p a r e r o u t i n e/ e x c h a n g e r o u t i n e .

f s o r t d ad a f n d f l pd c n t p f l pd e x c f l p

s s o r t d ad a f n d s t rd a c m p s t rd e x c s t r

a r r a y s o r t p a r a m e t e r f o r m a t :

w o r d b e g e l m l o c a t i o n o f f i r s t e l e m e n tw o r d e n d e l m l o c a t i o n o l a s t e l e m e n tw o r d e l m s i z t b y t e s i a n e l e m e n tw o r d f n d a d r l o c a t i o n o f f i n d r o u t i n ew o r d c m p a d r l o c a t i o n o c o m p a r i s o n r o u t i n ew o r d s w p a d r l o c a t i o n o e x c h a n g e r o u t i n e

a r r a y s o r t

s a v e p o i n t e r t o e l e m e n ts a v p t r I d a v a r a d r

s t b e g e l m , x / s a v e l o c a t i o n

a r y s r t

a y s l

a y s 2

a y s 3

l d l d c p b c b n c p b c b e I d s t I d s t s t s t p h j s p i j s r t

d e t e r m i n e

f n d e n t s e I d s b s t I d s b s t l d I d

b e g e l mb e g e l m + 1e n d e l m + 1a y s 2 ; b : f i r s t < l a s ta y s le n d e l ma y s 2a y s 3 ; b : f i r s t = l a s t ( o n e e l e m e n t )e n d e l m / e x c h a n g e p o i n t e r sb e g e l me n d e l m + 1b e g e l m + 1e n d e l me n d e l m + 1

/ s a v e d i r e c t i o n f l a gf n d e n t / g e t e l e m e n t c o u n t

s h l s r t / e x e c u t e s o r t

e l e m e n t c o u n t

e n d e l m / i b y t e s i a r r a yb e g e l me l m c n te n d e l m + 1b e g e l m + 1e l m c n t + 11 1 t

Page 67: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 67/84

] b b l a s r o r o c m b c s b i n

d d e b n i t

e l m c n te l m c n t + 1

e l m s i zf d e l m s i ze l m c n t

] b b l

s h e l l s o r t

l s r t I d as t I d s t I d b c I d

h l l s t ab n

e l m c n td e l t ae l m c n t + 1d e l t a + 1f t s t l es h l l# t s t g et s t f l gs h ! 4

o u t e r l o o p

] b b l s e cI d s b s t I d s b s t I d s t s t

e l m c n td e l t al s t e l me l m c n t + 1d e l t a + 1l s t e l m + 1# c r r e l mc r r e l m + 1

m i d d l e l o o p

b b 2 c l I d s t a d s t I d

c r r e l me l m ld e l t ae l m 2c r r e l m + 1

s t a e l m l + 1a d s t

d e l t a + 1e l m 2 + l

i n n e r l o o p

b b 3 j s rj s a n b n j s s e I d s t s b s t

f n d e l mc o m p a rt s t f l gs h l 2e x c h n g

e l m le l m 2d e l t ae l m l

/ d i v i d e b # b y t e s / e l e

/ r e s u l t i n e l m c n t

; d e l t a = e l m c n t

/ a s c e n d i n g s o r t

/ d e s c e n d i n g s o r t; t e s t - r e s u l t f l a g/ e n t e r o u t e r l o o p

; l s t e l m = e l m c n t - d e l t a

; c r r e l m =

; e l m l = c r r e l m

; e l m 2 = c r r e l m + d e l t a

/ f i n d e l e m e n t s/ c o m p a r e e l e m e n t s/ i p r o p e r o r d e r ?; b : y e s/ s w a p e l e m e n t s

; e l m 2 = e l m l

; e l m l = e l m l - d e l t aI d e l m l + 1s t a e l m 2 + ls b c d e l t a + 1s t a e l m l + 1b c ] b b 3

i n n e r l o o p e n

h l 2 i n c c r r e l mb n e s h l 3i n c r r e l m + 1

s h l 3 I d c m I d s b b c

l s t e l mc r r e l ml s t e l m + 1c r r e l m + 1] b b 2

m i d d l e l o o p e n d

s h l 4

o u t e ]

f i n d

f n d e l m

f n d i n t

f n d f l p

f n d s t r

] b b l

f n d l

] b b 2

l s r o I d o r b n

l o

i t

t w

j m

l d d f l d d f l d l d I d s t I d c p b c a s r o c p b c a s r o a d s t I d a d s t I d

d e l t a + 1d e l t ad e l t a + 1d e l t a] b b l

) e n

e l e m e n t s

( f n d a d r )

# 2 - 1$ 2 1 5 - 1$ 2 # 3 - 1# e l m l + l , xp r o d u c + 1e l m l , x# 3 - 1f n d l

p r o d u c + 1# 5 - 1f n d l

p r o d u c + 1e l m l , xp r o d u cp r o d u c + 1e l m l + 1 , xp r o d u c + 1p r o d u c

a d b e g e l ms t I d a d s t d e d e b e c p b n I d s t I d

e l p t r , xp r o d u c + 1b e g e l m + 1e l p t r + l , x

] b b l# 3 - 1f n d 2( e l p t r ) , y

e l l e n , y( e 2 p t r ) , y

s t a e 2 1 e n , yd e b p ] b b 2

; b : l s t e l m > = c r r e l m

; d e l t a = i n t ( d e l t a / 2 )

; d e l t a = 0

; b : n o c o n t i n u e

/ f i n i s h e d

/ t c u r r e n t h a n d l e r

/ i n t e g e r ?; b : y e s; *

/ s t r i n g ?; b : y e s; *

; * 2 , * 3 , * 5

/ a d d o f f s e t t o b a s e a d

; b : d o s e c o n d e l e m e n t/ s t r i n g ?; b : n o/ g e t s t r i n g d e s c r i p t o r s

; b : e l m l >

; c r r e l m = c r r e l m + 1

f n d 2 i t s

c o m p a r e t w e l e m e n t s

c o m p a r j m ( c m p a d r ) / t o c u r r e n t h a n d l e r

c o m p a r e i n t e g e r s

c m p i n t l d y # / m o s t s i g n i f i c a n t b y t es e I d a ( e l p t r ) , y

Page 68: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 68/84

s b ( e 2 p t r ) , yb e c i n 2b m c i n l / s i g n e d c o m p a r eb v e l g r tb v e l l e s

c i n l b v e l l e sb v e l g r t

c i n 2 i n yI d a ( e l p t r ) , ys b ( e 2 p t r ) , yb e e l e q ub c e l l e s / u n s i g n e d c o m p a r e

r e t u r n e l g r e a t e r t h a n e

e l g r t I d a i i s g r tr t

c o m p a r e f l o a t i n g p o i n t s

c m p f l p j s m e m f a c + 4 ; e t f a j s r a n p f a c + 4 / c o m p a r e e t o f a cb m e l l e s ; b : e l < e 2b n e e l g r t ; b : e l > e 2

r e t u r n e

e l e q u I d r t

c o m p a r e

c m p s t r

c s t l

] b b l

c s t 2

c s t 3

I d c m b c I d t a b e l d i n I d c m b n d e b n I d c m b e b c

r e t u r n e

e l l e s I d r t

e x c h a n g e

e x c h n g

e x c i n t

e x c f l p

e x c s t r] b b l

j m

l d d f l d d f l d I d t a I d s t t x s t

e q u a l e

f i s e q u

s t r i n g s

e l l e ne 2 1 e nc s t le 2 1 e n

c s t 2i -

( e l a d r ) / y( e 2 a d r ) , y

c s t 3

] b b le l l e ne 2 1 e ne l e q ue l g r t

l e s s t h a n

t i s l e s

e l e m e n t s

( s w p a d r )

1 2 - 1$ 2 # 5 - 1$ 2 1 3 - 1( e l p t r ) , y

( e 2 p t r ) , y( e l p t r ) , y

( e 2 p t r ) , y

/ c o m p a r e l e n g t h s/ b : e l < e 2

/ u s e s h o r t e r s t r i n g; b : s h o r t e r i n u l l

/ c h a r s d i f f e r e n t ?

; b : y e s/ a l l c h a r s c o m p a r e d ?; b : n o/ l e n g t h s d i f f e r e n t ?

; b : e l = e 2; b : e l > e 2

e

/ t o c u r r e n t h a n d l e r

/ s k i p n e x t t w o b y t e s

b p ] b b lr t

s o r t p a r a m e t e r s t o r a g e

d u * + U $ f f f e / w o r d - a l i g n

b e g e l m d / p o i n t e r - > f i r s t e l e m e n te n d e l m d / p o i n t e r - l a s t e l e m e n te l m s i z d / i b y t e s / e l e m e n tf n d a d r d / v e c t o r - > f i n d r o u t i n ec m p a d r d / v e c t o r - > c o m p a r e r o u t i n es w p a d r d / v e c t o r - e x c h a n g e r o u t i n e

d e n d

L i s t i n g 2 B A S I C g e n e r a t o r f o r " s h e l l s o r t . o "

B D 1 0 0 r e m g e n e r a t o r f o r " s h e l l s o r t . o "G C 1 1 0 n $ = " s h e l l s o r t . o " : r e n a m e o f p r o g r a mF 1 2 0 n d = 4 9 5 : s a = 4 9 1 5 2 : c h = 6 1 7 8 6

( f o r l i n e s 1 3 0 - 2 6 0 , s e t h e s t a n d a r d g e n e r a t o r o p a g e 5

L 1 0 0 0B 1 0 1 0I 1 0 2 0L 1 0 3 0K 1 0 4 0H 1 0 5 0I K 1 0 6 0O F 1 0 7 0D 1 0 8 0P 1 0 9 0H 1 1 0 0O 1 1 1 0P 1 1 2 0E 1 1 3 0C 1 1 4 0G 1 1 5 0B 1 1 6 0H 1 1 7 0B 1 1 8 0O 1 1 9 0C 1 2 0 0K 1 2 1 0J 1 2 2 0N 1 2 3 0D 1 2 4 0C 1 2 5 0A C 1 2 6 0I L 1 2 7 0E 1 2 8 0G C 1 2 9 0O 1 3 0 0I B 1 3 1 0A 1 3 2 0G 1 3 3 0J 1 3 4 0D 1 3 5 0J G 1 3 6 0M 1 3 7 0E 1 3 8 0H I 1 3 9 0C L 1 4 0 0O B 1 4 1 0O 1 4 2 0H 1 4 3 0I D 1 4 4 0F 1 4 5 0D 1 4 6 0P 1 4 7 0

3 2 3 2 7 2

2 2

4 8

5 7 6 0 6 3

d a t ad a t ad a t ad a t ad a t ad a t ad a t a 1 6 0 ,d a t a 2 0 2 ,d a t a 1 6 5 ,d a t a 7 2 d a t a 9 6 d a t ad a t ad a t ad a t a 1 9 3 ,d a t a 2 7 d a t a 2 4 0 ,d a t a 1 7 3 ,d a t a 1 9 3 ,d a t a 4 0 d a t a 1 9 3 ,d a t a 1 9 3 ,d a t a 1 6 9 ,d a t a 2 4 4 ,d a t a 8 8 d a t a 1 0 6 ,d a t a 2 d a t a 1 6 5 ,d a t a 2 2 9 ,d a t a 1 3 3 ,d a t a 1 0 6 ,d a t a 1 0 7 ,d a t a 1 9 3 ,d a t a 5 6 d a t a 3 8 d a t a 3 9 d a t a 1 1 1 ,d a t a 1 1 1 ,d a t a 1 0 7 ,d a t a 1 9 3 ,d a t a 2 d a t a 3 8 d a t a 1 9 2 ,d a t a 3 8 d a t a 9 1 d a t a 1 6 5 ,d a t a 2 0 2 ,d a t a 3 4

2 5 3 , 1 7 4 , 3 2 6 4 1 9 2 , 1 6 5 ,3 2 2 5 3 , 1 7 4 ,3 2 , 6 4 , 1 9 2 ,

1 6 2 , 8 6 9 2 1 6 2 , 1 6 8 1 8 9 , 8 5

1 3 6 , 2 0 8 , 2 4 6 ,7 1 1 5 7 , 2 4 0 ,

1 5 7 , 2 4 1 , 1 9 3 ,1 6 2 , 2 2 , 1 0 8 ,1 9 3 , 1 3 6 , 1 9 3 ,1 9 3 , 1 6 7 , 1 9 3 ,1 9 3 , 1 8 0 , 1 9 3 ,1 7 2 , 2 4 1 , 1 9 3 ,2 0 8 , 7 2 3 6 ,

2 6 , 1 7 3 , 2 4 2 ,2 4 3 , 1 9 3 , 1 4 1 ,1 4 0 , 2 4 3 , 1 9 3 ,

3 2 1 9 7 , 1 9 2 ,2 3 7 , 2 4 0 , 1 9 3 ,2 3 7 , 2 4 1 , 1 9 3 ,

0 , 6 , 8 8 1 9 3 , 1 4 4 , 5 1 3 6 , 2 0 8 , 2 3 8 ,1 6 5 , 8 9 1 3 3 ,1 6 9 , 8 1 3 3 ,

8 8 2 2 9 , 1 0 6 ,1 0 7 , 1 3 3 , 1 0 9 ,1 1 1 , 2 4 , 1 6 5 ,1 3 3 , 4 0 , 1 6 5 ,1 3 3 , 4 1 , 3 2 ,

3 7 1 0 5 , 2 0 8 ,1 6 5 , 3 8 , 1 3 3 ,1 6 5 , 3 9 , 1 3 3 ,1 7 6 , 2 2 4 , 2 3 0 ,1 6 5 , 1 0 8 , 1 9 7 ,1 7 6 , 1 9 1 , 7 0

5 1 0 6 , 2 0 8 ,1 6 0 , 1 4 4 1 6 2 , 2 1 8 1 ,1 9 2 , 2 1 4 4 ,

4 1 4 4 , 3 1 3 3 , 9 0 1 6 5 ,1 6 5 , 9 0 1 0 9 ,

9 1 1 0 9 , 2 4 1 ,2 4 0 , 2 0 8 , 1 9 2 ,1 5 3 , 9 6 0

1 3 9 , 1 7 6 ,7 0 , 7 2 ,3 2 1 3 9 ,

1 6 2 , 2 4 6 9 2 0 8 ,6 9 , 7 0 ,

1 9 2 , 1 5 3 ,3 2 1 1 0 ,

1 9 3 , 1 9 7 ,2 2 9 , 4 8

0 , 3 ,2 1 7 , 1 9 3 ,2 2 0 , 1 9 3 ,2 2 3 , 1 9 3 ,2 0 4 , 2 4 3 ,2 4 2 , 1 9 3 ,1 9 3 , 1 4 1 ,2 4 1 , 1 9 3 ,

8 3 2 9 6 5 6

1 3 3 , 8 8 1 3 3 , 8 9

3 8 , 8 9 ,2 3 7 , 2 4 4 ,

9 6 1 6 5 ,1 0 7 , 1 6 9 ,1 0 5 , 2 0 8 ,1 3 3 , 1 0 8 ,1 6 9 , 0 1 1 0 , 1 3 3 ,1 1 1 , 1 3 3 ,

5 4 1 9 3 ,2 2 , 3 2 ,4 0 2 2 9 ,4 1 2 2 9 ,

1 1 0 , 2 0 8 ,1 1 0 , 1 6 5 ,1 0 7 , 1 0 2 ,1 6 2 , 9 6 1 6 0 , 4

3 9 1 3 3 ,1 0 , 1 0 ,1 0 , 3 8 ,9 1 1 1 7 ,

2 4 0 , 1 9 3 ,1 9 3 , 1 4 9 ,

2 2 0 8 ,1 7 7 , 3 6

1 6 2 ,1 6 5 , 6 1 7 6 , 1 6 1 0 4 , 1

4 2 1 0 2 0 8 , 3 2 4 3 , 1 9 1 9 2 , 9 6

4 7 1 6 1 4 4 ,

2 , 5 , 3

1 7 4 , 2 4 1 9 3 , 1 4 1 4 4 , 2 2 4 0 , 1 9 1 4 2 , 2 4 1 5 7 , 1 9 1 7 3 , 2 4 1 7 3 , 2 4 1 6 0 , 1

4 2 2 0 1 9 3 , 2 3

8 8 1 3 2 1 4

8 4 5 1 6 5 , 8 91 3 3 , 1 1

3 8 1 0 3 9 1 0 3 2 1 3

2 1 4 , 1 9 1 0 6 , 1 3 1 0 7 , 1 3

2 2 3 1 0 9 , 2 2 1 0 6 , 1 6 1 0 8 , 2 4

4 4 1 6 9 1 1 8 3 8 , 9 19 1 1 1 3 9 1 3

1 4 9 , 3 43 5 2 0 1 3 1 7

1 5 3 , 9

Page 69: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 69/84

1 4 8 0 d a t a 0 1 3 6 , 1 6 2 4 3 , 9 6 1 4 9 0 d a t a 1 6 0 , 0 5 6 , 1 7 7 , 3 4 ,1 5 0 0 d a t a 1 0 , 4 8 , 4 8 0 , 1 5 ,1 5 1 0 d a t a 5 8 1 1 2 , 9 2 0 0 , 1 7 7 ,1 5 2 0 d a t a 2 4 0 , 1 5 1 4 4 , 4 7 1 6 9 ,1 5 3 0 d a t a 1 6 6 , 1 8 7 , 3 2 , 9 5 1 8 8 ,1 5 4 0 d a t a 2 4 3 , 1 6 9 , 1 4 , 9 6 1 6 5 ,1 5 5 0 d a t a 1 4 4 , 2 1 6 5 , 9 9 1 7 0 ,1 5 6 0 d a t a 2 5 5 , 2 0 0 , 1 7 7 , 9 7 2 0 9 ,1 5 7 0 d a t a 2 0 2 , 2 0 8 , 2 4 6 , 1 6 5 , 9 6 1 5 8 0 d a t a 2 2 4 , 1 7 6 , 2 0 9 , 1 6 9 , 3 5 1 5 9 0 d a t a 1 9 3 , 1 6 0 , 1 4 4 1 6 0 ,1 6 0 0 d a t a 2 1 7 7 , 3 4 , 1 7 0 , 1 7 7 ,1 6 1 0 d a t a 1 3 8 , 1 4 5 , 3 6 1 3 6 , 1 6

3 S h e l l s o r t T e s t1 0 1 0 1 1 1 1 1 2 1 2 1 5 1 5 1 6 1 6 1 8 1 8 2 0 2 0 2 1 2 1 2 2 2 2 2 3 2 3 2 4 2 4 2 5 2 5 3 0 3 0 3 1 3 1 3 3 3 3 3 4 3 4 3 5 3 5 4 0 4 0 4 1 4 2 4 2 4 3 4 5 4 5 4 6 4 6 4 7 4 7 4 8 4 8 5 0 5 0 5 1 5 1 5 2 5 2 5 3

1 0 8 ,2 4 1 ,1 1 2 ,

3 4 5 6 4

? 4 1 0 0 ,1 9 7 ,

9 6 4

3 6 2 4 3 ,

p r i n t " { d o w n } * a r r a y s h e l l s o r t t e s t e r "p r i n t " * b y a n t o n t r e u e n f e l s "p r i n t " * l a s t r e v i s e d 0 9 / 2 8 / 8 8 "

2 4 8 , 1 9 3 6 2 4 6 0 8

2 4 1 , 3 9 6 3 3 6 2 0 8

1 9 9 1 1 6

2 0 8 ,9 9 2 4

1 0 8 , 2 5 4 4 1 6

1 4 5 , 3 9

i f p e e k ( 4 9 1 5 2 ) < > 3 2 o r p e e k ( 4 9 1 5 3 ) < > 2 5 3 t h e n a = p e e k ( 1 8 6 ) : l o a d " s h e l l s o r t . o " , a , 1

m e = 1 0 0 0 : s z = 2 0 : m p = 2 0i m = 3 2 0 0 0 : i r = 1 6 0 0 0r m = 1 0 0 0 0 0 0 : r r = 5 0 0 0 0 0 : r p = 1 0 0

p r i n t " { d o w n } d e f i n e t e s t p a r a m e t e r s : "

p $ = " a r r a y t y p e ( s t r i n g , i n t e g e r ,

p $ = " { d o w n } i n i t i a l f e l e m e n t s " : p = l

p $ = " { d o w n } f i n a l f e l e m e n t s " : p = i e : <

p $ = " { d o w n } s o r t o r d e r ( a s c e n d i n g ,

r e a l )

: q = m e :

? = m e : i

" : q $ = " s i r " : g o s u b 9 7 5 : a t = a

r = i n t ( m e / 8 ) : g o s u b 9 5 0 : i e = a

• = m e : g o s u b 9 5 0 : f e = a

d e s c e n d i n g ) " : q $ = " a d " : g o s u b 9 7 5 : s o = a

p $ = " { d o w n } i p a s s e s t o a v e r a g e " : p = l : q = 2 0 0 : r = l : g o s u b 9 5 0 : n p = a

p $ = " { d o w n } d i s p l a y f i r s t p a s s ( n

d e f f n r O ( a ) = i n t ( r n d ( l ) * a )d e f f n r l ( a ) = i n t ( r n d ( l ) * a ) + ld e f f n r n ( a ) = i n t ( ( a + . 0 0 5 ) * 1 0 0 ) / 1 0 0

i f a t = l t h e n d i m a r $ ( m e )i f a t = 2 t h e n d i m a r % ( m e )i f a t = 3 t h e n d i m a r ( m e )

d i m u p ( m p ) , s p ( m p )

f o r p c = l t o n pp r i n t " { d o w n } p a s s f " ; p c

c c = i e : c i = li f a t = l t h e n g o s u b 7 5 0

g o s u b 8 0 0p $ = " r a n d o m = "g o s u b 6 0 0u p ( c i ) = u p ( c i ) + ( e t - u p ( c i ) ) / p cp $ = " s o r t e d = "g o s u b 6 0 0s p ( c i ) = s p ( c i ) ( e t - s p ( c i ) ) / p c

i f a t = l t h e n g o s u b 7 8 0c c = 2 * c c : c i = c i + li f c c < = f e t h e n 4 5 0

n e x t p c

p r i n t " { d o w n } { d o w n } a v e r a g e s o v e r " ;

y e s ) " : q $ = " n y " : g o s u b 9 7 5 : d f = a

n p ; " p a s s e s : "

I C I G E E C O E N C A O K M I H H P E G D L H B B F F E A H F D

I N P M C E A M G A E O G D P B K H D M B B O B F D K P

5 3 5 4 5 4 5 5 5 5 5 6 5 6 5 7 5 8 5 8 6 0 6 0 6 1 6 1 6 2 6 2 6 3 6 3 6 4 6 4 6 5 6 5 7 5 7 5 7 6 7 6 7 8 7 8 8 0 8 0 8 1 8 1 8 2 8 2 8 3 8 3 8 4 8 5 8 5 8 6 8 6 8 7 8 7 8 8 8 8 8 9 8 9 9 0 9 0 9 1 9 1 9 5 9 5 9 6 9 6 9 7 9 7 9 8 9 8 9 9 9 9

p r i n t " { d o w n } i e l e m e n t s " , " r a n d o m " , " s o r t e d "p r i n t : c c = i e : c i = lp r i n t c c , f n r n ( u p ( c i ) ) , f n r n ( s p ( c i ) )c c = 2 * c c : c i = c i + li f c c < = f e t h e n 5 4 5

p $ = " { d o w n } a n o t h e r t e s t ( n o , y e s ) " : q $ = " n y " : g o s u b 9 7 5 : i f a = 2 t h e n c l r : g o t o l 8 0

e n

p r i n t c c ; p $ ;i f s o = l t h e n a = l : b = c ci f s o = 2 t h e n a = c c : b = lo n a t g o t o 6 2 0 , 6 2 5 , 6 3 0c = t i : s y s 4 9 1 5 2 , a r $ ( a ) , a r $ ( b ) : d = t i : g o t o 6 3 5c = t i : s y s 4 9 1 5 2 , a r % ( a ) , a r % ( b ) : d = t i : g o t o 6 3 5c = t i : s y s 4 9 1 5 2 , a r ( a ) , a r ( b ) : d = t ie t = f n r n ( ( d - c ) / 6 0 )p r i n t e t ; " s e c o n d s "i f d f = 2 a n d p c = l t h e n g o s u b 8 5 0r e t u r n

p r i n t " { d o w n } g e n e r a t i n g m a s t e r s t r i n g . . . "a = r n d ( r n d ( - t i ) ) : m s $ = " "f o r i = l t o 2 5 5 : m s $ = m s $ + c h r $ ( f n r O ( 2 6 ) + 6 5 ) : n e x t : r e t u r n

f o r i = l t o c c : a r $ ( i ) = " " : n e x t : a = f r e ( 0 ) : r e t u r n

p r i n t " { d o w n } g e n e r a t i n g " ; c c ; " e l e m e n t s . . . "a = r n d ( r n d ( - t i ) )o n a t g o t o 8 1 5 , 8 2 0 , 8 2 5a = 8 + d f : f o r i = l t o c c : a r $ ( i ) = m i d $ ( m s $ , f n r l ( 2 4 0 ) , f n r l ( a ) ) : n e x t : g o t o 8 3 0f o r i = l t o c c : a r % ( i ) = f n r l ( i m ) - i r : n e x t : g o t o 8 3 0f o r i = l t o c c : a r ( i ) = ( f n r O ( r m ) - r r ) / r p : n e x ti f d f = 2 a n d p c = l t h e n g o s u b 8 5 0r e t u r n

f o r i = 0 t o c c - l s t e p s zp r i n t : o n a t g o t o 8 6 0 , 8 6 5 , 8 7 0f o r j = l t o s z : p r i n t l e f t $ ( a r $ ( i + j ) , 9 ) , : n e x t : g o t o 8 7 5f o r j = l t o s z : p r i n t a r % ( i + j ) , : n e x t : g o t o 8 7 5f o r j = l t o s z : p r i n t a r ( i + j ) , : n e x tg o s u b 9 0 0n e x tp r i n t : p r i n t " { d o w n } p r e s s a n k e y { d o w n } " : g o s u b 9 0 5r e t u r n

g e t a $ : i f a $ = n " t h e n 9 1 0g e t a $ : i f a $ = " " t h e n 9 0 5r e t u r n

a $ = s t r $ ( p ) : b $ = s t r $ ( q ) : c $ = s t r $ ( r )p r i n t p $ ; " ( " ; a $ ; " - n ; b $ ; n ) " ; c $ ; l e f t $ ( " { 7 l e f t } " , l e n ( c $ ) + l ) ;i n p u t a : a = i n t ( a ) : i f a < p o r a > q t h e n 9 5 5r e t u r n

p r i n t p $ ; " " ; l e f t $ ( q $ , l ) ; " { l e f t } { l e f t } { l e f t } " ;i n p u t a $ : a $ = l e f t $ ( a $ , l )f o r a = l t o l e n ( q $ ) : i f a $ = m i d $ ( q $ , a , 1 ) t h e n 9 9 5n e x t : g o t o 9 7 5r e t u r n

Page 70: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 70/84

g l o b F u n c t i o n F o P o w e r

W i l d c a r d p a t t e r n m a t c h i n g

b y A d r i a n P e p p e r

T h e P o w e r s h e l l p r o v i d e s a p l e a s i n g c o m m a n d - l i n ei n t e r f a c e . H o w e v e r , o f t e n f o u n d m y s e l f w i s h i n g i w o u l dp r o v i d e t h e u s e f u l ' w i l d c a r d ' f i l e n a m e f a c i l i t i e s o f s y s t e m ss u c h a M S - D O S a n U N I X .

' W i l d c a r d ' i t e r m u s e d t o r e f e r t o t h a b i l i t y t s p e c i f y m a n yf i l e n a m e s a o n c e i c o m m a n d l i n e b h a v i n g t h c o m m a n dl i n e i n t e r p r e t e r t r e a t s o m e a r g u m e n t s n o j u s t a s s i n g l e l i t e r a ln a m e s , b u a p a t t e r n s m a t c h i n g s e t s o f i l e n a m e s . M a n y o u g e u s e d t t y p i n g * o o t h e r s y s t e m s t m a t c h a l f i l e n a m e se n d i n g w i t h . c H e r e t h i n o i n t e r p r e t e d l i t e r a l l y , b u i m e t a c h a r a c t e r , u s e d t m e a n " a n y n u m b e r o r e p e t i t i o n s o a n c h a r a c t e r " . F r o m t h l i s t o a l c u r r e n t l y a v a i l a b l e f i l en a m e s , a l m a t c h i n g f i l e n a m e s a r s e l e c t e d a n t h c o m m a n df u n c t i o n s a i f a l l t h n a m e s h a b e e n l i t e r a l l y t y p e d i p l a c eo t h p a t t e r n .

F o r e a s o n s b u r i e d d e e p i t h f i f t e e n - y e a r a n t i q u i t y o U N I Xd e v e l o p m e n t , p r o g r a m s a n d r o u t i n e s f o r e x p a n d i n g w i l d c a r dp a t t e r n s i n t o l i s t s o m a t c h i n g f i l e n a m e s o f t e n g o b y t h n a m eg l o b . I t i s a a b b r e v i a t i o n o " g l o b a l " , a n r e f e r e n c e t t h f a c t t h a t t h c o m m a n d w i l l b e x e c u t e d " g l o b a l l y " ; t h a t i t s a y , f o a l a p p r o p r i a t e a v a i l a b l e f i l e n a m e s . v e r yn a r r o w - m i n d e d u s e o f t h w o r d " g l o b a l " , i y o t h i n k a b o u ti t

a v a i l a b l e f i l e n a m e s f o r p a t t e r n m a t c h i n g . T h s i m p l e d i p r o g r a m i l l u s t r a t e d d o e s t h i s . I e s s e n t i a l l y m i m i c s t h b u i l t - i ns h e l l c o m m a n d w h i c h g i v e s d i r e c t o r y l i s t i n g o t h e d r i v ec u r r e n t l y d e s i g n a t e d a t h ' w o r k ' d r i v e .

/ d i r . c b a s i c - s t y l e d i r e c t o r y l i s t i n g

* f i n c l u d e < s t d i o . h >

s t a t i c c h a r b u f [ 1 0 0 ] ;m a i n ( a r g c , a r g v )u n s i g n e d a r g c ;c h a r * * a r g v ;

c h a r * p a t ;u n s i g n e d d e v ;F I L E f i d ;u n s i g n e d n

/ c o m m a n d l i n e p a t t e r n i f g i v e n , e l s e e m p t y s t r i n g * p a ( a r g c 1 a r g v [ l ] " " s p r i n t f ( b u f , " $ % s " , p a t ) ;

f d e f i n e w r k d e v ( * ( d i a r * ) 0 x l 7 f c )d e v = w r k d e v ; / d e v i c e s e b s h e l l w o r k c o m m a n d *

f i d = 5 i f ( ! o p e n ( f i d , d e v , 0 b u f )

f e r r o r ) )p r i n t f ( " C a n ' t o p e n % o n d e v i c e % d \ n " , b u f , d e v ) ;e x i t ( l ) ;

A l t h o u g h t h P o w e r s h e l l d o e s n o p r o v i d e t h i s , i p r o v e dn o t t o o d i f f i c u l t t c r e a t e a g e n e r a l i z e d m e a n s t a l l o w P o w e r

p r o g r a m s t e a s i l y s u p p o r t i t h e m s e l v e s .T h i s a r t i c l e a t t e m p t s t n o o n l y g i v e a s o l u t i o n , b u a l s o t t r a c e t h s t e p s b y w h i c h c o n c e p t c a b e c o m e p r a c t i c a l t o o l .I a d d i t i o n , i a t t e m p t s t g i v e a l i t t l e i n s i g h t i n t o t h l a n g u a g e a n t h P o w e r p a c k a g e .

S t r a n g e l y e n o u g h , t h o u g h , t h a l g o r i t h m s a n s y s t e m d e t a i l sp r e s e n t e d c a b e a s i l y a d a p t e d t v a r i e t y o l a n g u a g e s .

R e a d i n g d i s k d r i v e d i r e c t o r y w i t h P o w e r

T h f i r s t s t e p w a t v e r i f y t h a t P o w e r p r o g r a m s c o u l d q u i t ee a s i l y p r o c e s s d i r e c t o r y l i s t i n g s f r o m 1 5 4 1 s a n s i m i l a r d i s kd r i v e s . T h i s d i r e c t o r y l i s t i n g w o u l d b c o n s i d e r e d o u r l i s t o

f g e t c ( f i d ) ;f g e t c ( f i d ) ; / s k i p " l o a d a d d r e s s " *

w h i l e ( ( = g d i r l i n e ( b u f , f i d ) ) ! E O F )p r i n t f ( " % u % s \ n " , n b u f ) ;

f d o s e ( f i d ) ; / f d o s e f o o p e n ( ) a l l o w s r e - u s e *

T h g d i r l i n e r o u t i n e i c r u c i a l t t h e d i r p r o g r a m :/

g d i r l i n e . c r e a d a l i n e f r o md i r e c t o r y " l o a d " i n t o g i v e n b u f

r e t u r n a f u n c t i o n v a l u e* t h " l i n e n u m b e r " p a r t o b a s i c

s t y l e l i n e ( t h a t i s n u m b e r o b l o c k s )E O a e n d - o f - f i l e

* f i n c l u d e < s t d i o . h >

Page 71: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 71/84

f i d )* b u f ;f i d ;

c h a r * b u n s i g n e d c n

f g e t c ( f i d ) ;f g e t c ( f i d ) ;

/ s k i p " l i n k " * / . . *

n f g e t c ( f i d ) ; / g e t " l i n e n u m b e r " , l o w b y t e * f g e t c ( f i d ) ; / a n d h i g h b y t e * n + c « 8 ; / a n p u t t h e t w o t o g e t h e r *

/ r e a d r e s t o f l i n e ; e n d e d n o r m a l l y b y a z e r o b y t e * f o ( b u f ; ( f g e t c ( f i d ) ) & & c ! E O F ; + + b )

* c

* b ' \ 0 ' ; / * j u s t i n c a s e d i d n ' t e n d w i t h z e r o *

i ( E O F ) r e t u r n E O F ;

r e t u r n n / r e t u r n " l i n e n u m b e r " * / a s s u m e E O F i i n v a l i d l i n e n u m b e r *

h d i p r o g r a m t a k e s a d v a n t a g e o f e a t u r e o t h 1 5 4 1 a n d i s k d r i v e s b o p e n i n g ' d i r e c t o r y l i s t i n g ' , s i g n i f i e d

f i l e n a m e b e g i n n i n g w i t h d o l l a r - s i g n c h a r a c t e r ( $ ) , b u s p e c i f y i n g z e r o a t h s e c o n d a r y a d d r e s s f o r t h e d r i v e .i i n t e r p r e t e d s p e c i a l l y b t h e s e d r i v e s , c a u s i n g t h e m t

a n s e n d b a c k w h a t a p p e a r s t b B A S I C p r o g r a m ,w i t h l o a d a d d r e s s , a n m e a n i n g l e s s s t a t e m e n t l i n k s .

e n u m b e r o f b l o c k s f o e a c h f i l e i s e n t b a c k a t h l i n ef o t h ' s t a t e m e n t ' , w h i l e t h s t a t e m e n t i t s e l f f o r m s

h r e s t o t h d i r e c t o r y l i n e . W h e n e v e r t h f i l e n a m e u s e d f o o p e n b e g i n s w i t h d o l l a r - s i g n , t h e d i r e c t o r y i o p e n e d .

i s e c o n d a r y a d d r e s s o f z e r o i u s e d w i l l t h s p e c i a lp r o g r a m ' f o r m a t b t r a n s m i t t e d .

l t h i s i w h l o a d " $ " , 8 i B A S I C r e p l a c e s y o u r c u r r e n tw i t h s o m e t h i n g t h a t , w h e n l i s t e d , g i v e s y o

a b o u t t h e d i r e c t o r y o t h d i s k .

P o w e r d o e s p r o v i d e l i b r a r y r o u t i n e s f o r e a d i n g t h d i s k d i r e c t o r y e n t r i e s , t h e r e w e r e n u m b e r o r e a s o n s f o

o w a n t i n g t u s e t h e m . T h m o s t i m p o r t a n t w a t h a t t h e y w o u l do w o r k a a l w i t h t h n o r m a l R A M d i s k s o f t w a r e p r o v i d e d b f o t h e i r 1 7 6 4 / 1 7 5 0 R A e x p a n d e r , w h i l e t h

o d i r e c t o r y l i s t i n g o s e c o n d a r y a d d r e s s z e r o w o u l d .

v i n g a d i r e c t o r y l i s t i n g f o l a t e r u s

h C o m m o d o r e d i s k d r i v e s p e r f o r m l i m i t e d w i l d c a r dw h e n r e t u r n i n g d i r e c t o r y l i s t i n g s . q u e s t i o n m a r k

? c a n b e u s e d t m a t c h a n s i n g l e a r b i t r a r y c h a r a c t e r , a n a ( * c a n b e u s e d t m a t c h a n n u m b e r o a n

s .

p r e l i m i n a r y r o u t i n e f o p r o v i d i n g t h g l o b f a c i l i t y t h e n c a s i m p l y w r i t t e n , a s f o l l o w s :

d e v g l o b . c e x p a n d w i l d c a r d f i l e n a m e s

d e v g l o b e x e c u t e s t h e g i v e n f u n c t i o nf o e a c h f i l e n a m e r e t u r n e d b yd i r e c t o r y l i s t i n g o f t h e g i v e nf i l e n a m e w i l d c a r d p a t t e r n o t h g i v e n d e v i c e

r e t u r n s a f u n c t i o n v a l u e t h n u m b e ro n a m e s m a t c h e d

T h ' s e l e c t ' f u n c t i o n a r g u m e n t a l l o w st h e f i l e s e l e c t i o n p r o c e s s t o b c u s t o m i z e d .

^ i n c l u d e < s t d i o . h >

t h i s s t r u c t u r e i t o c r e a t e a l i n k e dl i s t o f m a t c h i n g f i l e n a m e s

t y p e d e f s t r u c t l i n ks t r u c t l i n k * l $ n e x t ; / p o i n t t n e x t i l i s t * c h a r * l $ n a m e ; / p o i n t t o n a m e o t h i s f i l e * L I N K ;

s t a t i c L I N K * n a m e l i s t ;s t a t i c c h a r b u f [ 1 0 0 ] ;

d e v g l o b ( d e v , p a t , f u n c , s e l e c t )u n s i g n e d d e v ; / * d e v i c e t o u s e f o r d i * c h a r * p a t ; / * f i l e n a m e p a t t e r n t o e x p a n d * i n t ( * f u n c ) ( ) ; / f u n c t i o n t o c a l l o n m a t c h e s * i n t ( * s e l e c t ) ( ) ; / e x t r a m a t c h e r *

e x t e r n c h a r * m a l l o c ( ) ;e x t e r n c h a r * s t r d u p ( ) ;L I N K * * p l i n k ; / k e e p t r a c k o e n o f l i s t * L I N K * n l i n k ; / p o i n t e r t o n e w L I N K c r e a t e d * c h a r * n n a m e ; / p o i n t e r t o n e w s a v e d n a m e * L I N K * l l i n k ; / g e n e r a l p o i n t e r t o L I N K * c h a r * b F I L E f i d ;i n n

s p r i n t f ( b u f , " $ % s " , p a t ) ; / f o r m d i r e c t o r y n a m e *

f i d = 5 i ( ! o p e n ( f i d , d e v , 0 b u f ) f e r r o r ) )

r e t u r n 0

p l i n k = & n a m e l i s t ; / m a t c h i n g f i l e n a m e s w i l l * * p l i n k = N U L L ; / b s a v e d i n a l i n k e d l i s t *

f g e t c ( f i d ) ; / s k i p " l o a d a d d r e s s " * f g e t c ( f i d ) ; / * . . . * /w h i l e ( g d i r l i n e ( b u f , f i d ) ! E O F )

i f ( * b u f ! ' / n o f i l e n a m e l i n e ; s k i p i *

e l s ef o ( b u f f s t r l e n ( b u f ) ;

> b u f & * ! " " - - b )

* b ' = ' \ 0 ' ;f o ( b u f ; * ! = ' \ 0 ' & * b + + ! ' " ' ;

/ s k i p t o E O S o a f t e r f i r s t " * i f ( ! s e l e c t ( * s e l e c t ) ( b ) )

/ g o g o o d o n e ! * // u s m a l l o c t o c r e a t e L I N K s t r u c t f o r l i s t * n l i n k = ( L I N K * ) m a l l o c ( l , s i z e o f ( L I N K ) ) ;n n a m e s t r d u p ( b ) ; / s a v e c o p y o n a m e * / n o t e : b u i P O W E R C c a u s e s l o w b y t e *

/ o n l y t o b t e s t e d i f a s s i g n m e n t d o n e i n s i d e i f * i f ( ! n l i n k ! n n a m e )

Page 72: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 72/84

p r i n t f ( " g l o b : t o o m a n y n a m e s a % s \ n " , ) b r e a k ; / f i n i s h p r e m a t u r e l y *

n l i n k - > l $ n a m e = n n a m e ; / p o i n t t o n a m e * * p l i n k = n l i n k ; / a n l i n k n e w L I N K * p l i n k & n l i n k - > l $ n e x t ; / l i n k n e x t o n e h e r e * * p l i n k = N U L L ; / N U L L ( e n d ) f o n o *

T p r o v i d e w i l d c a r d f a c i l i t y o t h s o r t w w o u l d l i k e t h e n ,w n e e d t c h e c k u o t h r e s u l t s o t h C o m m o d o r e d i s kd r i v e w i l d c a r d m a t c h i n g .

B e c a u s e t h l a n g u a g e a n t h P o w e r i m p l e m e n t a t i o n b o t hs u p p o r t r e c u r s i o n , n i c e w i l d c a r d m a t c h i n g r o u t i n e i n o a l t h a t d i f f i c u l t t o w r i t e .

f c l o s e ( f i d ) ; / f c l o s e f o r o p e n ( ) a l l o w s r e - u s e *

/ n o r u t h r o u g h t h e l i s t o f s a v e dn a m e s , e x e c u t i n g t h e f u n c t i o n f o re a c h o n

* n 0 f o ( l l i n k n a m e l i s t ; l l i n k ; l l i n k = n l i n k )

i ( f u n c )( * f u n c ) ( l l i n k - > l $ n a m e ) ; / c a l l f u n c t i o n *

n l i n k = l l i n k - > l $ n e x t ; / r e m e m b e r n e x t * f r e e ( l l i n k - > l $ n a m e ) ; / b e f o r e p t r f r e e d * f r e e ( l l i n k ) ;+ + n ; / * c o u n t m a t c h i n g n a m e s *

r e t u r n n

T h i s m e r e l y r e q u e s t s d i r e c t o r y , a n s t o r e s t h l i s t o n a m e sr e t u r n e d i l i n k e d l i s t , m a k i n g u s e o f t h l a n g u a g e s t r u c tf a c i l i t i e s , t o g e t h e r w i t h t h l i b a r a r y d y n a m i c m e m o r ya l l o c a t i o n r o u t i n e s . W h e n i h a f i n i s h e d c o l l e c t i n g t h d i r e c t o r y l i s t i n g , i e x e c u t e s t h g i v e n f u n c t i o n o n c e f o e a c hf i l e n a m e f o u n d . I a d d i t i o n , ' s e l e c t o r ' f a c i l i t y i p r o v i d e d .

T h s t r d u p r o u t i n e u s e d b d e v g l o b i m e r e l y :

l i n c l u d e < s t d i o . h >/

s t r d u p a l l o c a t e a c o p y o f s t r i n g

r e t u r n s a f u n c t i o n v a l u e t h n e w l y a l l o c a t e d s t r i n g

N U L L i f e n o u g h m e m o r y i n o t a v a i l a b l e*

c h a rs t r d u p ( s t r i n g )c h a r * s t r i n g ;

e x t e r n c h a r * m a l l o c ( ) ;c h a r * n e w s t r ;

n e w s t r m a l l o c ( s t r l e n ( s t r i n g ) + 1 ) ;i f ( n e w s t r ! N U L L )

s t r c p y ( n e w s t r , s t r i n g ) ;r e t u r n n e w s t r ;

C h e c k i n g u p o n C o m m o d o r e ' s w i l d c a r d s

T h t r o u b l e w i t h C o m m o d o r e d r i v e ' s i n t e r p r e t a t i o n o i t h a t a n s u f f i x f o l l o w i n g i i i g n o r e d .

T h * . e x a m p l e g i v e n a b o v e , f o r i n s t a n c e , w o u l d b i n t e r p r e t e d b C o m m o d o r e d r i v e a m a t c h i n g a l f i l e s o t h d r i v e , n o j u s t t h o s e e n d i n g i . c

R e c u r s i o n r e f e r s t o t h a b i l i t y o r o u t i n e s i c o m p u t e rl a n g u a g e t i n v o k e t h e m s e l v e s . T i m p l e m e n t t h i s , t h l a n g u a g e m u s t c r e a t e a e n t i r e l y n e e n v i r o n m e n t ( i . e . s e o l o c a l v a r i a b l e s ) f o e a c h i n v o c a t i o n o r o u t i n e . T h i s m e a n s i d o e s n o m a t t e r w h e n r o u t i n e c a l l s i t s e l f , e i t h e r d i r e c t l y o i n d i r e c t l y .

T h r e c u r s i o n i n e e d e d a a e a s y w a t c h e c k t h a t a l p o s s i b l e w a y s o e x p a n d i n g a n y o c c u r r e n c e s o f a r c o n s i d e r e d b e f o r e t h e p a t t e r n i r e j e c t e d .

F o e x a m p l e , t h e p a t t e r n a * x ? o m a t c h e s t h s t r i n g a x y o x y o ,b u i i n e c e s s a r y t o r e j e c t t h f i r s t m a t c h e d x ? o , a n g b a c ka n l o o k f o r a n o t h e r .

O u w i l d m a t c h r o u t i n e , t s u p p o r t a n ? i s

w i l d m a t c h d m o d e r a t e l y p r i m i t i v ew i l d c a r d m a t c h

r e t u r n s n o n - z e r o a t h e f u n c t i o n v a l u ei g i v e n p a t t e r n m a t c h e s s t r i n g

p a t t e r n c a c o n t a i n t h f o l l o w i n gs p e c i a l c h a r a c t e r s :

* * m a t c h a n y n u m b e r o f a n y c h a r a c t e r sm a t c h e x a c t l y o n e o f a n y c h a r a c t e r

a l o t h e r c h a r a c t e r s a r m a t c h e dl i t e r a l l y . ' * a n ' ? c a n n o t b m a t c h e d l i t e r a l l y . P a t t e r n m u s t m a t c he n t i r e s t r i n g .

* f d e f i n e N Of d e f i n e Y E S

w i l d m a t c h ( p , s )c h a r * p / p a t t e r n , a s a l i t e r a l s t r i n g * c h a r * s / s t r i n g t o t e s t a m a t c h i n g e n t i r e p a t t e r n *

c h a r p c

f o / u n t i l w e r e t u r n b y f a i l u r e o r s u c c e s s * / s w i t c h o n e x t c h a r i p a t t e r n * s w i t c h ( p * p + + )

c a s e ' * ' : / m a t c h a n y n u m b e r o f a n y c h a r * d

/ c h e c k a l l p o s s i b l e s u f f i c e s * i ( w i l d m a t c h ( p , s )

r e t u r n Y E S ; / * a l e a s t s u f f i x w o r k s * w h i l e ( * s + + ) ;

r e t u r n N O ; / * a l l s u f f i c e s i n c o n s i s t e n t *

c a s e ' ? ' :

Page 73: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 73/84

i ( * ' \ 0 ' ) / m a t c h a n y r e a l c h a r * r e t u r n N O

/ e l s e c h e c k n e x t c h a r i p a n d * b r e a k ;

c a s e ' \ 0 ' : / * p a t t e r n e n d e d * r e t u r n * ' \ 0 ' ; / * Y E S o n l y i f e n d s t o o *

/ r e t u r n i n g Y E u n c o n d i t i o n a l l y h e r e w o u l d * / c h e c k i f i n i t i a l p o r t i o n o f m a t c h e d *

d e f a u l t : / l i t e r a l m a t c h o c h a r i p a t t e r n * / A S S E R T : i * ' \ 0 ' w e r e t u r n ( N O ) * i ( * s ! = p c

r e t u r n N O

/ e l s e c h e c k n e x t c h a r i p a n d s *

+ + s ; / * n e x t c h a r i s *

e a c h i n v o c a t i o n o w i l d m a t c h h a i t o w p r i v a t eo a n s a n d o e s n ' t d i s t u r b t h e v a l u e s k n o w n t t h

n c a l l i n g i t t h i s p r o v i d e s a a u t o m a t i c m e t h o d o k e e p i n go t h s u c c e s s o e a c h p o s s i b l e s u f f i x t o t h s t r i n g t h u s

a m a t c h e d .

s o m e c a r e , a n o n - r e c u r s i v e s o l u t i o n t m a t c h i n g t h i sd e f i n i t i o n o p a t t e r n s c o u l d p r o b a b l y b w r i t t e n , b u t h

g i v e n h e r e i e a s i l y e x t e n d a b l e t m o r e c o m p l e xf e a t u r e s . T h e s e i n c l u d e c h a r a c t e r s c l a s s e s , t y p i c a l l y

b e n c l o s i n g l i s t o c h a r a c t e r s i s q u a r e b r a c k e t sa n ] ) F o r e x a m p l e :

[ c h ]

u l d m a t c h f i l e n a m e s e n d i n g w i t h e i t h e r . o . e x t e n s i o n s .e x t e n s i o n s t p a t t e r n m a t c h i n g i n c l u d e a l l o w i n g t h

o a n e l e m e n t , n o t j u s t t h ' a n y n u m b e r o a n ' a i m p l i e d b *

e x c e l l e n t d i s c u s s i o n o p a t t e r n m a t c h i n g t e c h n i q u e s i e d i t h c l a s s i c p r o g r a m m i n g t e x t S o f t w a r e T o o l s , b

K e r n i g h a n a n P . J . P l a u g e r [ 1 ] , a n s a m p l eo n o t h a l g o r i t h m i a c t u a l l y i n c l u d e d o t h

d i s t r i b u t i o n d i s k a s t h e p r o g r a m f i n d . c .

i a l t o g e t h e r . . .

n o c o m b i n e d e v g l o b w i t ht h e r o u t i n e g l o b

g l o b . c e x p a n d w i l d c a r d f i l e n a m e s*

< s t d i o . h >

s e l e c t d o u b l e c h e c k n a m e s m a t c h e db 1 5 4 1 ( e t c . ) d o s

( u s e d b y g l o b f u n c t i o n )

a r * s a v e p a t N U L L ;s e l e c t ( n a m e )

c a l l t w i l d m a t c h , a n

c h a r * n a m e ;

r e t u r n w i l d m a t c h ( s a v e p a t , n a m e ) ;

/ g l o b e x e c u t e g i v e n f u n c t i o n f o e a c h

f i l e o t h w o r k d e v i c e m a t c h i n gt h e g i v e n p a t t e r n

* g l o b ( p a t , f u n c ) / r e t u r n q u i t / c o n t i n u e s t a t u s * c h a r * p a t ; / * f i l e n a m e p a t t e r n t o e x p a n d * i n ( * f u n c ) ( ) ; / * f u n c t i o n t o c a l l o n m a t c h e s *

i n t s e l e c t ( ) ;e x t e r n i n t s p r i n t f ( ) ;e x t e r n c h a r * m a l l o c ( ) ;u n s i g n e d i n b a s i c ; / f l a g i l i n k e d a b a s i c p r o g r a m * u n s i g n e d d e v ;c h a r * p * e n d p ;

I d e f i n e w r k d e v ( * ( c h a r * ) 0 x l 7 f c )/ d e v i c e s e b s h e l l w o r k c o m m a n d *

t d e f i n e k r n d e v ( * ( c h a r * ) 0 x b a )/ d e v i c e l a s t u s e d f o r k e r n a l O P E N *

d e v = w r k d e v ;/ A S S E R T : s p r i n t f n e e d e d b d e v g l o b * i n b a s i c = f i s p r i n t f 0 x 8 8 0 ;i ( i n b a s i c ) d e v = k r n d e v ;

i ( p a t [ 0 ] ' : ' ) / n a m e s w o n ' t c o n t a i n d r i v e * p p a t + 1 ;

e l s e i f ( p a t [ l ] ' : ' )p p a t + 2 ;

e l s ep a t ;

/ m a k e p a t a c c e s s i b l e t s e l e c t * /s a v e p a t s t r d u p ( p ) ;

/ r e m o v e = t y p f r o m e n d o f p a t t e r n * / s i n c e i w o n ' t a p p e a r e i t h e r * p = s a v e p a t + s t r l e n ( s a v e p a t ) ;e n d p = p - 4 ;w h i l e ( > e n d p & s a v e p a t )

i f ( * - - ? ' = ' )* ' \ 0 ' ;b r e a k ;

r e t u r n d e v g l o b ( d e v , p a t , f u n c , f i s e l e c t ) ;

A n t a k i n g i o t h r o a d

c a n o n i c a l u s e o f t h f i l e n a m e m a t c h i n g g l o b r o u t i n e i t p r o d u c e s e l e c t i v e l i s t o m a t c h i n g n a m e s . T h i s i s i m i l a r t t h I c o m m a n d o t h U N I X s y s t e m . I s i s a l r e a d y i m p l e m e n t e ds l i g h t l y d i f f e r e n t l y i n t h P o w e r s h e l l , s w h a v e n a m e do u v e r s i o n I f

I t ' s q u i t e s i m p l e r e a l l y . I j u s t c a l l s o u g l o b , u s i n g a s t h ef u n c t i o n f o e a c h f i l e n a m e r o u t i n e t h a t s i m p l y e c h o e s i t a r g u m e n t .

/ I l i s t f i l e n a m e s

s e l e c t e d b l i s t o f p a t t e r n s* f i n d u d e < s t d i o . h >/

Page 74: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 74/84

f u n c t i o n t o c a l l f o r e a c h n a m em a t c h e d b y g l o b

* i n e c h o n a m e ( n a m e )c h a r * n a m e ;

p r i n t f ( " % s \ n \ n a m e ) ;

m a i n ( a r g c , a r g v )u n s i g n e d a r g c ;c h a r * * a r g v ;

e x t e r n i n t e c h o n a m e ( ) ;u n s i g n e d i

/ i f n o t h i n g s p e c i f i e d * / p r o v i d e a d e f a u l t a c t i o n *

i ( a r g c 2 g l o b ( " * " ,

e l s ef o ( 1 a r g c ; + + i ) / * p r o c e s s e a c h p a t t e r n *

g l o b ( a r g v [ i ] , f i e c h o n a m e ) ;

s l i g h t l y m o r e i n t e r e s t i n g t h i n g t d i a u g m e n t p r o g r a mt h a t t a k e s l i s t o f i l e n a m e a r g u m e n t s s t h a t i c a u s p a t t e r n s i n s t e a d . T h i s c a n s a v e m u c h g u e s s w o r k a n d / o r t y p i n g ,a i t h f o l l o w i n g p r o g r a m w h i c h s e a r c h e s f o a n p r i n t so c c u r r e n c e s o f a s t r i n g i l i s t o f i l e s ( p a t t e r n s ) .

/ f i n d s t r . c s t r i n g s e a r c h p r o g r a m

T h i s p r o g r a m w i l l p r i n t a l o c c u r r e n c e so t h e g i v e n s t r i n g i n t h e s p e c i f i e d f i l e s .

T h f i l e s c a n b e s p e c i f i e d a l i s t o p a t t e r n s .

* f i n c l u d e < s t d i o . h >

i d e f i n e M A X B D F 2 5

c h a r * i n d e x ( ) ;s t a t i c c h a r * m a t c h s t r = N U L L ;

m a i n ( a r g c , a r g v )u n s i g n e d a r g c ;c h a r * a r g v [ ] ;

i n t f i n d s t r ( ) ;i

i f ( a r g c < 3 ) {f p r i n t f f s t d o u t , " % s : < m a t c h - s t r i n g > f i l e ( s ) \ n " ,

a r g v [ 0 ] ) ;e x i t ( ) ;

m a t c h s t r = a r g v [ l ] ;f o r ( i = 2 ; i < a r g c ; + + i )

g l o b ( a r g v [ i ] , f i f i n d s t r ) ;

s t a t i c c h a r b u f [ M A X B O F ] { 0 } ;

f i n d s t r ( f i l e n a m e )c h a r * f i l e n a m e ;

F I L E i n f i d ;c h a r * p

c h a r c l u n s i g n e d l e n g t h , l i n e n o ;

c * m a t c h s t r ;l e n g t h = s t r l e n ( m a t c h s t r ) ;i n f i d = f o p e n ( f i l e n a m e , " r " ) ;i f ( i n f i d N U L L )

f p r i n t f ( s t d o u t , " c a n n o t o p e n % s . \ n "r e t u r n ;

f i l e n a m e ) ;

f o ( l i n e n o = l ; f g e t s f b u f , M A X B U F , i n f i d ) ; + + l i n e n o )f o ( p = b u f ; ( p = i n d e x ( p , d ) ! N U L L ; + + p )

/ c o n s i d e r a l l o c c u r r e n c e s o f c * i f ( s t r n c m p l p , m a t c h s t r , l e n g t h ) 0

p r i n t f ( " % s % d : % s " , f i l e n a m e , l i n e n o , b u f ) ;b r e a k ; / s t o p a f t e r f i r s t m a t c h o n l i n e *

f c l o s e ( i n f i d ) ;

T h s a m e m o d i f i c a t i o n c o u l d b m a d e t t h p r o g r a m s w h i c hc o m e o t h P o w e r d i s k , s u c h a p r i n t . c , f o r m a t . c a n f i n d . c .

I m p r o v i n g p e r f o r m a n c e

n o t i c e a b l e p e r f o r m a n c e i m p r o v e m e n t c a n b e m a d e b r e p l a c i n g t h g d i r l i n e r o u t i n e w i t h o n w r i t t e n i a s s e m b l e r .T h i s i p r i m a r i l y b e c a u s e t h l i b r a r y f g e t c r o u t i n e d o e sr e l a t i v e l y e x p e n s i v e c h k i n K e r n a l c a l l f o e a c h c h a r a c t e r .

C / A S S M v e r s i o n 2 . 1 0 / 2 4 / 8 5g d i r l i n e . a :

g d i r l i n e c a l l a b l e f u n c t i o n r e a d s a l i n e f r o m d i r e c t o r y " l o a d " f o r m a ti n g d i r l i n e ( b u f , f i d )c h a r * b u fF I L E f i d

r e t u r n s a f u n c t i o n v a l u e " b a s i c l i n e n u m b e r " ( " n u m b e r o f b l o c k s " i d i r e c t o r y l i n e )

F F C 6F F C C

c h k i nc l r c h n

$ f f c 6$ f f c c

0 3 3 C a r g s t k = $ 0 3 3 c0 0 4 C s a v e x = $ 4 c0 0 F B b u f p = $ f b0 0 4 D f i d = $ 4 d0 0 4 E s a v e y = $ 4 e

a n $ f f o r c h k i n

. r e f c $ f u n c t i n i t. r e f c $ g e t c h a r. d e f g d i r l i n e

f i r s t , c a l l c $ f u n c t _ i n i t f o q u i c k s e t u pc o p y p a s s e d p a r a m e t e r s f r o m t r a n s f e r a r e a ( c a s s e t t e b u f f e r ) t z

0 0 0 00 0 0 30 0 0 50 0 0 80 0 0 A0 0 0 D0 0 0 F0 0 1 20 0 1 40 0 1 5

2 0 8 6 4 CB D 3 C8 F B 3 8 F B 3 8 5 4 DA 2 0 C 6

0 g d i r l i n e

0

0

0

F

j s s t I d s t I d s t I d s t t a j s

c $ f u n c t _ i n i ts a v e xa r g s t k , xb u f pa r g s t k + l , xb u f p + 1a r g s t k + 2 , xf i

c h k i n

o u t p u t b u

l o w b y t eo f f i d a r g

s e l o g i c a l i n p u t d e v i c e

Page 75: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 75/84

0 0 1 80 0 1 B

2 4 0 2 4 0

] s j s

c g e tc g e t

s k i p " l i n k "

n o g e t " b a s i c l i n e n u m b e r " a n d s a v e a s n o r m a l r e t u r n v a l u e

0 0 1 E0 0 2 10 0 2 30 0 2 60 0 2 90 0 2 B

2 0 4 2 0 0A 4 9 3 0 2 4 0 A 6 4 C9 3 D 0 3

j s l d s t j s l d s t

c g e ts a v e xa r g s t k , xc g e ts a v e xa r g s t k + l , x

l o w b y t e

a n d h i g h

r e a d r e s t o f l i n e i n t o b u f f e r , u n t i l z e r o b y t e o r b a s t a t u s e n c o u n t e r e d

0 0 2 E0 0 3 0

0 0 3 20 0 3 50 0 3 70 0 3 90 0 3 B0 0 3 D0 0 3 F

A 0 8 4 4 E

2 4 2 0 0 l o o pA 4 9 F E 4 C 0 D 0 F 34 C C C F F

l d s t s a v e y

j s c g e tl d y s a v e ys t a ( b u f p ) , yi n c s a v e yc m # b n e l o o pj m c l r c h n y e r e t u r n

n e x t c h a r

s a v e i t

z e r o ?n

c g e t c a l l t h e C l i b r a r y i n t e r n a l r o u t i n e c $ g e t c h a r t o r e a d c h a r a c t e r f r o mt h e c u r r e n t c h k i n i n p u t f i l e . c $ g e t c h a r m u s t s t i l l b e p a s s e d t h e l o g i c a l f i l en u m b e r i n t h e ' a r e g i s t e r s i c a n c h e c k w h e t h e r E O F h a s b e e n r e a c h e d o nt h a t f i l e y e t .

c $ g e t c h a r r e t u r n s w i t h c a r r y s e i E O r e a c h e d , o t h e r w i s e i r e t u r n s t h e n e x t c h a r a c t e r f r o m t h e f i l e i t h ' a r e g i s t e r , c g e t i s l o c a lt o t h i s g d i r l i n e f u n c t i o n , s o i t a r r a n g e s t o r e t u r n f r o m g d i r l i n e w i t hf u n c t i o n v a l u e o f E O F w h e n e n d - o f - f i l e i r e a c h e d .N o r m a l l y , c g e t r e t u r n s t h en e x t c h a r a c t e r f r o m t h e c u r r e n t f i l e i n t h e ' a r e g i s t e r .

0 0 4 20 0 4 40 0 4 70 0 4 9

0 0 4 A0 0 4 B0 0 4 C0 0 4 E0 0 5 00 0 5 3

A 2 B 6

6 6 A A 9 9

4 0 0

4 F 3 3

c g e t0

e o

0 0

I d j s b c r t

p l a ;p l a ;l d I d s t s t

f i c $ g e t c h a re o

r e t u r n E O p o p r e t u r ns a v e x# $ f fa r g s t k , xa r g s t k + l , x

f r o m g d i r l i n ea d d r e s ss t o r e E O ( - 1 ) a s r e t u r n v a l u e

a n r e t u r n f r o m g d i r l i n e

0 0 5 6 4 C C C F F j m c l r c h n

E n d o f a s s e m b l y , e r r o r s

h g d i r l i n e . a f i l e c a n b e a s s e m b l e d u s i n g t h p u b l i c d o m a i na s s e m b l e r t p r o d u c e g d i r l i n e . o f i l e w h i c h c a b

i p l a c e o t h c o m p i l e d v e r s i o n o g d i r l i n e . c t o m a k eo b r u n a b o u t t w i c e a f a s t .

b u ( o n o ! )

w o r d o c a u t i o n : C o m m o d o r e d r i v e s d n o w o r k w e l l t h a n o u t p u t f i l e o p e n a t h s a m e t i m e a t h d i r e c t o r y .

( b u t n o a l w a y s ) p r o g r a m u s i n g t h g l o ba n c r e a t i n g a o u t p u t f i l e o t h s a m e d e v i c e w i l li t d i r e c t o r y r e a d i n g t e r m i n a t e d p r e m a t u r e l y w i t h

s t r a n g e e r r o r s . T h s a m e p h e n o m e n o n c a b o b s e r v e dw h e n r e d i r e c t i n g t h e o u t p u t o t h P o w e r b u i l t - i nc o m m a n d , a i n > d i r e c t o r y . t m p

V e r y o f t e n , b u t n o t a l w a y s , t h l a s t f e f i l e s o t h d i s k w i l lb a b s e n t f r o m t h l i s t i n g c r e a t e d i t h o u t p u t f i l e .

E x e r c i s e s f o t h r e a d e r

W e l l , i w o u l d n ' t b f a i r t o f i n i s h t h i s d i s c u s s i o n w i t h o u tl e a v i n g t h r e a d e r w i t h s o m e f o o d f o t h o u g h t , w o u l d i t S I ' l l e n w i t h f e s u g g e s t i o n s a t h o y o m a w a n t t a l t e r g l o b f o y o u r o w a p p l i c a t i o n s .

V e r y o f t e n w h e n s p e c i f y i n g f i l e n a m e t C o m m o d o r e d i s kd r i v e , i i n e c e s s a r y t o s u f f i x i w i t h t h f i l e t y p e . U n d e rc e r t a i n c i r c u m s t a n c e s , t h e n , t h i s , s , p o , u ( o r e v e n , o , c s u f f i x g i v e s e x t r a i n f o r m a t i o n a b o u t t h f i l e n a m e . I i s i m i l a rt t h f i l e n a m e e x t e n s i o n s o M S - D O S , a l t h o u g h u s u a l l y i i o p t i o n a l . S t i l l , i m i g h t b n i c e t h a v e i o t h e n o t h f i l en a m e p a s s e d t t h f u n c t i o n c a l l e d t h r o u g h g l o b .

P e r h a p s , t h e n , i t h e p a t t e r n p a s s e d t d e v g l o b i n c l u d e s s u f f i xl i k e , p o , * o r , ? a t t e n t i o n s h o u l d b p a i d t t h f i l e t y p e a n i s h o u l d b p u o t h e n o t h f i l e n a m e p a s s e d o t o t h ef u n c t i o n .

S i m i l a r t r e a t m e n t c o u l d b a f f o r d e d ? : * : o 0 o 1 t s p e c i f y d i r e c t o r y . w a c o u l d e v e n b e w o r k e d o u t t r e a tt h d e v i c e n u m b e r a s p a r t o t h p a t t e r n .

O U N I X , t h l i s t o f i l e n a m e s m a t c h i n g p a t t e r n i a l w a y ss o r t e d a l p h a b e t i c a l l y . T h u s c o u l d b e d o n e i d e v g l o b a w e l l .

g l o b i p r e s e n t e d h e r e a r o u t i n e . T h i s g l o b r o u t i n e c o u l d b u s e d t c r e a t e g l o b p r o g r a m t h a t c o u l d , i l i m i t e d f a s h i o n ,' g l o b ' o t h e r p r o g r a m s o c o m m a n d s .

g l o b < c o x n m a n d > [ < p a t t e r n > . .

c o u l d e x p a n d t h e p a t t e r n s i n t o t h l i s t s o m a t c h i n g f i l e n a m e s ,a n c a u s e :

< c o m m a n d > [ < £ i l e n a m e > . . . ]

t b e x e c u t e d . T h i s c a b e d o n e b y w r i t i n g t h e e x p a n d e dc o m m a n d l i n e t o t h e s c r e e n , a n s t u f f i n g t h e k e y b o a r d i n p u tb u f f e r t c a u s e i t b r e a d b t h P o w e r s h e l l a f t e r t h g l o bp r o g r a m e x i t s . O c o u r s e , i t h l i n e w o u l d e n u b e i n g g r e a t e rt h a n e i g h t y c h a r a c t e r s i n l e n g t h , i w o u l d n e e d t b t r u n c a t e d .

A p r e s e n t e d h e r e , t h g l o b f a c i l i t y c a b u s e f u l t s a v et y p i n g , a n a l l o w s e a r c h i n g f o f i l e s . A h i n t e d a e a r l i e r , t h p a t t e r n - m a t c h i n g p r i n c i p l e n e e d n o t o n l y b e u s e d f o f i l en a m e s , b u c a b u s e d w h e n m a t c h i n g o t h e r t y p e s o s t r i n g s .

[ l ] K e r n i g h a n , B r i a n W a n P l a u g e r , P . J . , S o f t w a r e T o o l s ,A d d i s o n - W e s l e y , 1 9 7 6 .

Page 76: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 76/84

T w A s s e m b l e r s F o G E O Sc o m p a r i s o n o f G e o C O P E a n G e o p r o g r a m m e r

b F r a n c i s G K o s t e l l a

G e o C O P E i a v a i l a b l e f o $ 2 ( U S ) f r o m :

B i l l S h a r p C o m p u t i n gP . O . B o 7 5 3 3W a c o , T 7 6 7 1 4

G e o p r o g r a m m e r i a v a i l a b l e f r o m :

B e r k e l e y S o f t w o r k s2 1 5 0 S h a t t u c k A v e .B e r k e l e y , C 9 4 7 0 4

I ' l i k e t p r e s e n t y o w i t h b r i e f o v e r v i e w o t w a s s e m b l e r st h a t r u u n d e r G E O S , a n d t h e n t h r o w s h o r t a r g u m e n t a y o a t w h y o s h o u l d b w r i t i n g p r o g r a m s f o G E O S .

I y o u ' v e w r i t t e n p r o g r a m s f o G E O S w i t h a n o n - G E O S a s s e mb l e r , y o a r p r o b a b l y f a m i l i a r w i t h t h t i m e - c o n s u m i n g h a s s l et h a t t h p r o g r a m m e r m u s t e n d u r e i o r d e r t c o n v e r t h i o b j e c tf i l e i n t o a r u n n a b l e G E O S f i l e . B e s i d e s t h o b j e c t f i l e n e e d i n gt b e m a n i p u l a t e d i o r d e r t w o r k w i t h G E O S , o n e m u s t c o ns t a n t l y e x i t G E O S t m a k e m o d i f i c a t i o n s a n w a i t w h i l e t h e a ss e m b l e r c r e a t e s t h n e f i l e , u s u a l l y w i t h o u t t h s p e e d t h a t t h T u r b o D O S a d d s , t h e n r e - b o o t t h G E O S s y s t e m .

W h a t t h G E O S p r o g r a m m e r n e e d s i s y s t e m t h a t o p e r a t e sw h i l e i t h G E O S e n v i r o n m e n t a n o u t p u t s G E O S - r e a d y f i l e s .T h e r e a r p r e s e n t l y t w p a c k a g e s ( t h a t k n o w o f ! ) t h a t d t h i s :g e o C O P E f r o m B i l l S h a r p C o m p u t i n g a n G e o p r o g r a m m e rf r o m B e r k e l e y S o f t w o r k s .

L o o k i n g i n t o G e o C O P E

G e o C O P E i t h l e s s c o m p l e x o t h t w a n w a t h f i r s tG E O S - s p e c i f i c a s s e m b l e r r e l e a s e d . T h C O P E s y s t e m h a t w m a i n p r o g r a m s , E d i t o r a n c o p e A S M ( t h e a s s e m b l e r ) .

T h n i c e s t p a r t o t h C O P E s y s t e m i t h E d i t o r . C O P E u s e s i t o w u n i q u e s t r u c t u r e f o r i t s o u r c e f i l e s , a n e a c h p a g e o f s o u r c e f i l e c a h o l d u t 8 o t e x t . f e a t u r e t h a t f o u n dv e r y u s e f u l , w a t h e E d i t o r ' s a b i l i t y t o m a k e t h s o u r c e f i l e se i t h e r G E O S S E o r V L I R . T h u s , m s y s t e m e q u a t e s f i l e w o u l db S E s t r u c t u r e a n w o u l d b . i n c l u d e d i t h m a i n V L I R

s o u r c e f i l e . V L I R f i l e c a h a v e 1 2 r e c o r d s , a n a 8 p e r e c o r d , y o c a s e t h a t e a c h o y o u r s o u r c e f i l e s c a g e v e r yl a r g e i n e e d e d .

f e o t h e r f e a t u r e s o t h E d i t o r t h a t l i k e d a n d f o u n d v e r yu s e f u l w e r e t h a b i l i t y t o s e t B o o k m a r k , s t h a t y o c o u l dr e t u r n t t h l a s t l i n e e d i t e d , a n a A u t o s a v e f e a t u r e t h a t a u t om a t i c a l l y u p d a t e d c h a n g e s w h e n s e l e c t e d . T h b i g g e s t a d v a nt a g e o t h E d i t o r i t h a t i i f a s t ! U n l i k e g e o W r i t e , y o c a q u i c k l y s c r o l l u o d o w n t h r o u g h d o c u m e n t , a n s i n c e i d o e s n ' t s u p p o r t f o n t s o f o n t s t y l e s y o u ' r e n o t l e f t w a i t i n gw h i l e t h s y s t e m c a l c u l a t e s 2 4 - p o i n t b o l d o u t l i n e s . T h E d i t o ra l s o s u p p o r t s T e x t S c r a p s , h a S a v e R e p l a c e f u n c t i o n , a n a l l o w s y o t s a v e s i n g l e p a g e s o V L I R s o u r c e f i l e a s s i n g l eS E s o u r c e f i l e s , a n d S E Q a p a g e s o V L I R f i l e s . T h C O P E E i t o r a l s o a l l o w s y o a c c e s s t D e s k A c c e s s o r i e s ( t h e s y s t e mc o m e s w i t h o n e : H e x C a l c a h e x / d e c / b i n c a l c u l a t o r ) a n d w o r k sw i t h a n R E U . T h o n l y t h i n g m i s s i n g f r o m t h E d i t o r i t h a b i l i t y t u s t a b s t o o f f s e t t h o p c o d e s a n c o m m e n t s f r o mt h l e f t m a r g i n .

O n t h i n g t b a w a r e o w h e n u s i n g C O P E ' s E d i t o r , i t h a t i s t o r e s e a c h l i n e o t h s o u r c e f i l e a n u l l - t e r m i n a t e d s t r i n g . I fy o u s t h T e x t S c r a p f u n c t i o n t m o v e t e x t t o o f r o mg e o W r i t e , y o u ' l l r u i n t o f e p r o b l e m s . P a s t i n g S c r a p i n t o

C O P E f i l e f r o m g e o W r i t e d o c u m e n t i s i m p l y t a k e n c a r e o b e n t e r i n g C R w h e r e t h l i n e e n d s s h o u l d b e B u g e o W r i t ew i l l c h o k e o C O P E S c r a p s ( t h e T e x t M a n a g e r h a n t r o u b l ew i t h t h e m , t h o u g h ) . I ' v e m a n a g e d t g e a r o u n d t h i s p r o b l e mb w r i t i n g s i m p l e f i l t e r p r o g r a m t h a t s t r i p s o u a l t h n u l l se x c e p t t h f i n a l o n e .

C O P E s u p p o r t s 2 d i f f e r e n t p s e u d o - o p s , f r o m t h t y p i c a l. B Y T E a n . W O R D t s o m e G E O S - s p e c i f i c o n e s l i k e . I C O N f o d e f i n i n g h e a d e r i c o n s a n . S E G M E N T f o m a p p i n g o u a n V L I R m o d u l e s . C O P E a l s o a l l o w s y o t d e f i n e m a c r o s w i t ht h . M A C a n . M N D d i r e c t i v e s .

L a b e l s c a b u t 3 c h a r a c t e r s i l e n g t h a n a r c a s e s e n s it i v e . C o p e a l s o a l l o w s y o t u s l o c a l b r a n c h l a b e l s u t 3 o u t s t a n d i n g ( u n r e s o l v e d ) l o c a l l a b e l s a r p e r m i t t e d . A l t h u s u a l a r i t h m e t i c a n l o g i c a l o p e r a t o r s a r s u p p o r t e d ( * / + - A N D , E O R , O R ) .

Page 77: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 77/84

I y o u ' r e j u s t g e t t i n g y o u r f e e t w e w i t h G E O S , G e o C O P E i t h

p e r f e c t p l a c e t s t a r t . . .

h m a j o r a d v a n t a g e t h a t t h C O P E s y s t e m h a i s i t s s i m p l en d i r e c t a p p r o a c h . W i t h i n a n h o u r o f r e a d i n g t h m a n u a l ,a a a p p l i c a t i o n u a n r u n n i n g . T h m a n u a l i t s e l f o n l y

t h f e a t u r e s o t h E d i t o r a n c o p e A S M . T h e x a m p l e sr f e w , b u c o v e r a l t h s p e c i f i c s . I y o u ' v e u s e d M A D S ,

a d a p t v e r y q u i c k l y a s t h e t w a r v e r y s i m i l a r .

h m a n u a l t o g e t h e r w i t h t h s a m p l e f i l e s w i l l h a v e y o w r i tn V L I R a p p l i c a t i o n s i n t i m e a a l l . B u s i n g t h . S E G M E N Ty o s i m p l y i n d i c a t e t h e n o o n V L I R m o d u l e a n h s t a r t o a n o t h e r . T h n i c e t h i n g a b o u t t h i s a p p r o a c h i t h a t

b e l s i n a l t h d i f f e r e n t m o d u l e s a r g l o b a l a n t h n e e d f o t a b l e s o r d u p l i c a t e l a b e l d e f i n i t i o n s i e l i m i n a t e d .

f i l e s a r e a s y t m a i n t a i n a n u p d a t e . I ' v e k e p t a l m s o u r c e i V L I R s t r u c t u r e : t h f i r s t p a g e h o l d s t h h e a d e rd e f i n i t i o n a n a i n d e x t t h e n t i r e f i l e , t h s e c o n d p a g em c o n s t a n t s a n e q u a t e s , t h e t h i r d p a g e h o l d s a l o m

a n t h s o u r c e c o d e b e g i n s o n p a g e f o u r . W r i t i n g e v e nh l a r g e s t o a p p l i c a t i o n s , I ' v e n e v e r g o n e o v e r 2 v l i r p a g e s

s o u r c e .

y o h a v e y o u r s o u r c e c o d er , y o l o a d t h a s s e m b l e r

n s e l e c t t h f i l e . C o p e A S M i a s s e m b l e r t h a t w i l l a s s e m

l t d i s k a n p r i n t a n e r r o r s t s c r e e n . Y o m a l i s t t h a s s e m

l o i t s e c o n d p a s s a n c a t u r ni s l i s t i n g o o o f f . C o p e A S M a l s o

y o t p a u s e t h l i s t i n g i I t h f i l e a s s e m b l e s w i t h o u t a n e r r o r s , y o c a e x i t

D e s k T o p a n r u t h f i l e . I y o d h a v e e r r o r s , y o u ' l l h a v ep a u s e t h a s s e m b l e r a n s c r i b b l e t h e m d o w n . T h i s i t h

p a r t o t h s y s t e m a o p t i o n t o u t p u t t a e r r o r f i l es o r e l y n e e d e d . F u r t h e r m o r e , a t t e m p t i n g t p a u s e t h s c r e e n

w i l l s o m e t i m e s s c r o l l t h e r r o r s o f f t h e s c r e e n , f o r c i n go t r e a s s e m b l e j u s t t s e t h e r r o r s .

C O P E c a o n l y h a n d l e u t 5 0 0 0 c h a r a c t e r s i i t t a b l e , s y o u ' l l h a v e t k e e p t h o s e l a b e l s s h o r t a n u s

o l o c a l l a b e l s i y o a r a s s e m b l i n g l a r g e a p p l i c a t i o n .l i m i t o c o p e A S M i t h a t i c a o n l y a s s e m b l e 8 s e

o c o d e a t i m e . T h i s i s n ' t a b i p r o b l e m a i m a t h o u g h : y o c a s i m p l y d i v i d e t h f i l e u i n t o V L I R

d u l e s a n d l o a d t h e m i a s p a r t o y o u r i n i t i a l i z a t i o n r o u t i n e .f a v o r i t e a p p r o a c h h e r e i t p u a l o m t a b l e s , g r a p h i c s ,

n f o n t s i n t o o n o m o r e V L I R m o d u l e s a n l o a d t h e m i h t a f t e r d r a w i n g t h i n t r o s c r e e n .

h a v e n ' t d o n e a n r i g o r o u s c o m p a r i s o n s o a s s e ml t i m e s , I ' v e g o o n g o o d e x a m p l e : t h e o r i g i n a l v e r s i o n o

w a a s s e m b l e d w i t h t h M A D S a s s e m b l e r , t h e n c o n v e r tt G E O S f o r m a t . T h a m o u n t o f t i m e t a k e n b e t w e e n l o a d i n g

h M A D S a s s e m b l e r a n l o a d i n g t h a s s e m b l e d a n d c o n v e r t e df r o m t h D e s k T o p w a s l i g h t l y u n d e r 3 5 m i n u t e s . A f t e rn g t h s o u r c e f i l e s t C O P E f o r m a t , t h e t i m e b e t w e e n

t h C O P E a s s e m b l e r a n l o a d i n g t h a s s e m b l e d a p p l i

c a t i o n w a j u s t a b o u t f o u r m i n u t e s ! N o I ' v e g o t a d m i t t h a tt h i s w a o a n r e u , b u e v e n w i t h o u t i t t h a s s e m b l y t o o ka b o u t s i o s e v e n m i n u t e s . ( B e s i d e s , M A D S d i d n ' t s u p p o r t t h R E U . )

I y o u ' r e j u s t g e t t i n g y o u r f e e t w e w i t h G E O S , C O P E i t h p e f e c t p l a c e t s t a r t . T h s y s t e m e a s i l y h a n d l e s s m a l l e r p r o g r a m sa n i f a i r l y f a s t a n e a s y t m a i n t a i n . B u o n c e y o u r a p p l i c at i o n s b e g i n t g r o w i s i z e , t h a t 5 , 0 0 0 c h a r a c t e r s y m b o l t a b l eb e g i n s t f i l l u f a i r l y q u i c k l y . O n c e y o g e t t h i s p o i n t , y o s h o u l d c o n s i d e r G e o p r o g r a m m e r .

T h f i r s t t h i n g t h a t s t r i k e s y o w h e n y o u o p e n t h G e o p r o g r a m m e r p a c k a g e i t h 4 5 0 - p a g e m a n u a l . I y o h a v e n u m b e r o G E O S p r o g r a m s , y o a r p e r h a p s u s e d t t h s o m e t i m e s s i m p l i s t i c d o c u m e n t a t i o n t h a t p r e s e n t s y o w i t h t h " t h i s i d i s k , p u t h d i s k i t h d r i v e . . . " l e v e l o i n f o r m at i o n . w a v e r y p l e a s a n t l y s u r p r i s e d t o p e n t h i s m a n u a l a n r e a d t h r o u g h i w i t h o u t e v e r h a v i n g m i n t e l l i g e n c e i n s u l t e d .T h f i r s t t w o d o z e n p a g e s d c o n t a i n t h b a s i c i n f o f o r f i r s tt i m e G E O S u s e r s , a n t h e r e i a c h a p t e r d e v o t e d t a o v e r v i e wo t h G e o p r o g r a m m e r s y s t e m , b u t h r e s t o t h m a n u a l i

f i l l e d w i t h l o a d s o u s e f u l i n f o r m a t i o n .G r a n t e d , t h i n f o i n o a l o r g a n i z e da w e l l a i m i g h t b e ( " N o w , w h e r e i t h a t p a r t a b o u t b i t w i s e e x c l u s i v e -o r ? ! " ) b u g e n e r a l l y y o u ' l l b a b l e t f i n d w h a t y o u n e e d w i t h l i t t l e p e r s i st e n c e . I a d d i t i o n , t h a p p e n d i c e s o ft h m a n u a l c o n t a i n d e t a i l e d l i s t i n g s o a l t h s y s t e m c o n s t a n t s a n v a r i a b l e s ,

a l o n g w i t h h a r d c o p y l i s t i n g o t h m a c r o a n s a m p l e s o u r c ef i l e s i n c l u d e d o d i s k .

T h G e o p r o g r a m m e r d i s k i t s e l f i f l i p p y t h a t i n c l u d e s , b s i d e s t h s a m p l e f i l e s a n d s y s t e m s y m b o l s a n m a c r o s , t h t h r e e p r o g r a m s t h a t m a k e u t h G e o p r o g r a m m e r s y s t e m :G E O A S S E M B L E R , G E O U N K E R a n G E O D E B U G G E R . N o t h e r e i n e d i t o r h e r e . U n l e s s y o u h a v e t e x t e d i t o r t h a t h a n d l e sg e o W r i t e f i l e s [ s u c h a s Q & E d i t , w r i t t e n b K o s t e l l a a n B u c k l e y a n a v a i l a b l e f r o m R U E d . ] , y o u ' l l h a v e t e d i ty o u r s o u r c e f i l e s w i t h g e o W r i t e l A n G e o p r o g r a m m e r i t w o - d r i v e s y s t e m ; y o c a u s i w i t h o n d r i v e , b u t h a m o u n t o d i s k s w a p p i n g i n v o l v e d w i l l q u i c k l y c o n v i n c e y o t h a t t h a t s e c o n d d r i v e i w o r t h t h m o n e y . B e t t e r y e t , a R E i n o o n l y f a s t s e c o n d d r i v e t h a t m a k e s u s i n g g e o W r i t et o l e r a b l e , b u i w i l l a l l o w y o t u s G E O D E B U G G E R t i t f u l l e s t .

T h a t b e i n g s a i d , l e m g i v e b r i e f o v e r v i e w o t h a s s e m b l yp r o c e s s . O n c e y o u ' v e e d i t e d a l o y o u r s o u r c e , y o a s s e m b l ee a c h o t h s o u r c e f i l e s i n t o . r e l r e l o c a t a b l e o b j e c t f i l e s . T h e ny o l o a d a l i n k e r f i l e ( a l s o g e o W r i t e d o c u m e n t ) i n t o G E O L I N K E R t l i n k t o g e t h e r y o u r . r e l f i l e s i n t o a r u n n a b l e G E O Sf i l e o d i s k . N o y o c a l o a d G E O D E B U G G E R t t e s t a n d d eb u y o u r p r o g r a m . S o u n d s s i m p l e , e h W e l l , t h e r e ' s l o m o r eg o i n g o h e r e t h a n w o u l d a p p e a r . G e o p r o g r a m m e r g i v e s y o a c c e s s t s o m e p o w e r f u l f e a t u r e s a n a b i l i t i e s t h a t y o m a

Page 78: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 78/84

f i n d t h a t y o w o n ' t w a n t t d w i t h o u t o n c e y o u ' v e g o t t e nu s e d t t h e m .

F i r s t o f f , G E O A S S E M B L E R i t w o - p a s s a s s e m b l e r t h a t s u p p o r t sn u m b e r o u s e f u l f e a t u r e s : c o n d i t i o n a l a s s e m b l y , m a c r o s , l

c a l a b e l s , t h a b i l i t y t p a r s e c o m p l e x a l g e b r a i c e x p r e s s i o n s ,a n t h a b i l i t y t p a s s s y m b o l s t t h l i n k e r o d e b u g g e r .G E O A S S E M B L E R w i l l a l s o o u t p u t a e r r o r f i l e t d i s k ( i g e o W r i t e f o r m a t , o c o u r s e ! ) , i n e e d e d , f o e a c h f i l e a s s e mb l e d .

W h e n G E O A S S E M B L E R s t a r t s a s s e m b l i n g f i l e , i u s e s t h r e ec o u n t e r s t k e e p t r a c k o t h c o d e : . z s e c t f o r z e r o p a g e r a m ,. p s e c t f o r p r o g r a m c o d e , a n . r a m s e c t f o u n i n i t i a l i z e d d a t a . I y o u ' r e l a z y l i k e a m w h e n y o n e e d n e v a r i a b l e , y o j u s ta d i s o m e w h e r e i t h c u r r e n t s e c t i o n o c o d e i n s t e a d o a d d i n g i t s e p a r a t e s e c t i o n o c o d e f o r v a r i a b l e s . B u s i n gt h e . p s e c t a n . r a m s e c t d i r e c t i v e s , y o c a a d v a r i a b l e s j u s ta b o u t a n y w h e r e l i k e t h i s :

. r a m s e c tM y V a r i a b l e :

. p s e c t \ b. b l o c k

W h e n t h a s s e m b l e r e n c o u n t e r s t h i s c o n s t r u c t i o n , i w i l l g i v et h l a b e l M y V a r i a b l e t h a d d r e s s o f t h e c u r r e n t a d d r e s s o f. r a m s e c t ( w h i c h c a n b e s e b t h . r a m s e c t d i r e c t i v e o i t h l i n k e r f i l e ) . T h . r a m s e c t s e c t i o n d e f a u l t s t t h R A f o l l o wi n t h l a s t b y t e o c o d e , t h u s w d o n ' t e n d u p a s s e m b l i n gu n i n i t i a l i z e d v a r i a b l e s a n d a d d t t h l e n g t h o t h p r o g r a m .P e r h a p s n o t a b i g d e a l , b u w h e n y o h a v e f e h u n d r e db y t e s o v a r i a b l e s i b e c o m e s n o t i c e a b l e .

A n o t h e r u s e f u l f e a t u r e o t h a s s e m b l e r i t h 1 6 - b i t e x p r e ss i o n e v a l u a t o r { g e o u n k e r a l s o u s e s t h s a m e e v a l u a t o r ) . B s i d e s t h e u s u a l a r i t h m e t i c , t h e e v a l u a t o r h a n d l e s n u m b e r o l o g i c a l o p e r a t o r s : t h m a n u a l l i s t s t h i r t y o f t h e m . u s u a l l yk e e p a w a y f r o m c r e a t i n g e x p r e s s i o n s t o o c o m p l e x t b e u n d e rs t o o d a o n g l a n c e , b u G E O A S S E M B L E R w i l l l e y o c r e a t es o m e t r u l y b i z a r r e a n o u t l a n d i s h e x p r e s s i o n s i y o s d e s i r e !B u t h r e a l p o w e r f i n d h e r e i t h a t y o c a e a s i l y c r e a t e d a t at a b l e s w i t h f e e a s i l y c h a n g e d c o n s t a n t s a t h r o o t o s o m ec o m p l e x e x p r e s s i o n s . P e r h a p s t h i s d o e s n ' t s e e m t h a t u n u s u a l ,b u I ' v e b e e n a b l e t c r e a t e e x p r e s s i o n s t h a t a l t h o t h e r a s e m b l e r s o w h a v e c h o k e d o n a n d o n ' t m i s s h a v i n g t d t h m a t h b h a n d .

Y o r u G E O A S S E M B L E R f r o m D e s k T o p a n s e l e c t t h f i l e t a s e m b l e f r o m t h t y p i c a l 1 5 - f i l e d i a l o g b o x . O n c e y o u ' v e s l e c t e d t h e f i l e t a s s e m b l e , y o a r g i v e n c h o i c e o d r i v e f o t h o u t p u t f i l e , t h e n t h f i l e i s a s s e m b l e d . T h o u t p u t f i l e i s t h s a m e n a m e a s t h e s o u r c e f i l e b u t w i t h . r e l a p p e n d e d . W h e nt h i s i d o n e , y o c a q u i t t D e s k T o p , a s s e m b l e a n o t h e r f i l e , o o p e n t h e e r r o r f i l e ( i . e . e n t e r g e o W r i t e ) i o n w a g e n e r a t e d .f r i e n d o m i n e w h b e t a - t e s t e d t h v e r s i o n 2 . p a c k a g e t e l l sm t h a t G E O A S S E M B L E R V 2 . 0 w i l l a l l o w y o t g d i r e c t l y t ot h l i n k e r , a n t h a t i i n o l i m i t e d t s e l e c t i n g o n l y t h f i r s t1 s o u r c e f i l e s o d i s k .

O n c e y o u ' v e a s s e m b l e d a l t h . r e l f i l e s i y o u r p r o g r a m , i t ' st i m e t u s g e o u n k e r . G e o u n k e r d o e s m o r e t h a n j u s t c o n e c t s e p a r a t e o b j e c t f i l e s t o g e t h e r . F i r s t o a l l , g e o l i n k e r u s e s

l i n k f i l e t d e t e r m i n e t h s t r u c t u r e o t h o u t p u t p r o g r a m , b ei G E O S S E Q , V L I R , o r C B M , w h i c h i ' r e g u l a r ' o b j e c t f i l e . S e o n d l y , t h l i n k e r w i l l a d t h h e a d e r t t h f i l e . T h l i n k e r w i l la l s o c r o s s - r e s o l v e a l l a b e l r e f e r e n c e s b e t w e e n t h d i f f e r e n t. r e l f i l e s ; i f l a b e l i d e f i n e d i t w d i f f e r e n t f i l e s , b u i n o r e f e r e n c e d i t h i r d f i l e G E O U N K E R w i l l n o f l a g a e r r o r .

O n t h i n g w o u l d l i k e t m e n t i o n h e r e i t h a t a l t h o u g h t h a s e m b l e r a n l i n k e r a c c e p t s y m b o l n a m e s u p t 2 c h a r a c t e r s i l e n g t h , o n l y t h f i r s t e i g h t a r e s i g n i f i c a n t . T h i s i n o r e a l l yp r o b l e m , b u y o s h o u l d r e m e m b e r t h a t t h e r e a r f e h u d r e d s y s t e m s y m b o l s i t h g e o s S y m f i l e u s u a l l y . i n c l u d e d d u i n g a s s e m b l y .

o n c e w r o t e r o u t i n e n a m e d D e l e t e R e g i o n t h a t w a o n l yc a l l e d f r o m r o u t i n e i a n o t h e r s o u r c e f i l e . D e l e t e R e g i o n n e e s e e m e d t b c a l l e d , b u t h d i s k w o u l d g a c t i v e f o r s e o n w h e n i s h o u l d h a v e b e e n c a l l e d . T h d e b u g g e r o n l ys h o w s t h e e i g h t s i g n i f i c a n t c h a r a c t e r s o t h l a b e l w h e n y o l i s t t h c o d e , s o c o u l d n ' t i m a g i n e w h a t w a h a p p e n i n g . B u t h d e b u g g e r a l s o l e t s y o v i e w t h l a b e l n a m e b i t h e x a dd r e s s , a n u p o n e x a m i n a t i o n , t h i s l a b e l a p p e a r e d s o m e w h e r ei t h K e r n a l j u m p t a b l e . T h r o u t i n e t h a t w a b e i n g c a l l e dw a t h K e r n a l r o u t i n e D e l e t e R e c o r d l L u c k i l y d i d n ' t h a v ea n y V L I R f i l e s o p e n . . . .

G e o l i n k e r w i l l a l s o a l l o w y o t o u t p u t s e p a r a t e s y m b o l t b l ( a g a i n , g e o W r i t e f i l e ) t t h e d r i v e o y o u r c h o i c e . L i k eG E O A S S E M B L E R , i t h e r e a r a n e r r o r s , y o h a v e t h o p t i o n o fd i r e c t l y o p e n i n g t h e r r o r f i l e a f t e r l i n k i n g . O n t h i n g t n o t eh e r e i t h a t w h e n t h e r e a r m o r e t h a n 9 e r r o r s , t h s y s t e m w i l ls o m e t i m e s h a v e f a t a l c r a s h .

W h e n G E O U N K E R c r e a t e s t h e f i l e o d i s k , i a l s o w r i t e s s p e c i a l. d b g f i l e t d i s k f o u s b t h d e b u g g e r m o r e o t h i s l a t e r .

T h m a n u a l d o e s n o t i n c l u d e s p e c i f i c a t i o n s f o r e i t h e rG E O A S S E M B L E R o g e o l i n k e r , o t h e r w i s e I ' b h a p p y t o i nc l u d e a l i s t h e r e . I y o u d o r u i n t o p r o b l e m s a s s e m b l i n g a n l i n k i n g v e r y l a r g e f i l e s , y o c a n a l w a y s u s t h . n o g l b l a n . n o e q i n d i r e c t i v e s t o c u d o w n t h n u m b e r o s y m b o l s p a s s e dt t h l i n k e r . O n w a t q u i c k l y c u d o w n o t h n u m b e r o s y m b o l s i t u s . n o g l b l a n . n o e q i n b e f o r e . i n c l u d e g e o S y m( t h e s y s t e m l a b e l s a n e q u a t e s ) a n . g l b l a n . e q i n a f t e r . O c o u r s e y o d o n ' t g e t a n y t h i n g f o f r e e , a n t h e s e s y m b o l sd o n ' t g e p a s s e d t t h d e b u g g e r !

s n e a k y t r i c k u s w h e n d o i n g t h i s , t g e t h s y s t e m s y b o l s t t h d e b u g g e r w h e n w r i t i n g a l a r g e V L I R a p p l i c a t i o n , i t a s s e m b l e t h g e o s R o u t i n e s a n g e o s M e m o r y M a p a n l i n kt h e m i n t o o n o m m o d u l e s t h a t i s n ' t u s i n g v e r y m a n y s y mb o l s . E a c h m o d u l e h a i t o w s e o s y m b o l s a n d i s e l e c t e di t h d e b u g g e r b t h s e t m o d c o m m a n d . I y o u ' r e d e b u g g i n g

s t r e t c h o c o d e t h a t u s e s l o o s y s t e m c a l l s , j u s t r e s e t t h m o d u l e p r i o r i t y t t h m o d u l e w i t h t h s y s t e m s y m b o l s .

Page 79: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 79/84

A l t e r n a t e l y , f i n d t h a t j u s t d e f i n i n g t h p s e u d o - r e g i s t e r s a g l o b a l e q u a t e s h e l p s g r e a t d e a l w h e n d e b u g g i n g .

A n o t h e r p o t e n t i a l p r o b l e m I ' v e n o t i c e d t h a t i n o d o c u m e n te d i t h a t w h e n l i n k i n g f i l e s f r o m t w o d r i v e s , t h l i n k e r s e e m st s e a r c h f o r t h e f i l e o t h c u r r e n t d r i v e f i r s t , t h e n c h e c k s t h o t h e r d r i v e . T h p r o b l e m h e r e i t h a t i y o h a v e t w d i f f e r e n tv e r s i o n s o o n p a r t i c u l a r . r e l f i l e , l e t ' s c a l l i b e t a . r e l , a n t h i sf i l e i s u p p o s e d t b l i n k e d a f t e r f i l e c a l l e d a l p h a . r e l t h a t i n o o t h e c u r r e n t d i s k , w h e n t h l i n k e r s w i t c h e s d r i v e s t f i n da l p h a . r e l , i d o e s n o s w i t c h b a c k t t h o r i g i n a l d r i v e , p o t e nt i a l l y l i n k i n g t h e w r o n g b e t a . r e l . d o n ' t h a v e a n y e m p i r i c a le v i d e n c e f o t h i s , b u i y o u r m o d i f i c a t i o n s d o n ' t s e e m t b a p p e a r i n g i y o u r n e v e r s i o n o p r o g r a m , t r m o v i n g a l o t h . r e l f i l e s i o n v l i r m o d u l e t t h s a m e d i s k .

O n c e y o u ' v e a s s e m b l e d G E O S p r o g r a m , i t ' s t i m e t l o a dG E O D E B U G G E R h e r e ' s w h e r e t h f u b e g i n s ! G E O D E B U G G E R i

s o r t o ' s h e l l ' t h a t u s e s N M l s t t a k e c o n t r o l o t h m a c h i n ea n a l l o w s y o t d e b u g t h p r o g r a m ( o e x a m i n e t h K e r n a l )i a a l m o s t i n t e r a c t i v e e n v i r o n m e n t . L o a d y o u r p r o g r a m f r o mt h d e b u g g e r . N e e d t t w e a k s o m e v a l u e s o r c h e c k w h t h a tb r a n c h i s n ' t b e i n g t a k e n ? J u s t b a n g o n t h r e s t o r e k e y a n dy o u ' r e i t h G E O D E B U G G E R a g a i n .G E O D E B U G G E R i t h e b e s t t h i n g a b o u tt h i s p a c k a g e ; y o c a s e b r e a k p o i n t s ,a l t e r s t a c k o r e g i s t e r v a l u e s , a n a c c e s s t h e d i s k d r i v e s a l m o s t l i k es e c t o r e d i t o r .

a u t o e x e c m a c r o r e m o v e s t h e s e f r o m t h s y m b o l t a b l e , l i k et h i s :

G e o p r o g r a m m e r a l o n g w i t h a R E w i l l d r a m a t i c a l l y i n c r e a s e

y o u r o u t p u t a n c a p a b i l i t i e s . . .T h e r e a r e a c t u a l l y t w v e r s i o n s o fG E O D E B U G G E R . W h e n y o l o a d t h p r o g r a m , i f i r s t c h e c k s f o R E U . I t h e r e i o n c o n n e c t e d ,t h f u l l d e b u g g e r i l o a d e d i n t o t h R E U , o t h e r w i s e t h m i n i -d e b u g g e r i l o a d e d i n t o R A f r o m $ 3 E 0 0 t o $ 5 F F F . N e e d l e s s t s a y , t h R E s u p e r - d e b u g g e r i t h p r e f e r r e d o p t i o n .

W h a t m a k e s t h d e b u g g e r t r u l y u s e f u l i t h a b i l i t y f o i t u s t h . d b g f i l e s g e n e r a t e d b t h l i n k e r . T h e s e f i l e s c o n t a i n al i s t o s y m b o l s a n t h e i r a d d r e s s e s . T h i s w a y , w h i l e i n t h e d b u g g e r , y o c a l i s t a n d m o d i f y s e c t i o n o c o d e u s i n g l a b e l sf r o m y o u r s o u r c e f i l e s . O c o u r s e , y o u r c h a n g e s a r n o s a v e d ,b u t h i s a l l o w s y o t t r o u d i f f e r e n t t h i n g s w i t h o u t c o s t a n t l y r e a s s e m b l i n g t h p r o g r a m .

G E O D E B U G G E R i b a s i c a l l y m a c h i n e l a n g u a g e m o n i t o r w i t hp l e n t y o f e a t u r e s . O n o t h m o s t p o w e r f u l o t h e s e i t h s u p e r - d e b u g g e r i t h a b i l i t y t d e f i n e m a c r o s . M o s t o t h c o m m a n d s i t h d e b u g g e r a r e a c t u a l l y s y s t e m m a c r o s c o p o s e d o n u m b e r o m a c r o p r i m i t i v e s . G E O D E B U G G E R a l l o w sy o t d e f i n e u t 1 , 0 0 0 b y t e s o u s e r m a c r o s . T h e s e u s e rm a c r o s c a n b e m a d e u o t h m a c r o p r i m i t i v e s o s y s t e mm a c r o s . m a c r o f i l e w i t h t h s a m e n a m e a y o u r a p p l i c a t i o nw i l l b a u t o m a t i c a l l y l o a d e d a l o n g w i t h y o u r a p p l i c a t i o n .O p t i o n a l l y , y o c a d e f i n e d e f a u l t s e o m a c r o s a n d a a t o e x e c m a c r o t r u w h e n t h d e b u g g e r i l o a d e d . F o e x a m p l e , t h e l i n k e r a l w a y s p a s s e s a f e o t h s y s t e mv a r i a b l e s t t h d e b u g g e r , b u t h a v e n o u s f o t h e m , s m

. m a c r o a u t o e x e c n a m ec l r s y m P a s s l [ c r ] ; e l i m i n a t e s y m b o lc l r s y m p i c W f c r ]c l r s y m p i c H f c r ]

. e n d m

T h e r e a r d o z e n s o f o t h e r c o m m a n d s , b u t h e r e a r e p r o b l e m sw i t h s o m e o t h m e m o r y c o m m a n d s , m o s t n o t a b l y F I L L ,w h i c h d o e s n ' t w o r k a a l l . M b e t a - t e s t f r i e n d t e l l s m t h a t t h i sb u h a b e e n e l i m i n a t e d i t h 2 . v e r s i o n . T h o n l y o t h e rt h i n g t h a t o n c o u l d d e s i r e w o u l d b m o r e d e t a i l e d d e s c r i pt i o n o t h m a c r o p r i m i t i v e s i t h m a n u a l .

O v e r a l l , t h e G e o p r o g r a m m e r p a c k a g e i n i c e l y p u t o g e t h e r ,a n a l o n g w i t h a R E w i l l d r a m a t i c a l l y i n c r e a s e y o u r o u t p u ta n c a p a b i l i t i e s . M o s t e s p e c i a l l y , t h d e b u g g e r w i l l t e a c h y o a b o u t p r o g r a m m i n g f o G E O S b a l l o w i n g y o t e x a m i n e a n G E O S p r o g r a m a n d t h G E O S K e r n a l i d e t a i l .

I y o u ' r e n e t a s s e m b l y l a n g u a g e , s u g g e s t t h a t y o g i v ew r i t i n g G E O S p r o g r a m s t r y . c o m -m o p r o b l e m f o b e g i n n e r s i t h n e e d t d e v e l o p s e o r o u t i n e s t p e r f o r m c o m m o n f u n c t i o n s ; i . e . ,p r i n t i n g t e x t a n g r a p h i c s t t h s c r e e n , m o v i n g l a r g e c h u n k s o m e m o r y a r o u n d , d i s k a c c e s s , a n s t r i n g i n p u t t n a m e j u s t f e w .W h e n y o u ' r e j u s t s t a r t i n g o u t , y o

b a s i c a l l y b e g i n w i t h n o t h i n g , a n u n t i l y o u ' v e a c c u m u l a t e de n o u g h e x p e r i e n c e t w r i t e c o d e t p e r f o r m s o m e o t h a b o v ef u n c t i o n s , y o u r a b i l i t y t w r i t e u s e f u l p r o g r a m s i h i n d e r e d .W h e n y o c o d e f o G E O S , a l o t h e s e b a s i c f u n c t i o n s a r a l w a y sa v a i l a b l e . Y o c a c o n c e n t r a t e o w r i t i n g t h ' h e a r t ' o t h p r g r a m w i t h o u t g e t t i n g b o g g e d d o w n i m i n o r d e t a i l s . B g e t t i n gp r o g r a m s u p a n d r u n n i n g q u i c k l y , t h b e g i n n e r w i l l ( h o p e f u l l y )f o r m p o s i t i v e a s s o c i a t i o n s w i t h a s s e m b l y l a n g u a g e , i n s t e a d o t h i n k i n g o i a s o m e a r c a n e a r w h i c h i p a i n f u l l y l e a r n e d !

I y o u ' r e i n t e r e s t e d i n w r i t i n g G E O S p r o g r a m s , y o u m u s t g e a a s s e m b l e r p a c k a g e t h a t r u n s i G E O S . I y o u ' r e n o s u r e h o f a y o w a n t t g s u g g e s t y o g e t h g e o C O P E a s s e m b l e rf r o m B i l l S h a r p C o m p u t i n g . T h p r i c e i g o o d a n t h s y s t e md i r e c t a n u n c o m p l i c a t e d . I y o l a t e r d e c i d e t h a t y o n e e dm o r e p o w e r a n y o h a v e t w o - d r i v e s y s t e m ( o R E U ! ) a n c a a f f o r d t h e p r i c e , g f o G e o p r o g r a m m e r . I y o u ' r e a e p e r i e n c e d p r o g r a m m e r , s u g g e s t t h a t y o u g o s t r a i g h t t G e o p r o g r a m m e r o g e t h e m b o t h .

B e r k e l e y S o f t w o r k s s h o u l d b c o m m e n d e d f o r e l e a s i n g s u c hn i c e p a c k a g e , e s p e c i a l l y c o n s i d e r i n g t h r e l a t i v e l y s m a l l

m a r k e t f o p r o d u c t s o t h i s n a t u r e . U n f o r t u n a t e l y , t h e y d o n ' ts e e m a i t h e y ' r e g o i n g t r e l e a s e v e r s i o n 2 . a n t i m e s o o n .O n o n l y h o p e s t h a t t h e y w o u l d a t l e a s t c o n s i d e r d o i n g a m a i l -i u p g r a d e f o p r e s e n t u s e r s .

9 I s s u e

Page 80: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 80/84

N e w s B R K

F o r m a t E x e c u t i v e V e r s i o n 4 . 0 : P o w e r s o f t h a s a n n o u n c e d t h r e l e a s e o F o r m a t E x e c u t i v e V e r s i o n 4 . 0 . F o r m a t E x e c u t i v e i t h f i r s t a n o n l y c o m p r e h e n s i v e d i s k f o r m a t a n f i l e t r a n s f e rp r o g r a m f o t h C o m m o d o r e 1 2 a n 1 2 8 D . F o r m a t E x e c u t i v en o a l l o w s C o m m o d o r e 1 2 o 1 2 8 D c o m p u t e r w i t h 1 5 7 1 o 1 5 8 1 d r i v e t r e a d , w r i t e a n f o r m a t o v e r 1 5 d i f f e r e n t 3 . 5 " o 5 . 2 5 " M S - D O S ( P C - D O S ) , C P / M - 8 0 , C P / M - 8 6 , C o m m o d o r eC P / M a n C o m m o d o r e D O ( P R G , S E Q , U S R , R E L ) d i s k f o m a t s . T h i s m e a n s t h C o m m o d o r e 1 2 8 c a n n o t r a n s f e r f i l e sb a c k a n d f o r t h f r o m a l m o s t a n C P / M o M S - D O S m i c r o c o mp u t e r . T h m a n u a l a l s o d e t a i l s h o t u s F o r m a t E x e c u t i v eV e r s i o n 4 . t o t r a n s f e r f i l e s f r o m m a c h i n e s s u c h a t h C o m o d o r e A m i g a , t h e A t a r i S a n t h A p p l e M a c i n t o s h .

F o r m a t E x e c u t i v e V e r s i o n 4 . f e a t u r e s i n c l u d e : h i g h s p e e db u r s t f i l e t r a n s f e r t e c h n i q u e , f i l e t r a n s f e r s b e t w e e n a l f o r m a t s ,C o m m o d o r e P E T A S C I I t o t r u e A S C I I c o n v e r s i o n , l i n e f e e da d j u s t m e n t , w i l d c a r d s u p p o r t ( ? , * ) , s i n g l e d r i v e , m u l t i p l ed r i v e s , d u a l d r i v e s , R A M d i s k , a n h a r d d r i v e s u p p o r t ; C P / Mu s e r a r e a s u p p o r t , 1 5 8 1 p a r t i t i o n s u p p o r t , a n a u t o m a t i c d i s kl o g i n . B a c k u p d i s k s a r p e r m i t t e d . A l C o m m o d o r e d r i v ed e v i c e s a r s u p p o r t e d : 1 5 4 x , 1 5 7 x , 1 5 8 x d r i v e s , a n 1 7 x xR A M d i s k s . F o r m a t E x e c u t i v e V e r s i o n 4 . w i l l p e r m i t t r a n s f e r so a n A S C I I o O B J E C T f i l e o a n l e n g t h a b u r s t s p e e d .

F o r m a t E x e c u t i v e i c o m p a t i b l e w i t h C 1 2 8 s y s t e m e n h a n c e m e n t ss u c h a J i f f y D O S . c o m p l e t e l i s t o f s u p p o r t e d f o r m a t s i a v a i l a b l e o Q u a n t u m L i n k i t h f i l e : F E - F M T S . F o r m a t E x e c ut i v e V e r s i o n 4 . i a v a i l a b l e f o t h C o m m o d o r e 1 2 o 1 2 8 Dw i t h 1 5 7 1 o 1 5 8 1 d r i v e . S e n d c h e c k ( w k s . ) o m o n e y o r d e r f o $ 5 9 . 9 5 p l u s $ 3 . 5 0 S & ( C O D a d $ 3 t o P o w e r s o f t , I n c . , P . O .B o 7 3 3 3 , B r a d e n t o n , F L 3 4 2 1 0 . O Q u a n t u m L i n k : P o w e r s o f t

C P / M P r o d u c t i v i t y S o f t w a r e : T h P u b l i c D o m a i n S o f t w a r eC o p y i n g C o m p a n y i o f f e r i n g C P / M u s e r s a e x c l u s i v er e p a c k a g i n g o f W o r d S t a r v e r s i o n 2 . 2 6 . P D S C s a y s t h a t C P / Mu s e r s a r o f t e n l e f t o u t o f c u r r e n t s o f t w a r e r e l e a s e s , p d s c s a y st h a t i i c o m m i t t e d t p r o v i d i n g C P / M u s e r s w i t h t h m o s tp r o d u c t i v e C P / M s o f t w a r e a v a i l a b l e .

W o r d S t a r v e r s i o n 2 . 2 6 c a t u r n C o m m o d o r e 1 2 i n t o a e f f e c t i v e , p o w e r f u l w o r d p r o c e s s o r i n c l u d i n g f e a t u r e s s u c h a M a i l M e r g e , w h i c h a l l o w s u s e r s t m e r g e t e x t a n d / o r d a t a f i l e st g e n e r a t e f o r m l e t t e r s , b o i l e r p l a t e t e x t ( t e x t c r e a t e d f r o m f i l e so p r e - e x i s t i n g , c o m m o n l y u s e d s e c t i o n s o t e x t ) , m a i l i n g l i s t s ,a n l a r g e d o c u m e n t s .

P D S C i o f f e r i n g t h i s a s t h e f i r s t o m a n y c l a s s i c s o f t w a r e p r g r a m s f o r m a t t e d f o r t h e C o m m o d o r e 1 2 8 . T h i s C o m m o d o r e1 2 C P / M d i s k e d i t i o n c o m e s c o m p l e t e w i t h a O s b o r n eU s e r ' s R e f e r e n c e G u i d e t h a t e x p l a i n s h o t u s W o r d S t a r ,a n a l s o h a s e c t i o n s o t h C P / M o p e r a t i n g s y s t e m .

W o r d S t a r v e r s i o n 2 . 2 6 i I B d a t a - c o m p a t i b l e u s i n g r e a d i l ya v a i l a b l e c o n v e r s i o n s o f t w a r e i n c l u d i n g B i g B l u e R e a d e r a n U n i f o r m . W o r d S t a r v e r s i o n 2 . 2 6 a n m a n u a l a r a v a i l a b l e f o $ 3 9 . 9 5 p l u s $ 4 . 5 0 f o p o s t a g e a n h a n d l i n g .

T h U s e r ' s G u i d e a l s o d e s c r i b e s h o t u s o t h e r p r o g r a m sa v a i l a b l e f r o m P D S C : S u p e r C a l c a n M i c r o s o f t B A S I C ,w h i c h a r $ 2 e a c h w h e n o r d e r e d w i t h W o r d S t a r v e r s i o n 2 . 2 6( $ 3 9 . 9 5 e a c h p l u s $ 4 . 5 0 f o p o s t a g e a n h a n d l i n g i o r d e r e ds e p a r a t e l y ) .

A l s o i n c l u d e d i t h W o r d S t a r v e r s i o n 2 . 2 6 p a c k a g e i s e o K e F r o n t s . M o r e u s e f u l t h a n a q u i c k r e f e r e n c e g u i d e , t h e s es e l f - a d h e s i v e l e t t e r s a t t a c h t y o u r k e y b o a r d a n d i n c l u d e a l t h c o m m a n d s y o n e e d t u s t h s p e c i a l w o r d p r o c e s s i n gf u n c t i o n s o W o r d S t a r . F o m o r e i n f o r m a t i o n , c a l l o w r i t e :P D S C , 3 3 G o l d S t . , S u i t e L 3 N e Y o r k , N Y 1 0 0 3 8 , ( 8 0 0 ) 2 2 1 -7 3 7 2 , ( 2 1 2 ) 7 3 2 - 2 2 5 8 .

F O R T R A N C o m p i l e r f o C 6 4 : T h i r t y y e a r s a g o , F O R T R A Nw a t h f i r s t h i g h - l e v e l l a n g u a g e . T o d a y i r e m a i n s o n o t h m o s t u n i v e r s a l l y - u s e d p r o g r a m m i n g l a n g u a g e s . F o r t r a n 6 s u p p o r t s m o r e t h a n 4 s t a t e m e n t s a n f u n c t i o n s a n i p r a c t ic a l , e c o n o m i c a l a n d c o n v e n i e n t w a f o u s e r s t l e a r n F o r t r a no t h C 6 4 . F o r t r a n 6 i a i m e d a t h e s t u d e n t a n n o v i c ep r o g r a m m e r w h w a n t s t u s t h i s m a t h e m a t i c a l l y - b a s e dl a n g u a g e .

F o r t r a n 6 i n c l u d e s b u i l t - i n e d i t o r , c o m p i l e r a n l i n k e r , a n c r e a t e s f a s t s t a n d a l o n e p r o g r a m . O n c e c o m p l e t e d , t h p r g r a m m o d u l e m a b r u n w i t h o u t F o r t r a n . S u b r o u t i n e s a n f u n c t i o n s m a b e c o m p i l e d s e p a r a t e l y f r o m t h m a i n p r o g r a m .I n p u t a n o u t p u t m a b f r e e - f o r m o r f o r m a t t e d , a n t h e u s e rh a s a c c e s s t t h 6 5 0 2 r e g i s t e r s , K e r n a l a n d m a c h i n e l a n g u a g er o u t i n e s . F o r t r a n 6 c a r r i e s a s u g g e s t e d r e t a i l p r i c e o $ 3 9 . 9 5 .O t h e r l a n g u a g e p r o d u c t s f r o m A b a c u s : A d a , A s s e m b l e r ,B A S I C c o m p i l e r s , C O B O L , a n P a s c a l . C o n t a c t : A b a c u sS o f t w a r e , 5 3 7 0 5 2 n d S t S E G r a n d R a p i d s , M I 4 9 5 0 8 , ( 6 1 6 )6 9 8 - 0 3 3 0 .

S Y S L A W : L e g a l G u i d e f o S y s O p s : n e b o o k f r o mL L P r e s s e x p l a i n s t h l e g a l r i g h t s a n r e s p o n s i b i l i t i e s o s y s o p s , t h p e o p l e w h o p e r a t e c o m p u t e r i z e d b u l l e t i n b o a r ds y s t e m s ( B B S ) . W r i t t e n i c l e a r E n g l i s h b J o n a t h a n W a l l a c ea n d R e e s M o r r i s o n , t w l a w y e r s w h a r b o t h v e t e r a n s y s o p s ,t h o n e - h u n d r e d p a g e b o o k c o v e r s a l a s p e c t s o t h e m e r g i n ga r e a o S Y S L A W .

" M o r e t h a n 4 , 5 0 0 c o m p u t e r b u l l e t i n b o a r d s y s t e m s a r r u n n i n gi t h i s c o u n t r y , b u t h l e g a l r i g h t s a n r i s k s o t h e i r s y s o p s h a v en e v e r b e e n e x p l a i n e d " , s a y s J o n a t h a n W a l l a c e . " H u n d r e d s o u n k n o w i n g s y s o p s s e u B B S ' s o t h e i r h o m e c o m p u t e r s e a c h

Page 81: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 81/84

y e a r , " a c c o r d i n g t c o - a u t h o r R e e s M o r r i s o n , " a n d t h e y d o n ' tk n o w w h a t c a h a p p e n t t h e m l e g a l l y , o w h a t t h e y c a d o . "

S Y S L A W , o s y s o p l a w , f o r t h o s e w h r u b u l l e t i n b o a r d s y t e m s , c o n c e r n s t h l e g a l c o n s e q u e n c e s f o t h o s e w h r u B B S ' s . T h t o t a l n u m b e r o p e o p l e w h d i a l t h t h o u s a n d s o fb u l l e t i n b o a r d s y s t e m s i i t h e s e v e r a l h u n d r e d t h o u s a n d s , a n t h e l e g a l i s s u e s a r e p l e n t i f u l . M o r e i m p o r t a n t , t h l a a f f e c t i n gs y s o p s i n o m e r e l y u n s e t t l e d , i i u n e s t a b l i s h e d .

S i g n i f i c a n t l e g a l i s s u e s h a v e a r i s e n i c o n n e c t i o n w i t h B B S ' s ,b u n e i t h e r c o u r t s n o l e g i s l a t o r s h a v e c o m e t o g r i p s w i t h t h i st e c h n o l o g y . S c a t t e r e d s t a t e a n f e d e r a l s t a t u t e s c a a f f e c tB B S , a n t h c o m m o n l a w d e v e l o p m e n t o t h a r e a h a b e e ns p a r s e a n c o n f u s e d . G i v e n t h d y n a m i c a c t i v i t y o B B S ' s , t h t i m e w a r i p e f o c a r e f u l t r e a t m e n t o t h m a n y p o t e n t i a lp r o b l e m s , w h i c h i n c l u d e :

W h a t i s o m e o n e p o s t s c o p y r i g h t e d m a t e r i a l o t h b o a r d ?D o e s i m a t t e r i y o c h a r g e u s e r s o r a c c e p t a d s ?W h a t i y o d e l e t e c r u c i a l m e s s a g e b a c c i d e n t ?C a y o b a s o m e o n e f r o m u s i n g y o u r B B S ?

B e i n g u n s e t t l e d , S Y S L A W m i g h t d e t e r t h e d e v e l o p m e n t o t h i s t e l e c o m m u n i c a t i o n s e x p l o s i o n . T h a u t h o r s b e l i e v e t h a tB B S ' s o f f e r a e x c i t i n g , p r o g r e s s i v e a n i n f l u e n t i a l m e d i u m ,e v e n i i t i n f a n c y , t h a t w i l l b e p r o m o t e d b c l a r i t y o l a w a n da u n d e r s t a n d i n g o f s y s o p ' s r i g h t s a n r e s p o n s i b i l i t i e s .

T h s o f t c o v e r m a n u a l c o s t s $ 1 9 . 0 0 p l u s $ 2 . 0 0 f o p o s t a g e a n h a n d l i n g . O r d e r s a n c h e q u e s m a b s e n t t L L P r e s s , 1 5 B r o a d w a y , S u i t e 6 1 0 , N e Y o r k , N Y 1 0 0 3 8 .

S i m C i t y , T h C i t y S i m u l a t o r : M a x i s S o f t w a r e a n n o u n c e s t h r e l e a s e o S i m C i t y , T h C i t y S i m u l a t o r , f o C 6 4 / C 1 2 8 . W h e ny o e n t e r S i m C i t y y o t a k e o t h r o l e o M a y o r a n C i t yP l a n n e r o s o p h i s t i c a t e d s i m u l a t e d c i t y . Y o z o n e l a n d , b a a n c e b u d g e t s , i n s t a l l u t i l i t i e s , m a n i p u l a t e e c o n o m i c m a r k e t s ,c o n t r o l c r i m e , t r a f f i c a n p o l l u t i o n a n o v e r c o m e n a t u r a l d i a s t e r s . Y o c o n t r o l t h f a t e o t h c i t y .

D e s i g n , p l a n a n g r o w y o u r o w U t o p i a n d r e a m c i t y f r o m t h g r o u n d u p , o r t a k e o v e r a n o e i g h t i n c l u d e d p r e - b u i l t c i t i e so t h v e r g e o d i s a s t e r . S c e n a r i o s i n c l u d e : S a F r a n c i s c o , C 1 9 0 6 , j u s t b e f o r e t h e g r e a t q u a k e ; T o k y o , J a p a n 1 9 5 7 , j u s tb e f o r e a m o n s t e r a t t a c k ; a n B o s t o n , M 2 0 1 0 , j u s t b e f o r e an u c l e a r m e l t d o w n . W a t c h t h d i s a s t e r o c c u r , g a t h e r y o u r f u n d sa n i n f o r m a t i o n a n b r i n g t h c i t y b a c k t l i f e .

h c i t y i a l i v e : y o s e t r a f f i c o t h r o a d s , t r a i n s o t h a i l s , p l a n e s i t h a i r , e v e n f o o t b a l l g a m e s i t h s t a d i u m . Y o s e p o p u l a t i o n l e v e l s r i s e a n f a l l , r e s i d e n t i a l a r e a s d e v e l o p r o m s i n g l e f a m i l y h o m e s t c o n d o s t s l u m s . W a t c h c o m m e r i a l a n i n d u s t r i a l a r e a s g r o w o d e c l i n e d e p e n d i n g o y o u r k i l l a s t r a t e g i c c i t y p l a n n e r .

y o d t h p l a n n i n g a n z o n i n g , i i t h S i m u l a t e d C i t ia . k . a . S i m s , w h m o v e i a n a c t u a l l y b u i l d t h c i t y .

S i m s l i v e , w o r k , p l a y , m o v e , d r i v e , a n c o m p l a i n a b o u t t a x e s ,t r a f f i c , t a x e s , c r i m e a n t a x e s j u s t l i k e h u m a n s .

S i m C i t y i p r i m a r i l y a c o n s t r u c t i v e g a m e , b u t t h o s e w h c a n ' te n j o y g a m e w i t h o u t d e s t r u c t i o n c a w i p e o u c i t y t h r o u g ht e r r o r i s m , f i n a n c i a l m i s m a n a g e m e n t , o b e v o k i n g n a t u r a ld i s a s t e r s u c h a a e a r t h q u a k e o m o n s t e r a t t a c k .

S i m C i t y c o m e s w i t h e x t e n s i v e d o c u m e n t a t i o n i n c l u d i n g aU s e r R e f e r e n c e , a e x p l a n a t i o n o t h i n n e r w o r k i n g s o t h s i m u l a t i o n , a n a e s s a y o t h H i s t o r y o C i t i e s a n C i t yP l a n n i n g .

S i m C i t y i d i s t r i b u t e d b y B r 0 d e r b u n d a n c a r r i e s r e t a i l p r i c eo $ 2 9 . 9 5 . M a x i s S o f t w a r e s p e c i a l i z e s i S y s t e m S i m u l a t i o n s ,

n e t y p e o f e n t e r t a i n m e n t s o f t w a r e , w i t h e m p h a s i s o q u a li t g r a p h i c s a n s o p h i s t i c a t e d s i m u l a t i o n t e c h n i q u e s . M a x i sS o f t w a r e , 9 5 3 M o u n t a i n V i e w D r i v e , S u i t e # 1 1 3 , L a f a y e t t e ,C A 9 4 5 4 9 .

C 1 2 8 C P / M S o f t w a r e f r o m C r a n b e r r y S o f t w a r e T o o l s :C r a n b e r r y S o f t w a r e T o o l s o f f e r s v a r i e t y o f p r o d u c t s i n c l u di n p u b l i c d o m a i n d i s k e t t e c o n t a i n i n g w h a t t h v e n d o rd e s c r i b e s a " a e n t i r e l y n e C P / M e n v i r o n m e n t f o t h C 1 2 8 " I n c l u d e d o t h e d i s k a r e :

N E W S Y S . C O M g e n e r a t e s t h e 1 2 / 6 / 8 5 v e r s i o n o f C P / M 3 . C O N F . C O M C P / M 3 . c o n f i g u r a t i o n u t i l i t yC C P . C O M t h f a m o u s C C P 1 0 4 u p g r a d e d c o m m a n d

e n v i r o n m e n tH I S T . C O M c o m m a n d l i n e e d i t i n g a c c e s s o r y

T h C C P 1 0 4 e n v i r o n m e n t a l l o w s t h r e c a l l , e d i t i n g a n r e e x e c u t i o n o f c o m m a n d l i n e s ; e a s y u s e o f u s e r a r e a s ; a n n a m e d r e f e r e n c e t u s e r a r e a s . t o t a l o f 2 1 f i l e s a r e s u p p l i e d ,i n c l u d i n g p o w e r f u l C P / M f i l e m a n a g e m e n t u t i l i t i e s s u c h a A C O P Y , C S W E E P a n N S W E E P . L i m i t e d d o c u m e n t a t i o n i a l s o i n c l u d e d . T h c o s t o t h d i s k i j u s t $ 5 . 0 0 p o s t p a i d !

W a n t t t r y o u r h a n d a p r o g r a m m i n g ? C r a n b e r r y S o f t w a r eT o o l s ' P P r o g r a m m i n g S e r i e s i a i n e x p e n s i v e w a t g e y o u r f e e t w e t . T h f o l l o w i n g C P / M L a n g u a g e p a c k a g e s c o s to n l y $ 5 . 0 0 ( ! p e d i s k :

1 T h r e e B A S I C s : B A S I C 5 , E B A S I C , Z B A S I C2 F O C A L c a l c u l a t o r - l i k e s t a c k l a n g u a g e ( s o r r y , n

d o c u m e n t a t i o n )3 T w F O R T H s : U N I F O R T H , a n F I G - F O R T H ( s o r r y , n

d o c u m e n t a t i o n )4 L A S M Z 8 A s s e m b l e r5 S A M 7 6 u n u s u a l s y m b o l i c p r o c e s s i n g l a n g u a g e6 S m a l l - C I n t e r p r e t e r f u n , i n t e r a c t i v e e n v i r o n m e n t7 S m a l l - C C o m p i l e r f a s t s u b s e t o s t a n d a r d C a s s e m b l e r

r e q u i r e d8 P a r a s o l S y s t e m p o w e r f u l a n c o m p l e t e , l i k e C O B O L9 D r a c o S y s t e m p o w e r f u l a n c o m p l e t e , l i k e1 0 E - P r o l o g r u l e - b a s e d a r t i f i c i a l i n t e l l i g e n c e1 1 A l g o l / M s c i e n t i f i c l a n g u a g e l i k e A l g o l - 6 0

9 I s s u e 7

Page 82: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 82/84

1 2 C o n c u r r e n t P a s c a l - S h a s c o p r o c e s s e s l i k e M o d u l a - 21 3 P L / 0 m i n i a t u r e c o m p i l e r , c o m p l e t e w i t h s o u r c e1 4 R A T F O R T r a n s l a t o r F O R T R A N n e v e r l o o k e d t h i s g o o d

C r a n b e r r y ' s D i s k R e p o r t e r - 1 2 8 w a c r e a t e d w i t h t h C 1 2 8o w n e r i m i n d . D R - 1 2 8 t a k e s a d v a n t a g e o m a n y o t h s p e c i a l f e a t u r e s f o u n d o n l y i t h C 1 2 8 ' s C P / M + . D R - 1 2 8 w i l ld i s p l a y t h c o n t e n t s o y o u r C P / M d i s k e t t e s s o r t e d b f i l en a m e , e x t e n s i o n , s i z e o d a t a . T h c o n t e n t s o a l u s e r a r e a s a r s h o w n , n o j u s t a r e a z e r o . U n l i k e m a n y u t i l i t i e s w r i t t e n f o t h o l d e r C P / M 2 . 2 , D R - 1 2 8 w i l l d i s p l a y t h e c o r r e c t a m o u n t o f r e e s p a c e r e m a i n i n g o C 1 2 8 d i s k e t t e . B e s t o f a l l , D R - 1 2 8w i l l p r i n t h a n d y d i s k e t t e l a b e l s o y o u r p r i n t e r . J u s t $ 8 . 9 5 .

T h A l p h a N o t e Q u i c k R e f e r e n c e S y s t e m f r o m C r a n b e r r y i p e r s o n a l t e x t d a t a b a s e p r o g r a m f o a l c o m p u t e r s r u n n i n g t h C P / M o p e r a t i n g s y s t e m ( a s p e c i a l v e r s i o n c u s t o m i z e d f o t h C 1 2 8 i a v a i l a b l e ) . A l p h a N o t e h a b e e n d e s i g n e d t s e r v e a a " i n t e l l i g e n t m e m o p a d " t h a t c a a s s i s t y o i c a p t u r i n g t h l a r g e n u m b e r o u s e f u l f a c t s t h a t b o m b a r d y o d u r i n g t h a v e ra g d a y .

A l p h a N o t e c a s t o r e a u n l i m i t e d n u m b e r o f r e e - f o r m a t t e x tn o t e s , w i t h n l e n g t h r e s t r i c t i o n s o t h e r t h a n t h s i z e o y o u rd r i v e . E a c h n o t e c a b a s s o c i a t e d w i t h s e v e r a l ' k e y p h r a s e s 't h a t c a a s s i s t y o i f i n d i n g t h e n o t e a f t e r i i s t o r e d , m u c hl i k e t h c a r d c a t a l o g i l i b r a r y .

P a r t i a l k e y w o r d m a t c h i n g a n c a s e - i n d e p e n d e n t k e y w o r dm a t c h i n g a r e a v a i l a b l e t e x t e n d t h p o w e r o y o u r s e a r c h e st h r o u g h A l p h a N o t e d a t a f i l e s . N n e e d t m e m o r i z e l o t s o k e y w o r d s y o c a n c h o o s e t s e a r c h t h r o u g h t h m a i n t e x t o y o u r n o t e s a s w e l l . Y o c a c r e a t e a n u s a m a n y d i f f e r e n t' n o t e - b a s e s ' a s y o w i s h . U s i n g A l p h a N o t e i s n a p , w i t h t h p r o g r a m ' s e a s y - t o - u s e , s i n g l e - k e y m e n u i n t e r f a c e .

A l p h a N o t e c a d i s p l a y a n n o t e u s i n g q u i c k , r a n d o m - a c c e s sd i s k t e c h n i q u e s . Y o c a c a l l u f u l l - s c r e e n ' d i r e c t o r y ' o y o u r s t o r e d n o t e s a a a l t e r n a t i v e t s e a r c h i n g f o p a r t i c u l a re n t r y . N o t e s m a b q u i c k l y a d d e d a n d d e l e t e d , t o b e t t e r a c c o mm o d a t e t h s h o r t - t e r m i m p o r t a n c e o t h i s t y p e o f d a t a . T h s p e c i a l i n t r o d u c t o r y p r i c e o A l p h a N o t e i j u s t $ 9 . 9 5 p o s t p a i d .

A l s o f r o m C r a n b e r r y S o f t w a r e T o o l s , A l p h a T e x t T o o l s( $ 3 9 . 9 5 ) i a i n t e g r a t e d t e x t p r o c e s s i n g s y s t e m p e r f e c t f o h o m e o s m a l l b u s i n e s s u s e . T h T o o l s a r d i v i d e d i n t o s i m a j o r s e c t i o n s : 1 A l p h a T e x t F o r m a t t e r , a n e m b e d d e d c o m a n d t e x t p r o c e s s o r w i t h o v e r 3 c o m m a n d s , g i v i n g t h u s e rt o t a l c o n t r o l o v e r m a r g i n s , p a g e l a y o u t , h e a d e r s a n f o o t e r s ,n u m b e r i n g s t y l e , a n t e x t j u s t i f i c a t i o n . A l p h a T e x t a l s o f e t u r e s m a i l m e r g e c a p a b i l i t y , a u t o m a t i c n u m b e r i n g o f p a r ag r a p h s a n l i s t s , t a b l e o c o n t e n t s g e n e r a t i o n , a n u s e r c u t o m i z a b l e p r i n t e r a n v i d e o c o n t r o l , i n c l u d i n g o n - s c r e e n p r v i e w o t h f o r m a t t e d t e x t . 2 A l p h a E d i t E d i t o r , f o e f f o r tl e s s e d i t i n g o b o t h d o c u m e n t s a n d p r o g r a m t e x t . A l p h a E d i tf e a t u r e s o v e r 3 s i n g l e - k e y c o m m a n d s a n i o p t i m i z e d f o u s w i t h A l p h a T e x t . 3 A l p h a S p e l l S p e l l i n g C h e c k e r , c o p l e t e w i t h 3 4 , 0 0 0 w o r d d i c t i o n a r y . 4 ) A l p h a F o n t P r i n t e r

E n h a n c e r , w h i c h g i v e s o w n e r s o E p s o n c o m p a t i b l e d o t -m a t r i x p r i n t e r s t h e c a p a b i l i t y t p r o d u c e n e a r l e t t e r q u a l i t yd o c u m e n t s i f o u r d i s t i n c t i v e f o n t s . Y o c a d e s i g n y o u r o w f o n t s o m o d i f y t h e f o n t s s u p p p l i e d w i t h t h p a c k a g e . C u t o s y m b o l s m a b e a s i l y c r e a t e d . M o s t E u r o p e a n l a g u a g e s a r s u p p o r t e d a n f o n t s a r b e i n g c r e a t e d f o m a n yM i d d l e a n F a E a s t e r n l a n g u a g e s . A l p h a F o n t c a p r o c e s sb o t h r i g h t - f l o w i n g a n l e f t - f l o w i n g l a n g u a g e s . 5 A l p h a M e n u I n t e r a c t i v e E n v i r o n m e n t , f o e a s y e x e c u t i o no t h T o o l s w i t h j u s t s i n g l e k e y p r e s s . 6 A l p h a U t i l i t i e s ,w h i c h p e r f o r m d i c t i o n a r y u p d a t e , t e x t f i l e c o n v e r s i o n , a n f o n t c r e a t i o n a n m o d i f i c a t i o n .

T h A l p h a T e x t T o o l s a r f u r n i s h e d w i t h a e x a m p l e - f i l l e dU s e r ' s G u i d e , t w q u i c k r e f e r e n c e p a g e s , a n a T u t o r i a l f o n e u s e r s .

A 8 0 , 0 0 0 w o r d A l p h a S p e l l d i c t i o n a r y i a l s o a v a i l a b l e( $ 1 0 . 9 5 ) a i d i s k w i t h f o u r a d d i t i o n a l f o n t s ( $ 1 2 . 9 5 ) .

A l p h a S h a p e ( $ 9 . 9 5 ) w i l l r e f o r m a t d o c u m e n t s t h a t h l f t v ea l r e a d y b e e n f o r m a t t e d , s u c h a t h d o c u m e n t a t i o n f i l e s t h a tu s u a l l y a c c o m p a n y s h a r e w a r e . A l p h a S h a p e r e p a r s e s s u c h d o cu m e n t s , e l i m i n a t i n g c o n t r o l c h a r a c t e r s a n c h a n g i n g p a g i n at i o n , b l a n k l i n e s e q u e n c e s , a n m a r g i n s t t h u s e r ' s t a s t e . I a l s o s u p p o r t s a t w o - c o l u m n p r i n t i n g m o d e f o d r a m a t i c s i z er e d u c t i o n o t h i n p u t t e x t .

T h e A l p h a T o o l s p a c k a g e ( $ 3 1 . 9 5 ) i c o m p o s e d o f : 1 )S o u r c e L i s t e r U t i l i t y , t h a t p r o d u c e s a p p e a l i n g l i s t i n g s o s o u r c e c o d e o t h C R T , t h p r i n t e r , o i d i s k f i l e . L i s t i n g sa r e p a g i n a t e d ; p a g e h e a d e r s c o n t a i n t h e i n p u t f i l e n a m e , t h s y s t e m d a t a / t i m e , u s e r - s u p p l i e d c o m m e n t a r y l i n e , a n t h f i l e m o d i f i c a t i o n d a t e / t i m e . E a c h s o u r c e l i n e i d i s p l a y e d w i t h

l o g i c a l n e s t i n g l e v e l t h i g h l i g h t t h e h i e r a r c h i c a l s t r u c t u r e o t h c o d e . h a n d y t a b l e o c o n t e n t s l i s t s a l p r o c e d u r e s a n f u n c t i o n s . R e s e r v e d w o r d s c a b p r i n t e d i u p p e r c a s e , b o l df a c e , o b o t h . A o u t l i n i n g f e a t u r e p e r m i t s i n t e r a c t i v e v i e w i n go t h c o d e b l o g i c a l n e s t l e v e l . 2 S o u r c e R e f o r m a t t e r U t i li t y , t h a t a u t o m a t i c a l l y r e a l i g n s t h e i n d e n t a t i o n o t h s o u r c ec o d e a c c o r d i n g t p r o g r a m l o g i c . 3 C r o s s R e f e r e n c e U t i l i t y ,t h a t c o m p l e t e l y m a p s a l n o n - r e s e r v e d s y m b o l s a n p r o v i d e st h s a m e e l e g a n t r e p o r t i n g f o r m a t a t h S o u r c e L i s t e r . E a c hm e m b e r o t h T o o l s h a s a f l e x i b l e U N I X - s t y l e c o m m a n d l i n ei n t e r f a c e .

A l p h a C P P ( $ 1 9 . 9 5 ) i m a c r o p r e p r o c e s s o r t h a t p r o v i d e sp o w e r f u l c o n d i t i o n a l p r o c e s s i n g f e a t u r e s f o r n o r m a l t e x t f i l e s ,a n f o l a n g u a g e s l a c k i n g c o n d i t i o n a l c o n s t r u c t s ( l i k e T u r b oP a s c a l V 3 ) . S u p p o r t f o r t h e # d e f i n e , # i f d e f , # i f n d e f , # i n c l u d e ,# e l s e , a n d # u n d e f k e y w o r d s .

A l p h a D u m p i f i l e d u m p i n g u t i l i t y t h a t p r o d u c e s f o r m a tt e d o u t p u t o e i t h e r t h e C R o p r i n t e r . T h u s e r c a s e l e c tf i v e d u m p f o r m a t s : b i n a r y , o c t a l , d e c i m a l , h e x a d e c i m a l a n A S C I I . O n l y $ 8 . 9 5 . A l l p r i c e s i U . S . d o l l a r s . C o n t a c t :C r a n b e r r y S o f t w a r e T o o l s , P . O . B o 6 8 1 , P r i n c e t o n J u n c t i o n ,N J , 0 8 5 5 0 - 0 6 8 1 .

T r a n s a c t

Page 83: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 83/84

T h P o t p o u r r i D i s kH e l p !

T h i s H E L P f u l u t i l i t y g i v e s y o i n s t a n tm e n u - d r i v e n a c c e s s t t e x t f i l e sa t h t o u c h o k e - w h i l e a n p r o g r a m i r u n n i n g !

L o a n H e l p e rH o w m u c h i t h a t l o a n r e a l l y g o i n gt o c o s t y o u ? W h i c h i n t e r e s t r a t ec a y o a f f o r d ? W i t h L o a n H e l p e r ,t h a n s w e r s a r a s c l o s e a s y o u rf r i e n d l y 6 4

K e y b o a r dL e a r n i n g h o t p l a y t h p i a n o ?T h i s h a n d y e d u c a t i o n a l p r o g r a mm a k e s i e a s y a n f u t l e a r n t h n o t e s o t h k e y b o a r d .

F i l e d u m pE x a m i n e y o u r d i s k f i l e s F A S T w i t ht h i s m a c h i n e l a n g u a g e u t i l i t y .H a n d l e s s i f o r m a t s , i n c l u d i n g h e x ,d e c i m a l , C B a n t r u e A S C I I ,W o r d P r o a n S p e e d S c r i p t .

A n a g r a m sA n a g r a m s l e t s y o u u n s c r a m b l ew o r d s f o c r o s s w o r d p u z z l e s a n t h l i k e . T h p r o g r a m u s e s r e c u rs i v e M s u b r o u t i n e f o m a x i m u ms p e e d a n e f f i c i e n c y .

L i f e

F A S T m a c h i n e l a n g u a g e v e r s i o no m a t h e m a t i c i a n J o h n H o r t o nC o n w a y ' s c l a s s i c s i m u l a t i o n . S e u y o u r o w " c o l o n i e s ' a n w a t c ht h e m g r o w !

W a B a l l o o n sS h o o t d o w n t h o s e e v i l N a z i W a B a l l o o n s w i t h y o u r h a n d y A c m eC a n n o n ! D o n ' t l e t h e m g e a w a y !

V o G o o g o lA l a s t ! T h m a p h i l o s o p h e r ,H e l g a v o G o o g o l , b r i n g s h e o w b r a n d o w i s d o m t t h s m a l ls c r e e n ! I t h i s i ' A l ' , t h e n i j u s t a i n ' tn a t u r a l !

N e w sS a v e t h m o n e y y o u s p e n d o t h o s e s u p e r m a r k e t t a b l o i d s t h i sp r o g r a m w i l l g e n e r a t e e q u a l l yc o n v i n c i n g h e a d l i n e c o p y f o f r e e !

W r T h u l t i m a t e i e a s y - t o - u s e d a t ab a s e p r o g r a m s . W R l e t s y o q u i c k l y a n s i m p l y c r e a t e , e x a mi n a n e d i t j u s t a b o u t a n d a t a .C o m e s w i t h s a m p l e f i l e .

Q u i zT r i v i a f a n a t i c s a n s t u d e n t s a l i k ew i l l h a v e f u w i t h t h i s p r o g r a m ,w h i c h g i v e s y o m u l t i p l e c h o i c et e s t s o m a t e r i a l y o h a v e e t e r e d w i t h t h W R p r o g r a m .

A H A ! L a n d e rA H A I ' s g r e a t l u n a r l a n d e r p r o g r a m .U s e i t h e r j o y s t i c k o k e y b o a r d t c o m p e t e a g a i n s t y o u r s e l f o r u t

o t h e r p l a y e r s . W a t c h o u f o s p a c e m i n e s !

B a t h E l v e sc u t e l i t t l e a r c a d e - s t y l e g a m e ;

c a p t u r e t h e l v e s i t h b a a q u i c k l y a y o c a b u d o n ' t g e t h g o o d e l f !

B l a c k j a c kT h e m o s t f l e x i b l e b l a c k j a c k s i m u l at i o n y o u ' l l f i n d a n y w h e r e . S e u y o u r f a v o u r i t e r u l e v a r i a t i o n s f o d o u b l i n g , s u r r e n d e r i n g a n s p l i tt i n g t h e d e c k .

F i l e C o m p a r eW h i c h o t h o s e t w f i l e s y o j u s tc r e a t e d i t h m o s t r e c e n t v e s i o n ? W i t h t h i s g r e a t u t i l i t y y o u ' l ln e v e r b l e f t w o n d e r i n g .

G h o u l D o g sA r c a d e m a n i a c s l o o k o u t ! Y o u ' l ln e e d a l y o u r d e x t e r i t y t h a n d l et h i s w i c k e d j o y s t i c k - b u s t e r ! T h e s em a d o g - m o n s t e r s f r o m s p a c ea r e n o t f o n o v i c e s !

O c t a g o n sJ u s t t h t h i n g f o y o M e n s a t y p e s .O c t a g o n s i c h a l l e n g i n g p u z z l eo t h m i n d . F o u r l e v e l s o p l a y ,a n t o u g h ' m e m o r y ' v a r i a t i o nf o r e a l e x p e r t s !

B a c k s t r e e t sn i f t y a r c a d e g a m e , 1 O O % m

c h i n e l a n g u a g e , t h a t h e l p s y o l e a r n t h t y p e w r i t e r k e y b o a r dw h i l e y o p l a y ! U n l i k e a n t y p i n gp r o g r a m y o u ' v e s e e n !

A l t h a b o v e p r o g r a m s , j u s t $ 1 7 . 9 5 U S $ 1 9 . 9 5 C a n a d i a n . N o n o E A C H o t h a b o v e p r o g r a m s , A L o t h a b o v e p r o g r a m s , o n s i n g l e d i s k , a c c e s s e di n d e p e n d e n t l y o f r o m a m e n u , w i t h b u i l t - i n m e n u - d r i v e n h e l p a n f a s t - l o a d e r .

T h E N T I R E P O T P O U R R I C O L L E C T I O NJ U S T $ 1 7 . 9 5 U S ! !

S e O r d e r C a r d a C e n t e r

Page 84: The Transactor V9 05 1989 Jun

8/7/2019 The Transactor V9 05 1989 Jun

http://slidepdf.com/reader/full/the-transactor-v9-05-1989-jun 84/84

T H T I M E S A V E R

T y p e i l o o T r a n s a c t o r p r o g r a m s ?D o e s t h a b o v e t i m e a n a p p e a r a n c e o t h s k l o o k f a m i l i a r ?

^ V j i t h T h T r a n s a c t o r D i s k , a n p r o g r a m i j u s t L O A D a w a y !