11
8/7/2019 The Transactor V2 01 1979 May 31 http://slidepdf.com/reader/full/the-transactor-v2-01-1979-may-31 1/11

The Transactor V2 01 1979 May 31

Embed Size (px)

Citation preview

Page 1: The Transactor V2 01 1979 May 31

8/7/2019 The Transactor V2 01 1979 May 31

http://slidepdf.com/reader/full/the-transactor-v2-01-1979-may-31 1/11

Page 2: The Transactor V2 01 1979 May 31

8/7/2019 The Transactor V2 01 1979 May 31

http://slidepdf.com/reader/full/the-transactor-v2-01-1979-may-31 2/11

D e c i m a l A l e x c o n v e r s i o n ; f e t e c h n i q u e s J i B u t t e r f i e l dI y o s t a y c l e a r o f m a c h i n e l a n g u a g e , y o u ' l l n e v e r n e e d t e x p l o r et h m y s t e r i e s o f H e x a d e c i m a l n u m b e r i n g . I f y o u d o n e e d t u s t h i s k i n d o f n u m b e r i n g s c h e m e , y o u ' l l o f t e n w a n t t c o n v e r t b a c ka n f o r t h b e t w e e n d e c i m a l a n d h e x a d e c i m a l . F o e x a m p l e , a p r o g r a mc o n t a i n s S T S ( 2 3 l t 5 ) } a n d y o u w a n t t u s t h M a c h i n e L a n g u a g e M o n i t o rt s e w h a t ' s i t h a t p a r t o f m e m o r y . B u t h M L w a n t s t h a d d r e s si H e . . h o t c o n v e r t ?

M o s t o f t h e s e t e c h n i q u e s c a n b r e a d i l y d o n e w i t h p o c k e t c a l c u l a t o r ,o w i t h p r o g r a m . B u t w h e n y o u r c a l c u l a t o r b a t t e r y h a g o n e d e a d ,a n y o u r P E T i a l r e a d y l o a d e d w i t h d i f f e r e n t p r o g r a m t h a t y o u d o n ' tw a n t t d i s t u r b , i t ' s h a n d y t w o r k i a l l o u t u s i n g i m m e d i a t e s t a t e m e n t sC o n v e r t i n g D e c i m a l t H e x a d e c i m a l .

M f a v o r i t e q u i c k m e t h o d i t h i s ( l e t ' s c o n v e r t 2 3 U 5 a a n e x a m p l e ) :

2 3 h $ A l O 9 6 F O J - T ' - I N T ( X ) ; X « ( X - I O T ( X ) ) * 1 6 N E X T. a n d o u t c o m e t h n u m b e r s 0 2 9 r e p r e s e n t i n g h e x 0 9 2 9 .I y o g e n u m b e r s g r e a t e r t h a n 9 r e m e m b e r t h a t 1 0 i w r i t t e n a A 1 8 B a n s o u t 1 a F C o n v e r t i n g H e x a d e c i m a l t o D e c i m a l .

T h i s i s s i m p l e m a t t e r o m u l t i p l y i n g t h p r e v i o u s t o t a l b 1 6 a n da d d i n g t h n e d i g i t . T c o n v e r t h e 0 9 2 9 b a c k t o d e c i m a l w t y p e :

( ( 0 * 1 6 9 ) * 1 6 2 ) * 1 6

a n w e g e t o u r o r i g i n a l v a l u e o 2 3 h 5 . I y o d o n ' t l i k e b r a c k e t s ,y o c o u l d t r t h a l t e r n a t i v e :

0 * 1 * 0 9 6 9 * 2 5 6 2 * 1 6 +

w i t h t h s a m e r e s u l t . I n t h e e x a m p l e , t h l e a d i n g z e r o c a b e d r o p p e df r o m t h e c a l c u l a t i o n , o c o u r s e .

G i l d i n g t h l i l y .

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

T h e a s i e s t w a i s v a r i a n t o f I F X > T H E N P R I N T C H R $ ( X + 5 5 ) ;b u t i f y o u l i k e t b a f f l e y o u r f r i e n d s w i t h o b s c u r e c o d i n g y o u c a t r e i t h e r o b o t h o t h e s e :

Z - 0 : X $ - " O 9 2 A " : K ) R J - 1 T O U : Y - A S C ( M I B $ ( X $ , J ) ) : Z - Z * l 6 + Y - h 8 + 7 * ( Y > $ 7 ) - . N E X T J : ? Z

Page 3: The Transactor V2 01 1979 May 31

8/7/2019 The Transactor V2 01 1979 May 31

http://slidepdf.com/reader/full/the-transactor-v2-01-1979-may-31 3/11

T h L I S T C h a i n

O n o f t h e m o s t o f t e n u s e d c o m m a n d s t b e x e c u t e d d i r e c t l y f r o m t h ek e y b o a r d i L I S T ; a m o s t f u n d a m e n t a l f u n c t i o n a i a l l o w s u s t o b s e r v et h c o n t e n t s o o u B A S I C a n d p r ° c e e d t o i m p l e m e n t t h e s c r e e n e d i t o r , af e a t u r e o t h e P E T t h a t m o s t o f u h a v e t a k e n f o g r a n t e d . T h i s v e r yp o w e r f u l p r o g r a m m i n g t o o l p e r m i t s d e l e t i o n , i n s e r t i o n a n a l t e r a t i o n o l i n e s a n d c h a r a c t e r s . B u a a l l t h i s o c c u r s , P E T i s b u s y d o i n g s o m er a t h e r e x t e n s i v e i n t e r n a l h o u s e k e e p i n g ; c h e c k i n g a v a i l a b l e s p a c e , u p d a t i n gF R E ( O ) , m a n i p u l a t i n g p o i n t e r s i z e r o p a g e a n d n u m b e r o f o t h e r t h i n g s .

O t h e s e t a s k s P E p e r f o r m s f o r i t s e l f , i a l s o c r e a t e s t h L I S Tc h a i n , a f u n c t i o n o f e q u a l i m p o r t a n c e t P E a n d U s e r . A l i n e o B A S I C i c o m p l e t e d , P E i n s e r t s t h r e e e x t r a b y t e s o i n f o r m a t i o n w h i c h i u s e s t k e e p t r a c k o w h e r e t h e l i n e e n d s a n d a l s o w h e r e t h n e x t l i n eb e g i n s . T h b e s t w a t o b s e r v e t h i s i t l o a d ' V i e w 1 , o n o t h m a c h i n el a n g u a g e p r o g r a m s w h i c h a p p e a r e d i T r a n s a c t o r 1 0 V o l u m e 1 P r o c e e d a f o l i o w s

1 L O A D a n d R U N V i e w . T h i s w i l l s e t u t h m a c h i n e l a n g u a g e f o V i e w i t h s e c o n dc a s s e t t e b u f f e r .

2 S Y S 6 4 8 2 4 . T h i s v . - i l l c l e a r o u t h B A S I C m e m o r y s p a c e b u w i l l n o a f f e c t t h s e c o n d c a s s e t t e b u f f e r .

3 P O K E 8 4 9 , 4 T h i s w i l l c a u s e V i e wt d i s p l a y p a g e o m e m o r y w h i c h i t h f i r s t b l o c k o ' p a g e 1 o B A S I C m e m o r ys p a c e , ( B A S I C b e g i n s a t H e x 0 4 0 0 o r d e c i m a l1 0 2 4 w h i c h i 4 x 2 5 6 . )

4 S Y S 8 2 6 T h e V i e w p r o p x a m s h o u l dn o b o p e r a t i n g a n d i s p l a y i n g p a g e a t h t o o t h s c r e e n . T h d i s p l a y s h o u l dc o n s i s t o m o s t l y ' $ s i g n s r e p r e s e n t i n ge m p t y s p a c e .

P r e c e d i n g t h e ' $ s i g n s y o u s h o u l d s e t h r e e f @ s i g n s . T h e f @ s i g nr e p r e s e n t s z e r o ( t r y P O K E 3 3 4 0 0 , 0 ) . T h e f i r s t ' @ o r z e r o i l o c a t i o n1 0 2 4 i s d u m m y e n d - o f - l i n e c h a r a c t e r . T h n e x t t w o z e r o e s r e p r e s e n t t h ef i r s t p o i n t e r t t h e n e x t l i n e o f B A S I C b u s i n c e t h e y a r e z e r o e s t h i si n d i c a t e s t o P E T t h a t n o t h i n g e x i s t s b e y o n d t h i s p o i n t . T h e t h r e e ! 0 f s

a r a u t o m a t i c a l l y p l a c e d a t h e n o t h l a s t l i n e o f B A S I C . T h e f i r s t' 0 o z e r o i a u t o m a t i c a l l y p l a c e d a t h e n o e v e r y l i n e o f B A S I C t i n d i c a t e , o f c o u r s e , e n d - o f - l i n e ! .

T h t h r e e z e r o e s w i l l n o t s t a y z e r o e s f o l o n ^ a w a r a b o u t t e n t e r i n t o P E T t h e f o l l o w i n g :

1 0 ? " # " ( w i t h o u t s p a c e s )

U p o n h i t t i n p , ' R E T U R N 1 y o u s h o u l d n o t i c e t h e t o p l i n e o t h s c r e e n c h a n g e .T h f i r s t c h a r a c t e r w i l l s t i l l b a ' 0 r e p r e s e n t i n r , o u r d u m m y e n d - o f - l i n e ,( A r u l e , l o c a t i o n 1 0 2 4 w i l l a l w a y s b z e r o u n l e s s P O K E d b t h U s e r . )T h n e x t t w c h a r a c t e r s s h o u l d b e i o r d e r , f . T f a n ' I ? 1 w h e r e , T = 1 0 a n

Page 4: The Transactor V2 01 1979 May 31

8/7/2019 The Transactor V2 01 1979 May 31

http://slidepdf.com/reader/full/the-transactor-v2-01-1979-may-31 4/11

D = 4 . T h e s e r e p r e s e n t t h e l o w o r d e r a n h i g h o r d e r b y t e s ( r e s p e c t i v e l y )o t h p o i n t e r t . n e x t l i n e o f B A S I C . B u j u s t e x a c t l y w h a t d o t h e yp o i n t a t S i n c e t h e s e n u m b e r s a r e - i n h e x a d e c i m a l , t h h i g h o r d e r b y t e i u s e d a m u l t i p l i e r o 2 5 a n d t h e l o o r d e r b y t e i m u l t i p l i e d b a n a d d e d t o g i v e u t h e d e c i m a l b y t e a d d r e s s . I t h i s c a s e t h e r e s u l tw i l l b e

x 2 5 6 D 2 5 + O * x 2 5 6 l O 1 0 2 i * i

1 0 3 ^I f w e s t a r t c o u n t i n g a 1 0 2 H ( t h e f H O M E f p o s i t i o n ) a c r o s s 1 c h a r a c t e rs p a c e s t o 1 0 3 H , w e f i n d o u r s e l v e s a t h b y t e w h i c h o u r p o i n t e r p o i n t sa ( F i g u r e 1 , 0 ) . S i n c e t h o n l y e x i s t i n g p r o g r a m c o n s i s t s o l i n e 1 0 t h i s b y t e w i l l b z e r o a i t h e f o l l o w i n g b y t e .

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

(

1 0 2 9 1 0 3 0f

1 0 3 1

/

1 0 3 2I

1 0 3 3

<

1 0 3 4 1 0 3 5 1 0 3 6 1 0 3 7

P R I N TP o i n t e r =

1 0 3 41 D u m m y T e n

o l i n ec h a r a c t e r

( 1 0 )

E n o L i n e

E m p t y . . .

E n o

B A S I CF i g u r e 1 .

T h e s e i n d i c a t e e n - o f - v a l i - B A S I C . N o t i c e a l s o t h e p r e c e d i n g b y t e w h i c hi n d i c a t e s e n d - o f - l i n e .

G e t t i n g b a c k t o u r p o i n t e r , i m m e d l a t e l y f o l l o w i n g s h o u l d b a n o t h e rf J a n d a n ' @ ' ( F i g u r e 1 . 0 ) , T h e s e r e p r e s e n t t h l o a n h i g h o r d e r b y t e s ,

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

L . N . @ x 2 5 6 2 5 O L . N . 2 5 ( 1 0 x = 1

1 . . . w h i c h i o c o u r s e t h e l i n e n u m b e r o f t h o n l y e x i s t i n g B A S I C s f a r .

T h n e x t c h a r a c t e r o n t h e t o l i n e i r e v e r s e f i e l d ' Y o t h t o k e nf o ' P R I N T 1 w h i c h i 1 5 3 . ( s e e t a b l e f o l l o w i n g ) T h e r e m a i n i n g c h a r a c t e r sa r s e l f e x p l a n a t o r y .

N o w l e t ' s g e l i t t l e d e e p e r a n d e n t e r t h f o l l o w i n g e x t r a c o d e :4 0 0 ? " ! t

B e f o r e h i t t i n g ' R E T U R N 1 w a t c h c l o s e l y t h e t w o l a s t ! @ c h a r a c t e r s ( l o c a t i o n s

Page 5: The Transactor V2 01 1979 May 31

8/7/2019 The Transactor V2 01 1979 May 31

http://slidepdf.com/reader/full/the-transactor-v2-01-1979-may-31 5/11

1 0 3 4 a n d 1 0 3 5 ) . N o h i t ' R E T U R N 1 a n t h e y w i l l c h a n g e t a f S a n f D o 1 a n d a w h i c h e q u a l s 1 0 4 3 ( 2 5 1 9 ) . i f w e c o u n t a c r o s s t 1 0 4 3 w e f i n d o u r s e l v e s o n c e a g a i n a t t h s e c o n d l a s t t @ c h a r a c t e r i n d ic a t i n g e n d - o f - B A S I C ( F i g u r e 1 . 1 ) . R e c a l l t h a t o u r f i r s t p o i n t e r i l o c a t i o n s1 0 2 5 a n 1 0 2 6 p o i n t e d a t 1 0 3 4 . T h e r e f o r e t h e f i r s t l i n e p o i n t e r p o i n t s a tt h n e x t l i n e p o i n t e r w h i c h i t u r n p o i n t s a t h e n e x t l i n e p o i n t e r a n s o t t h e e n d o y o u r B A S I C p r o g r a m . S o u n d s s i m p l e d o e s n ' t i t W e l l i i s T h i s i t h L I S T C h a i n a n d P E T e m p l o y s t h e s e p o i n t e r s t e x e c u t e c o m m a n d ss u c h a s

1 L I S T2 L I S T - 5 0 03 L I S T 5 0 0 - 5 0 0 04 R U N 2 05 G O T O 5 0 06 G O S U B 1 0 0 0

W h e n i m p l e m e n t i n g t h e s e c o m m a n d s , e i t h e r d i r e c t l y o u n d e r p r o g r a m c o n t r o l ,P E i m m e d i a t e l y j u m p s t o t h e p o i n t e r a t 1 0 2 5 a n d 1 0 2 6 a n d s t o r e s i t P E t h e ne x a m i n e s t h e f o l l o w i n g t w b y t e s ( 1 0 2 7 a n d 1 0 2 8 ) w h i c h m a k e u t h l i n e n u m b e ra n c o m p a r e s t h e m a g a i n s t t h e g i v e n a r g u m e n t . I n o n e i g i v e n t h c o m p a r i s o ni o f c o u r s e u n n e c e s s a r y . I t h c a s e o L I S T 5 0 0 - 5 0 0 0 , P E T w i l l f i r s tc o m p a r e t h e l i n e n u m b e r b y t e s w i t h 5 0 0 . I t h t e s t y i e l d s " l e s s t h a n " ,P E r e c a l l s t h e p o i n t e r b y t e s a n u s e s t h e i r v a l u e s t j u m p t t h n e x tp o i n t e r . T h i s n e p o i n t e r i s t o r e d i p l a c e o t h e f i r s t a n t h e a b o v ep r o c e d u r e i r e p e a t e d u n t i l a n " e q u a l " o " g r e a t e r t h a n " t e s t r e s u l t i o b t a i n e d . P E t h e n , b e g i n s L I S T i n g b y ' P R I N T i n g 1 o u t t h e c o n v e r t e d - t o - d e c i m a ll i n e n u m b e r f o l l o w e d b s p a c e f o l l o w e d b y t h e t e x t b e l o n g i n g t o t h a t l i n en u m b e r . T e x t c o n t i n u e s ' P R I N T i n g 1 u n t i l t h e z e r o e n d - o f - l i n e c h a r a c t e r i d e t e c t e d . P E T h a l t s h e r e , r e c a l l s t h e p o i n t e r l a s t s t o r e d a n d m a k e s t h j u m p t t h e n e x t p o i n t e r . T h i s p o i n t e r i a g a i n s t o r e d a n d t h e l i n eb y t e s a r e e x a m i n e d . . . b u t t h i s t i m e c o m p a r e d t t h s e c o n d a r g u m e n t ; 5 0 0 0 .I f g r e a t e r t h a n r e s u l t o c c u r s t h L I S T p r o c e d u r e t e r m i n a t e s . O t h e r w i s eP E c o n t i n u e s t o

a d i s p l a y t e x t w h i l e t e s t i n g f o b r e c a l l p o i n t e r i s t o r a g ec j u m p t n e p o i n t e r a n d s t o r ed e x a m i n e l i n e i s i n s t r u c t e de c o n t i n u e o t e r m i n a t e

1 0 2 4 1 0 2 5 1 0 2 6 1 0 2 7I - ' ! !h i

P o i n t e 1 0 3 4

1 0 3 3 1 0 3 4 1 0 3 5 1 0 3 6

1 I

1 0 4 2 1 0 4 3 1 0 4 4 1 0 4 5 1 0 4 6_ _

I L _ H ! P o i n t e r =

- 1 0 4 3E n d o fB A S I C

E m p t y .

F i g u r e 1 .

Page 6: The Transactor V2 01 1979 May 31

8/7/2019 The Transactor V2 01 1979 May 31

http://slidepdf.com/reader/full/the-transactor-v2-01-1979-may-31 6/11

S o m e o y o m a y n o w b a s k i n g . . . ." W h y d o e s P E d a l l t h a t b a c k - t r a c k i n g t r e c a l l

p o i n t e r v a l u e w h i c h i s i m p l y t h e a d d r e s s o t h b y t e i m m e d i a t e l y f o l l o w i n g t h e z e r o e n d - o f - l i n ec h a r a c t e r ? W h d o e s n f t P E T j u s t t e s t f o z e r o a n h a v e t h l i n e b y t e s i t h e f o l l o w i n g t w l o c a t i o n s .T h i s w o u l d f r e e u t h o s e e x t r a t w o b y t e s u s e d b P E e v e r y t i m e i c r e a r e s l i n e p o i n t e r ^ . , : *

T h a n s w e r i s p e e d » T h d i f f e r e n c e w o u l d n o b n o t i c e d s m u c h w i t h L I S To e v e n L I S T w i t h p a r a m e t e r s . T h r e a l d e c r e a s e i s p e e d w o u l d o c c u r u p o ne x e c u t i o n o G O T O o G O S U B i n s t r u c t i o n s . P E T w o u l d h a v e t o t e s t e v e r y b y t ef o r a z e r o ( s t a r t i n g a 1 0 2 4 ) a n t h e n , o f c o u r s e , l o o k a t h l i n e # T h i s t e s t i n g f o z e r o w o u l d t a k e s o m e t i m e , e s p e c i a l l y i t h e a v e r a g e n u m b e ro f b y t e s p e r l i n e w e r e u a r o u n d 3 0 o r 3 5 C o u p l e d w i t h t h e n u m b e r o fG O T O s a n d G O S U B s i y o u r p r o g r a m , B A S I C e x e c u t i o n s p e e d w o u l d b c o n s i d e r a b l ys l o w e r . U s i n g t h p r e s e n t m e t h o d , P E T s k i p s a c r o s s t h e p o i n t e r s l i k e a f r o ga c r o s s t h e l i l y p a d s ( o n l y i w o n ' t e a u y o u r b u g s a t t h e s a m e t i m e ) .

I n s e r t i o n a n d D e l e t i o n

W h e n w p r o g r a m l i n e o t e x t t h a t i t f a l l b e t w e e n t w o e x i s t i n gl i n e s , P E m u s t k n o w w h e r e t o p u t i t W w o n ' t d i s c u s s h o w P E T s p l i t st h e x i s t i n g c o d e ; t h a t ' s a n o t h e r s u b j e c t . P E T j u m p s a l o n g l o o k i n g a tl i n e n u m b e r s u n t i l a " i n - b e t w e e n 1 1 c o n d i t i o n i s a t i s f i e d . E x i s t i n g t e x ti m o v e d u f r o m t h r i g h t p o i n t e x a c t l y f a e n o u g h f o t h c o d e t o b ei n s e r t e d . T h e p o i n t e r s ( l i n e p o i n t e r s a n p o i n t e r s i z e r o p a g e ) a r eu p d a t e d a n c o n t r o l i r e t u r n e d t o t h e k e y b o a r d .

F o d e l e t i o n o l i n e s , P E s i m p l y f i n d s t h l i n e a n " s q u e e z e s " i o u t . P o i n t e r s a r e u p d a t e d . . . . o p e r a t i o n c o m p l e t e .

T r e x p e r i m e n t i n g w i t h t h V i e w p r o g r a m t w a t c h h o P E h a n d l e si t e d i t i n g .

A s s u m i n g t h a t V i e w i s t i l l r u n n i n g , t y p e i N E b u b e f o r e h i t t i n g' R E T U R N 1 , r e c o r d t h e s e c o n d a n d t h i r d c h a r a c t e r s o p a g e 4 T h e y a r e r e s e tb ' N E W ' b u n o t i c e h o w t h e r e s t o f m e m o r y s t i l l e x i s t s . I t h e s el o c a t i o n s a r e P O K E d b a c k t w h a t t h e y w e r e , t h p r o g r a m c a n o b L I S T e do n c e a g a i n . H o w e v e r , z e r o p a g e p o i n t e r s w e r e a l l r e s e t b N E a l s o .E d i t i n g o a s s i g n i n g v a r i a b l e s t v a l u e s w i l l c a u s e c r a s h ( a n d r a t h e ri n t e r e s t i n g o n a t t h a t ) s d n o t t r y R U N . A b o u t t h o n l y w a t f S A V E !i i t u s t h U N L I S T r o u t i n e .

W h a t Y o C a D

S o m e i n t e r e s t i n g r e s u l t s c a b o b t a i n e d b y m a n i p u l a t i n g t h e s e l i n ep o i n t e r s ; p a r t i c u l a r l y l o c a t i o n s 1 0 2 5 a n d 1 0 2 6 . I f w e P O K E 1 0 2 5 , 0 w e ' v ee s s e n t i a l l y a i m e d t h e p o i n t e r a l o c a t i o n 1 0 2 4 2 5 0 ) I f L I S Ti e x e c u t e d , P E w i l l p i c k u p t h e f i r s t p o i n t e r , d i s p l a y t h t e x t a n j u m pt 1 0 2 4 . S i n c e 1 0 2 4 i s z e r o a n i n o f o l l o w e d b y z e r o , P E i f o o l e di n t o t h i n k i n g e n d - o f - B A S I C t r i t

Page 7: The Transactor V2 01 1979 May 31

8/7/2019 The Transactor V2 01 1979 May 31

http://slidepdf.com/reader/full/the-transactor-v2-01-1979-may-31 7/11

S i m i l a r l y , i w P O K E 1 O 2 5 , 1 v ; h a v e a i m e d t h f i r s t p o i n t e r a i t s e l f !N o t r L I S T . B y t h e s a m e t o k e n y o u c a p o i n t t h a t f i r s t p o i n t e r ( o a n p o i n t e r f o r t h a t m a t t e r ) a a n o t h e r p o i n t e r i B A S I C ; b u t o n l y a t p o i n t e r s

• ♦ • a n y t h i n g e l s e a n d P E T w i l l c r a s h . B y d o i n g t h i s m a n i p u l a t i o n o p o i n t e r s , y o c a n h a v e L I S T - i n h i b i t o a n l i n e s y o w i s h w i t h o u t a f f e c t i n gR U ( s l o n g a y o d n o u s R U w i t h a r g u m e n t s t h a t l i e w i t h i n t h eL I S T - i n h i b i t e d l i n e s ) . B c a r e f u l t h o u g h . . . . m i s t a k e s c a n b h a z a r d o u s !

N o w l e t f s h a v e s o m e f u n w i t h V i e w . T y p e t h e f o l l o w i n g o n c l e a rs c r e e n n e a r t h e b o t t o m ( V i e w , o f c o u r s e , w i l l n o c l e a r ) :

F O 3 2 T O 1 3 5 : P 0 K E 8 4 9 , T : F O R T 2 5 0 : N E X T R , T

H i ' R E T U R N * a n d n e x t m o n t h w e ' l l d i s c u s s h o w P E s t a r e s v a r i a b l e s .

Page 8: The Transactor V2 01 1979 May 31

8/7/2019 The Transactor V2 01 1979 May 31

http://slidepdf.com/reader/full/the-transactor-v2-01-1979-may-31 8/11

1 6 / 3 2 K P E T N o t e s C o l l e c t e d b J i m R u s s o

T h e O p e r a t i n g S y s t e m o f t h e 1 6 / 3 2 K P E i a b o u t 9 0 % t h e s a m e a t h 8 P E T ,b u h a b e e n r e - a s s e m b l e d s t h a t a l m o s t e v e r y t h i n g i i a s l i g h t l y d i f f e r e n tp l a c e i m e m o r y t h a n i u s e d t o b e * M o s t b u g s h a v e b e e n f i x e d a n d s o m el i m i t a t i o n s r e m o v e d .A n p u r e B A S I C p r o g r a m ( n P E E K , P O K E , S Y S , o W A I T ) t h a t w o r k s o n a n 8 KP E T s h o u l d a l s o w o r k o 1 6 / 3 2 K P E T . P O K i n g a n d P E E K i n g s c r e e n m e m o r y( 3 2 7 6 8 t o 3 3 7 6 7 ) i s s t i l l s a f e b u P O K i n g t h e o p e r a t i n g s y s t e m ( b e l o w 1 0 2 Hd e c i m a l ) o r u s i n g a o p e r a t i n g s y s t e m P E E K v a l u e t m a k e d e c i s i o n c o u l d b eh a z a r d o u s . O t h e r p r o g r a m s c a b m a d e t w o r k p r o p e r l y i r e f e r e n c e s t R A a n R O l o c a t i o n s a r e c h a n g e d . C o m m o d o r e ' s 1 6 / 3 2 K P E m a n u a l c o n t a i n sm e m o r y m a f o p a g e s 0 a n 2 l i s t o f n e w R O M a d d r e s s e s f o l l o w s . T h e s et w l i s t s s h o u l d c o n t a i n t h e i n f o r m a t i o n n e e d e d i m o s t c a s e s .S o m e H a r d w a r e D i f f e r e n c e s ;

T h c h a r a c t e r g e n e r a t o r R O M h a s b e e n r e v i s e d s t h a t w h e n l o w e r c a s e m o d ei s e l e c t e d , u p p e r a n l o w e r c a s e a r e i n t e r c h a n g e d . T h a t i s t h S H I F T 1k e m u s t b u s e d t o b t a i n a u p p e r c a s e c h a r a c t e r . A l s o , 8 p r o g r a m su s i n g l o w e r c a s e t h a t a r e r u n o 1 6 / 3 2 K P E w i l l d i s p l a y a l l l o w e r c a s ea s u p p e r c a s e a n d v i c e v e r s a .

T h e s i g n a l w h i c h b l a n k s t h e v i d e o o n t h e 8 i n o c o n n e c t e d o n t h e 1 6 / 3 2 ,s P O K E 5 9 4 0 9 , 5 n l o n g e r w o r k s . T h e R O r o u t i n e s s t i l l r e f e r e n c e t h i sa d d r e s s b u t h e r e q u i r e d h a r d w a r e s e e m s t h a v e b e e n o m i t t e d .

S u m m a r y o D i f f e r e n c e s :

T h b u i T h a s b e e n f i x e d . N o e v e r y 6 2 3 r d . i n t e r r u p t d o e s n ' t i n c r e m e n tT I A l s o , T i a l l o w e d t c o u n t 1 / 6 0 s e c . t o f a r : 2 * 4 0 0 0 0 p r e c e d e s 0 0 0 0 0 0 .

E x e c u t i o n ( o a l e a s t s o m e c o d e ) i f a s t e r d u t m o r e e f f i c i e n t c o d i n g a n b e t t e r u s o z e r o p a g e . P R I N T ( t s c r e e n ) i f a s t e r b e c a u s e e x t r a c o d e t m a i n t a i n s e p a r a t e P O p o i n t e r h a b e e n e l i m i n a t e d . A l s o , s c r e e n s n o w a n ' s c r o l l u f l a s h 1 h a s b e e n e l i m i n a t e d t h a n k s t d y n a m i c s c r e e n R A M s .

S t a n d a r d t y p e w r i t e r o p e r a t i o n i . e . , s h i f t f o u p p e r c a s e .

R N r e t u r n s n u m b e r d e r i v e d f r o m i n t e r v a l t i m e r s .

O P E N i n g m o r e t h a n 1 f i l e s n l o n g e r c r a s h e s s y s t e m .

O P E N s t a t e m e n t c o r r e c t l y s e t s " c u r r e n t t a p e b u f f e r p o i n t e r " .

Page 9: The Transactor V2 01 1979 May 31

8/7/2019 The Transactor V2 01 1979 May 31

http://slidepdf.com/reader/full/the-transactor-v2-01-1979-may-31 9/11

R e v i e w : B a s i c f o r H o m e C o m p u t e r s J o h n W i l e y & S o n s , I n c .b B o A l b r e c h t , L e R o y F i n k e l , a n d J e r a l d R B r o w n .

g o o d t e a c h i n g b o o k t h a t d e a l s w i t h M I C R O S O F T ™ B a s i c f u n d a m e n t a l s .T h i s i t h t y p e o B a s i c t h a t R E T h a s , a n d r e a d e r s w i l l f i n di t s u i t a b l e i n t r o d u c t i o n t o P E T p r o g r a m m i n g *

T h b o o k i s s e l f - t e a c h i n g g u i d e , w h i c h m e a n s t h a t o n a l m o s t e v e r yp a r a g r a p h y o u a r e a s k e d t " f i l l i n t h e b l a n k s " T h i d e a b e h i n dt h i s t y p e o p r o g r a m m e d i n s t r u c t i o n i t h a t y o d m o r e t h a n r e a dy o p a r t i c i p a t e . T h i s m a k e s f o g o o d t e a o h i n g t e x t ; b u t h b o o k b e c o m e s l e s s u s e f u l f o r r e f e r e n c e o q u i c k s c a n n i n g .T h a b s o l u t e b e g i n n e r w i t h P E w i l l e n c o u n t e r f e s t u m b l i n gb l o c k s a t t h s t a r t o t h e b o o k . T h i s i d u t s l i g h t d i f f e r e n c e si t h B a s i c b e i n g d e s c r i b e d . P E T s a y s R E A D Y i n s t e a d o f O K i t s a y s 7 S Y N T A X E R R O R i n s t e a d o S E R R O R ; i u s e s t h D e l e t e k e i n s t e a d o f t h e b a c k a r r o w t o c o r r e c t e n t r y e r r o r s . A l v e r y m i n o rp r o b l e m s , b u t h e y m i g h t s h a k e t h c o n f i d e n c e o n e o p h y t e .O n c e h e g e t s o v e r t h e s e i n i t i a l r o u g h s p o t s , h o w e v e r , i t ' s a l c l e a r s a i l i n g . B c h a p t e r t h r e e , t h a u t h o r s g e t i n t o t h m e a to B a s i c p r o g r a m m i n g , a n d t h e r e a d e r s h o u l d h a v e n f u r t h e r t r o u b l e .

E a c h c h a p t e r i w e l l o r g a n i z e d . F i r s t , y o u ' r e t o l d w h a t y o m a e x p e c t t o l e a r n i t h i s c h a p t e r . T h e n t h e t e x t m a t e r i a l , b r o k e n i n t on e a t l y n u m b e r e d s e c t i o n s . L i b e r a l u s i m a d e o i l l u s t r a t i o n s ,d i a g r a m s , a n s a m p l e p r o g r a m s ; a n t h p r o g r a m s a r u s u a l l y a i m e dt o w a r d s r e a l w o r l d e x a m p l e s , n o t J u s t a b s t r a c t m a t h e m a t i c s .F i n a l l y , e a c h c h a p t e r e n d s w i t h s e l f - t e s t , c o m p l e t e w i t h a n s w e r s ,w h i c h a l l o w s y o t r e v i e w a n d m a k e s u r e y o u ' v e g o t i t a l l r i g h t .

T h o r d e r o f t h c h a p t e r s i w e l l p l a n n e d , p r o c e e d i n g f r o m t h m o r eb a s i c p r o g r a m m i n g c o m m a n d s t o w a r d s m o r e a d v a n c e d c o n c e p t s .T h a u t h o r s d o n ' t s u g g e s t i t b u b C h a p t e r J t h r e a d e r i e q u i p p e d t s k i p a h e a d t s u b j e c t s i w h i c h h m a h a v e s p e c i a lI n t e r e s t . S o i f h e ' s a n x i o u s t o l e a r n a b o u t s t r i n g v a r i a b l e s o a b o u t s u b r o u t i n e s , h e c a n l e a p a h e a d t c h a p t e r o 1 0 I t ' s n i c et s e b o o k t h a t ' s s o w e l l o r g a n i z e d t h a t y o c a d t h i s .

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

T h b o o k i p r e t t y g o o d a p p r o a c h t o l e a r n i n g B a s i c . I w o n ' tt a k e t h e r e a d e r i n t o a d v a n c e d c o n c e p t s , b u i w i l l g i v e h i g o o d s t a r t .

R e v i e w b J i B u t t e r f i e l d

Page 10: The Transactor V2 01 1979 May 31

8/7/2019 The Transactor V2 01 1979 May 31

http://slidepdf.com/reader/full/the-transactor-v2-01-1979-may-31 10/11

P E R E S E T S W I T C H

T h P E R e s e t S w i t c h a l l o w s y o t r e g a i n c o n t r o l o f y o u r P E T w i t h o u t t u r n i n gt h p o w e r O F F a n d b a c k O N I t h b l i n k i n g c u r s o r s h o u l d d i s a p p e a r , a n d n o n eo t h k e y b o a r d k e y s w o r k , s i m p l y p r e s s t h b u t t o n o t h e R e s e t S w i t c h , a n t h m e s s a g e " * * * C O M M O D O R E B A S I C * * * , 7 1 6 7 B Y T E S F R E E , R E A D Y " ( 8 P E T S ) f o l l o w e db y t h e c u r s o r w i l l b d i s p l a y e d o t h s c r e e n .

Y o l o s e w h a t e v e r B a s i c p r o g r a m t h a t w a s i t h e c o m p u t e r , b u t i d o e s n o t c l e a rm e m o r y c o n t e n t s b e l o w $ 0 4 . 0 0 . S i n c e t h P E i n o t r e s e t b t h e O N / O F F p o w e rs w i t c h , y o a v o i d t h e d a n g e r o e l e c t r i c a l f a i l u r e i t h p o w e r s u p p l y , C R d i s p l a y a n d t h e l o g i c c o m p o n e n t s .

T h P E R e s e t S w i t c h m a b i n s t a l l e d o a l P E m o d e l s . I n s t a l l a t i o n i s i m p l ea n d f u l l i n s t r u c t i o n s a r s u p p l i e d . T h e s w i t c h c o n t a i n s p r o t e c t i v e c i r c u i tt a v o i d d a m a g e t o t h e c o m p u t e r i t h e v e n t i i i n s t a l l e d i n c o r r e c t l y .

T o b t a i n P E T R e s e t S w i t c h s e n d $ 1 0 . 0 0 ( c h e q u e o r m o n e y o r d e r ) t oG . P . R e i t h m e i e r^ 1 D u p l e x A v e . , A p t . 6 1 T o r o n t o , O n t a r i o

1 V

P E i t h r e g i s t e r e d t r a d e m a r k o C o m m o d o r e I n t e r n a t i o n a l I n c .

Page 11: The Transactor V2 01 1979 May 31

8/7/2019 The Transactor V2 01 1979 May 31

http://slidepdf.com/reader/full/the-transactor-v2-01-1979-may-31 11/11

R E A L G R A P H I C S F O P E

H o w o u l d y o u l i k e t o d i s p l a y s o m e R E A L g r a p h i c s o y o u r P E c o m p u t e r ? R e a l g r a p h i c s s u c h a f i n e l y d e t a i l e d m a t h e m a t i c a l c u r v e s o r p e r s p e c t i v e d r a w i n g s o c o m p u t e r a r o p r o p o r t i o n a l l y s p a c e dt e x t o w h a t e v e r d i r e c t l y o t h P E s c r e e n . G r a p h i c s i w h i c h e a c h i n d i v i d u a l d o I h u g e 6 4 , 0 0 0d o a r r a y * 3 2 0 w i d e a n d 2 0 h i g h i I N D I V I D U A L L Y c o n t r o l l a b l e . A a b o n u s , h o w o u l d y o l i k e a e x t r a 8 o m e m o r y w h e n s u p e r g r a p h i c s w e r e n o t b e i n g u s e d ?

A l a s t t h f a m o u s M T V I S I B L E M E M O R Y a v a i l a b l e t K I M - 1 u s e r s f o r w e l l o v e r y e a r I n o a v a i la b l e w i t h a a d a p t o r f o t h P E T . T h K - 1 0 0 7 P E T - t o - M T U a d a p t o r p l u g s i n t o t h P E e x p a n s i o n c o n e c t o r a n i n c l u d e s c a b l e a n e d g e s o c k e t a s s e m b l y w h i c h w i l l a c c e p t o u r K - 1 0 0 8 - P E T V i s i b l eM e m o r y b o a r d . M o s t a l o t h a s s e m b l y c a n b h i d d e n I n s i d e t h P E i o n l y t h V i s i b l e M e m o r y i u s e d o t h u n i t c a b p l u g g e d i n t o o u K - 1 0 0 5 m o t h e r b o a r d / c a r d f i l e f o f u r t h e r e x p a n s i o n w i t ho t h e r a d v a n c e d d e s i g n M T b o a r d s . U s o t h K - 1 0 0 7 d o e s n o t i u t h P E T ' s e x p a n s i o n p o r t h o w e v e r .

B e s i d e s t h b u a d a p t o r , t h e K - 1 0 0 7 c o n t a i n s v i d e o p r o c e s s i n g c i r c u i t r y t o t r a n s l a t e s t a n d a r dV i s i b l e M e m o r y c o m p o s i t e v i d e o i n t o t h f o r m r e q u i r e d b t h P E m o n i t o r a l t h o u g h c o m p o s i t e V v i d e o i s t i l l a v a i l a b l e f o a e x t e r n a l C C T V m o n i t o r . A o n - b o a r d l a t c h a l l o w s s o f t w a r e s w i t c h i n gb e t w e e n s t a n d a r d P E v i d e o a n V v i d e o . A l n e c e s s a r y o p e r a t i n g p o w e r i t a k e n f r o m t h P E t r a n s f o r m e r b u t a s m o s t o o u c u s t o m e r s k n o w , M T b o a r d s r e q u i r e v e r y l i t t l e p o w e r f o o p e r a t i o n .

K - 1 0 0 8 - P E T $ 2 4 3 . 0 0 K - 1 0 0 7 $ 7 9 . 0 0

A L S O R E A L V O I C E M U S I CB n o y o h a v e p r o b a b l y h e a r d o t h " D A C m u s i c s y s t e m " f o t h K I M - 1 t h a t w a p i o n e e r e d b y

H a C h a m b e r l i n i a s s o c i a t i o n w i t h M T U . U t i n d e p e n d e n t , s i m u l t a n e o u s m u s i c a l v o i c e s , e a c hw i t h a n i n d e p e n d e n t w a v e f o r m , c a b s y n t h e s i z e d f o t r u e 4 - p a r t h a r m o n y . W h i l e s o f t w a r e i t h k e t s u c h p e r f o r m a n c e , o u r K - 1 0 0 2 - 3 C s o f t w a r e p a c k a g e a l l o w s m o s t o t h p o t e n t i a l o t h t e c h n i q u e t b r e a l i z e d o s t a n d a r d 8 P E T .

W h a v e n o r e d e s i g n e d t h o r i g i n a l D A b o a r d s p e c i f i c a l l y f o t h P E T . T h K - 1 0 0 2 - 2 A o p e r a t e s f r o ms i n g l e v o l t p o w e r s u p p l y a n i n c l u d e s a a c c u r a t e b i d i g i t a l - t o - a n a l o g c o n v e r t e r , s h a r p p o l e

l o w - p a s s f i l t e r , a n a u d i o p o w e r a m p l i f i e r u s a b l e w i t h a n k i n d o s p e a k e r . T h b o a r d p l u g s d i r e c t l yo n t o t h P E u s e r p o r t a n d s e c o n d c a s s e t t e p o r t f o p o w e r y e a l s i g n a l s f e e d - t h r o u g h t s e c o n ds e o b o a r d e d g e f i n g e r s .

K - 1 0 0 2 - 2 $ 5 0 . 0 0 K - 1 0 0 2 - 3 C $ 2 0 . 0 0W A N T M O R E E X P A N S I O N Y E T ?

K - 1 0 0 5 S l o t C a r d F i l e $ 7 5 . 0 0 K - 1 0 1 6 1 6 L o P o w e r M e m o r y $ 3 4 0 . 0 0K - 1 0 1 2 2 4 P R O M , P R O G R A M M E R , I / O , C O M M $ 2 3 7 . 0 0

K - 1 0 2 0 P r o t o t y p i n g B o a r d $ 4 2 . 0 0

M I C R O T E C H N O L O G Y U N L I M I T E D8 4 G a l a x y W a y , P . O . B o 4 5 9 6 M a n c h e s t e r , N 0 3 1 0 8

6 0 3 - 6 2 7 - 1 4 6 4