Top Banner
8/6/2019 Printer Book for the Commodore 64 and VIC-20 http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 1/343
343

Printer Book for the Commodore 64 and VIC-20

Apr 08, 2018

Download

Documents

CubemanPDX
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 1/343

Page 2: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 2/343

P R I N T E R B O O Kf o t h C o m m o d o r e 6

( a n d V i c - 2 0 )B y R B r u c k m a n n

K G e r i t sT W i e n s

D A T A B E C K E R B O O K

P u b l i s h e d b y » • » C « n C o u n t O | B W » I I l 5 | { f . A b a c u s t o ™ ] S o f t w a r e

Page 3: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 3/343

P R I N T E R B O O Kf o t h C o m m o d o r e 6

( a n d V i c - 2 0 )B y R B r u c k m a n n

K G e r i t sT W i e n s

D A T A B E C K E R B O O K

P u b l i s h e d b y » • » C « n C o u n t O | B W » I I l 5 | { f . A b a c u s t o ™ ] S o f t w a r e

Page 4: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 4/343

A l c o m m a n d s , t e c h n i c a l i n s t r u c t i o n s a n p r o g r a m s c o n t a i n e di t h i s b o o k h a v e b e e n c a r e f u l l y w o r k e d o b t h a u t h o r s ,I . e . , w r i t t e n a n r u u n d e r c a r e f u l s u p e r v i s i o n . H o w e v e r ,m i s t a k e s i p r i n t i n g a r n o t o t a l l y i m p o s s i b l e ; b e y o n dt h a t , A B A C U S S o f t w a r e c a n e i t h e r g u a r a n t e e n o r b e h e l dl e g a l l y r e s p o n s i b l e f o r t h e r e a d e r ' s n o a d h e r i n g t t h t e x t w h i c h f o l l o w s , o f o f a u l t y i n s t r u c t i o n s r e c e i v e d .T h a u t h o r s w i l l a l w a y s a p p r e c i a t e r e c e i v i n g n o t i c e o s u b s e q u e n t m i s t a k e s .

F i r s t P r i n t i n g , A p r i l 1 9 8 5P r i n t e d i U . S . A .

C o p y r i g h t ( C 1 9 8 4

C o p y r i g h t ( C 1 9 8 5

T r a n s l a t e d b G e n e T r a a sE d i t e d b y J i D ' H a e mP r o g r a m s e d i t e d b y R u s s T a b e rD a t a B e c k e r G m b HM e r o w i n g e r s t r . 3 4 0 0 0 D u s s e l d o r f , W G e r m a n yA b a c u s S o f t w a r e , I n c .P . O . B o 7 2 1 1G r a n d R a p i d s , M 4 9 5 1 0

T h i s b o o k i c o p y r i g h t e d . N p a r t o t h i s b o o k m a b r e p r o d u c e d , s t o r e d i r e t r i e v a l s y s t e m , o t r a n s m i t t e d i a n f o r m o b y a n y m e a n s , e l e c t r o n i c , m e c h a n i c a l ,p h o t o c o p y i n g , r e c o r d i n g , o o t h e r w i s e w i t h o u t t h p r i o rw r i t t e n p e r m i s s i o n o A B A C U S S o f t w a r e o D a t a B e c k e r G m b H .I S B N 0 - 9 1 6 4 3 9 - 0 8 - 9

Page 5: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 5/343

T A B L E O F C O N T E N T S

1 . I N T R O D U C T I O N

I N T E R F A C E ST H C - 6 4 S E R I A L B U

2 . 1 . 1 F U N D A M E N T A L S2 . 1 . 2 A D D R E S S E S2 . 1 . 3 D A T A T R A N S F E R .

T H C E N T R O N I C S I N T E R F A C E 1 2 . 3 T H E R S - 2 3 2 I N T E R F A C E 1

S E C O N D A R Y A D D R E S S E S 2 3 . V I C - 1 5 2 5 / G P - 1 0 0 V I C / M P S - 8 0 1 2 3 . V I C - 1 5 2 6 2 3 . T H I R D P A R T Y P R I N T E R I N T E R F A C E S 3

4 . C O N N E C T I N G T Y P E W R I T E R T T H U S E R P O R T 3

5 . P R O G R A M C O L L E C T I O N F O R V I C - 2 0 A N C - 6 4 4 5 . S H O R T A P P L I C A T I O N P R O G R A M S F O E V E R Y D A Y U S 4 5 . 1 . 1 D E V I C E N O P R E S E N T ? 4 5 . 1 . 2 F O R M A T T I N G N U M E R I C A L A N A L P H A N U M E R I C A L D A T A 4 5 . 1 . 3 F O R M A T T E D P R O G R A M L I S T I N G S 5 5 . W O R D P R O C E S S I N G 6 5 . 2 . 1 M I N I T E X T S I M P L E T E X T E D I T O R 6 5 . 2 . 2 W H A T A B O U T P O S T E R S ? 8 5 . H A R D C O P Y 9 5 . 3 . 1 T E X T H A R D C O Y 9 5 . 3 . 2 G R A P H I C H A R D C O P Y 1 0 5 . G R A P H I C S - W I T H A N W I T H O U T S I N G L E - P I N C O N T R O L 1 1 5 . 4 . 1 G R A P H I C S W I T H O U T S I N G L E - P I N C O N T R O L 1 1 5 . 4 . 2 G R A P H I C S W I T H S I N G L E - P I N C O N T R O L 1 2

Page 6: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 6/343

5 . 4 . 3 T H R E E - D I M E N S I O N A L H I R E S G R A P H I C S 1 3

6 . P R I N T E R P R I N C I P L E S 1 4 6 . T H D A I S Y - W H E E L P R I N T E R 1 4 6 . 2 T H E P A R A L L E L M A T R I X P R I N T E R 1 5 6 . 3 T H E S E R I A L M A T R I X P R I N T E R 1 5

7 . 0 T H E O P E R A T I N G S Y S T E M O F T H E M P S - 8 0 1 1 5 7 . 1 T H E 8 0 3 9 M I C R O P R O C E S S O R 1 5 7 . B L O C K D I A G R A M O F T H E M P S - 8 0 1 1 6 7 . M P S - 8 0 1 R O M L I S T I N G 1 6

8 . 0 T H E V I C - 1 5 2 0 P R I N T E R - P L O T T E R 2 3 8 . U S E F U L N E S S A N O P E R A T I O N 2 3 8 . S E C O N D A R Y A D D R E S S E S O T H V I C - 1 5 2 0 2 4 8 . C O N S T R U C T I N G F I G U R E S O A L K I N D S 2 6 8 . 3 . 1 S Q U A R E 2 6 8 . 3 . 2 R E C T A N G L E 2 7 8 . 3 . 3 P A R A L L E L O G R A M 2 7 8 . 3 . 4 T R I A N G L E 2 7 8 . 3 . 5 A R C S 2 8 8 . 3 . 6 T R I A N G L E 2 9 8 . R E P R E S E N T A T I O N S O F U N C T I O N S . 2 9 8 . P E C U L I A R I T I E S O T H E 1 5 2 0 3 0 98 . S T A T I S T I C S O T H E 1 5 2 0 P L O T T E R 3 1 8 . P L O T T E R U T I L I T Y P R O G R A M 3 2

Page 7: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 7/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

1 . I N T R O D U C T I O N

W h e n y o s a w t h i s b o o k f o r t h e f i r s t t i m e , y o p r o b a b l yw o n d e r e d t y o u r s e l f : " H o w i t h w o r l d c a t h e y w r i t e s m u c h m a t e r i a l a b o u t s u c h t r o u b l e - f r e e d e v i c e a p r i n t e r ? "

Y o c a n s e e f r o m j u s t l o o k i n g a t h i s b o o k , t h o u g h , t h a ti i q u i t e l a r g e o n e . Y o u a s k a g a i n , " W h y ? "

L e u a s k y o u q u e s t i o n : W o u l d y o e v e r t h i n k o w r i t i n gb o o k e n t i t l e d ' T h e B i H a n d M i x e r H a n d b o o k ' ? O f c o u r s e

y o w o u l d d i s m i s s s u c h a i d e a i m m e d i a t e l y a f i r s t , b u i i u n b e l i e v a b l e w h a t y o u m i g h t n e e d t k n o w t o p e r a t eh a n d m i x e r . F o r e x a m p l e , w h i p p i n g c r e a m i s o m e t h i n g y o w o u l d n ' t n e e d t h i s h a n d b o o k f o r ; b u t w h a t d y o d w h e n y o t r k n e a d i n g b r e a d d o u g h i t h e m i x e r , a n t h m i x e r j a m s ?O f c o u r s e y o u d o n ' t k n o w — t h e H a n d b o o k w o u l d p r o b a b l y t e l ly o u . [ U n t i l t h b o o k i w r i t t e n , w e ' l l t e l l y o u t h es o l u t i o n : S i m p l y s e t t h e b e a t e r s t u r n i n g i t h o p p o s i t ed i r e c t i o n ] .

Y o s e e , o u b o o k w a w r i t t e n w i t h t h i s i m i n d . I c o v e r sa l m o s t e v e r y t h i n g , f r o m c o n n e c t o r s t o p e r a t i n g s y s t e m s ,w i t h p l e n t y o m a t e r i a l i b e t w e e n f o a l i n t e r e s t e dp a r t i e s . O i n t e r e s t t m o s t p e o p l e , t h o u g h , w i l l b o u c o l l e c t i o n o p r o g r a m l i s t i n g s , w h i c h w i l l m a k e u s i n gp r i n t e r s o m e w h a t e a s i e r .

W e h a v e t r i e d t m a k e t h i s b o o k a c o m p r e h e n s i v e a p o s s i b l ef o t h o w n e r s o p o p u l a r p r i n t e r s ( a n d t h e i r c o m p a t i b l e s )b u i l t f o r t h e C - 6 4 .

Page 8: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 8/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

C h a p t e r 8 i d e v o t e d e x c l u s i v e l y t t h V I C - 1 5 2 0 p r i n t e r -p l o t t e r . A l t h o u g h t h r e m a i n i n g c h a p t e r s h a v e g o o d d e a lw h i c h a p p l i e s t y o 1 5 2 0 o w n e r s , w e w a n t e d t b a t h o r o u g h a p o s s i b l e ; w e d i d n ' t w a n t y o u t o f e e l l e f t o u t .

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

T h A u t h o r s

Page 9: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 9/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

2 I N T E R F A C E S

T h e r e i h a r d l y s u b j e c t i h o m e c o m p u t i n g t h a t a t t r a c t st e c h n i c i a n s a m u c h a i n t e r f a c e s . T h e s e w i l l a l l o w t h t e c h h o b b y i s t t c o n v e y i n f o r m a t i o n t a n f r o m t h c o m p u t e ri a n n u m b e r o f w a y s .

I n t e r f a c e s a r n e c e s s a r y t p r i n t i n g . H o w e v e r m a n yc a p a b i l i t i e s y o u r p r i n t e r m i g h t h a v e , t h o d d s a r v e r y g o o dt h a t i i n o a " o r i g i n a l " d e v i c e ( n o t r e a d y t p l u gd i r e c t l y i n t o y o u r c o m p u t e r ) . T c o m p l i c a t e m a t t e r s e v e nm o r e , m o s t p r i n t e r s w i t h i n b r a n d n a m e c a d i f f e r g r e a t l yi c o n n e c t i o n s . P e r h a p s y o h a v e f o u n d t h p r i n t e r w h i c h

w i l l f u l f i l l y o u r n e e d s , y e t y o a r e n ' t s u r e w h e t h e r i w i l lc o n n e c t t y o u r c o m p u t e r .

T h s a l e s p e r s o n s a y s t y o u , " B u t y o u r c o m p u t e r h a a i n t e r f a c e , a n d t h p r i n t e r h a c o n n e c t o r . E v e r y o n ek n o w s t h a t y o c a n ' t c o m b i n e t h e t w o . "

I i r e a l l y a c l e a r a t h a t ?

W h a v e a t t e m p t e d i t h i s c h a p t e r t e x p l a i n t h d i f f e r e n ti n t e r f a c e s a v a i l a b l e t o y o u . I t h e n y o c a m a k e y o u ro w j u d g e m e n t r e g a r d i n g t h c o m p a t i b i l i t y o f t h e d i f f e r e n ti n t e r f a c e s .

N a t u r a l l y , w e ' l l b e g i n a s m a n y o t h e r s d w h e n t a l k i n ga b o u t t h C - 6 4 ; w i t h t h s e r i a l b u s .

Page 10: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 10/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

2 . T h C - 6 4 S e r i a l B u

T h C - 6 4 s e r i a l b u s i n o t h s a m e a t h s t a n d a r d p o r t o t h s a m e n a m e , a g r e e d u p o n b y U . S . m a n u f a c t u r e r s i 1 9 7 4 .

T h e 6 4 ' s h a s m a l l e r l o g i c t h a n t h " b i g 1 1 s e r i a l p o r t ,a l t h o u g h i t s m a l l n u m b e r o l i n e s u s e d a r e j u s t a c o m p l e x .S e e f o r y o u r s e l f .

2 . 1 . 1 F u n d a m e n t a l s

T h s e r i a l p o r t h a s s i x l i n e s , a o p p o s e d t t h p a r a l l e lp o r t ' s 2 4 l i n e s . L e t ' s l o o k a t h e m i n d i v i d u a l l y :

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

T h i s f u n c t i o n i n o u s e d b y C o m m o d o r e .

G N

A T ( A T t e N t i o n ) . W h e n e v e r t h c o m p u t e r t r a n s m i t sc o m m a n d t t h p r i n t e r , t h i s l i n e i a c t i v a t e d . R a t h e r t h a ns i m p l y s e n d c o m m a n d d i r e c t l y , A T i u s e d f i r s t t o l e t t h p r i n t e r k n o w t h a t c o m m a n d w i l l b e c o m i n g . O n c e t h c o m m a n d i e x e c u t e d , t h i s l i n e c a n b e " u n c o u p l e d " f r o m t h b u t o l e t i c o n t r o l a n o t h e r d e v i c e i s d e s i r e d .

Page 11: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 11/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

C L ( C L o c K ) . S i n c e t h s e r i a l p o r t t r a n s f e r s d a t a o n e b i ta t i m e ( r a t h e r t h a n i b y t e s ) , t h e C L l i n e s e n d s t i m ei m p u l s e w i t h e v e r y b i s e n t , w h i c h c h e c k s t h v a l i d i t y o t h d a t a l i n e s .

D A T A . T h i s i t h d a t a l i n e , w h i c h t r a n s m i t s t h d a t ab y t e w i t h t h e l e a s t s i g n i f i c a n t b i t . A l o n g w i t h t h a t , t h i sl i n e h a s o t h e r t a s k s t p e r f o r m l a t e r ( a w s h a l l s o o ns e e ) .

R E ( R E S e t ) . l o w - l e v e l g a u g e i t h i s l i n e a r r a n g e s a l c o n n e c t e d d e v i c e s i n c e r t a i n s e q u e n c e , a n d c h e c k s t s e w h e t h e r d e v i c e i s w i t c h e d o n

T h e x a m p l e b e l o w w i l l s e r v e t i l l u s t r a t e t h i s l i n e ' sf u n c t i o n . T a k e t h e s e t w B A S I C l i n e s :

1 O P E N 1 , 2 P R I N T # 1 , " A "

A l t h i s p r o g r a m s h o u l d d i p r i n t t h l e t t e r t p r i n t e r w i t h d e v i c e n u m b e r o 4 L i n e 2 t r i g g e r s t h b u i n t o a c t i o n . T h O P E N c o m m a n d a l o n e d o e s n ' t s e t h p r i n t e ri n t o a c t i o n ; t h i s i a l s o t h c a s e w i t h t h d i s k d r i v e , i

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

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

- 5

Page 12: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 12/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

2 . 1 . 2 A d d r e s s e s

P l e a s e r e f e r t t h d i a g r a m s o p a g e s 8 a n 1 0

1 A T N w i l l b e l o w f o c h a r a c t e r s w h i c h f o l l o w c o m m a n d .

2 T h i s w i l l t u r n t h d a t a l i n e g o i n g t o t h e d e v i c e l o w i t h i n m i l l i s e c o n d . T h c o m p u t e r s i g n a l s w h e n b y t e i r e a d y w i t h C L K = h i g h .

3 A l o n g a t h d e v i c e i n o r e a d y t t a k e i d a t a , t h eD A T A l i n e w i l l r e a d l o w ; o t h e r w i s e , D A T A = h i g h .

3 - 4 : N o t h d e v i c e n u m b e r t r a v e l s o v e r t h D A T A l i n e , a n s e n d s b i w i t h e v e r y h i g h i m p u l s e f r o m t h C L l i n e .

5 W i t h i n t h a t s a m e o n e m i l l i s e c o n d , t h p r i n t e r r e t u r n st h D A T A l i n e t l o s e t t i n g . T h i s s e r v e s t t u r n o f fr e c e p t i o n , u n t i l m o r e d a t a i s e n t b t h c o m p u t e r .

W e n o w h a v e t h D A T A l i n e p e r f o r m i n g t h r e e t a s k s , i . e . :

1 T r a n s m i t t i n g d a t a2 R e c e i v i n g d a t a3 C l o s i n g o f d a t a

2 . 1 . 3 D a t a t r a n s f e r

6 T h d a t a t r a n s f e r b e g i n s h e r e , a l o n g a t h s e n d e r h a s e C L h i g h . T h i s s h o w s t h a t b y t e i r e a d y f o t r a n s f e r .

7 T h r e c e i v i n g d e v i c e a c k n o w l e d g e s i t r e a d i n e s s b ys e t t i n g D A T A h i g h .

Page 13: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 13/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

8 - 9 : A d a t a b i t n o w t r a v e l s o v e r t h D A T A l i n e w i t h e v e r yi m p u l s e g i v e n b y C L K .

9 R e c e i p t o t h e n t i r e b y t e i c o n v e y e d t t h s e n d e r b yD A T A = l o w . O u l e t t e r A i l i n e 2 h a s j u s t b e e n p r i n t e d( a n d i a l t h a t i l e f t o f t h i s e n t i r e p r o c e d u r e ) .

1 1 - 1 2 : T h c a r r i a g e r e t u r n , o C H R $ ( 1 3 ) , i t r a n s m i t t e d i t h s a m e w a y .

N o t h C L l i n e h a s a a d d i t i o n a l t a s k :

A t h s a m e t i m e t h a t t h e l a s t b y t e o t r a n s f e r e d d a t a i r e g i s t e r e d , t h r e c e i v e r i t o l d t b e g i n i t a s s i g n m e n t .T h i s f u n c t i o n i e n t r u s t e d t C L K .

1 3 - 1 4 : T h i s a r r a n g e m e n t i s i m i l a r t t h e l a s t t w oi l l u s t r a t i o n s , w i t h t h a d d i t i o n o t h r e c e i v e r s e t t i n g t h D A T A l i n e t o h i g h ; t h s e n d e r r e c e i v e s t h i s c h a n g e w i t h i n0 . m i l l i s e c o n d s a f t e r t h d a t a t r a n f e r w a i n i t i a l i z e d b C L K = l o w . N o t h C L K r e m a i n s h i g h , w h i c h o b v i o u s l y m e a n st h a t t h b y t e p r e v i o u s l y s e n t w a s t h e l a s t b y t e .

T h i s c o n d i t i o n w i l l c a u s e t h r e c e i v e r t q u i t w i t hD A T A = l o w .

1 5 A s o o n a D A T A i a g a i n h i g h , t h s e n d e r c a r r i e s o v e ra e m p t y b y t e ( c h r $ ( 0 ) — t h i s i p o i n t 1 i t h i l l u s t r a t i o n ) , a f t e r w h i c h t h e b u s s t a n d s i s t a t e o r e s t .

Page 14: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 14/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

A d d r e s s i n g

5

- 8

Page 15: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 15/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

D a t a T r a n s f e r

Page 16: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 16/343

A B A C U S S o f t w a r e P B I N T B R B O O K f o r t h e C O M M O D O R E 6

L a s t D a t a B v t e

• —

r

C

( 3

1

Page 17: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 17/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

T h d e a d d r e s s i n g f o l l o w s a l o n g t h l i n e s o p o i n t s 1 - 5 ,w h e r e b y t h d a t a b y t e s h o w s v a l u e o f 6 3 ( $ 3 F ) . T h i s i t h s o - c a l l e d U N L I S T E N c o m m a n d , w h i c h m e a n s t h a t a l d e v i c e sr e c e i v i n g d a t a u u n t i l n o w a r u n c o u p l e d f r o m t h b u s , s ot h a t n o m o r e d a t a w i l l b t r a n s f e r r e d .

A y o c a s e e , t h i s s y s t e m w o r k s b e a u t i f u l l y . T h m o s ta n n o y i n g d i s a d v a n t a g e t s e r i a l p o r t ( a o p p o s e d t p a r a l l e l p o r t ) i t h s l o w s p e e d o d a t a t r a n s f e r ( t h ep a r a l l e l p o r t d o e s i m i l l i s e c o n d w h a t t a k e s t h s e r i a lp o r t 6 m i l l i s e c o n d s ) , w h i c h r e s u l t s i l o t s o f w a i t i n gt i m e .

1 1

Page 18: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 18/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

2 . T h C E N T R O N I C S I n t e r f a c e

O n o t h m o s t w i d e l y - u s e d p r i n t e r i n t e r f a c e s i t h e o n ep r o p o s e d b C e n t r o n i c s . T h i s m e t h o d o d a t a t r a n s f e r h a b e e n a c c e p t e d b y m o s t p r i n t e r m a n u f a c t u r e r s , a n d m o s tp r i n t e r s a r c o m p a t i b l e w i t h t h i s p r o d u c t .

Y o h a v e g r e a t a d v a n t a g e i y o h a v e p r i n t e r w i t h t h i ss o r t o i n t e r f a c e ( o a e c o n o m i c a l v a r i a n t o i t ) . T h o n l y p r o b l e m r e m a i n i n g i c o n n e c t i n g t h p r i n t e r t t h e C -6 4

T h m o s t e c o n o m i c a l m e t h o d o m a k i n g t h i s c o n n e c t i o n i p r e s e n t e d i d e t a i l i A B A C U S S o f t w a r e ' s T i p s a n d T r i c k s f o t h C o m m o d o r e 6 4 Y o u ' l l n e e d c o n n e c t i n g c a b l e t r i t h p r i n t e r t t h u s e r p o r t , a n l i t t l e d r i v e r s o f t w a r e .W i t h t h h e l p o t h e s e w r i t i n g s o i n t e r f a c e s ( w h i c h w i l lh e l p y o u f i n d y o u r w a y a r o u n d t h u s e r p o r t b i t ) , i w i l ln o b a a l d i f f i c u l t f o y o t a s s e m b l e s u c h c a b l e .

S o m e w h a t m o r e e x p e n s i v e ( b u t c l e a r l y m o r e c o n v e n i e n t ) i a i n t e r f a c e w h i c h c o n v e r t s t h s e r i a l C - 6 4 s e r i a l p o r t i n t or e a d a b l e f o r m f o r t h e p r i n t e r . T h i s i u s u a l l y s m a l l b o xw h i c h s i m p l y c o n n e c t s b e t w e e n t h t w d e v i c e s . T h i ss o l u t i o n h a c a t c h t i t h o w e v e r : M a n y u n i t s o f t h i sk i n d l i m i t y o u t " s t a n d a r d " a l p h a n u m e r i c c h a r a c t e r s . T h m a n y g r a p h i c a n c o n t r o l c h a r a c t e r s i t h C - 6 4 ' s c h a r a c t e rs e t a r e n o u s u a l l y a c k n o w l e d g e d b y t h p r i n t e r u s i n g t h i sb o x . O t h e r w i s e t h i s i n t e r f a c e i q u i t e u s e f u l , e s p e c i a l l yw h e n y o u c o n s i d e r t h a t n o d r i v e r s o f t w a r e o a n k i n d i r e q u i r e d . F r o m B A S I C t h p r i n t e r c a b a d d r e s s e d a n o r m a l C o m m o d o r e d e v i c e . F o r a n c h a r a c t e r c o d e c o n v e r s i o n st h a t m i g h t b n e c e s s a r y , p l e a s e s e S e c t i o n 3 . 3 .

1

Page 19: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 19/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

g o o d a l l - a r o u n d s o l u t i o n ( a t h e a s e o u s i w e l l w o r t ht h e x p e n s e ) i f u l l g r a p h i c i n t e r f a c e m a n u f a c t u r e d b C A R D C O a n d o t h e r s . T h i s s o r t o i n t e r f a c e ( m e n t i o n e d i S e c t i o n 3 . 3 ) g i v e s y o u g r e a t c o n t r o l o v e r n o n - c o m m o d o r ep r i n t e r s . F i r s t , y o j u s t c o n n e c t t h p r i n t e r u t t h s e r i a l p o r t a i i w e r e s t a n d a r d C o m m o d o r e p r i n t e r ,w h i c h m e a n s t h a t y o c a e a s i l y o p e r a t e i f r o m B A S I C .S e c o n d l y , t h p r i n t e r w i l l e a s i l y p r o d u c e t h o s e c o n t r o lc h a r a c t e r s a n g r a p h i c s w i t h t h h e l p o t h i s i n t e r f a c e .A s i d e f r o m t h a t , t h e d e v i c e i c o m p a t i b l e w i t h t h V I C - 1 5 2 5p r i n t e r , s t h a t m o s t s o f t w a r e u s e d w i t h t h l a t t e r w i l l r u t h E P S O N w i t h n o r e a l t r o u b l e .

N o w , h o w e v e r , w e c o m e t t h s u b j e c t a h a n d , i . e . , t h C e n t r o n i c s i n t e r f a c e .

A r u l e , i h a 3 6 - p i n C i n c h c o n n e c t o r , f r o m w h i c h a b o u th a l f t h l i n e s a c t u a l l y c a r r y s i g n a l . I y o w i s h t l i m i t y o u r s e l f t d a t a t r a n s f e r a n n o t h i n g m o r e , 1 o t h o s e l i n e s w o u l d b e s u f f i c i e n t . T h o t h e r s s e r v e a s i g n a l s t c e r t a i n c o n d i t i o n s w i t h i n t h p r i n t e r , a n d a r n o a v a i l a b l e o n a l l t h d i f f e r e n t b r a n d s o c o n n e c t i n gj a c k .

L e t ' s b e g i n w i t h t h p i n l a y o u t o t h C e n t r o n i c s c a s e .

S T R O B E . T h i s l i n e i h i g h w h e n t h p r i n t e r i i s t a t e o f r e s t . l o i m p u l s e t a k e s l e s s t h a n o n m i c r o s e c o n d t s i g n a l t h p r i n t e r t h a t d a t a i o t h w a y .

2 - D A T A 0 - 7 . T h p r i n t e r r e c e i v i e s b y t e s o v e r t h e s el i n e s .

1 3

Page 20: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 20/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

1 A C K N L G . T h e p r i n t e r a c k n o w l e d g e s r e c e i p t o t h d a t ab y t e o v e r t h i s l i n e , u s i n g l o i m p u l s e o a p p r o x i m a t e l y 1 m i c r o s e c o n d s . T h s e n d e r c a t h e n t r a n s m i t t h n e x t b y t eo v e r t h d a t a l i n e s ( b u t s t i l l n s t r o b e t s e n d i b a c k ! ) .

T h i s l i n e i a b s o l u t e l y n e c e s s a r y t e r r o r - f r e e c o n t r o l o t h d a t a f l o w . T h s o - c a l l e d B U S Y l i n e c a s e r v e t h s a m ep u r p o s e , i . e . , t h 1 s i g n a l s m e n t i o n e d a b o v e a r e t h ei m p o r t a n t o n e s , s o m o s t i n t e r f a c e s d o n o t i n c l u d e A C K N L G .

1 B U S Y . T h i s l i n e i h i g h w h e n t h p r i n t e r i n o r e a d y t r e c e i v e n e d a t a b y t e . T h i s l i n e h a d i f f e r e n t w a y s o o p e r a t i n g ; t h p r i n t e r c a b s t o p p e d w h e n t h p a p e r h a r u o u t , o r i i i O F F L I N E , e t c .

I p o s s i b l e , t h d a t a s e n d e r ( t h e c o m p u t e r ) s h o u l d f i r s ts e n d t h d a t a w i t h S T R O B E w h e n B U S Y = l o w .

1 2 P E . T h i s l i n e g i v e s h i g h s i g n a l t t h p r i n t e r w h e n t h p a p e r h a r u o u t .

1 G N D . T h i s i t h g r o u n d w i r e f o a l s i g n a l s .

1 + 5 V . T h i s c a p r o v i d e a n e x t e r n a l i n t e r f a c e s w i t hv o l t a g e . T h i s c u r r e n t i n o a v a i l a b l e o a l p r i n t e r s .T h n e c e s s a r y i n f o r m a t i o n s h o u l d b i y o u r p r i n t e r m a n u a l .

3 I N I T . T h i s l i n e g i v e s l o i m p u l s e o f l e s s t h a n 5 m i c r o s e c o n d s , b r i n g i n g t h p r i n t e r t t h s t a r t i n g p o s i t i o n ,a s i f y o u h a d j u s t s w i t c h e d t h p r i n t e r o n

1 4

Page 21: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 21/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

3 E R R O R . U s i n g l o i m p u l s e , t h i s l i n e i n f o r m s t h p r i n t e rw h e t h e r t h e r e i n p a p e r l e f t , o r w h e t h e r t h p r i n t e r i O F F L I N E , o i a n y e r r o r s a p p e a r .

T h c o m b i n a t i o n o t h P a n E R R O R s i g n a l s c a h e l p y o ui n t e r p r e t a n y c a u s e f o r t h e B U S Y m o d e s h u t t i n g o f f , i y o c a g e t h e s e s i g n a l s o y o u r c o m p u t e r . T h e s e l i n e s a r r a r e l y u s e d .

3 S L C T I N l o s i g n a l o t h i s l i n e m a k e s i p o s s i b l e f o t h p r i n t e r t f u n c t i o n i n i t i a l l y . I t ' s c o n c e i v a b l e t h a ty o u c o u l d p r o d u c e a a r t i f i c i a l l o s i g n a l w i t h t h h e l p o

s w i t c h r i g g e d t t h i n s i d e o f t h e p r i n t e r .

I y o u r p r i n t e r d o e s n o s t i r o i n i t i a l i z a t i o n , t h e n y o s h o u l d d i s r e g a r d t h a b o v e .

T h u n u s e d l i n e s e i t h e r h a v e n f u n c t i o n w h a t s o e v e r , o t h e yp e r f o r m t a s k s s p e c i f i c t t h p r i n t e r . C h e c k y o u r p r i n t e rd o c u m e n t a t i o n .

I i p o s s i b l e t r u p r i n t e r w i t h l i n e s 1 - 9 , 1 a n 1 a l o n e . T h r e m a i n i n g l i n e s m a b u s e d b s o m em a n u f a c t u r e r s , b u n u n i v e r s a l a g r e e m e n t s h a v e b e e n m a d e .

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

1 W h e n B U S Y = l o w , b y t e c a n b e s e n t o v e r t h d a t a l i n e s .A f t e r m i n i m u m o f 0 . 5 m i c r o s e c o n d s , t h

2 S T R O B E w i l l b r e l e a s e d , w h i c h h a d u r a t i o n o a l e a s t m i c r o s e c o n d .

- 1 5 -

Page 22: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 22/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

T h a r r i v a l o t h c h a r a c t e r b y t e w i l l c h a n g e B U S Y t h i g h .

3 A f t e r S T R O B E i t a k e n o f f , t i m e p e r i o d o

4 l e s s t h a n 0 . m i c r o s e c o n d s e l a p s e s . N o t h d a t a l i n e sw i l l c h a n g e t h e i r c o n d i t i o n .

5 T h e t i m e c a v a r y g r e a t l y f r o m h e r e o i n w h e r e a s i t h p r e v i o u s s t e p s , s p e c i f i c s c o u l d b g i v e n . T h i s d e p e n d so w h a t t h p r i n t e r h a t d i t h m e a n t i m e , i . e . ,b r i n g i n g u c h a r a c t e r s f r o m t h b u f f e r , o w h e t h e r t h m o s tr e c e n t l y h a n d l e d c h a r a c t e r w a a t h e n o l i n e .

6 N o w n e w d a t a c a b s e n t o v e r t h d a t a l i n e s .

W h e n B U S Y = l o w , t h S T R O B E c a n b e r e l e a s e d , a n d t h e e n t i r ep r o c e d u r e s t a r t e d a n e w .

1

Page 23: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 23/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

t i c s I n t e r f a c e

V -

( £

1

" J

Page 24: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 24/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

2 . T h R S - 2 3 2 C I n t e r f a c e

H e r e w e ' l l l o o k a y e a n o t h e r m e t h o d o f t h e l o g i c o i n t e r f a c i n g t w d e v i c e s . T h R S - 2 3 2 C t y p e o i n t e r f a c e i p r e f e r r e d b e c a u s e o f i t s a b i l i t y t t r a n s f e r d a t a a n i t v e r s a t i l i t y ; i t p h y s i c a l c o n s t r u c t i o n a n l o g i c c i r c u i t sa r e t h e r e a s o n f o t h i s .

A R S - 2 3 2 C p l u g i c o n s i d e r e d b i - d i r e c t i o n a l , i . e . , d a t a c a t r a v e l i b o t h d i r e c t i o n s . I m o s t c a s e s , t h e d a t a t r a n s f e ro n l y g o e s i o n d i r e c t i o n ( t t h p r i n t e r ) , b u t w h e nd e f i n i t e c o n t r o l l i n e s a r i n v o l v e d ( s u c h a s o n t h C e n t r o n i c s i n t e r f a c e ) , t h p r i n t e r s e n d s i n f o r m a t i o n i t h o p p o s i t e d i r e c t i o n ( b a c k t t h c o m p u t e r ) .

T h r e a s o n t h a t w e a r e p r e s e n t i n g s m u c h d e t a i l o t h i si n t e r f a c e i t h a t , a w e ' v e a l r e a d y m e n t i o n e d , t h i si n t e r f a c e i v e r y w i d e l y u s e d ; a n o t h e r r e a s o n i t h a t t h eC o m m o d o r e R S - 2 3 2 C C a r t r i d g e s u p p o r t s t h C - 6 4 o p e r a t i n gs y s t e m w i t h n p r o b l e m ; f i n a l l y , i t h s e c t i o n s t f o l l o wo s e t t i n g p a r a m e t e r s , w a r u s i n g t h i s i n t e r f a c e a t h s t a n d a r d , t h e l p t a k e s o m e o t h m y s t e r y o u t o f a d d r e s s i n gf o r t h e l a y m a n .

T h p r o b l e m l i e s n o t o n l y i t h p r o p e r c h o i c e o d a t at r a n s f e r p a r a m e t e r s ( w e ' l l e x p l a i n p a r a m e t e r s l a t e r ) , b u i t h f a c t t h a t s o m e t i m e s t w d e v i c e s w i l l o p e r a t e u s i n g t h i si n t e r f a c e u s i n g s i m p l e " o n e - o n - o n e " c o n n e c t i o n — m o r e o f t e nt h a n n o t , t h e y w o n ' t w o r k . W e ' l l s h o w y o u h o t s o l v e t h i sp r o b l e m , a n h o t h p r o b l e m i c a u s e d , d o n o t b d i s c o u r a g e d i y o a r e n ' t s u r e w h e t h e r t h p r o b l e m i i t h e l e c t r o n i c e q u i p m e n t , o i t h p r o g r a m l o g i c .

1

Page 25: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 25/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

T h f o l l o w i n g e x p l a n a t i o n s d e a l w i t h t h V I C - 1 0 1 1 R S 2 3 2 -C a r t r i d g e f r o m C o m m o d o r e o n l y .

T h c o n n e c t o r i b a s e d o 2 5 - p i n c o n n e c t o r ( b e s t k n o w n a D B - 2 5 - s u b m i n i a t u r e ) . Y o u c a n p u r c h a s e m a t c h i n g

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

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

D o n ' t w o r r y , t h o u g h , i o u p i n l a y o u t f o t h R S - 2 3 2C a r t r i d g e , y o u ' l l f i n d t h a t o n l y t h r e l e v a n t s i g n a l s w i l lb u s e d . Y o n e e d n ' t u s t h p i n s l e f t u n m e n t i o n e d .

P I 2 T X T r a n s m i t t e d D a t a ( s i g n a l o u t p u t ) . T h i s l i n es e r i a l l y t r a n s f e r s t h u s e r d a t a .

P I 3 R X R e c e i v e d D a t a ( s i g n a l i n p u t ) . T h e c o n n e c t e dd e v i c e s e n d s b a c k t h a t d a t a h a b e e n r e c e i v e d . A r u l e ,t h i s l i n e i n o u s u a l l y r e s e r v e d i p r i n t e r s .

P I 4 R T R e q u e s t t S e n d ( s i g n a l o u t p u t ) . T h i s l i n e i a c t i v a t e d ( > 3 V ) w h e n t h i n t e r f a c e i a w a i t i n g d a t a . T h i si n o a l w a y s t h c a s e i p r i n t e r o p e r a t i o n s ; i 3 - w i r eo p e r a t i o n s , t h i s s i g n a l i a l w a y s o n

1

Page 26: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 26/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

P I 5 C T C l e a r t S e n d ( s i g n a l i n p u t ) . T h e C - 6 4 c a s e n d d a t a O N L Y w h e n t h i s l i n e f r o m t h c o n n e c t e d d e v i c e i o ( > 3 V ) .

T h i s l i n e m u s t b e c o n n e c t e d u i p r i n t e r o p e r a t i o n s s i n c ei d i c t a t e s d a t a f l o w ; o t h e r w i s e , c h a r a c t e r s c a b l o s td u r i n g d a t a t r a n s f e r .

P I D S R D a t a S e R e a d y ( s i g n a l i n p u t ) . T h i s l i n e s o r to " t a k e s a t t e n d a n c e " f o r t h e C - 6 4 ' s o p e r a t i n g s y s t e m , i . e . ,i c h e c k s t s e w h e t h e r d e v i c e i c o n n e c t e d t t h i n t e r f a c e , a n d w h e t h e r i i s w i t c h e d o n

A n y o p e r a t i o n , b e i s e n d i n g o r e c e i v i n g , w i l l o n l y o c c u ri t h i s l i n e d e t e c t s v o l t a g e o v e r v o l t s .

P I G N G r o u n d . A p p l i e s t a l l i n e s .

P I D C D a t a C a r r i e r D e t e c t e d ( s i g n a l i n p u t ) . T h i ss i g n a l h a r o u g h l y t h s a m e m e a n i n g a 6 Y o w o u l d b b e s to f c o n n e c t i n g i w i t h p i 2 0

P I 2 D T D a t a T e r m i n a l R e a d y ( s i g n a l o u t p u t ) . T h i sl i n e i t h o p p o s i t e o 6 T h i s s i g n a l i a c t i v a t e d w i t ht h e f i r s t O P E N c o m m a n d c o n t a i n i n g d e v i c e n u m b e r 2

T h t r a n s f e r p a r a m e t e r s a r d e t e r m i n e d i t h c o m p u t e r i t h O P E N c o m m a n d , a n d i t h p r i n t e r b y t h e d i p s w i t c h e s .I t i s o f i r s t p r i o r i t y t u n d e r s t a n d w h a t t h e s e p a r a m e t e r sa r e .

2

Page 27: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 27/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

1 B a u d r a t e

T h i s d e t e r m i n e s t h t r a n s f e r s p e e d i b i t s p e s e c o n d ( r o u g h e s t i m a t e ) a n i t h e m o s t i m p o r t a n t p a r a m e t e r o f t h e ma l l i f t h b a u d r a t e s d n o m a t c h , t h e s y s t e m d o e s n ' tw o r k a t a l l .

2 N u m b e r o D a t a b i t s

T h i s p a r a m e t e r d e t e r m i n e s h o m a n y b i t s b y t e w i l l c o n t a i n .N o r m a l v a l u e s w h e n c o n n e c t e d w i t h p r i n t e r a r a n 8

3 N u m b e r o S t o p b i t s

A r u l e , t h i s i o n l y o 2 Y o c a t r p l a y i n g w i t ht h i s n u m b e r , b u w a t c h o u t f o r c o m p a t i b i l i t y p r o b l e m s .

4 P a r i t y

Y o u h a v e c h o i c e o n p a r i t y , e v e n , o r o d d p a r i t y .Y o c a c h o o s e n p a r i t y , b e c a u s e i s a v e s t r o u b l e w i t hd a t a b i t s , a n i n t r a n s f e r e r r o r s a r e x p e c t e d .

I c a s e y o u d o n ' t k n o w w h a t p a r i t y m e a n s :

d a t a b y t e c o n s i s t s o 0 - b i t s a n d l - b i t s . T c h e c k w h e t h e rb y t e h a b e e n t r a n s f e r r e d u n g a r b l e d , a a d d i t i o n a l b i i

a d d e d , i . e . , t h s o - c a l l e d p a r i t y b i t . T h i s s h o u l d p r o d u c ee i t h e r a o d o e v e n n u m b e r i n s e r i e s o l - b i t sc o n s i s t e n t l y , d e p e n d e n t o t h p a r a m e t e r s e t .

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

- 2 1 -

Page 28: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 28/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

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

i g n o r e s

S h o u l d y o u h a v e a l t h p a r a m e t e r s s e c o r r e c t l y , a n d t h d e v i c e s a r p r o p e r l y c o n n e c t e d , a n t h t h i n g s t i l l w o n ' tr u n , y o c a t r l i t t l e t r i c k o t h e p a r i t y ; j u s t t r n p a r i t y , t h e n l o o k a t h t a b l e b e l o w f o s e t t i n g p a r a m e t e r sf r o m B A S I C .

T s i m p l i f y s e t t i n g p a r a m e t e r s f r o m t h c o m p u t e r e n d , w h a v e a s s e m b l e d t h m o s t i m p o r t a n t v a r i a b l e s a n p l a c e d t h e mi t h t a b l e b e l o w ; t h e u n n e c e s s a r y p a r a m e t e r s h a v e b e e nl e f t o u t . I y o a r i n t e r e s t e d i s e e i n g t h o s e n o t l i s t e d ,s e A B A C U S S O F T W A R E ' S T h A n a t o m y o t h C o m m o d o r e 6 4

1

2

3

B a u d r a t e :5 1 1 1 5 3 0 6 0 1 2 0 02 4 0 0

D a t a b i t s :

S t o p b i t s :

V a r i a b l e

1

V a r i a b l e3

V a r i a b l e

1 2

b r

d

s b

2

Page 29: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 29/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

4 H a n d s h a k e : V a r i a b l e h s n y e

W h a v e y e t d i s c u s s t h v a r i a b l e h s A f t e r c h o o s i n g y o u rp a r a m e t e r s , t h O P E N c o m m a n d w o u l d l o o k l i k e t h i s :

O P E N 1 , 2 , 0 , C H R $ ( b r + d b + s b ) + C H R $ ( h s )

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

S o l d e r c a b l e w i r e t p i o b o t h c o n n e c t o r s ( p r i n t e r -s i d e a n d c o m p u t e r - s i d e ) .

C o n n e c t ( a g a i n , b o t h e n d s ) p i n s 4 - 5 a n d 6 - 8 - 2 0 t o n a n o t h e r . T h i s w i l l f i r s t c h e c k f o h a n d s h a k i n g , a n l o o kf o o p e r a t i o n a l r e a d i n e s s a b o t h e n d s .

C h e c k y o u r p r i n t e r h a n d b o o k t s e w h i c h p i i f o d a t ai n p u t ( u s u a l l y o 3 ) C o n n e c t t h a t p i n , a n s o l d e r t h o t h e r e n d o t h a t l e a d t p i a t h c o m p u t e r s i d e .

I f a l l p a r a m e t e r s a r c o r r e c t ( a n d p a r i t y i d i s a b l e d ) , t h c a b l e s h o u l d b r e a d y t g o C o n n e c t t h p r i n t e r a n c o m p u t e r , t u r n t h e m o n a n t r a O P E N a n d P R I N T c o m m a n d .

C o n t i n u o u s p r i n t i n g s h o u l d h e l p u d e t e r m i n e w h e t h e r s o m ec h a r a c t e r s a r b e i n g s k i p p e d ( y o u ' l l o f t e n f i n d t h i s a t h b e g i n n i n g o l i n e ) . W h a v e n ' t g i v e n y o u a n m e t h o d y e f o s h u t t i n g o f t h p r i n t e r w h e n t h d a t a f l o w s t o p s .

N o y o u ' l l h a v e t f i g u r e o u w h i c h l i n e o f t h p r i n t e rs i g n a l s t h i s c o n d i t i o n . S e v a r i a b l e h ( i t h a b o v e O P E N )

- 2 3 -

Page 30: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 30/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

t e q u a l 1 O p e n t h b r i d g e 4 - o t h c o m p u t e r s i d e , a n c o n n e c t p i ( f r o m t h c o m p u t e r s i d e ) f i r s t t b r i d g e 4 - 5 ,t h e n w i t h b r i d g e 6 - 8 - 2 0 . O n o t h e s e t w c a s e s h a t g i v ey o c o m p l e t e d a t a i e v e r y l i n e .

I h s = 0 , t h e h a n d s h a k e l i n e s a r e n o i n t e r p r e t e d , a n d t h ec o m p u t e r s e n d s d a t a a n y w a y . T h i s p r o c e d u r e o n l y w o r k s w e l lw i t h a e x t r e m e l y l o b a u d r a t e , s i n c e t h p r i n t e r h a l t s f o i n p u t a f t e r e a c h c h a r a c t e r . I o r d e r t u s s l o w d a t af l o w , y o s h o u l d u s p r i n t e r w i t h o u t a n y s o r t o f i n p u tb u f f e r .

T h o n l y i t e m r e m a i n i n g i t o l e t y o u k n o w h o w t s w i t c h o l o w e r - c a s e l e t t e r i n g , a n d c a l l u u p p e r - c a s e a g a i n . F i r s ty o u ' l l n e e d s o m e t e c h n i c a l b a c k g r o u n d — s e e t h e x p l a n a t i o no s e c o n d a r y a d d r e s s i s e c t i o n 3 . 3 .

Y o s e e , i i n o s d i f f i c u l t t f i n d y o u r w a y t h r o u g h t h m a z e o p a r a m e t e r s a n l i n e s , a l o n g a y o u h a v e s o m e i d e ao w h a t y o u ' r e d o i n g .

2

Page 31: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 31/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

3 . S E C O N D A R Y A D D R E S S E S

T h e r e i h a r d l y s u b j e c t a i m p o r t a n t a t h s e c o n d a r ya d d r e s s . T h i s " g r e y a r e a " c a m a k e l i f e f a i r l y d i f f i c u l tw h e n i c o m e s t s o f t w a r e c o m p a t i b i l i t y w i t h p r i n t e r s .

D o n ' t b m i s l e d b t h p r e f i x " s e c o n d a r y " ; t h i s d o e s n ' t m e a nt h a t t h a d d r e s s t a k e s s e c o n d p r i o r i t y . T h i s i n d i c a t i o n i o n l y u s e d i s e r i a l b u t e r m i n o l o g y t d i s t i n g u i s h i f r o mt h p r i m a r y a d d r e s s ( t h e d e v i c e a d d r e s s i t s e l f ) . T h s e c o n d a r y a d d r e s s g i v e s t h m a n n e r i w h i c h t h d e v i c e w i l lb u s e d .

B y t h e e n o t h i s c h a p t e r , t h b e g i n n i n g p r o g r a m m e r s h o u l dh a v e b e t t e r i d e a o h o w t h e s e n u m b e r s w o r k .

R e m e m b e r , p r i n t e r s d o n o t a l r e s p o n d t h e s a m e w a t t h s a m e s e c o n d a r y a d d r e s s n u m b e r s . T h e b i g g e s t d i f f e r e n c e l i e si t h a t , f o e x a m p l e , o n p r i n t e r m a u s a a d d r e s s n u m b e ro a s w i t c h t h a l t d a t a , w h i l e a n o t h e r p r i n t e r u s e st h s a m e n u m b e r t o d o t h o p p o s i t e . T h i s , o f c o u r s e , m e a n st h a t s o f t w a r e d e s i g n e d f o t h f o r m e r w i l l c r a s h w h e n u s e dw i t h t h e l a t t e r . T h e r e i w a a r o u n d t h i s ; i i m a t t e ro c h a n g i n g P R I N T s t a t e m e n t s a r o u n d b i t , s t h a t p r o b l e m sc a n b e i r o n e d o u t .

B e a r t h i s t i i m i n d : S e u y o u r p r i n t e r o u t p u t r o u t i n ea s i n g l e s u b r o u t i n e , w h e r e t h s p e c i f i c P R I N T s t a t e m e n t sc a n b e f o u n d . T h e n , w h e n d i f f e r e n t p r i n t e r s a r b r o u g h t i t p l a y , y o o n l y h a v e t c h a n g e m i n i m u m o v a r i a b l e s . I w o u l d b w i s e t d o t h e s a m e w i t h t h O P E N c o m m a n d s . A r u l e , t h i s w i l l b a l t h a t y o m a h a v e t c h a n g e .

- 2 5 -

Page 32: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 32/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

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

D e f i n e t h l o g i c a l f i l e n u m b e r , d e v i c e a d d r e s s , a n s e c o n d a r y a d d r e s s a t h b e g i n n i n g o t h p r o g r a m , a n d f i l li t h n u m b e r s i t h O P E N a n P R I N T s t a t m e n t s w i t h t h e s ed e f i n i t i o n s . Y o u ' l l k i l l t w b i r d s w i t h o n s t o n e b y d o i n gt h i s : Y o w i l l b e a b l e t e a s i l y c h a n g e b o t h t h s e c o n d a r ya d d r e s s , a n d y o c a q u i c k l y a l t e r t h l o g i c a l f i l e n u m b e rf o p r i n t e r s t h a t r e q u i r e a e x t r a l i n e f e e d ( u s e n u m b e r> 1 2 7 ) o d o n ' t r e q u i r e a d d i t i o n a l l i n e f e e d s ( < 1 2 8 ) .

H e r e i a e x a m p l e :

1 L F = 1 : D A = 4 : S A = 7

1 0 O P E N L F , D A , S A

1 0 0 0 P R I N T # L F ,

N o i t i s j u s t m a t t e r o c h a n g i n g t h v a l u e s i l i n e 1 w h e n t h n e c e s s i t y a r i s e s , w i t h o u t h a v i n g t l o o k u p a l l t h O P E N a n P R I N T s t a t e m e n t s .

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

2

Page 33: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 33/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

3 . V I C - 1 5 2 5 / G P - 1 0 0 V I C / M P S - 8 0 1

T h e s e p r i n t e r s o n l y r e c o g n i z e t w s e c o n d a r y a d d r e s s e s w h i c hh e l p t h e m d e t e r m i n e w h i c h c h a r a c t e r s e t o u s e . L i k e t h 6 4 t h e s e p r i n t e r s a l s o h a v e t w b a s i c r e p r e s e n t a t i o n s .

S e c o n d a r y a d d r e s s ( o n s e c o n d a r y a d d r e s s )

1 O P E N 1 , 4 , 0 [ o 1 O P E N 1 , 4 ]2 0 P R I N T # l , f l a b c A B C f t

T h i s w i l l c a u s e t h p r i n t e r t p r i n t l o w e r - c a s e l e t t e r s i u p p e r - c a s e , a n u p p e r - c a s e l e t t e r s a g r a p h i c c h a r a c t e r s .

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

3 P R I N T # l , C H R $ ( 1 7 ) " a b c A B C "

U p p e r / l o w e r - c a s e w i l l p r i n t p r o p e r l y i t h i s l i n e o n l y .

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

1 O P E N 1 , 4 , 72 P R I N T # l , " a b c A B C "

U p p e r - a n l o w e r - c a s e a r p r i n t e d c o n s i s t e n t l y . T h i s c a b c h a n g e d t e m p o r a r i l y ( c f . s e c o n d a r y a d d r e s s 0 u s i n g t h c h a r a c t e r s t r i n g f o " c u r s o r - u p " b e f o r e t h t e x t :

3 P R I N T # l , C H R $ ( 1 4 5 ) " a b c A B C "

2

Page 34: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 34/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

N o t h l o w e r - c a s e a p p e a r s a u p p e r - c a s e , a n t h u p p e r - c a s el e t t e r s a r p r i n t e d a g r a p h i c s .

P l e a s e r e m e m b e r t h a t t h e c h a n g e s m a d e b C H R $ ( 1 7 ) o C H R $ ( 1 4 5 ) a r i e f f e c t f o r t h e l e n g t h o f t h e c u r r e n t P R I N Ts t a t e m e n t O N L Y .

N a t u r a l l y , y o c a m i t e c h n i q u e s w i t h i n l i n e , e i t h e r l i k et h i s :

1 O P E N 1 , 2 P R I N T # l , " a b c f f c h r $ ( 1 7 ) " A B C "

o l i k e t h i s :

1 O P E N l , 4 : 0 P E N 2 , 4 , 72 P R I N T # 1 , " a b c " : P R I N T # 2 , " A B C "

B o t h v e r s i o n s g i v e t h s a m e r e s u l t . T h e s e v e r s i o n s a r o n l yc o m p a t i b l e o C o m m o d o r e p r i n t e r s .

2

Page 35: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 35/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

3 , V I C - 1 5 2 6

M u c h h a b e e n w r i t t e n a b o u t t h i s p r i n t e r ; f e w d e v i c e s h a v ec a u s e d s m u c h c o n f u s i o n i t h e p a s t . H e r e i s u m m a r y o i t h i s t o r y :

T h p r i n t e r s p u o t h m a r k e t b e f o r e 1 2 / 8 3 w e r e n o t h i n gl i k e w h a t t h m a n u a l c l a i m e d — r a t h e r , t h e y r a n l i k e t h e V I C -1 5 2 5 s . T h o n l y r e g r e t t a b l e d i f f e r e n c e w a s t h a t t h e s i n g l e -n e e d l e g r a p h i c s s u p p o s e d l y s e u b y C H R $ ( 8 ) w e r e n o p o s s i b l e .

H o w e v e r , t h f o l l o w i n g m e a s u r e s w e r e i n s t a l l e d i t h 1 5 2 6 :A f t e r o p e n i n g t h e d e v i c e , p i n 1 o t h I i s o c k e t U 4 i g r o u n d e d . S e t h m a n u a l f o a p p l i c a t i o n s .

R u s e l f - t e s t t f i n d o u w h i c h i y o u r p r i n t e r . T h ef i r s t l i n e o t h p r i n t o u t s h o u l d h a v e t h v e r s i o n n u m b e r o t h p r i n t e r ' s o p e r a t i n g s y s t e m . T h i s s h o u l d b l e s s t h a n 7

1 5 2 6 o p e r a t i o n f e a t u r e s t h f o l l o w i n g s e c o n d a r y a d d r e s s e s :

S e c o n d a r y a d d r e s s ( o n s e c o n d a r y a d d r e s s ) .

S i m i l a r t a d d r e s s o t h p r i n t e r s i S e c t i o n 3 . 1 .T e m p o r a r y c h a n g e s c a n b e m a d e u s i n g C H R $ ( 1 7 ) a n C H R $ ( 1 4 5 ) .

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

T h i s g i v e s o u t h f o r m a t t e d d a t a p r e v i o u s l y d e t e r m i n e d b t h f o r m a t t i n g c o m m a n d g i v e n b s e c o n d a r y a d d r e s s 2

2

Page 36: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 36/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

T h c h o i c e o c h a r a c t e r s e f o l l o w s ( g i v e n b y s e c o n d a r ya d d r e s s o 8 ) A l s o , l i n e c h a n g e s c a b m a d e h e r e .

B e a r i m i n d t h a t y o c a s e p a r a t e o n f i e l d o d a t a f r o ma n o t h e r b u s i n g C H R $ ( 2 9 ) . S e y o u r p r i n t e r m a n u a l f o o t h e r e x a m p l e s .

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

T h i s a d d r e s s t r a n s f e r s t h f o r m a t c o m m a n d . I o t h e r w o r d s ,i i n f o r m s t h p r i n t e r t p r i n t o u h a r d c o p y i n c e r t a i ns e q u e n c e . T h i s i u s e f u l f o n u m b e r s i w h i c h t h d e c i m a lp l a c e s s h o u l d b l i n e d u v e r t i c a l l y . S e e y o u r m a n u a l .

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

H e r e y o u c a d e t e r m i n e h o w m a n y l i n e s p e r p a g e t p r i n tb e f o r e t h p r i n t e r a u t o m a t i c a l l y p e r f o r m s s i l i n e f e e d s .T h i s i p r a c t i c a l f o e n d l e s s p r i n t e r p a p e r ; t h e l i n e f e e d ss k i p o v e r t h p e r f o r a t i o n , l e a v i n g t h r e e l i n e s o t o p o f t h en e x t p a g e , a n t h r e e l i n e s o t h b o t t o m o t h p r e v i o u sp a g e . T f i g u r e o u h o t r e a c h t h i s v a l u e , c o n s i d e r t h a t

m a x i m u m o 6 l i n e s f i l l s h e e t o 1 1 p a p e r . S u b t r a c t( t h r e e f o e a c h b o r d e r ) , a n d s e n d t h f o l l o w i n g c o m m a n d s :

1 2 3

O P E N 1 P R I N T # 1C L O S E

4 , , C H R $ ( 6 6 )

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

1 O P E N 1 ,

3

Page 37: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 37/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

1 O P E N 1 ,

5 0 P R I N T # 1 , C H R $ ( 1 4 7 ) C H R $ ( 1 4 1 ) .

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

T h i s i n o t h i n g m o r e t h a n p l a y t h i n g ; i s w i t c h e s o t h p r i n t e r ' s d i a g n o s t i c m o d e :

1 O P E N 1 , 4 , 4 : P R I N T # 1 : C L O S E

T h p r i n t e r w i l l n o w l i s t a n p r o g r a m e r r o r s .

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

T h i s a d d r e s s a l l o w s y o u t d e f i n e a n c u s t o m c h a r a c t e r s t h a tw i l l f i i n t o a n 8 X 8 m a t r i x .

I o r d e r t d r a w a n y l a r g e s i n g l e - p o i n t g r a p h i c s , p l e a s e s e S e c t i o n 5 . 3 . 2 .

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

T h i s l e t s y o u a d j u s t t h e d i s t a n c e b e t w e e n t w l i n e s i i n c r e m e n t s o f 1 / 2 1 6 " ; t h e b e s t r a n g e l i e s b e t w e e n a n 1 2 7 .

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

1 O P E N 1 , 4 , 6 : P R I N T # 1 , C H R $ ( 2 4 ) : C L O S E

3

Page 38: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 38/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

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

T h i s s w i t c h e s o u p p e r / l o w e r - c a s e m o d e . U s t h f o l l o w i n gt d s o

1 O P E N 1 , 4 , 7 : P R I N T # 1 : C L O S E

N o t e : N d a t a i t r a n s m i t t e d . T h i s m o d e c a n b e s w i t c h e do f u s i n g s e c o n d a r y a d d r e s s o 1

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

P e r f o r m s t h o p p o s i t e o s e c o n d a r y a d d r e s s 7

1 O P E N 1 , 4 , 8 : P R I N T # 1 : C L O S E

R e t u r n s t h p r i n t e r t u p p e r - c a s e / g r a p h i c m o d e .

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

1 O P E N 1 , 4 , 9 : P R I N T # 1 : C L O S E

S w i t c h e s o f t h d i a g n o s t i c m o d e i n i t i a l i z e d b s e c o n d a r ya d d r e s s 4

S e c o n d a r y a d d r e s s 1

1 O P E N 1 , 4 , 1 0 : P R I N T # 1 : C L O S E

I n i t i a l i z e s t h p r i n t e r ( j u s t a i y o u ' d t u r n e d t h p r i n t e ro f f a n d o a g a i n ) . T h i s g i v e s t h o p t i o n o b e i n g a b l e t s w i t c h t h p r i n t e r o f i m i d - r u n , t m a k e a n p r o g r a mc h a n g e s a n d a d d i t i o n s , w i t h o u t t h u s i n g t h O F F / O N s w i t c h .

3

Page 39: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 39/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

3 . T h i r d P a r t y P r i n t e r I n t e r f a c e s ( N o n - C o r a o d o r e P r i n t e r s )

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

B a s i c a l l y , t h i r d p a r t y i n t e r f a c e s t r t m a k e y o u r p r i n t e ri d e n t i c a l t t h V I C - 1 5 2 5 .

A l p r i n t e r s o t h m a r k e t ( w i t h t h e e x c e p t i o n o C o m m o d o r e )h a v e c h a r a c t e r d i s t r i b u t i o n k n o w n a A S C I I ( A m e r i c a nS t a n d a r d C o d e f o I n f o r m a t i o n I n t e r c h a n g e ) . I t h i si n t e r n a t i o n a l l y a c k n o w l e d g e d s y s t e m , y o c a c o u n t o t h c h a r a c t e r s a n c o n t r o l c h a r a c t e r s b e i n g i t h s a m e o r d e r .S o f o e x a m p l e , C H R $ ( 6 5 ) w i l l a l w a y s e q u a l H A " , a n C H R $ ( 9 7 ) w i l l b e " a " . C o m m o d o r e ' s c h a r a c t e r c o d e s ( k n o w n a C o m m o d o r e A S C I I ) a r q u i t e d i f f e r e n t ; C H R $ ( 6 5 ) = M a f t a n C H R $ ( 1 9 3 ) = " A " .

T h i r d p a r t y p r i n t e r i n t e r f a c e s c h a n g e C o m m o d o r e A S C I I i n t ot r u e A S C I I t e n a b l e C o m m o d o r e c o m p u t e r s t c o m m u n c i a t e w i t hm a n y o t h e r p r i n t e r s .

E a c h t h i r d p a r t y p r i n t e r i n t e r f a c e u s e s s e c o n d a r y a d d r e s s e st p r e f o r m v a r i e t y o d i f f e r e n t o p t i o n s . O n e s u c hi n t e r f a c e t h " C A R D ? + G " i n c l u d e s c o m m a n d s f o " S p e c i a ll i s t i n g m o d e s " , " u p p e r / l o w e r c a s e " , " u p p e r c a s e / g r a p h i c s " ," g r a p h i c s m o d e " a n d t h e a b i l i t y t " L O C K " t h e i n t e r f a c e i n t ot h s p e c i f i e d m o d e .

C h e c k y o u r m a n u a l f o c o m p l e t e d e t a i l s a b o u t y o u r p a r t i c u l a ri n t e r f a c e .

3

Page 40: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 40/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

C o m m o n K e v b o a r d J M a t r i x

X - L I N E S

3

Page 41: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 41/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

4 . C O N N E C T I N G T Y P E W R I T E R T O T H E U S E R P O R T

T h i s c h a p t e r r e f e r s t c o n n e c t i n g r e c e n t - m o d e l e l e c t r o n i ct y p e w r i t e r , j u s t t k e e p t h r e c o r d s t r a i g h t .

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

F i r s t y o u h a v e t d e t e r m i n e w h e t h e r t h w i r i n g i t h t y p e w r i t e r i s u i t e d f o r t h i s c o n n e c t i o n ; i s e e m s t h a t t h s i m p l e r a n c h e a p e r t h a c t i o n ( t h e m a t e r i a l v a l u e o f t h ea c t i o n c a h a r d l y b w o r t h m o r e t h a n $ 3 . 0 0 ) , t h e m o r e c h o o s yt h a c t i o n c a b e . N o w , i b r e a d i n g t h i n s t r u c t i o n s o l o o k i n g i n s i d e t h e m a c h i n e , y o u h a v e f o u n d t h a t i h a m i c r o p r o c e s s o r c o n t r o l l i n g i t t h e n w e c a n g a h e a d w i t h t h p r o c e d u r e . D o n ' t w o r r y , y o w o n ' t h a v e t r e p r o g r a m t h t y p e w r i t e r ; w e ' l l u s t h s e t - u p o h a n d , a n d c h e c k t h k e y b o a r d ' s ' X - m a t r i x ( s e e b e l o w ) , t h e n t a k e t h c o n n e c t i o nf r o m t h e r e .

I t h t y p e w r i t e r f i t s t h e c r i t e r i a l i s t e d a b o v e , w h a t n e x t ?F o r t h e n e x t s t e p , a l y o u ' l l n e e d i a o h m m e t e r . O p e n t h t y p e w r i t e r c a r e f u l l y , s t h a t y o c a g e a t h k e y b o a r dc o n t a c t s .

B e f o r e w g a n y f u r t h e r , a e x p l a n a t i o n o f t h e k e y b o a r dm a t r i x m i g h t b i o r d e r . T h i s m a t r i x i d e s i g n e d a l o n g t h l i n e s o f t h e i l l u s t r a t i o n o t h p r e v i o u s p a g e . T h n u m b e ro l i n e s w i l l v a r y f r o m m a c h i n e t m a c h i n e , b u i d o e s n ' tm a t t e r .

3

Page 42: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 42/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

Y o c a n s e e t h a t e v e r y p o i n t o i n t e r s e c t i o n o t h m a t r i xl i e s e v e n w i t h t y p e w r i t e r k e y . T h m i c r o p r o c e s s o r r u n sv o l t a g e a c r o s s e v e r y X - l i n e . I n k e y s a r p r e s s e d , o c o u r s e n o t h i n g h a p p e n s . I f h o w e v e r , k e i p r e s s e d , t h v o l t a g e t r a v e l s a c r o s s t h c o r r e s p o n d i n g Y - l i n e . T h i s t e l l st h p r o c e s s o r e x a c t l y w h i c h k e y w a s p r e s s e d , b e c a u s e o f t h ev a r y i n g r e s i s t a n c e b e t w e e n X - l i n e s a n Y - l i n e s .

M a k e s u r e t h a t t h i s v o l t a g e i s n ' t o v e r v o l t s , s i n c e o u i n t e r f a c e c a n n o t h a n d l e h i g h e r v o l t a g e s ; m o s t p r o c e s s o r -e q u i p p e d m a c h i n e s w i l l n o t g o v e r t h i s v o l t a g e , s t h e r ew o n ' t b a n r e a l p r o b l e m .

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

w i t h m i n i m u m o s o l d e r i n g . I m a g i n e i y o w i l l , y o c a c o n t r o l a l 5 k e y s u s i n g T W O w i r e s . T d t h i s , w e ' l l t a t h X a n Y - l i n e s , b u t t h a t i s n ' t i m p o r t a n t a t h m o m e n t .

N o f o r t h e h a r d p a r t . Y o m u s t f i g u r e o u w h e r e t h X a n Y - l i n e s l i e . A y o r e m e m b e r f r o m t h i l l u s t r a t i o n , t h l i n e s c o n n e c t u n d e r n e a t h k e y s . Y o u ' l l h a v e t c h e c k t h e s ec o n n e c t i o n s u s i n g a o h m m e t e r ; t h i s m e a n s t h a t y o u ' l l h a v et c h e c k o u t t h e r e s i s t a n c e o e a c h k e y , s i n c e t h e r e i n g u a r a n t e e t h a t t h v o l t a g e s r u s e q u e n t i a l l y f r o m k e y t k e y .

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

3

Page 43: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 43/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

N o f o o u c o n t r o l l e r , w h i c h i b a s e d o t w a n a l o gm u l t i p l e x e r s . T h i l l u s t r a t i o n b e l o w s h o w s i t i n n e rw o r k i n g s .

P r i n c i p l e o a t

A . B . C

L o o k a t h i s p i c t u r e , a n d c o m p a r e i t t h c o m p l e t e c i r c u i ta t h e n o t h e c h a p t e r . Y o u ' l l s e w h a t w e m e a n . W e c a nc o n n e c t o n e o f e i g h t X - l i n e s w i t h o n e o f e i g h t Y - l i n e s ,c o n t r o l l e d b y t h e u s e r p o r t . T h t y p e w r i t e r p r o g r a m m i n g i j u g g l e d a r o u n d b i t , a n d t h e k e w h i c h i u n d e r t h i n t e r s e c t i n g l i n e s , s t r i k e s .

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

T h s y s t e m w o r k s i s u c h w a t h a t t h r e e b i t s s e n t o v e r t h eu s e r p o r t c h o o s e t h X - l i n e , t h r e e m o r e b i t s c h o o s e t h e Y -l i n e , a n d t h e r e m a i n i n g t w b i t s s e r v e a t h a n a l o g s w i t c hf o r t h e s h i f t k e a n w h a t e v e r o t h e r k e y y o u w i s h . N o t h a tt h c o n n e c t o r i b u i l t a n r i g g e d u p t e s t i o u u s i n g t h f o l l o w i n g p r o g r a m :

- 3

Page 44: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 44/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

1 P A = 5 6 5 7 6 : P B = 5 6 5 7 72 D A = 5 6 5 7 8 : D B = 5 6 5 7 93 P O K E D A , P E E K ( D A ) O 4 : R E M D A T A D I R E C T I O N R E G I S T E R1 0 I N P U T " X - L I N E " ; X1 1 I N P U T " Y - L 1 N E " ; Y1 2 I N P U T " S H I F T 0 = N O , 1 = Y E S " ; S H1 3 C H = X + 8 * Y + 6 4 * S H : P R I N T C 1 4 G O S U B 2 0 0 : G O T O 1 0 2 0 P O K E P B , C H2 1 P O K E P A , P E E K ( P A ) A N 2 5 2 2 F O R D L = 0 T 1 0 0 : N E X T D 2 3 P O K E P A , P E E K ( P A ) O 2 4 R E T U R N

W r i t e d o w n t h c o m b i n a t i o n s b e t w e e n t h p r i n t e d c h a r a c t e r sa n t h X Y l i n e s a n d S H I F T k e y ; t h p r o g r a m w i l l g i v e y o ut h e s e n u m b e r s o n s c r e e n a t h s a m e t i m e t h e p r i n t i n g o c c u r s .

Y o c a n o c r e a t e t r a n s l a t i o n t a b l e w i t h t h h e l p o f t h ep r o g r a m b e l o w . T h i s w i l l m a k e p o s s i b l e e a s y u s o y o u rn e p r i n t e r / t y p e w r i t e r .

1 D I M C H ( 2 5 5 )2 G E T A $ : I F A $ = " " T H E N 2 3 P R I N T A $ C O R R E S P O N D S T " 4 I N P U T C 5 C H ( A S C ( A $ ) ) = C H6 G O T O 2

W h e n y o u ' r e d o n e , s t o p t h e p r o g r a m ( S T O P k e y ) a n s a v e t h t a b l e o d i s k e t t e o c a s s e t t e f o l a t e r u s e .

3

Page 45: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 45/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

P r i n t i n g o u t e x t i a s i m p l e a t h i s : R e p l a c e l i n e s 1 0 0 -1 4 o f t h e f i r s t p r o g r a m u s i n g t h f o l l o w i n g r o u t i n e :

1 0 F O R L = l T L K N ( C H $ )1 1 C H = C H ( A S C ( M I D $ ( C H $ , L , 1 ) ) )1 2 G O S U B 2 0 0 : N E X T L : R E T U R N

S o m e p r e r e q u i s i t e s : Y o u r t e x t m u s t b c o n t a i n e d i C H $ , a n y o s t a r t t h r o u t i n e w i t h G O S U B 1 0 0 . L i n e s 1 0 - 5 0 m u s t b er u n t h e f i r s t t i m e t g i v e v a r i a b l e s , b u c a t h e m b c l i p p e d o f f o r s p e e d .

S o t h a t ' s i t G o o d l u c k i y o u r e f f o r t s .

3

Page 46: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 46/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M N O D O R B 6

G N G N

4

Page 47: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 47/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

5 . P R O G R A M C O L L E C T I O N F O V I C - 2 0 A N D C - 6 4

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

T h e s e p r o g r a m s c o v e r w i d e r a n g e o s u b j e c t s .U n f o r t u n a t e l y , i t ' s i m p o s s i b l e t p r o d u c e p r o g r a m s c o v e r i n ge v e r y g e n e r a l s u b j e c t , , f o e v e r y p r i n t e r o n t h e m a r k e t . I w t r i e d t d o t h i s , t h i s b o o k w o u l d b t h s i z e o f t h eM a n h a t t a n Y e l l o w P a g e s !

T h s i n g l e - p o i n t g r a p h i c s p r o g r a m n a t u r a l l y d o e s n ' t o f f e ra n s u p p o r t t t h d a i s y - w h e e l p r i n t e r o w n e r . H o w e v e r , w eh a v e i n c l u d e d s o m e s m a l l g r a p h i c p r o g r a m s t h a t w i l l g i v et h e s e r e a d e r s s o m e s u r p r i s i n g r e s u l t s .

T i p s h a v e b e e n i n c l u d e d a a l i m p o r t a n t p o i n t s , t h e l p y o ua d a p t t h e s e p r o g r a m s t y o u r p r i n t e r . I y o u r p r i n t e rw a s n ' t m e n t i o n e d i t h e s e p a g e s , a n d y o u r m a c h i n e u s e sd i f f e r e n t c o n t r o l c o d e s f r o m t h o n e s w e ' v e l i s t e d , y o m a f i n d c o d e s t h a t p e r f o r m t h s a m e t a s k s i y o u r p r i n t e rd o c u m e n t a t i o n .

R e g a r d l e s s o w h e t h e r o n o a l t h e s e p r o g r a m s r u o y o u rp r i n t e r a t h m o m e n t , y o u ' l l s t i l l b a b l e t a p p l y m o s t o t h e s e s u g g e s t i o n s t y o u r o w p r o g r a m m i n g .

4

Page 48: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 48/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

5 . S h o r t A p p l i c a t i o n s P r o g r a m s f o E v e r y d a y U s

Y o u ' l l f i n d t h r e e u t i l i t y p r o g r a m s i t h i s s e c t i o n w h i c hs h o u l d b e o f i n t e r e s t t a l p r i n t e r o w n e r s . F i r s t w h a v es e t u p s h o r t r o u t i n e w h i c h p r e v e n t s p r o g r a m b r e a k i t h p r i n t e r o d i s k d r i v e h a n o b e e n s w i t c h e d o n Y o c a a t t a c h o m e r g e t h i s r o u t i n e t a n B A S I C p r o g r a m , t p r e v e n t t h a n n o y i n g ? D E V I C E N O P R E S E N T e r r o r .

T h s e c o n d r o u t i n e i s o m e w h a t m o r e e x t e n s i v e ; i t i s u s e df o f o r m a t t i n g n u m e r i c a l a n a l p h n u m e r i c d a t a .

F i n a l l y , t h e r e i a n o t h e r f o r m a t t i n g p r o g r a m . T h i s o n e ,h o w e v e r , i e x p r e s s l y f o f o r m a t t i n g p r o g r a m l i s t i n g s ,a r r a n g i n g t h l i s t s f o e a s y r e a d i n g . S p a c e s a r i n s e r t e db e t w e e n c o m m a n d s , F O R / N E X T l o o p s a r e i n d e n t e d , a n d I F - T H E N sa r b r o k e n d o w n . T h u s , f o r m e r l y u n r e a d a b l e l i s t i n g i m a d e c o m p r e h e n s i b l e .

5 . 1 . 1 D e v i c e N o P r e s e n t ?

C o m m o d o r e B A S I C h a n b u i l t - i n p r o v i s i o n f o a v o i d i n gD E V I C E N O T P R E S E N T e r r o r , w h i c h c a c a u s e p r o g r a m c r a s h .

S Y N T A X E R R O R s a r e a s i l y c u r e d , a a r D I V I S I O N B Z E R Oe r r o r s . U n f o r t u n a t e l y , i t ' s n o t h a t s i m p l e w i t h p r i n t e r o d i s k a c c e s s . B e l o w i s b r i e f s u b p r o g r a m t h a t w i l l i n f o r my o o f t h e d e v i c e b e i n g o f f ; j u s t s w i t c h i o n a n g e o w i t h y o u r w o r k . T h e r e i n e a t f e a t u r e t t h i s p r o g r a m ;f o t h o s e o y o u w h o a r e h a v i n g p r o b l e m s p r o t e c t i n g y o u rp r o g r a m s f r o m l i s t i n g , t h e r e i s m a l l p r o t e c t i o n d e v i c e i t h p r o g r a m .

4

Page 49: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 49/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

1 1 R E * * * * * *1 2 R E * 1 3 R E * 1 4 R E *

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

P R I N T E R

* * * * * * * ** * *

1 5 R E * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *1 6 P O K E 7 6 8 , 11 7 O P E N 1 , 1 8 P R I N T # 1 , " " 51 9 C L O S E2 0 P O K E 7 6 8 , 1 3 92 1 I S T O - 1 2 8 T H E N 2 3 2 1 P R I N T " P R I N T E R I N O T U R N E D O N 2 2 R E T U R N2 3 R E * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *2 4 R E * * * *2 5 R E * D I S K * 2 6 R E * * * *2 7 R E * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *2 8 P O K E 7 6 8 , 6 12 9 O P E N l , 8 , 1 5 , " I t f3 0 C L 0 S E 13 1 P O K E 7 6 8 , 1 3 93 2 I S T O - 1 2 8 T H E N 3 4 3 3 P R I N T M D I S K D R I V E N O T U R N E D O N 3 4 R E T U R N

N o t e t h a t t h d i s k r o u t i n e i s n ' t v e r y d i f f e r e n t f r o m t h p r i n t e r r o u t i n e . B o t h r o u t i n e s c a b s w i t c h e d o w i t hG O S U B . Y o c a c h a n g e t h m e s s a g e s t s u i t y o u r o w t a s t e s .

4

Page 50: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 50/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

L i n e s 1 5 a n d 2 8 0 s h u t o f t h S T O P k e y v e c t o r . T h e s e p o k e sa l s o t u r n o f t h e r r o r m e s s a g e o u t p u t , a n g d i r e c t l y t t h R E T U R N c o m m a n d s . I y o u s R U N - S T O P / R E S T O R E , o r i f t h p r o g r a m b r e a k s o f f , t h c o m p u t e r w i l l h a n g u p

T h o n l y w a y t o g e t c o n t r o l b a c k i t o d o " c o l d s t a r t "( s w i t c h o f f , a n b a c k o n ) .

4

Page 51: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 51/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

5 . 1 . 2 F o r m a t t i n g N u m e r i c a l a n A l p h a n u m e r i c D a t a

E v e r y o n c e i w h i l e y o u h a v e n e e d f o n e a t l y f o r m a t t e dp r i n t o u t o n u m b e r s a n d / o r c h a r a c t e r s . Y e y o o f t e n e n u f r u s t r a t e d , b e c a u s e C o m m o d o r e B A S I C d o e s n ' t h a v e F O R M A T o P R I N T U S I N G c o m m a n d .

O t h e r c o m p u t e r s h a v e g r e a t c o m m a n d s l i k e P R I N T U S I N G a n do t h e r u t i l i t y c o m m a n d s t h a t t e n d t l e a v e t h e C o m m o d o r e u s e rf e e l i n g b i t l e f t b e h i n d . S o w s e a r c h t h C o m m o d o r eh a n d b o o k s , a n d f i n d t h a t t h e s o l u t i o n j u s t i s n ' t t h e r e .

O n e f i n e d a y , h o w e v e r , t h f i r s t 1 5 2 6 p r i n t e r a p p e a r e d o t h m a r k e t , a n d t h e r e w a s g r e a t r e j o i c i n g i t h C o m m o d o r ec o m m u n i t y . I w a s s a i d t h a t t h i s p r i n t e r h a t h a b i l i t y t p r i n t f o r m a t t e d l i s t i n g s e a s i l y . I w a n o c a p a b l e o g r a p h i c s , b u t t h a t d i d n ' t s e e m t m a t t e r , w i t h t h o t h e rn e a t f e a t u r e s .

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

T h i s f a c t w a b r o u g h t t o t h e a t t e n t i o n o f t h e m a n u f a c t u r e r ,w h q u i c k l y a n n o u n c e d r e p l a c e m e n t R O M f o t h 1 5 2 6 .

T h m a n u f a c t u r e o t h i s R O w a m u c h s l o w e r i c o m i n g t h a nt h a n n o u n c e m e n t — a n d t h o s e w h o l i v e b t h e s a y i n g , " G o o dt h i n g s c o m e t t h o s e w h o w a i t " w e r e t e r r i b l y d i s a p p o i n t e dw h e n t h R O M d i d c o m e o u t .

4

Page 52: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 52/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h C O M M O D O R E 6

I o r d e r t c u r e t h o l p r o b l e m s , t h d e v e l o p e r s o t h o p e r a t i n g s y s t e m s o f t w a r e h a t u t i l i z e s o m e o t h e r m e m o r yl o c a t i o n s w h i c h w e r e n o a v a i l a b l e t t h o l I s o c k e t . S t h e y t o o k t h s c a l p e l t t h s o c k e t , a n c r e a t e d s o m e m e m o r ys p a c e . P a r t o t h a t s p a c e w a s t h e a r e a w h e r e t h f o r m a t t e do u t p u t e x i s t e d .

S o n o w w e ' r e b a c k w h e r e w s t a r t e d . T h e r e a r f i v e r o u t e st t a k e t s o l v e o u r p r o b l e m . Y o u c a n :

1 B u n e c o m p u t e r w i t h P R I N T U S I N G c a p a b i l i t y ;2 B u s o f t w a r e d e v e l o p m e n t s y s t e m s u c h a M A S T E R - 6 4 ;3 W r i t e y o u r o w n r o u t i n e ;4 U s t h r o u t i n e p r i n t e d b e l o w ; o 5 F o r g e t t h w h o l e b u s i n e s s , a n d w i t h o u t t h f o r m a t t e d

l i s t s .

N u m b e r s e e m s t h m o s t e c o n o m i c a l m e t h o d . B e f o r e w g o o nw i t h t h i s r o u t i n e , h o w e v e r , l e t ' s s e w h a t o u t p u t c o n t r o lC o m m o d o r e B A S I C d o e s o f f e r u f o p r i n t i n g .

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

W e ' v e a l s e e n p r i n t o u t s o c a l c u l a t i o n s . T e x t a n d n u m b e r sm u s t b s t r a i g h t e n e d o u t , i . e . , t h e t e x t l e f t - j u s t i f i e d , a n t h n u m b e r s r i g h t - j u s t i f i e d . O n p o s s i b i l i t y e x i s t s i y o u rc o m p u t e r ' s B A S I C l a n g u a g e : T h e f u n c t i o n T A B .U n f o r t u n a t e l y , t h i s f u n c t i o n i f o t h s c r e e n , n o t t h ep r i n t e r . T h i s s h o u l d b o b v i o u s w h e n y o u t r y t h i s e x a m p l e :

P R I N T " H E L L O " T A B ( 1 0 ) " H O W ' S I G O I N G ? "

4

Page 53: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 53/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

w i l l b a r r a n g e d o n t h e s c r e e n l i k e t h i s :

H E L L O H O W ' S I G O I N G ?

b u t t h e p r i n t o u t w i l l l o o k l i k e t h i s :

H E L L O H O W ' S I G O I N G ?

H o i t h i s p o s s i b l e ? S i m p l e ; t h o p e r a t i n g s y s t e m c o n v e r t sT A B ( X ) i n t o S P C ( X ) w h e n t h o u t p u t i t a n d e v i c e o t h e rt h a n t h e s c r e e n .

T A i s p o s i t i o n c o u n t e d f r o m t h e l e f t b o r d e r , w h i l e S P i c o u n t e d o v e r f r o m t h l a s t c h a r a c t e r p o s i t i o n . T h e s t a r t i n gp o s i t i o n o t h s e c o n d t e x t , t h e n , d e p e n d s o t h l e n g t h o t h f i r s t t e x t .

T h e r e i p o s s i b i l i t y t h a t c a b u s e d o s o m e C o m m o d o r ep r i n t e r s :

I t ' s p o s s i b l e t o g e t p s e u d o - T A B b r e t u r n i n g t h p r i n t h e a dt t h e l e f t b o r d e r w i t h o u t l i n e f e e d , t h e n c o u n t i n g o f t h T A a n p r i n t i n g t h s e c o n d p a r t o t h l i n e . Y o c a a c c o m p l i s h t h i s o s o m e C o m m o d o r e p r i n t e r s u s i n g C H R $ ( 1 4 1 ) .H e r e i c o n c r e t e e x a m p l e t t r y :

1 O P E N 1 , 2 P R I N T # 1 , " E X T E N S I O N C O R D " C H R $ ( 1 4 1 ) S P C ( 4 0 ) " $ 1 . 0 0 "

T h e t e x t i p r i n t e d o t h l e f t e d g e , t h e n t h C H R $ ( 1 4 1 )s e n d s t h e p r i n t h e a d b a c k t c o l u m n w i t h o u t a d v a n c i n g t h p a p e r ; n e x t , t h S P C ( 4 0 ) m o v e s t h p r i n t h e a d t c o l u m n 4 0 a n d t h e p r i c e i p r i n t e d t h e r e .

4

Page 54: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 54/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

S o m e p r i n t e r s , s u c h a t h 1 5 2 5 d o n ' t r u t h i s p r o g r a m a i s r e p l a c e t h C H R $ ( 1 4 1 ) w i t h t h 1 5 2 5 ' s s p e c i a l c o n t r o lc o d e { C H R $ ( 1 6 ) } .

T h i s c o n t r o l c o d e a l l o w s y o t p u y o u r p r i n t h e a d i o n o 8 p o s i t i o n s . T h p r i n t p o s i t i o n m u s t b e s e n t i A S C I Ic o d e s t t h e p r i n t e r . H e r e i a e x a m p l e :

1 O P E N 1 , 2 P R I N T # 1 , " S T R A W B E R R Y J E L L Y " C H R ( 1 6 ) " 4 0 $ l . 9 8 "

T h i s e x a m p l e t e l l s t h p r i n t e r t p u t h p r i c e o c o l u m n4 0 T h p r i n t p o s i t i o n i d e t e r m i n e d b t h 4 p r e c e d i n gt h d o l l a r s i g n .

Y o u h a v e t m a n u a l l y f i g u r e o u t h d i s t a n c e f r o m t h l e f tb o r d e r n e e d e d b y S P C ( x ) t p r i n t t h t e x t i t h a t p a r t i c u l a rp l a c e o t h p a p e r ; t h i s i s n ' t a l w a y s t h b e s t m e t h o d .

L e t ' s t a k e t h f i r s t e x a m p l e ( t h e e x t e n s i o n c o r d l i s t i n g ) :

L e t ' s s u p p o s e t h a t t h a m o u n t c o n t a i n e d i t h p r i c e s t r i n gw a s " $ 1 1 . 4 5 " i n s t e a d o t h o r i g i n a l p r i c e . T h e a m o u n tw o u l d a l w a y s s t a r t a t h s a m e l e f t p o s i t i o n ; h o w e v e r , t h i sw o u l d s h i f t t h d e c i m a l p o i n t o n p l a c e t t h r i g h t . T h r e s u l t i i n t e r e s t i n g , b u i c e r t a i n l y d o e s n ' t h e l p y o u rf i n a n c i a l a d v a n c e m e n t .

W e w a n t i s o m e m e t h o d o f o r m a t t i n g t h t e x t s t h a t t h ed e c i m a l p o i n t s a r l i n e d u v e r t i c a l l y . T h e r e i s o l u t i o ni p r o g r a m l o g i c , w h i c h f i r s t l o o k s f o n u m b e r w i t h i ns t r i n g , c h e c k s f o d e c i m a l p o i n t , a d j u s t s t h S P C -p a r a m e t e r , a n p r i n t s t h p r i c e i t h p r o p e r s p o t .

4

Page 55: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 55/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

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

Y o c a h a v e t h i s l u x u r y b y t y p i n g i t h f o l l o w i n gs u b r o u t i n e , a n a d j u s t i t y o u r o w n n e e d s .

4 8 0 0 0 R E 4 8 0 0 1 R E M * * * * * * * * * * * * * * * * * * * F O R M A T T I N G * * * * * * * * * * * * * *4 8 0 0 2 R E M4 8 0 2 0 I F F Z * = 0 T H E N F Z * = l : F L S = L E N ( F O $ ) : F P $ = t M f4 8 0 4 0 F I S = L E N ( F I $ ) F B n f l : F C = 4 8 0 5 0 I F M I D $ ( F O $ , F Z S , 1 ) = " " T H E N F Z * = F Z * + 1 : F B $ = F B $ + " "

G O T O 4 8 0 5 04 8 0 6 0 F M $ = M I D $ ( F O $ , F Z * , 1 )4 8 0 8 0 F V * = 0 : F H S = 0 : F A * = 0 : F B S = 0 : F F * = 04 8 1 0 0 I F M I D $ ( F O $ , F Z * , l ) f f . f f T H E N F Z * = F Z * + l : F F ^ = 2 : G O T O 4 8 1 8 04 8 1 2 0 I F F Z * > F L * T H E N F A S = F A S + l : F Z * = F Z * + l : G O T O 4 8 2 4 04 8 1 4 0 I F M I D $ ( F O $ , F Z % , 1 ) = " " T H E N 4 8 2 4 04 8 1 6 0 F A * = F A S + 1 : F Z S = F Z S + 1 : G O T 0 4 8 1 0 04 8 1 8 0 I F M I D $ ( F O $ , F Z * , 1 ) = M " O R F Z * > F L * T H E N 4 8 2 4 04 8 2 0 0 F B * = F B S + l : F Z f c = F Z S + l4 8 2 2 0 G O T O 4 8 1 8 04 8 2 4 0 I F M I D $ ( F I $ F C S , 1 . t T H E N F C ^ = F C * + 1 : F F * = F F * + 4 : G O T O 4 8 3 2 04 8 2 6 0 F V S = F V S + 1 : F C * = F C * + 14 8 2 8 0 I F F C * > F I * T H E N G O T O 4 8 3 8 04 8 3 0 0 G O T O 4 8 2 4 04 8 3 2 0 I F F C * > F I * T H E N 4 8 3 8 04 8 3 4 0 F H * = F H * + 1 : F C 5 U = F C ^ + 14 8 3 6 0 G O T 0 4 8 3 2 04 8 3 8 0 I F F M $ " A ' f T H E N 4 8 7 8 04 8 4 0 0 L 2 = F A * - F V % : I F L 2 < 0 T H E N F F ^ = F F * + l : G O T O 4 8 7 2 0

4

Page 56: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 56/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

4 8 4 2 0 I F L 2 = 0 T H E N 4 8 4 6 04 8 4 4 0 F O R L 1 = 1 T O L 2 : F B $ = F B $ + " " : N E X T L 14 8 4 6 0 I F F V S = 0 T H E N 4 8 5 2 04 8 4 8 0 L 2 = F V S : F O R L 1 = 1 T O L 24 8 5 0 0 F B $ = F B $ + M I D $ ( F I $ , L 1 , 1 ) : N E X T L 14 8 5 2 0 I F F F S = 0 T H E N 4 8 9 2 04 8 5 4 0 F F * = 0 : F B F B $ + f f . f f : L 2 = F V * + 24 8 5 6 0 I F F B % = 0 T H E N 4 8 9 2 04 8 5 8 0 I F F B S = F H S T H E N L 3 = F B S : G O T O 4 8 6 2 0

4 8 6 0 0 L 3 = - F H % * ( F B * > F H % ) - F B * * ( F H S > F B S ) - 14 8 6 2 0 F O R L 1 = L 2 T O L 2 + L 34 8 6 4 0 F B $ = F B $ + M I D $ ( F I $ , L 1 , 1 ) : N E X T L 14 8 6 6 0 I F F H % > = F B * T H E N 4 8 9 1 04 8 6 8 0 L 2 = F B * - F H S : F O R L 1 = 1 T O L 24 8 7 0 0 F B F B f t O M N E X T L 1 : G O T O 4 8 9 1 04 8 7 2 0 L F A S + F B V . I F ( F F % A N D 2 ) T H E N F F S = 1 : L 2 L 2 + 14 8 7 4 0 F O R L 1 = 1 T O L 2 : F B $ = F B $ + " * "4 8 7 6 0 N E X T L 1 : G O T 0 4 8 9 1 04 8 7 8 0 I F ( F F S A N D 4 ) T H E N F V S = F V * + F H S + 14 8 8 0 0 L 2 = F V * : F O R L 1 = 1 T O L 24 8 8 2 0 I F M I D $ ( F I $ , L 1 , 1 ) < > " " T H E N L 3 = L 1 : L 1 = L 24 8 8 4 0 N E X T L 14 8 8 6 0 L 2 = - F V % * ( F A % > F V S ) - F A % * ( F V S > F A S )4 8 8 7 0 I F L 2 = 0 T H E N L 2 = F V ^4 8 8 8 0 F O R L 1 = L 3 T O L 3 + L 24 8 9 0 0 F B $ = F B $ + M I D $ ( F I $ , L 1 , 1 ) : N E X T L 14 8 9 0 2 I F F V * > = F A S T H E N 4 8 9 1 04 8 9 0 4 L 3 = F A ^ - L 2 : F O R L 1 = 1 T O L 34 8 9 0 6 F B F B t " : N E X T L 14 8 9 1 0 I F F Z ^ > F L ^ T H E N F Z ^ = 0 : G O T O 4 8 9 6 04 8 9 2 0 L 2 = F Z ^ : L 3 = F L * : F O R L 1 = L 2 T O L 34 8 9 3 0 I F M I D $ ( F O $ , L 1 , 1 ) < > " " T H E N F Z * = L 1 : L 1 = L 3 : G O T 0 4 8 9 5 04 8 9 4 0 F B F B $ + " f

5

Page 57: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 57/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

4 8 9 5 0 N E X T L 14 8 9 6 0 F P $ = F P $ + F B $ : F F S = ( F F S A N D 1 )4 8 9 7 0 R E T U R N

S i n c e t h p r o g r a m c o n t a i n s m a n y v a r i a b l e s t h a t g r e a t l yi n f l u e n c e t h o p e r a t i o n o t h r o u t i n e , h e r e i l i s t o fv a r i a b l e s a n e x p l a n a t i o n s .

F O m u s t c o n t a i n t h l i n e f o r m a t d e s i r e d .F I m u s t b p r o v i d e d w i t h u s e r d a t a .F B c o n t a i n s t h p r o c e s s e d p a r t i a l s t r i n g , w h i l eF P h o l d s t h c o m p l e t e p r i n t s t r i n g .F Z i t h p o i n t e r f o t h t e r m p r o c e s s e d i n F 0 $ .F F s i g n a l s a o v e r r u n o t h d i g i t s t t h l e f t o t h d e c i m a l p o i n t ( F F S O O ) .F A c o n t a i n s t h n u m b e r o d i g i t s a l l o w e d t o t h e l e f t o t h d e c i m a l p o i n t f o e a c h p r o c e s s e d f i e l d i F 0 $ .F B i a a b o v e , b u t t h r i g h t o f t h e d e c i m a l p o i n t .F V i t h n u m b e r o w h o l e n u m b e r p l a c e s i F I $ .F H f c c o n t a i n s t h n u m b e r o d e c i m a l p l a c e s i F I $ .

P r o g r a m c o m m e n t a r y :

4 8 0 2 0 - 4 8 0 8 0 I n i t i a l l y s e t s s o m e v a r i a b l e s t 0 4 8 1 0 0 - 4 8 1 6 0 N u m b e r s l e f t - o f - d e c i m a l a r p r o c e s s e d i

a r r a y s F 0 t o F A % .4 8 1 8 0 - 4 8 2 2 0 A a b o v e , b u f o r i g h t - o f - d e c i m a l ( F B * ) .4 8 2 4 0 - 4 8 3 0 0 N u m b e r o w h o l e d i g i t s i F I t F V * .4 8 3 2 0 - 4 8 3 6 0 N u m b e r o d e c i m a l p l a c e s i F I t F H % .4 8 4 0 0 - 4 8 4 4 0 H e r e t h a r r a n g e m e n t o n u m e r i c a l f i e l d s

b e g i n s . I F I h a f e w e r d i g i t s l e f t - o f -d e c i m a l - p o i n t t h a n c o n t a i n e d i F O $ , s p a c e sf i l l i t h d i f f e r e n c e .

5

Page 58: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 58/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

4 8 4 6 0 - 4 8 5 0 0 V a l i d n u m b e r s l e f t - o f - d e c i m a l f o l l o w F B $ .4 8 5 6 0 - 4 8 6 4 0 V a l i d d e c i m a l p l a c e s f o l l o w F B $ .4 8 6 6 0 - 4 8 7 0 0 I F I c o n t a i n f e w e r d e c i m a l p l a c e s t h a n a r

i F 0 $ , t h a r e a i f i l l e d i w i t h z e r o e s .4 8 7 2 0 - 4 8 7 6 0 I F I c o n t a i n s m o r e d i g i t s l e f t - o f - d e c i m a l

t h a n F 0 $ , t h e n t i r e f i e l d w i l l b e f i l l e dw i t h " * " , t a l l o w y o u t i m m e d i a t e l y s e e t h ee r r o r i t h o u t p u t . I t h i s c a s e , y o u m u s tc a r e f u l l y m e a s u r e t h s i z e o t h e a r r a y .T h i s c o n d i t i o n s i g n a l s t h p r o g r a m w h e nF F S O 0 .

4 8 7 8 0 - 4 8 8 4 0 P r e p a r a t i o n s f o a l p h a n u m e r i c f i e l d s b e g i nh e r e . F i r s t s p a c e s f r o m F I w i l l b e p r i n t e d ,s e p a r a t i n g e a c h f i e l d f o e a s y r e a d a b i l i t y .

4 8 8 6 0 - 4 8 9 0 0 C h a r a c t e r s f r o m F I a r t r a n s f e r r e d a c c o r d i n gt F 0 F B $ . R e a m i n i n g c h a r a c t e r s f r o m F I a r c u o f f , w h i l e l e f t o v e r c h a r a c t e r s f r o mF O a r f i l l e d i w i t h s p a c e s .

4 8 9 1 0 - 4 8 9 5 0 F B w i l l b f i l l e d i w i t h s p a c e s , a c c o r d i n gt t h d i s t a n c e t t h n e x t f i e l d c o n t a i n e di F 0 $ .

4 8 9 6 0 - 4 8 9 7 0 F B a d d e d t F P $ , a n m e m o r y i p u b a c k i n t oo r d e r .

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

P u t h i s i n f o r m a t i o n i n t o F 0 $ . O u s a m p l e w i l l l o o k l i k et h i s :

F 0 $ = " 9 9 9 9 a a a a a a a a a a 9 9 9 . 9 9 9 9 9 9 . 9 9 "

5

Page 59: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 59/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

N u m e r i c a l f i e l d s a r c h a r a c t e r i z e d w i t h M 9 " , s t r i n g s w i t h" a " . A l p h a n u m e r i c f i e l d s w i l l b e l e f t - j u s t i f i e d , b u t h n u m e r i c a l f i e l d s w i l l b r i g h t - j u s t i f i e d , i a c c o r d a n c e w i t ht h e i r p o s i t i o n i n F 0 $ .

A l t h a t r e m a i n s i f o y o t i n p u t y o u r d a t a t F I $ ; t h r o u t i n e w i l l r u n f o r a l o n g a i r e q u i r e d .

T h e l i n e p r i n t s o u a t h e e n d o f t h e r o u t i n e .

Y o u r p r o g r a m a d d i t i o n c o u l d l o o k l i k e t h i s :

1 O P E N 1 , 42 F O $ = " 9 9 9 9 A A A A A A A A A A 9 9 9 . 9 9 9 9 9 9 . 9 9 "3 F I $ = R I G H T $ ( S T R $ ( P O ) , 2 ) : G O S U B 4 8 0 0 0 :

R E P O S I T I O N N U M B E R4 F I $ = S T R $ ( A N ) : G O S U B 4 8 0 0 0 : R E M Q U A N T I T Y5 F I $ = A R $ : G O S U B 4 8 0 0 0 : R E M I T E M D E S C R I P T I O N6 F I $ = S T R $ ( E P ) : G O S U B 4 8 0 0 0 : R E M U N I T P R I C E7 F I $ = S T R $ ( A N * E P ) : G O S U B 4 8 0 0 0 : R E M T O T A L P R I C E8 P R I N T # 1 , C H R $ ( 1 6 ) ; F P $

N o t e t h a t t h r o u t i n e j u m p s i f i v e t i m e s , o r a o f t e n a n e e d e d ( a d e t e r m i n e d i F 0 $ ) . T h c o n f i g u r a t i o n i F 0 i j u s t a e x a m p l e ; y o c a r e d o i t o f i t y o u r o w n e e d s .

O n e s m a l l t i p : O c c a s i o n a l l y y o u ' l l w a n t t u s s m a l l e rs t r i n g f o l i n e . Y o u ' l l h a v e t r e s e t F Z t 0 a n s e u p t h e n e s t r i n g f o F O $ .

5

Page 60: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 60/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

5 . 1 . 3 F o r m a t t e d P r o g r a m L i s t i n g s

E v e r y o n e k n o w s t h a t i o r d e r t s p a r e e v e r y b y t e p o s s i b l e ,R E M s a n d s p a c e s a r e n ' t i n c l u d e d i p r o g r a m s . I f a f t e rs e v e r a l w e e k s , y o u w a n t t g i a n m a k e s o m e c h a n g e s ,d e c i p h e r i n g t h l i s t i n g c a n b e d i f f i c u l t . A l s o , w h e n y o uh a v e n o r m a l l i s t i n g a h a n d , f i n d i n g p r o g r a m s t r u c t u r e c a b e b o t h e r s o m e , e s p e c i a l l y s i n c e B A S I C i s n ' t v e r ys t r u c t u r e d l a n g u a g e .

N o w , o u s o l u t i o n t t h p r o b l e m i n o t h e f i n a l o n e ; t h b e s t m e t h o d i n v o l v e s a d v a n c e p l a n n i n g o y o u r p a r t , w r i t i n gy o u r p r o g r a m s i a e a s i l y - r e a d f o r m . H o w e v e r , w i t h t h h e l p o t h n e x t p r o g r a m , y o u ' l l b a b l e t p r i n t o u p r o g r a m s f r o m d i s k e t t e o c a s s e t t e w h i c h w i l l h a v e s p a c e si n s e r t e d b e t w e e n c o m m a n d w o r d s , a n d F O R - N E X T l o o p si n t e r l o c k e d . B e s i d e s t h i s , n e l i n e w i l l b s t a r t e d w i t ht h a p p e a r a n c e o e a c h c o l o n .

I o r d e r t u n d e r s t a n d t h l o g i c o t h i s p r o g r a m , y o u ' l ln e e d s o m e d e t a i l s o p r o g r a m m e m o r y a n h o t h B A S I Ci n t e r p r e t e r w o r k s i t h V I C - 2 0 a n C - 6 4 .

T s t a r t , l e t ' s h a v e l o o k a h o B A S I C p r o g r a m r e s i d e si m e m o r y . I y o u h a v e m a c h i n e l a n g u a g e m o n i t o r , t h f o l l o w i n g s t e p s w i l l h e l p y o u b e t t e r u n d e r s t a n d w h a t w e ' r et a l k i n g a b o u t .

F i r s t l o a d t h m o n i t o r . T h e n t y p e i t h f o l l o w i n g p r o g r a ml i n e i B A S I C :

1 P R I N T " H E L L O "

5

Page 61: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 61/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

N e x t , l e t ' s l o o k a t h m e m o r y l o c a t i o n s w h e r e t h i s l i n e i p l a c e d . 6 u s e r s w i l l f i n d t h i s i $ 0 8 0 0 - $ 0 8 0 F :

0 8 0 0 0 0 0 E 0 0 A 0 0 9 2 4 0 8 0 8 4 4 4 C 4 F 2 0 0 0

T h e s e a d d r e s s e s v a r y o t h e V I C - 2 0 ; d e p e n d i n g o t h a m o u n to m e m o r y e x p a n s i o n p l u g g e d i ( i a n y ) , t h a d d r e s s e s c a s t a r t a $ 0 4 0 0 , $ 1 0 0 0 o $ 1 2 0 0 . T h V I C - 2 0 o w n e r s w i l l h a v et r e m e m b e r t h i s c h a n g e — t h e m e m o r y s t a y s c o n s t a n t o t h C 6 4

B a c k t t h m e m o r y d u m p a b o v e . W h a t d t h e s e n u m b e r s m e a n ?L o c a t i o n $ 0 8 0 0 m u s t c o n t a i n z e r o — t h i s m a r k s t h b e g i n n i n go t h B A S I C p r o g r a m m e m o r y . A n y o t h e r v a l u e w i l l g i v e y o

? S Y N T A X E R R O R e v e r y t i m e y o u t y p e R U N .

T h c o n t e n t s o a d d r e s s e s $ 0 8 0 1 a n d $ 0 8 0 2 r e f e r t t h e n e x tp r o g r a m l i n e . T h i s m e a n s t h a t t h e n e x t p o s s i b l e l i n e w o u l db l o c a t e d a a d d r e s s 0 8 0 E , w h i c h i u s e d a c u e f o rG O T O s , G O S U B s , a n F O R / N E X T l o o p s . A n o t h e r t e r m f o t h i sl i n e r e f e r e n c e i l i n e - l i n k .

T h n e x t t w m e m o r y l o c a t i o n s c o n t a i n t h a c t u a l l i n e n u m b e ri h i g h - b y t e / l o w - b y t e f o r m a t . O u e x a m p l e g i v e s $ 0 A 0 0 ,w h i c h i s 1 0 i d e c i m a l .

N o w w e c o m e t t h s p e c i f i c c o m m a n d i t h l i n e — t h e P R I N Ts t a t e m e n t . P r o b l e m i s i d o e s n ' t L O O K l i k e P R I N Ts t a t e m e n t ; a l t h a t e x i s t s i t h v a l u e 9 9 L e t ' s c h a n g et h a t v a l u e t s e w h e t h e r i f u n c t i o n s a P R I N T , s i n c e w h a v e t h m o n i t o r r u n n i n g . C h a n g e t h 9 9 t o 9 7 e x i t t B A S I C , a n l i s t t h e B A S I C p r o g r a m .

5

Page 62: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 62/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

N o w h a v e v e r y d i f f e r e n t l i s t i n g : T h P R I N T s t a t e m e n ti g o n e , a n d t h e l i s t i n g n o l o o k s l i k e t h i s :

1 P O K E M H E L L O "

S t a t e m e n t s a n c o m m a n d s w i t h i n p r o g r a m a r c o n v e r t e d i n t os i n g l e - b y t e c o d e , w i t h e v e r y c o m m a n d h a v i n g i t o w i n d i v i d u a l c o d e . l i t t l e t e s t i n g c a h e l p y o d e t e r m i n ew h i c h c o d e i w h i c h . Y o u ' l l n o t e t h a t t h e s e c o d e s ( a l s ok n o w n a t o k e n s ) h a v e v a l u e s h i g h e r t h a n $ 7 F .

T h a t m e a n s t h a t t h e m o s t s i g n i f i c a n t b i t o f a a d d r e s s i s e b t o k e n s . T h u s , f i n d i n g t o k e n s i n d i s a s s e m b l e dl i s t i n g i q u i t e s i m p l e ; m o s t s i g n i f i c a n t b i t s a r o t h e r w i s eo n l y f o u n d o u t s i d e o q u o t e s , s c o m m a n d s u s u a l l y p r e c e d es t r i n g s . I s u c h c h a r a c t e r s e t s m o s t - s i g n i f i c a n t b i i

p r o g r a m l i n e , a n i t h n u m b e r o q u o t a t i o n m a r k s a d u t o z e r o , o a e v e n n u m b e r , t h e n t h e b i i h a n d l e d a t o k e n .

I a d d i t i o n , t h t o k e n s e x i s t i t h c o m p u t e r ' s R O a s e o B A S I C c o m m a n d s . T h c o m p u t e r u s e s t h i s c o m m a n d s e t f o rp r o g r a m i n p u t , i o r d e r t c h e c k c o m m a n d s y n t a x . E a c h l i n ei c h e c k e d t s e w h e t h e r s u c h c o m m a n d e x i s t s . I t h a t i t c a s e , t h c o m m a n d i i m m e d i a t e l y c o n v e r t e d i n t o i t r e s p e c t i v e t o k e n . W e ' l l b u s i n g t h i s t a b l e o c o m m a n d sl a t e r i o u p r o g r a m .

N o w w e c o m e t t h e e n d o f t h i s l o n g p r e f a c e ; o w i t h t h p r o g r a m l i s t i n g . T h e l i s t i n g b e l o w w i l l r u a i o t h e C -6 4 I o r d e r t o r u n i o V I C - 2 0 ( m i n i m u m 3 e x p a n s i o nr e q u i r e d ! ) , c h a n g e l i n e 3 7 0 a i s u g g e s t s t h e r e .

5

Page 63: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 63/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

1 0 D I M B T $ ( 7 5 )1 1 L M $ = M " : N F $ = " f : B L $ = " .1 2 F O R I = 1 T O 8 : H Z $ = H Z $ + L M $ : N E X T1 3 H Z $ = H Z $ + " S £ I T E1 4 F 1 $ = C H R $ ( 1 4 5 ) + L M $1 5 S N = 11 6 P R I N T C H R $ ( 1 4 7 )1 7 P R I N T : P R I N T : P R I N T " L I S T P R O G R A M "1 8 P R I N T : P R I N T1 9 I N P U T " P R O G R A M N A M E " ; N A $2 0 N P $ = N A $ + " , P , R " + C H R $ ( 3 4 )2 1 P R I N T : P R I N T " O U T P U T T 2 2 P R I N T " " C H R $ ( 1 8 ) " P " C H R $ ( 1 4 6 ) " R I N T E R O R " C H R $ ( 1 8 ) " D "

C H R $ ( 1 4 6 ) " I S K " ;2 3 I N P U T G A 2 4 I F G A $ = " " T H E N G A = 3 : G O T O 3 1 02 5 I F G A $ = " D " T H E N G A = 8 : N L $ = N A $ + " , S , W " + C H R $ ( 3 4 ) : G O T O 3 1 02 6 I F G A $ = " P " T H E N G A = 42 7 P R I N T : I N P U T " L I N E S P E R P A G E " ; Z N :2 8 Z N = ( Z N = 0 ) * - 6 6 + Z N2 9 P R I N T : I N P U T " T I T L E " ; U E $3 0 H Z $ = R I G H T $ ( H Z $ , L E N ( H Z $ ) - L E N ( U E $ ) ) : U E $ = U E $ + H Z $3 1 P R I N T : I N P U T " L E F T B O R D E R " ; 3 2 P R I N T : P R I N T : F O R I = 0 T O L : L M $ = L M $ + " " : N E X T3 3 O P E N 1 5 , 8 , 1 53 4 O P E N 1 , 8 , 4 , N P $ : G O S U B 9 5 03 5 1 = 3 6 F O R A = 4 1 1 1 8 T O 4 1 3 7 2 : R E M V I C 2 0 F O R A 4 9 3 1 0 T 4 9 5 6 43 7 X = P E E K ( A )3 8 I F X > 1 2 7 T H E N 4 1 03 9 B T $ ( I ) = B T $ ( I ) + C H R $ ( X )4 0 G O T 0 4 4 04 1 X = X A N D 1 2 7

- 5

Page 64: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 64/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

4 2 B T $ ( I ) = B T $ ( I ) + C H R $ ( X ) : P R I N T F 1 $ ; B T $ ( I ) ; L M $4 3 0 1 = 1 + 14 4 N E X T : P R I N T : P R I N T4 5 B T $ ( 1 1 ) = B T $ ( 1 1 ) + "4 6 B T $ ( 3 9 ) = B T $ ( 3 9 ) t 4 7 R E * * * * * * * * * R E A D P R O G R A M * * * * * * * * * * *4 8 P R I N T C H R $ ( 1 4 7 )4 9 I F G A < 8 T H E N 0 P E N 4 , G A : G O T O 5 1 05 0 0 O P E N 4 , G A , 3 , N A $ + t ! . L S T , S , W t f5 1 I F G A O 3 T H E N P R I N T M 0 U T P U T F O L L O W S O N D E V I C E * " ; G A5 2 P R I N T # 4 : G O S U B 1 0 4 05 3 G O S U B 9 8 0 : G O S U B 9 8 0 R E P R G - S T A R T S K I P5 4 R E M * * * * * * * * * M A I N L O O P * * * * * * * * * * *5 5 G O S U B 9 8 0 : G O S U B 9 8 0 R E S K I P L I N K A D D R E S S5 6 R E 5 7 G O S U B 9 8 0 : L B = A R E M L I N E L O B Y T E5 8 G O S U B 9 8 0 : H B = A R E M L I N E H I G H B Y T E5 9 Z N $ = S T R $ ( H B * 2 5 6 + L B )6 0 L N $ = L E F T $ ( L M $ , L E N ( L M $ ) - L E N ( Z N $ ) ) + Z N $ + N F $ : L F = O : P F = O : N N = O6 1 R E * * * * * * * * * L I N E L O O P * * * * * * * * * * *6 2 I F L E N ( L N $ ) < 7 0 T H E N 6 8 06 3 P R I N T # 4 , L N $ ; : I F N O T Q F T H E N P R I N T # 46 4 I F Q F T H E N P R I N T # 4 , C H R $ ( 3 4 )6 5 L N $ = L M $ + N F $ : I F Q F T H E N L N $ = L N $ + C H R $ ( 3 4 )6 6 N N = 06 7 G O S U B 1 0 1 06 8 G O S U B 9 8 0 R E M G E T F I R S T B Y T E6 9 I F A = 0 T H E N P R I N T # 4 , L N $ : L N $ = " " : Q F = 0 : R F = 0 : G O S U B 1 0 1 0 : G O T O 5 5 07 0 I N O R T H E N 7 2 R E R E A D T H R E M A I N D E R7 1 L N $ = L N $ + C H R $ ( A ) : G O T O 6 2 07 2 I F A = 3 2 A N D N O T Q F T H E N 6 2 7 3 I A O 4 4 T H E N 7 6 07 4 I A = 4 4 A N N N = 0 T H E N 7 6 0

5

Page 65: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 65/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

7 5 I F N F $ < > " " T H E N N F $ = L E F T $ ( N F $ , L E N ( N F $ ) - 4 )7 6 I F A = 3 4 T H E N Q F = N O T Q F7 7 I F A = 5 8 A N D N O T Q F T H E N P R I N T # 4 , L N $ ; " " : L N $ = L M $ + N F $ : N N = 0 : G O S U B

1 0 1 0 : G O T O 6 2 07 8 I F A = 6 1 A N D N 0 T Q F T H E N L F = N 0 T L F7 9 I F A > 1 2 7 A N D N O T Q F T H E N G O S U B 8 5 0 : G O T O 6 2 08 0 L N $ = L N $ + C H R $ ( A ) : I F N O T Q F T H E N G O S U B 8 2 08 1 G O T O 6 2 08 2 I F R I G H T $ ( L N $ , 4 ) = " ; " + C H R $ ( 3 4 ) + C H R $ ( 3 4 ) T H E N L N $ = L E F T $ ( L N $ ,

L E N ( L N $ ) - 4 )8 3 I F R I G H T $ ( L N $ , 4 ) = " + " + C H R $ ( 3 4 ) + C H R $ ( 3 4 ) T H E N L N $ = L E F T $ ( L N $ ,

L E N ( L N $ ) - 4 )8 4 R E T U R N8 5 I F R I G H T $ ( L N $ , 1 ) < > " " T H E N L N $ = L N $ + "8 6 I F A = 1 2 8 + 3 9 T H E N P R I N T # 4 , L N $ : L N $ = L M $ + N F $ : G O S U B 1 0 1 0

R E T H E N8 7 I F A = 1 2 9 T H E N N F $ = N F $ + B L $ R E B L $ = S P A C E S F O R F O R N E X T8 8 I F A = 1 3 0 T H E N N N = l : G O S U B 9 3 08 9 I F A = 1 4 3 T H E N R F = N O T R F R E M R E M F L A G O N9 0 I F A = 1 5 3 T H E N P F = N O T P F R E P R I N T F L A G O N9 1 I F A = 1 7 8 T H E N L F = N O T L F R E L E F L A G O N9 2 L N $ = L N $ + B T $ ( A - 1 2 8 ) + " " : R E T U R N9 3 I F N F $ < > " " T H E N N F $ = L E F T $ ( N F $ , L E N ( N F $ ) - 4 ) : L N $ = L E F T $ ( L N $ ,

L E N ( L N $ ) - 4 )9 4 R E T U R N9 5 I N P U T # 1 5 , A $ , B $ , C $ , D $9 6 I F A $ < > " 0 0 " T H E N P R I N T B $ : C L O S E 1 : C L O S E 4 : C L O S E 1 5 : E N D9 7 R E T U R N9 8 G E T # 1 , A $ : A = A S C ( A $ + C H R $ ( O ) )9 9 I S T < > 0 T H E N C L O S E 1 : C L O S E 4 : C L O S E 1 5 : E N D1 0 0 0 R E T U R N1 0 1 0 Z Z = Z Z + 1 : I F Z Z = Z N T H E N 1 0 3 01 0 2 0 R E T U R N

5

Page 66: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 66/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

1 0 3 0 F O R I = 1 T O 7 2 - Z N : P R I N T # 4 : N E X T1 0 4 0 P R I N T # 4 , L M $ ; " " ; U E $ ; S N1 0 5 0 P R I N T # 4 : P R I N T # 4 : Z Z = 31 0 6 0 S N = S N + 11 0 7 0 R E T U R N

I o r d e r t u n d e r s t a n d t h f u n c t i o n s o t h i s p r o g r a m , s o m ek n o w l e d g e o B A S I C p r o g r a m d e s i g n i n e c e s s a r y . T h u s ,s o m e w h a t m o r e t i m e w i l l b e s p e n t t h a n p r e v i o u s l y i p r o g r a md e s c r i p t i o n . T h i s c o m m e n t a r y w i l l b h e l p f u l w h e n y o d e c i d e t m a k e y o u r o w m o d i f i c a t i o n s t t h p r o g r a m . O n ec o n c e i v a b l e c h a n g e w o u l d b t m o d i f y r e v e r s e c h a r a c t e r s t p r i n t o u i n s t e a d a C H R $ ( X ) , s t h a t a n y p r i n t e r c a p r i n to u p r o g r a m l i s t i n g w i t h o u t c o n c e r n f o s p e c i a lc h a r a c t e r s .

L i n e s 1 0 0 - 1 5 0 i n i t i a l i z e s o m e v e r y i m p o r t a n t v a r i a b l e s . T h a r r a y B T w i l l l a t e r c o n t a i n t h i n d i v i d u a l B A S I C c o m m a n d s ,w h i l e L M d e f i n e s l e f t b o r d e r .

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

I y o u r e s p o n d t t h o u t p u t d e v i c e p r o m p t w i t h < R E T U R N > ,t h o u t p u t w i l l d e f a u l t t t h s c r e e n .

B y p a s s i n g t h d i s k d r i v e w i l l c a u s e l i n e s 2 7 0 - 3 5 0 t j u m pi n T h i s l i n e a s k s f o r l i n e s p e p r i n t e d p a g e a n d t i t l e

6

Page 67: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 67/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

t e x t . T h t i t l e w i l l a p p e a r o e v e r y p r i n t e d p a g e , a l o n gw i t h t h p a g e n u m b e r . I y o r e s p o n d t t h l i n e s - p e r - p a g ei n p u t w i t h < R E T U R N > , t h e s y s t e m w i l l d e f a u l t t o 6 $ l i n e s p e rp a g e .

L i n e 3 7 a s k s f o r l e f t m a r g i n : Y o u r b e s t c h o i c e w o u l d b b e t w e e n a n 1 l o w e r n u m b e r m i g h t s t a r t t h l e f tb o r d e r o v e r t h p e r f o r a t i o n s o t h e p a p e r . I y o w i s h , y o c a a l s o r e s p o n d h e r e w i t h < R E T U R N > o n l y , b u n a d d i t i o n a lr o o m f o p i n f e e d w i l l b p r o v i d e d .

N e x t , t h e r r o r c h a n n e l a n p r o g r a m d a t a a r e x e c u t e d ( l i n e9 5 0 ) , w h e r e a n e r r o r m e s s a g e s w i l l e v e n t u a l l y s h o w u p T h m o s t f r e q u e n t l y - e n c o u n t e r e d e r r o r m e s s a g e i F I L E N O F O U N D .

O n c e t h i s r o u t i n e i d o n e , t h F O R - N E X T l o o p i l i n e s 3 6 0 -4 6 P E E K s i n t o B A S I C R O M f o r t h e a b o v e m e n t i o n e d l i s t o c o m m a n d w o r d s . T h i s l i s t h a s s m a l l p e c u l i a r i t y t i t A l c o m m a n d s a r l i s t e d o n a f t e r t h o t h e r ; i o r d e r t k e e p t h c o m m a n d s s e p a r a t e d , t h e i g h t h d a t a b i o t h l a s tc h a r a c t e r o e a c h c o m m a n d w o r d i s t o r e d i t h i s t a b l e .T h i s e i g h t h b i i r e c o g n i z e d i l i n e 3 8 0 , a n d d e a l t w i t h i l i n e 4 1 0 ; t h b i i d e l e t e d , a n t h c o m m a n d d i s p l a y e d o t h e s c r e e n .

T h v a r i a b l e i n d e x s i m u l t a n e o u s l y r a i s e s , a n d P E E K s f o r t h en e x t c o m m a n d i m e m o r y .

F i n a l l y , t h c o m m a n d s I a n T H E N a r e a c h m a d e c h a r a c t e r sl o n g , i . e . , t h e y a r f i l l e d i w i t h s p a c e s .

- 6 1 -

Page 68: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 68/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

N o w , t h p r o g r a m g e t s d a t a f r o m t h d i s k e t t e . T h s u b r o u t i n e i l i n e s 9 8 0 - 1 0 0 0 p e r f o r m t h i s t a s k ; w i t h e v e r yc a l l o f t h e s u b r o u t i n e , c h a r a c t e r i l o a d e d f r o m t h d i s k e t t e a n s t o r e d i v a r i a b l e f o p r o c e s s i n g .

F i r s t , t h e r o u t i n e i c a l l e d t w i c e , b u t h v a l u e i n i n o u s e d . T h e r e a s o n f o t h i s ; t h f i r s t c o u p l e b y t e s o a n p r o g r a m f i l e g i v e s t h e l o a d a d d r e s s — s o m e t h i n g w h i c hd o e s n ' t i n t e r e s t u a t h m o m e n t .

N o t h p r o g r a m g o e s t t h b e g i n n i n g o t h m a i n l o o p a l i n e 5 4 0 H e r e , t o o , t h f i r s t t w b y t e s a r t a k e n b u t l e f tu n u s e d . T h e s e t w v a l u e s a r l i n e - l i n k a d d r e s s e s ( s e ea b o v e ) . T h n e x t f e b y t e s a r m u c h m o r e i m p o r t a n t , s i n c et h e y c o n t a i n t h l i n e n u m b e r . T h e s e a r e c o m p u t e d a n f o r m a t t e d i l i n e s 5 9 a n 6 0 0 . T h l i n e l o o p , i w h i c h a l

t h b y t e s b e l o n g i n g t t h i s l i n e a r e h a n d l e d , b e g i n s i l i n e8 4 0 .

F i r s t , t h p r e v i o u s l y a s s e m b l e d s t r i n g ( L N $ ) i c h e c k e d f o l e n g t h ( < 7 0 c h a r a c t e r s p e l i n e ) . I f t h i s a m o u n t i o v e r s t e p p e d , t h e n t h p o r t i o n g i v e n u t t h a t p o i n t i p r i n t e d o u t , a n t h s u b r o u t i n e i l i n e 1 0 1 0 i c a l l e d .H e r e t h l i n e i c h e c k e d t s e w h e t h e r i h a i n d e e dr e a c h e d t h m a x i m u m n u m b e r o c h a r a c t e r s , a n w h e t h e rl i n e f e e d i n e e d e d .

A f t e r t h i s t e s t , b y t e i s e n t t l i n e 7 1 0 , a n d t h e w o r kp r o p e r b e g i n s . A f t e r t h b y t e s a r s e n t t v a r i a b l e A m a n yt h i n g s h a p p e n a o n c e ; w e ' l l g i v e l i n e n u m b e r s a w g t h r o u g h t h s e q u e n c e .

- 6

Page 69: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 69/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

F i r s t , i t e s t e d t s e w h e t h e r i t i s e q u a l t z e r o . I t h a t i t h e c a s e , t h e e n o t h e l i n e h a s b e e n r e a c h e d ,w h i c h c a u s e s t h e l i n e n u m b e r f o t h p r i n t l i n e t i n c r e a s e ,a n f o L N t g i v e o u t h e n e x t s t r i n g . I i e q u a l t 3 2 h o w e v e r , s p a c e i g i v e n . W h e n s p a c e i f o u n d i t h p r o g r a m t e x t , t h p r o g r a m g o e s o n t o t h n e x t b y t e . I s p a c e i f o u n d i q u o t a t i o n m a r k s , i i i n s e r t e d i l i n es t r i n g L N f o l a t e r u s e . T h d i f f e r e n c e w i l l b a p p a r e n ti v a r i a b l e Q F w h i c h w e s h a l l e x p l a i n i m o m e n t .

N e x t f o l l o w s t e s t f o v a l u e o 4 ( c o m m a ) . T h i s i i m p o r t a n t i c o n t e x t o t h N E X T c o m m a n d w h i c h h a s e v e r a lv a r i a b l e s s e p a r a t e d b c o m m a s .

L i n e 7 6 w i l l t e s t f o r t h v a l u e 3 ( q u o t a t i o n m a r k s ) . I A = 3 4 , t h e n Q F w i l l b c h e c k e d w i t h N O T o p e r a t i o n :l = t r u e , w h i l e 0 = f a l s e . T h i s q u i c k l y t e s t s t s e w h e t h e rc h a r a c t e r i i q u o t e s o p r o g r a m t e x t .

r o u t i n e f o l l o w s t t e s t f o c o l o n s ( = 5 8 ) . A g a i n , Q i u s e d t s e i t h c o l o n i s i n t h p r o g r a m t e x t , o i i i i q u o t a t i o n m a r k s . I t h e c o l o n i p a r t o p r o g r a m l i n e ,L N d e c l a r e s a e n d - o f - l i n e , a n n e p r i n t e d l i n e i b e g u n . T h i s b r e a k s u l i n e s w i t h m u l t i p l e s t a t e m e n t s , a n da r r a n g e s t h e m f o e a s y r e a d a b i l i t y .

I f t h c h a r a c t e r r e c e i v e d i l a r g e r t h a n 1 2 a n i s i n t h p r o g r a m t e x t , i t i s h a n d l e d a t o k e n ; b u i t h i sc h a r a c t e r i s i n q u o t e s , t h e n i t i s p u i n t o L N $ .

T h v a l u e 1 6 ( s e e l i n e 8 6 0 ) s t a n d s f o t h t o k e n T H E N . I t h p r o g r a m d e t e c t s T H E N t o k e n , t h e p r e v i o u s l i n e w i l l b ep r i n t e d , t m a k e t h I F - T H E N s t r u c t u r e m o r e v i s i b l e .

6

Page 70: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 70/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

L i n e 8 7 s e a r c h e s f o r t h e i n t e r p r e t e r c o d e f o r F O R : W h e nt h i s t o k e n i f o u n d , t h s t r i n g N F i e x t e n d e d t t h c h a r a c t e r s e q u e n c e i B L $ . T h i s p r o c e d u r e p r i n t s o u F O R -N E X T l o o p s i s e q u e n c e .

L i n e 8 8 s e e k s t h p r e s e n c e o N E X T c o m m a n d . W h e n t h i sc o m m a n d a p p e a r s , t h F O R - c o m m a n d i a d d e d t t h c h a r a c t e r si l i n e 9 3 0 , t h e n t h e s e t i r e m o v e d . W h e n t h N E X T m u s ti n v o l v e s e v e r a l v a r i a b l e s s e p a r a t e d b y c o l u m n s , t h N N - f l a gi s e t t o 1

L i n e 8 9 t e s t s f o r t h p r e s e n c e o R E N s t a t e m e n t . I t h i si t h c a s e , t h R E M - f l a g ( R F ) i s s e t , p r i n t i n g o u t h R E l i n e w i t h o u t c h e c k i n g t h r e m a i n d e r o t h a t l i n e f o rc o m m a n d s .

A f t e r e x e c u t i n g l i n e s 8 5 0 - 8 9 0 , t h e l i n e s t r i n g L N a d d s t h ec h a r a c t e r s t r i n g f o t h c o r r e s p o n d i n g i n t e r p r e t e r c o d e .T h u s , t h c o r r e s p o n d i n g a r r a y e l e m e n t f o r t h e t o k e n ( 1 2 8 ) i a d d r e s s e d . I a d d i t i o n , s p a c e i a t t a c h e d t i n c r e a s er e a d a b i l i t y , a n d t h p r o g r a m r e t u r n s t t h e l i n e l o o p .

T h i s p r o g r a m l o o k s p r e t t y c o m p l i c a t e d a f i r s t g l a n c e .B a s i c a l l y , a l i d o e s i p e r f o r m L I S T c o m m a n d , w i t h s o m ea d d i t i o n a l f u n c t i o n s p e r f o r m e d b t h p r o g r a m .

6

Page 71: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 71/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

5 . W o r d P r o c e s s i n g

N e x t t d a t a b a s e , w o r d p r o c e s s i n g i p r o b a b l y t h f o r e m o s tr e a s o n w h p e o p l e b u c o m p u t e r s . S i n c e w o r d p r o c e s s i n gi n v o l v e s p r i n t e r s , w e h a v e p r o d u c e d s h o r t p r o g r a m f o r t h ep u r p o s e c a l l e d ' M i n i t e x t * . N o w , t h i s p r o g r a m d o e s n ' tc o m p a r e w i t h t r u e w o r d p r o c e s s i n g p r o g r a m s u c h a T E X T O M A T , f o r e x a m p l e ; b u t h i s p r o g r a m i a d e q u a t e f o t y p i n g u l e t t e r o q u i c k n o t e . I i w r i t t e n i m a c h i n el a n g u a g e , s t h a t y o c a s e h o p r i n t e r c o n t r o l w o r k s i

m a c h i n e c o d e .

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

5 . 2 . 1 M I N I T E X T S i m p l e T e x t E d i t o r

W h e n c o m p u t e r a n p r i n t e r a r c o m b i n e d , c h a n c e s a r t h a tw o r d p r o c e s s o r i i n v o l v e d . P u b l i s h i n g s o u r c e l i s t i n g f o a e f f i c i e n t p r o g r a m s u c h a T E X T O M A T w o u l d t a k e o v e r 3 0 p a g e s . A l t h o u g h w h a v e n ' t t r i e d i t w e s t i m a t ec o r r e s p o n d i n g p r o g r a m i t h f o r m o D A T A s t a t e m e n t s w o u l dt a k e u 4 t 5 p a g e s . N o t e v e n t h m o s t h a r d - c o r eh o b b y i s t w o u l d e n j o y t y p i n g i t h a t m u c h m a t e r i a l .

S w b e g a n s e a r c h i n g f o p a s s a b l e p r o g r a m t h a t w o u l dr e q u i r e a l i t t l e e f f o r t t t y p e i a p o s s i b l e . W i m m e d i a t e l y r u l e d o u w r i t i n g t h p r o g r a m i B A S I C , b e c a u s eo C o m m o d o r e ' s n o t o r i o u s l y s l o w " g a r b a g e c o l l e c t i o n " ( s t r i n gf u n c t i o n s ) , w h i c h g e i t h w a o w o r d p r o c e s s i n g .

- 6

Page 72: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 72/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

G a r b a g e c o l l e c t i o n r e m o v e s s t r i n g s n l o n g e r n e c e s s a r y f r o mm e m o r y . T h i s p r o c e d u r e c a n t a k e a n y w h e r e f r o m f e s e c o n d st o v e r 3 m i n u t e s . D u r i n g t h i s t i m e , t h c o m p u t e r a c c e p t sn i n p u t f r o m t h k e y b o a r d , a n a p p e a r s t b e l o c k e d - u p .

T h s e c o n d p o i n t a g a i n s t B A S I C t e x t e d i t o r i t h r e l a t i v es i z e o s u c h p r o g r a m . I o r d e r t p e r f o r m t h m o s te l e m e n t a r y f u n c t i o n s , t h p r o g r a m w o u l d h a v e t b o c o n s i d e r a b l e s i z e .

T h e r e i a a l t e r n a t e w a y t h a t y o m a y a l r e a d y h a v e t r i e d i p r i n t i n g t e x t . T h i s m e t h o d w i l l t r e a t t e x t l i k e n o r m a lB A S I C p r o g r a m w r i t t e n i P R I N T * c o m m a n d s . T h i s i r e a l l yq u i t e a u n s a t i s f a c t o r y m e t h o d , s i n c e y o u h a v e t g i v e e v e r yl i n e l i n e n u m b e r , a n d t y p e i t h c o m m a n d " P R I N T * L F " .A l s o , y o w o u l d h a v e t b s u r e t h a t e a c h l i n e i u n d e rc e r t a i n l e n g t h : T h i s i i t s e l f c a b n u i s a n c e t f l u i dw r i t i n g .

O n t h e o t h e r h a n d , t h i s l a s t m e t h o d m e a n s t h a t t h e s c r e e ne d i t o r i a v a i l a b l e t o y o u , a n t h a t y o u h a v e a c c e s s t t h c o m m a n d s f o l o a d i n g a n s a v i n g t h t e x t . S o a f t e r m u c hc o n s i d e r a t i o n , w c h o s e t h i s m e t h o d , a n a s c e r t a i n e d h o w c o u l d d i s p o s e o t h d i s a d v a n t a g e s . T h r e s u l t w a s h o r tm a c h i n e l a n g u a g e r o u t i n e o f 5 0 8 b y t e s .

I y o l o o k a h o t e x t i p r i n t e d i P R I N T s t a t e m e n t ,y o u ' l l n o t i c e t h a t q u o t a t i o n m a r k s m u s t p r e c e d e t h t e x t .W i t h o u t t h e s e q u o t e s , t h e t e x t a f t e r t h e l i n e n u m b e r w i l ln o b e p r i n t e d .

T h e r e i y e a n o t h e r p r o b l e m : T h e c u r s o r c o n t r o l k e y s , t h eR U N / S T O P k e y , C L R / H O M E a n t h f u n c t i o n k e y s p r o d u c e r e v e r s e

6

Page 73: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 73/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

g r a p h i c c h a r a c t e r s w h e n i q u o t e m o d e , w h i c h m e a n s t h a te d i t i n g t h p r o g r a m l i n e u s i n g y o u r c u r s o r k e y s i o u o t h q u e s t i o n .

T h e s e p r o b l e m s a r a l s o l v e d b t h f i r s t p a r t o f t h em a c h i n e l a n g u a g e p r o g r a m . T h e l i n e n u m b e r s a r s e l f -g e n e r a t i n g ( s i m i l a r t t h A U T O c o m m a n d f o u n d i s o m eB A S I C e x t e n s i o n s ) , a a r t h q u o t a t i o n m a r k s , s y o n e e d n ' t w o r r y a b o u t t y p i n g e i t h e r . Q u o t e m o d e i s w i t c h e do b m e m o r y c e l l i z e r o - p a g e R A M . A f t e r t h q u o t a t i o nm a r k a p p e a r s o t h s c r e e n , t h i s m e m o r y c e l l i s w i t c h e do f f , a n t h c o m p u t e r " t h i n k s " t h a t i t i s n l o n g e r i q u o t em o d e ; t h i s m e a n s t h a t y o a g a i n h a v e t h c u r s o r k e y sa v a i l a b l e f o e d i t i n g .

W s t i l l h a v e p r o b l e m — t h e l i n e l e n g t h . M o s t o u a r f r o m t h " h u n t - a n d - p e c k " s c h o o l o t y p i n g , a n t e n d t k e e po u e y e s o t h k e y b o a r d , r a t h e r t h a n t h e s c r e e n . W h e nw e ' r e t r y i n g t c o n c e n t r a t e o w r i t i n g , w s e l d o m t h i n k o l o o k i n g a t h s c r e e n . T h e r e f o r e , s o u n d s i g n i f y i n g t h e n d - o f - l i n e w o u l d b g o o d i d e a .

L o o k i n g a g a i n t t h z e r o - p a g e r a n g e m e n t i o n e d a b o v e ( t h ef i r s t 2 5 6 b y t e s o R A o s o ) , w e f i n d m e m o r y c e l l w h i c hg i v e s t h n u m b e r o c h a r a c t e r s i B A S I C l i n e . O u r l i t t l ep r o g r a m r e g u l a r l y c h e c k s t h i s c e l l t s e e h o w c l o s e w e a r et t h e n d - o f - l i n e ( u s i n g t h e i n t e r r u p t , s i t e s t s f o t h e n n u m b e r a b o u t 6 t i m e s s e c o n d ) . W h e n t h e n i a p p r o a c h i n g , t h t e l e v i s i o n s p e a k e r w i l l p r o d u c e s o u n d .Y o s h o u l d p r e s s t h < R E T U R N > k e y a t h e e n d o t h e n e x tw o r d .

6

Page 74: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 74/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

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

A s o o n a t h < R E T U R N > k e y i p r e s s e d , n e l i n e n u m b e ra n q u o t a t i o n m a r k i m m e d i a t e l y a p p e a r .

T h s e c o n d p a r t o t h p r o g r a m i r e s p o n s i b l e f o p r i n t i n go u t h t e x t . N o w , y o u c o u l d d t h i s j u s t b y t y p i n g L I S T ,b u w h l i k e s t w r i t e l e t t e r s t h a t h a v e l i n e n u m b e r a e v e r y l e f t m a r g i n ? T h i s p r o g r a m s e c t i o n p r i n t s t h l i n ew i t h o u t l i n e n u m b e r o q u o t e s , i n s t e a d g i v i n g o u c l e a nl e f t b o r d e r , s t h a t t h e c h a r a c t e r s d n o o v e r s t e p t h

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

T h i s p r o g r a m w o r k s i c o n n e c t i o n w i t h t h B A S I C i n t e r p r e t e r ,f o e a s e o h a n d l i n g . A f t e r t h p r o g r a m i c a l l e d w i t h S Y S ,y o h a v e t w n e c o m m a n d s a v a i l a b l e : T h ! G E T c o m m a n d t g e s p e c i f i c l i n e ; a n d t h e ! P R I N T c o m m a n d t p r i n t o u t h t e x t . T h l a t t e r c a b c a l l e d w i t h t h a b b r e v i a t i o n ! ?

O t t h p r o g r a m l i s t i n g . I y o u h a v e l i t t l e e x p e r i e n c ew o r k i n g m a c h i n e l a n g u a g e m o n i t o r , y o s h o u l d f i n d i q u i t ee a s y t m o d i f y t h i s p r o g r a m t y o u r o w n n e e d s .

6

Page 75: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 75/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

c O O Oc O O O

c O O Oc O O Oc O O Oc O O Oc O O Oc O O Oc O O Oc O O Oc O O Oc O O Oc O O Oc O O Oc O O Oc O O Oc O O Oc O O Oc O O Oc O O Oc O O Oc O O Oc O O Oc O O Oc O O Oc O O Oc O O Oc O O Oc O O Oc O O Oc O O Oc O O Oc O O O

b e e p f l gf o r m f e e dl c l h t x t a nt x e n df a t e x tc h r g e tc h r g o tp r t c o d eg e t c o d ef i l n ml g f n rs e c a dd e v a dl i n ei n c rp g l i n eb u f f e r lb u f f e r 2v e c t o rv e c t o r li r q v e c

b a s l o o po l d v e cm a i n l o o pg o o nw e i t e rb a s s t r t

$ c 0 0 0

1 $ 0 $ 1 $ 1 $ 2 $ 2 $ 6 $ 7 $ 7 $ 7 $ 9 $ a $ b $ b $ b $ b $ f $ f $ f $ 1 0 1$ 2 0 0$ 0 3 0 2$ 0 3 0 8$ 0 3 1 4$ a 4 7 4$ a 4 8 3$ a 4 8 6$ a 5 6 9$ a 5 7 6$ a 6 8 e

6

Page 76: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 76/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

c O O Oc O O Oc O O Oc O O Oc O O Oc O O Oc O O Oc O O Oc O O Oc O O Oc O O Oc O O Oc O O Oc O O Oc O O Oc O O Oc O O O

e x e c o l dc h k c o ms y n t a xi l l q u a n tg e t p a ri n t f l o a tf l o a t a s cs i c l r s c r ni r q o l do p e nc l o s ec k o u tc l r c hi n p u tb s o u ts t o p

$ a 7 e 7$ a e f d$ a f O 8$ b 2 4 8$ b 7 e b$ b c 4 9$ b d d d$ d 4 0 0$ e 5 4 4

$ e a 3 1$ f f c O$ f f c 3$ f f c 9$ f f c c$ f f c f$ f f d 2$ f f e l

* * * * * * * * * * * * * P R O G R A M B E G I N S H E R E * * * * * * * * * * * * * * * * *

c O O Oc 0 0 2c 0 0 4c 0 0 7c O O ac O O cc O O fc O l lc O 1 4c O 1 6c O 1 7c O 1 9c O l a

a a 8 8 a 8 a 8 a a 9 c 9

4 c 0 0 8 9 1 1 0

2

2

0 0

0

d

I d l d s t s t

# < t e s t i n# > t e s t i nv e c t o r lv e c t o r l + 1

I d # 1 2 8s t $ 0 2 9 1I d # $ 1 7s a $ d O 1 8I d # t a s t ( $ 2 b ) , yi n s t $ 2

; s h i f t - c o m m o d o r e d i s a b l e

; u p p e r / l o w e r - c a s e o

; c l e a r B A S I C p r o g r a m

7

Page 77: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 77/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

c O l cc O l ec O l fc O 2 1c O 2 3c O 2 5c O 2 7c O 2 9c O 2 cc O 2 fc O 3 1c O 3 4c O 3 6c O 3 8c O 3 ac O 3 cc O 3 ec 0 4 0c O 4 1c O 4 4c O 4 6c O 4 8c O 4 bc O 4 ec O 5 1c O 5 3c O 5 5c O 5 7c O 5 9c O 5 cc O 5 f

c O 6 2c O 6 4

a 1 6 8 a 6 8 2 2 a 8 a 8 a 8 a 8 6 2 c f 2 4 2 c f c f 4 4 2

f 2

2

0 2 2 0 2 8 4 8 8 6 f 0 f O f

7 2 0 7 e 7 a O 9 0 0 4 7

O e

a e

0

0

0 a 0

a c 0

b

I d c l a d s t I d a d s t j s j s I d s t I d s t I d s t I d s t r t

$ 2

# $ 0 2$ 2 $ 2 # $ 2 b a s s t r tc l r s c r n# $ 8 06 5 # 1 0 0l i n e

# l i n e + 1# 1 i n c r

t e s t i n j s c h r g e tc m b e j s j m

t e s t 2 j s c m b e c m b e j m

p r t j m pg e j s

b e j s

# t e s t 2c h r g o te x e c o l dc h r g e t# g e t c o d eg e # p r t c o d ep r s y n t a xp r t lc h r g e t1 g e t p a r

; s e t v e c t o r s

; c l e a r s c r e e n

; r e p e a t a l k e y s; f i r s t l i n e n u m b e r

; l i n e c o n d i t i o n

; r e t u r n

; i t h e n t e s t f u r t h e r

; o t h e r w i s e , n o r m a l c o m m; g e t n e x t c h a r a c t e r; i i ! g e t ?

; i i ! p r i n t ?

; s y n t a x e r r o r , o n o t ?

; i w a ! g e t

; f u r t h e r p a r a m e t e r s ?; g e t f u r t h e r p a r a m e t e r s

7

Page 78: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 78/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

c O 6 7c O 6 9c O 6 bc O 6 dc O 6 fc O 7 1c O 7 3c O 7 6c O 7 8c O 7 bc O 7 dc 0 8 0c O 8 2c O 8 5c O 8 8c O 8 b

c O 8 ec 0 9 0c O 9 2c O 9 3c O 9 5c O 9 8c O 9 ac O 9 dc O 9 ec O a Oc 0 a 2c 0 a 4c 0 a 6c 0 a 8c 0 a 9c O a cc O a f

8 a 8 a 8 a 8 a 8 a 8 a 8 2 4 a c f 7 a 8 a 8 5 a a 8 8 a 3 2 2 a

f 1 f 1 f 8 9 1 1 8 0 c 0 8 8 1

0 O

0 1 c 1

f f 6 6 9

4 d 0

0

d

0

0 c a 0

0

0

b b

s t I d s t I d s t

1 I d s t I d s t I d s t I d s t

a u t o j s j m

i n c rl l i n eh l i n e + 1# 1 2 8$ 0 2 9 1# 1 $ d O 1 8# > a u t ov e c t o r# > a u t ov e c t o r + 1a u t o n u mm a i n l o o p

a u t o n u m I d i r q v e ce m b e s e I d s t I d s t c l

w I d l d s t s t l d s e j s j s l d

# < b e e p o nw

# < b e e p o ni r q v e c# < b e e p o ni r q v e c + 1

l i n el i n e + 1f a c + 1f a # $ 9 0

i n t f l o a tf l o a t a s c#

; a n d n o t e t h e m

; i n p u t v e c t o r t a d j u s t; l i n e # f o A U T O; l i n e n u m b e r r o u t i n e

; b e e p o n

; i n t e r r u p t v e c t o r c h a n g e d; f o r e n d - o f - l i n e; b e e p r o u t i n e

; g e t l i n e n u m b e r; a n d c o n v e r t i ^ t o; A S C I I f o r m a t

7

Page 79: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 79/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

c O b lc 0 b 4c 0 b 6c 0 b 9c O b cc O b dc O b fc O c lc 0 c 2c 0 c 4c 0 c 6c 0 c 8c O c ac O c cc O c fc 0 d 2c 0 d 3c 0 d 5c 0 d 8c 0 d 9c O d cc O d ec O e Oc 0 e 3c 0 e 5c 0 e 7c O e ac O e cc O e ec O f Oc 0 f 2c 0 f 4c 0 f 6

b f 9 2 e d a 1 6 8 9 e a 9 2 e a 9 e 2 a 8 2 c f 4 a e 8 b c a a

0 0 0 d

f f

f f 0 f 2 0 d

2 0

d 0 d c O 0 6 f f f 0 f 8 a

0

0 f

0 f

0

f

f

a

1

1

1

1

1

I d b e s t j s i n

b n I d c l a d s t b c i n I d s t j s i n I d s t i n j s I d s t j s c m b e j m I d s b s t b c d e I d

b u f f e r l ,1 b u f f e r 2 ,b s o u t

1 l i n e

i n c rl i n e1 l i n e + 1

b u f f e r 2 ,b s o u t

# 3 b u f f e r 2 ,

b s o u t# $ d i n p u t

# c 1

g o o nl i n ei n c rl i n e1 l i n e + 1# < o l d v e c

l d y # > o l d v e c

; l i n e n u m b e r i i n p u t; b u f f e r & o s c r e e n

; i n c r e a s e l i n e

; s p a c e; i i n p u t b u f f e r; a n d o s c r e e n

; q u o t a t i o n m a r k s; i i n p u t b u f f e r

; a n d o s c r e e n

; c l e a r q o u t e - f l a g

; o n l y < R E T U R N > p r e s s e d ?

; i n o t , g o o ; o t h e r w i s e , d r o p l i n e; t o l v a l u e ,

; a n d s e t b a c k: i n p u t v e c t o r

7

Page 80: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 80/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

c 0 f 8c O f bc O f ec l O Oc l O 3c l O 5c l O 7c l O 9c l O bc l O dc l l Oc l l 2c l l 4c l l 6c l l 9c l l bc l l ec l 2 0c l 2 3c l 2 5c l 2 8c l 2 ac l 2 dc l 2 fc l 3 2c l 3 4c l 3 7c l 3 9c l 3 cc l 3 e

8 8 a 4 a c f a 8 4 a d a 8 a 8 a 8 a 8 a 8 a 8 a 8 a 8 8 4

0 0 0 7 d 4 0 0 0 3 0 2 0 1 0 0 0 0 7 0 f 0 f 0 4 0 4 0 0 3

0 0

a

e

d

d

d

d 4

d

d

d

d

e

s t s t l d j m

v e c t o rv e c t o r + 1# w e i t e r

b e e p o n I d $ d c m b e I d

s t j m

b e e p I d b n I d s t I d s t I d s t I d s t I d s t I d s t I d s t I d s t s t

e n j m

# 6 b e e p# b e e p f l gi r q o l d

b e e p f l ge n # s i d + 2 4# s i d + 3# s i # 1 2 0s i d + 1# 2 5 5s i d + 5# 2 4 9s i d + 6# 6 s i d + 4# 6 s i d + 4b e e p f l gi r q o l d

; c l e a r i n p u t b u f f e r

; c u r s o r - c o l u m n; 6 c h a r a c t e r s ?; t h e n b e e p; o t h e r w i s e , c l e a r f l a g; b e e p f l a g r e s e t; o l d i r q r o u t i n e; s h o u l d i b e e p ?; i n o t , t h e n o n w a r d

; v o l u m e

; k e y a c t i v a t i o n

; l o w b y t e f r e q

j h i g h b y t e f r e q

; a t t a c k / d e c a y

; s u s t / r e l e a s e

; p u l s e w a v e o

; w a v e o f f; o n c e , n m o r e; i r q e x i t

7

Page 81: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 81/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

♦ ♦ P R I N T R O U T I N E Sc l 4 1c l 4 3c l 4 5c l 4 7c l 4 9c l 4 b

c l 4 dc l 4 fc l 5 1c l 5 4c l 5 6c l 5 9c l 5 bc l 5 cc l 5 ec l 6 0c l 6 2c l 6 4c l 6 6c l 6 8c l 6 ac l 6 dc l 6 fc l 7 0c l 7 2c l 7 4c l 7 6c l 7 8c l 7 a

c ! 7 cc ! 7 e

a 8 a 8 a 8

a 8 2 a 2 a 3 e c d a e c d 4 a 1 6 8 a 8 a 8

a a

0 b 7 b 0 b

0 b c f b c 9 f f2

0 2 O 2 0 2 0 f c 2

0 7 2 7 4 f

O 2

p r t l I d a # 4s t d e v a dI d # 1 2 6s t a l g f n rI d # s t f i l n m

I d # s t s e c a dj s o p e nl d l g f n rj s c k o u tI d t x t a n + 2s e s b # c m t x t a nb n p r i n t lI d t x t a n + 3s b # c m t x t a n + 1b n p r i n t lj m e n d l

p r i n t l I d t x t a nc l a d # s t a t e x tI d t x t a n + 1s t a t e x t + 1I d # 6 s t p g l i n el d # l I d #

; d e v i c e *

; f i l e #

; f i l e n a m e

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

; o p e n f i l e

; o u t p u t t p r i n t e r; = s t a r t o v a r i a b l e s

; m i n u s; b a s i c - s t a r t ?

; n t e x t i m e m o r y; 1 i n e l i n k ,; l i n e n u m b e r a n ; q u o t a t i o n m a r k s m a r k; p o s i t i o n i t e x tj h i g h b y t e a l s o n o t e d

l i n e s p e r p a g e

: D r i n t l e f t b o r d e r

7

Page 82: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 82/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

c l 8 0c l 8 3c l 8 4c l 8 6c l 8 8c l 8 bc l 8 dc l 8 fc l 9 1c l 9 4c l 9 7c l 9 ac l 9 cc l 9 ec l a Oc l a 2c l a 4c l a 6c l a 9c l a bc l a dc l a fc l b 2c l b 3c l b 5c l b 7c l b 9c l b bc l b dc l c Oc l c lc l c 3c l c 5

2 8 d a 2 a b d 4 2 2 f e d e d a 2 c d a 2 8 d a 8 a a 2 8 d a 2

d

f 1 d 0 7 0 a d e 5 7 0 7 e O d f O 0 d

f 4 f O 2 d

f 1 d

f

f

c f f

f

f

f

f

l m l o o p l j s b s o u t

l o o p

w

w n u l l

w

w

d e b n I d j s l d I d

b n j m j s j s b e i n

b n i n

b n I d j s d e b n l d j s d e b n I d s t l d I d

l m l o o p j s d e b n I d j s

l m l o o p l# 1 b s o u t# ( t e x t ) , y

w n u l lb s o u ts t o pe n t e x tw t e x t + 1l o o p# c b s o u tp g l i n ew ♦ f o r m f e e db s o u t

w

# 6 p g l i n e# l # f

b s o u t

l m l o o p# 1 b s o u t

; c u r s o r - d o w n; u p p e r / l o w e r c a s e; * * * * * i o o p * * * * * * * * *

; e n d i B A S I C l i n e = 0

; s e n d c h a r a c t e r; s t o p p r i n t i n g ?; t h e n s t o p p r i n t i n g; i n c r e m e n t t e x t p o i n t e r

; s e n d l i n e f e e d; l i n e c o u n t e r - ; 6 l i n e s p r i n t e d ?; t h e n f o r m f e e d ( n e x t p .

; r e s e t l i n e c o u n t e r t 6

; l e f t m a r g i n f o n e x t l i n e

7

Page 83: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 83/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

c l c 8c l c ac l c cc l c ec l d Oc l d lc l d 3c l d 5c l d 7c l d 9c l d bc l d dc l d fc l e lc l e 3c l e 5c l e 7c l e 8c l e ac l e dc l e fc l f 2c l f 5c l f 7c l f a

a e d e 8 d a c d a c f a e d e 8 d 4 a 2 2 a 2 4

0 7 0 7

f 7 2 0 7 2 O 0 7 0 7

f 8 O d c b c 7

c

f f

f a

1

w

w 1

w

e n

e n d l

l d i n

b n i n d e b n I d c m b n I d c m b e l d i n

b n i n d e b n j m I d j s j s I d j s j m

# t e x tw t e x t + 1

1 t e x tt e x t e n d

w t e x t + 1t e x t e n d + 1e n # t e x t

w t e x t + 1

1 l o o p# c b s o u tc l r c hl g f n rc l o s eb a s l o o p

; s k i p n u l l l i n e - l i n k

; e n d o f B A S I C p r o g r a m ?

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

; p r i n t n e x t l i n e

; l a s t l i n e f e e d g i v e n; o u t p u t o s c r e e n

; c l o s e f i l e; r e t u r n t b a s i c

7

Page 84: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 84/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

I y o d o n ' t h a v e a a s s e m b l e r , v e r s i o n o M i n i t e x tf o l l o w s , w r i t t e n a B A S I C l o a d e r ( i . e . , i D A T As t a t e m e n t s ) . I y o u t y p e i e i t h e r p r o g r a m , b a b s o l u t e l ys u r e t h a t y o u ' v e s a v e d i t c a s s e t t e o d i s k e t t e b e f o r er u n n i n g ; o n c e R U i t y p e d i n y o u c a n n o t r e t r i e v e t h p r o g r a m !

1 0 F O 4 9 1 5 2 T 4 9 6 6 01 1 R E A D : P O K E I , X : S = S + X N E X T1 2 D A T A 1 6 9 , 6 5 , 1 6 0 , 1 9 2 , 1 4 1 , 8 3 , 1 4 0 , 9 3 , 1 6 9 , 1 2 81 3 D A T A 1 4 1 , 1 4 5 , 2 , 1 6 9 , 2 3 , 1 4 1 , 2 4 , 2 0 8 , 1 6 9 , 0 , 1 6 8 , 1 4 51 4 D A T A 4 3 , 2 0 0 , 1 4 5 , 4 3 , 1 6 5 , 4 3 2 4 , 1 0 5 , 2 , 1 3 3 , 4 5 , 1 6 51 5 D A T A 4 4 , 1 0 5 , 0 , 1 3 3 , 4 6 3 2 , 1 4 2 , 1 6 6 , 3 2 6 8 , 2 2 9 , 1 6 91 6 D A T A 1 2 8 , 1 4 1 , 1 3 8 , 2 , 1 6 9 , 1 0 0 , 1 3 3 , 2 5 1 , 1 6 9 , 0 , 1 3 3 , 2 5 21 7 D A T A 1 6 9 , 1 0 , 1 3 3 , 2 5 3 , 9 6 3 2 , 1 1 5 , 0 , 2 0 1 , 3 3 , 2 4 0 ,1 8 D A T A 3 2 , 1 2 1 , 0 7 6 , 2 3 1 , 1 6 7 , 3 2 , 1 1 5 , 0 , 2 0 1 , 1 6 1 , 2 4 01 9 D A T A 1 0 , 2 0 1 , 1 5 3 , 2 4 0 , 3 7 6 8 , 1 7 5 , 7 6 6 5 , 1 9 3 , 3 2 0 D A T A 1 1 5 , 0 , 2 4 0 , 1 3 3 2 , 2 3 5 , 1 8 3 , 1 3 4 , 2 5 3 , 1 6 5 , 2 0 , 1 3 32 1 D A T A 2 5 1 , 1 6 5 , 2 1 , 1 3 3 , 2 5 2 , 1 6 9 , 1 2 8 , 1 4 1 , 1 4 5 , 2 , 1 6 9 , 2 2 2 D A T A 1 4 1 , 2 4 , 2 0 8 , 1 6 9 , 1 3 3 , 1 4 1 , 2 3 , 1 6 9 , 1 9 2 , 1 4 1 ,2 3 D A T A 3 3 2 , 1 3 9 , 1 9 2 , 7 6 , 1 3 4 , 1 6 4 , 1 7 3 , 2 0 3 , 2 0 1 ,2 4 D A T A 2 4 0 , 1 2 , 1 2 0 , 1 6 9 , 3 , 1 4 1 , 2 0 3 , 1 6 9 , 1 9 3 , 1 4 1 , 2 2 5 D A T A 3 8 8 , 1 6 5 , 2 5 1 , 1 6 6 , 2 5 2 , 1 3 3 , 9 9 , 1 3 4 , 9 8 , 1 6 2 , 1 4 42 6 D A T A 5 6 , 3 2 , 7 3 , 1 8 8 , 3 2 , 2 2 1 , 1 8 9 , 1 6 2 , 0 , 1 8 9 , 1 2 7 D A T A 2 4 0 , 9 , 1 5 7 , 0 , 2 , 3 2 , 2 1 0 , 2 5 5 , 2 3 2 , 2 0 8 , 2 4 2 , 1 6 52 8 D A T A 2 5 1 , 2 4 , 1 0 1 , 2 5 3 , 1 3 3 , 2 5 1 , 1 4 4 , 2 , 2 3 0 , 2 5 2 , 1 6 9 , 3 2 9 D A T A 1 5 7 , 0 2 3 2 , 2 1 0 , 2 5 5 , 2 3 2 , 1 6 9 , 3 4 , 1 5 7 , 0 , 3 0 D A T A 2 3 2 , 3 2 , 2 1 0 , 2 5 5 , 1 6 9 , 0 , 1 3 3 , 2 1 2 , 3 2 , 2 0 7 , 2 5 5 , 2 0 13 1 D A T A 1 3 , 2 4 0 , 3 7 6 , 1 0 5 , 1 6 5 , 1 6 5 , 2 5 1 , 2 2 9 , 2 5 3 , 1 3 3 , 2 5 13 2 D A T A 1 7 6 , 2 , 1 9 8 , 2 5 2 , 1 6 9 , 1 3 1 , 1 6 0 , 1 6 4 , 1 4 1 , 2 3 , 1 4 03 3 D A T A 3 3 , 1 6 2 , 0 7 6 , 1 1 8 , 1 6 5 , 1 6 5 , 2 1 1 , 2 0 1 , 6 4 , 2 4 03 4 D A T A 7 , 1 6 9 , 0 , 1 3 3 , 2 7 6 4 9 , 2 3 4 , 1 6 5 , 2 , 2 0 8 , 4

7

Page 85: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 85/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

3 5 D A T A 1 6 9 , 8 , 1 4 1 , 2 4 , 2 1 2 , 1 6 9 , 8 , 1 4 1 , 3 , 2 1 2 , 1 6 9 ,3 6 D A T A 1 4 1 , 0 , 2 1 2 , 1 6 9 , 1 2 0 , 1 4 1 , 1 , 2 1 2 , 1 6 9 , 2 5 5 , 1 4 1 ,3 7 D A T A 2 1 2 , 1 6 9 , 2 4 9 , 1 4 1 , 6 , 2 1 2 , 1 6 9 , 6 5 , 1 4 1 , 4 , 2 1 2 , 1 6 93 8 D A T A 6 4 , 1 4 1 , 4 , 2 1 2 , 1 3 3 , 2 7 6 4 9 , 2 3 4 , 1 6 9 , 4 , 1 3 33 9 D A T A 1 8 6 , 1 6 9 , 1 2 6 , 1 3 3 , 1 8 4 , 1 6 9 , 0 , 1 3 3 , 1 8 3 , 1 6 9 , 0 , 1 3 34 0 D A T A 1 8 5 , 3 2 , 1 9 2 , 2 5 5 , 1 6 6 , 1 8 4 , 3 2 , 2 0 1 , 2 5 5 , 1 6 5 , 4 5 5 4 1 D A T A 2 3 3 , 2 , 1 9 7 , 4 3 , 2 0 8 , 1 1 , 1 6 5 , 4 6 , 2 3 3 , 0 , 1 9 7 , 4 4 2 D A T A 2 0 8 , 3 7 6 , 2 5 0 , 1 9 3 , 1 6 5 , 4 3 2 4 , 1 0 5 , 5 , 1 3 3 , 1 1 34 3 D A T A 1 6 5 , 4 4 , 1 3 3 , 1 1 4 , 1 6 9 , 6 6 , 1 3 3 , 2 5 4 , 1 6 9 , 1 7 3 2 , 2 1 04 4 D A T A 2 5 5 , 1 6 0 , 1 0 , 1 6 9 , 3 2 3 2 , 2 1 0 , 2 5 5 , 1 3 6 , 2 0 8 , 2 5 0 , 1 6 04 5 D A T A 0 , 1 7 7 , 1 1 3 , 2 0 8 , 3 7 6 , 1 6 4 , 1 9 3 , 3 2 , 2 1 0 , 2 5 5 , 3 4 6 D A T A 2 2 5 , 2 5 5 , 2 4 0 , 8 1 , 2 3 0 , 1 1 3 , 2 0 8 , 2 , 2 3 0 , 1 1 4 , 2 0 8 , 2 3 34 7 D A T A 1 6 9 , 1 3 3 2 , 2 1 0 , 2 5 5 , 1 9 8 , 2 5 4 , 2 0 8 , 1 2 , 1 6 0 , 6 3 4 8 D A T A 2 1 0 , 2 5 5 , 1 3 6 , 2 0 8 , 2 5 0 , 1 6 9 , 6 6 , 1 3 3 , 2 5 4 , 1 6 9 , 1 7 3 4 9 D A T A 2 1 0 , 2 5 5 , 1 6 0 , 1 0 , 1 6 9 , 3 2 3 2 , 2 1 0 , 2 5 5 , 1 3 6 , 2 0 8 , 2 5 05 0 D A T A 1 6 0 , 3 , 2 3 0 , 1 1 3 , 2 0 8 , 2 , 2 3 0 , 1 1 4 , 1 3 6 , 2 0 8 , 2 4 7 , 1 6 55 1 D A T A 1 1 3 , 1 9 7 , 4 5 , 2 0 8 , 6 , 1 6 5 , 1 1 4 , 1 9 7 , 4 6 , 2 4 0 , 1 4 , 1 6 05 2 D A T A 3 , 2 3 0 , 1 1 3 , 2 0 8 , 2 , 2 3 0 , 1 1 4 , 1 3 6 , 2 0 8 , 2 4 7 , 7 6 , 1 4 15 3 D A T A 1 9 3 , 1 6 9 , 1 3 3 2 , 2 1 0 , 2 5 5 , 3 2 , 2 0 4 , 2 5 5 , 1 6 5 , 1 8 4 , 3 5 4 D A T A 1 9 5 , 2 5 5 , 7 6 , 1 1 6 , 1 6 45 5 I < 6 4 4 5 2 T H E N P R I N T " E R R O R I D A T A ! ! E N 5 6 P R I N T " O K "5 7 S Y 1 4 0 9 6

T h p r o g r a m w i l l r u " a s - i s " o C - 6 4 , a n i c o m p a t i b l ew i t h a l C o m m o d o r e p r i n t e r s r u o t h s e r i a l b u s .

A f t e r s t a r t i n g t h p r o g r a m w i t h S Y S 4 9 1 5 2 , d i f f e r e n tm e m o r y l o c a t i o n s a r i n i t i a l i z e d , a n N E c o m m a n d i e x e c u t e d , w h i c h d e l e t e s t h l o a d e r p r o g r a m ; t e x t c a n n o w b ee n t e r e d w i t h o u t f u r t h e r a d o .

7

Page 86: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 86/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

T g e t i n p u t m o d e , t y p e i t h c o m m a n d ! G E T w i t h o u tl i n e n u m b e r . T h l i n e n u m b e r 1 0 a n q u o t a t i o n m a r k s w i l la p p e a r i m m e d i a t e l y o s c r e e n . N o w y o u c a p r o c e e d i w r i t i n g y o u r l e t t e r o a r t i c l e .

T h > B E E P < s o u n d s w h e n t h l i n e p a s s e s t h 6 4 - c h a r a c t e rm a r k . R e m e m b e r , t h o u g h , t h a t t h e l i n e l e n g t h i n c l u d e s t h l i n e n u m b e r ; a f t e r t h e > B E E P < , y o s h o u l d h i < R E T U R N > a t h n e x t p o s s i b l e o p p o r t u n i t y , o t h e r w i s e t h p r i n t e r o u t p u tw i l l b m e s s e d u p T e s p a c e s p r e c e d e e v e r y l i n e , b r i n g i n gt h p r i n t e d l i n e t t o t a l o 7 c h a r a c t e r s . I t h i sn u m b e r i o v e r s t e p p e d , t h p r i n t e r a u t o m a t i c a l l y p e r f o r m sl i n e f e e d , a n d p r i n t s t h o f f e n d i n g l i n e o p a p e r w i t h o u t t h l e f t m a r g i n .

Y o c a l e a v e i n p u t m o d e b p r e s s i n g < R E T U R N > a l o n e a f t e rl i n e n u m b e r a p p e a r s ; t h i s r e t u r n s y o u t n o r m a l m o d e o t h c o m p u t e r . N o w y o u c a i n p u t a l t h c o m m a n d s t h a t t h ec o m p u t e r w o u l d n o r m a l l y r e s p o n d t o a l t h o u g h t h m o s ti m p o r t a n t c o m m a n d s t M i n i t e x t w o u l d b L I S T , L O A D a n S A V E .

I y o u ' v e l e f t i n p u t m o d e , y o c a n l i s t a n d e d i t t h t e x t a i i w e r e n o r m a l B A S I C p r o g r a m . I y o u r e t y p e ! G E T , t h t e x t e d i t o r w i l l p i c k u f r o m t h e l i n e n u m b e r a w h i c h y o h a h i < R E T U R N > t o e x i t . I t ' s o b v i o u s t h a t y o c a a d l i n e n u m b e r s " b h a n d " : J u s t t y p e t h l i n e a i w o u l da p p e a r o s c r e e n i i n p u t m o d e .

I a d d i t i o n t ! G E T , t h e r e a r t w p a r a m e t e r s t h a t y o c a c o n t r o l . T h e s y n t a x i l i k e t h i s :

♦ G E T l i n e n u m b e r , l i n e i n c r e m e n t

8

Page 87: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 87/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

♦ G E T 2 0 0 , 5 w o u l d s t a r t a l i n e 2 0 0 , a n t h n e x t l i n e w o u l db 2 0 5 , t h e n 2 1 0 , e t c . T h i s i u s e f u l i y o h a v e a a l r e a d y - b e g u n t e x t t h a t y o w i s h t a d t o Y o u g i v e l i n en u m b e r t h a t i h i g h e r t h a n t h e n o t h t e x t p r e v i o u s l yl o a d e d .

T h ! P R I N T c o m m a n d h a s n o a d d i t i o n a l p a r a m e t e r s : A s o o n a t h w o r d i g i v e n , t h e p r o g r a m o p e n s c h a n n e l w i t hl o g i c a l f i l e n u m b e r o 1 2 6 , a n s e n d s t h e t e x t t t h p r i n t e r i u p p e r / l o w e r - c a s e . T h p r i n t o u t c a b s t o p p e d a a n y t i m e b p r e s s i n g t h R U N - S T O P k e y .

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

X Y - D i s k e t t e s i t h F a m i l y S i z e B o 2 0 0 0 d i s k e t t e s o n l y $ 1 9 . 9 5

W w a n t t p r i n t t h b o t t o m l i n e o t e x t i d o u b l e - w i d t hc h a r a c t e r s : M o s t p r i n t e r s s w i t c h o t h e i r d o u b l e - w i d t h m o d ew h e n t h e y r e c e i v e t h c o n t r o l c h a r a c t e r C H R $ ( 1 4 ) . T h ep r o b l e m i t c o n v e y t h i s c o d e t t h e p r i n t e r . T h e C - 6 4 h a

C O N T R O L k e y ; b u s i n g t h i s k e w i t h l e t t e r k e y , y o c a s e n d A S C I I v a l u e s f r o m ( C T R L - A ) t o 2 6 ( C T R L - Z ) . C T R L - N1 i A S C I I . T h i s c h a r a c t e r c a o n l y b e s e n t i q u o t e m o d ea p a r t o f t h e t e x t . T h i s i c o m p l i c a t e d b e c a u s e q u o t em o d e i s w i t c h e d o f i i n p u t m o d e .

T h s o l u t i o n i a f o l l o w s : F i r s t , w r i t e t h e t e x t a u s u a l ,t h e n l e a v e i n p u t m o d e b h i t t i n g < R E T U R N > w h e n t h n e x t l i n en u m b e r c o m e s u p N o w , m o v e t h c u r s o r o v e r t h i t h l i n e o t e x t w e w a n t e n h a n c e d . P r e s s S H I F T - I N S T / D E L , i n s e r t

- 8 1 -

Page 88: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 88/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

s p a c e , a n d p r e s s C T R L - N . r e v e r s e - v i d e o a p p e a r so s c r e e n , w h i c h w i l l c o n t r o l t h d o u b l e - w i d t h s w i t c h i n gw h e n t h t i m e c o m e s t p r i n t t h t e x t . T h e s a m e p r o c e d u r ea p p l i e s t o a l l t h c o n t r o l c h a r a c t e r s , f r o m C T R L - A t C T R L -Z A S C I I c o d e 2 ( C T R L - : ) i g r a p h i c a l l y r e p r e s e n t e d b r e v e r s e b r a c k e t , w h i l e C T R L - ; ( 2 9 ) d i s p l a y s t h e o t h e rr e v e r s e b r a c k e t .

A v o i d C T R L - @ a a l c o s t s ! T h i s c o m b i n a t i o n p r o d u c e s t h v a l u e 0 w h i c h t h p r o g r a m s e e s a t h e n o B A S I C l i n e .W h a t e v e r f o l l o w s t h a t z e r o i t h a t l i n e w i l l b s k i p p e d o v e ri t h p r i n t i n g s t a g e .

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

m a t e r i a l t o l d , b u g r e a t d e a l o e f f o r t i i n v o l v e d ,u n l i k e " r e a l " w o r d p r o c e s s o r s . O n t h e o t h e r h a n d , t h i sp r o g r a m i j u s t r i g h t f o r s h o r t l e t t e r s a n d s u c h .

8

Page 89: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 89/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

5 . 2 . 2 W h a t A b o u t P o s t e r s ?

F o p r i n t i n g o u l e t t e r s , m a n u s c r i p t s o l i s t i n g s , t h c h a r a c t e r s o t h d o t - m a t r i x p r i n t e r a r t h r i g h t s i z e .W h a t i w e w a n t t m a k e l a r g e r c h a r a c t e r s f o c h a n g e ?

I y o h a p p e n t o w 7 - p i n d o t - m a t r i x p r i n t e r ( M P S 8 0 1 ,V I C - 1 5 1 5 , V I C - 1 5 2 5 , E P S O N , e t c . ) , t h f o l l o w i n g p r o g r a m w i l la l l o w y o t p r i n t c h a r a c t e r s m a n y t i m e s n o r m a l s i z e , w i t hm i n i m u m o d i f f i c u l t y .

T h p r o b l e m i p r i n t i n g s u c h c h a r a c t e r s l i e s i t h c o n s t r u c t i o n o t h c h a r a c t e r s e t . T h a m o u n t o c o d er e q u i r e d t a l t e r t h c h a r a c t e r s e t c a n a d u t p l e n t y o k i l o b y t e s w o r t h o d a t a — a n d f r u s t r a t e d u s e r .

T h e n a g a i n , w h g o t o t h t r o u b l e o r e d e s i g n i n g c h a r a c t e rs e t , w h e n w a l r e a d y h a v e p e r f e c t l y g o o d o n i t h c o m p u t e r ? B o t h t h V I C - 2 0 a n t h C - 6 4 a l l o w t h e i rc h a r a c t e r g e n e r a t o r s t b r e a d o u t . T h i s c a p a b i l i t y i t h f o u n d a t i o n o w h i c h o u p r o j e c t i b u i l t .

I t ' s b e e n s a i d t h a t y o u c a n n o t r e a d o u t t h e c h a r a c t e rg e n e r a t o r f r o m B A S I C , o t h e r w i s e t h c o m p u t e r l o c k s u p T h a ti s n ' t n e c e s s a r i l y t r u e — r e a d o f o s i m p l e t r i c k t g e a r o u n d t h i s .

T h a n k s t t h p a r t i a l r e p e t i t i o n s i t h m e m o r y l a y o u t o t h e C - 6 4 , t h e c h a r a c t e r g e n e r a t o r a n t h I / I C ( t h e V I C -I c h i p , t h C I A s a n d t h e S I D ) a l l r e s i d e i t h s a m e m e m o r yr a n g e . W h e t h e r t h p r o c e s s o r i a c c e s s i n g t h c h a r a c t e rg e n e r a t o r o t h p e r i p h e r a l I C s , b i i t h p r o c e s s o rh o l d s t h d e s i g n a t i o n - C H A R E N .

8

Page 90: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 90/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

I t h i s b i t i l o w , t h c h a r a c t e r g e n e r a t o r i o n T h i s b i tc a n b e i n f l u e n c e d w i t h P O K E t a d d r e s s 1

I w P O K E 1 , 5 1 ( - C H A R E N = l o w ) , w e ' l l g e R E A D Y p r o m p t , a n dn m o r e o b v i o u s a c t i v i t y f r o m t h c o m p u t e r . W h a t w e ' v e d o n eh e r e i d e p r i v e C I A 1 o a n y a c c e s s t t h m i c r o p r o c e s s o r .T h i s I p r o d u c e s p e r i o d i c a l i n t e r r u p t ( 6 t i m e s p e s e c o n d ) , w h i c h c a o n l y o p e r a t e i t h C I A h a s a c c e s s t t h p r o c e s s o r . I t h c h a r a c t e r g e n e r a t o r i t b r e a d , t h e nt h i n t e r r u p t h a t b s w i t c h e d o f f .

T h i s c a n b e a c c o m p l i s h e d i m a c h i n e l a n g u a g e w i t h t h c o m m a n d S E I . T h i s c o m m a n d i s n ' t a p p l i c a b l e t B A S I C , s w e ' l l n e e d a n o t h e r m e t h o d ; w e ' l l t a k e a w a y t h s o u r c e o t h i n t e r r u p t b c l e a r i n g t h e I C R ( I n t e r r u p t C o n t r o lR e g i s t e r ) i C I A 1 .

F o r t h e m o m e n t , w e ' l l f o r e g o d e t a i l s o h o t h i s i d o n e :H o w e v e r , t h m o s t i m p o r t a n t i t e m s t r e m e m b e r a r P O K E5 6 3 3 3 , 1 2 7 t u r n s o f f t h i n t e r r u p t , w h i l e P O K E 5 6 3 3 3 , 1 2 9t u r n s i b a c k o n

T h s i t u a t i o n i e v e n m o r e e a s i l y s o l v e d o t h e V I C - 2 0 . T h c h a r a c t e r g e n e r a t o r i a l w a y s i t h a c c e s s r e g i s t e r o t h p r o c e s s o r , s n p r e c a u t i o n s n e e d b t a k e n .

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

F i r s t , w e ' l l w a n t t l o o k a h o c h a r a c t e r i c o n s t r u c t e di t h c h a r a c t e r g e n e r a t o r .

8

Page 91: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 91/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

I n d i v i d u a l c h a r a c t e r s o s c r e e n a r m a d e u p o f p o i n t s s e i a 8 X m a t r i x , j u s t l i k e d o t - m a t r i x - p r i n t e d c h a r a c t e r s .U n l i k e t h p r i n t o u t , t h s c r e e n i a r r a n g e d i s e t o fh o r i z o n t a l d o s e q u e n c e s ( p r i n t e r s a r v e r t i c a l l y a r r a n g e d ) ,i k e e p i n g w i t h n o r m a l v i d e o o p e r a t i o n .

T h e i g h t p o i n t s i s u c h s e r i e s i s t o r e d i t h c h a r a c t e rg e n e r a t o r a b i t s ( = b y t e ) . I b i i s e t , d o a p p e a r s o n s c r e e n ; i c l e a r e d ( o u n s e t ) , t h e b i r e m a i n s t h b a c k g r o u n d c o l o r . O n c h a r a c t e r i m a d e u o b y t e ss t o r e d s u c c e s s i v e l y i t h c h a r a c t e r g e n e r a t o r .

T h e r e i s p e c u l i a r i t y i t h i s s y s t e m w h i c h y o s h o u l d n o t e :T h s e q u e n c e o c h a r a c t e r s i s t o r e d a s c r e e n c o d e s , n o t i A S C I I v a l u e s . T h e f i r s t b y t e s o t h c h a r a c t e r g e n e r a t o rc o n t a i n s t h e b i t p a t t e r n f o ' © ' , t h n e x t f o r m ' A ' , a n s o n

I w w a n t t c r e a t e l a r g e r c h a r a c t e r s o t h p r i n t e r , w c a u t i l i z e s i n g l e - p i n m o d e . W w a n t t m a k e e v e r y b i i n t o

b l a c k f i e l d s e v e n p o i n t s h i g h , a n d s i x p o i n t s a c r o s s .S i n c e 4 8 0 p o i n t s p e l i n e a r e a v a i l a b l e t u i h i g h -r e s o l u t i o n m o d e , t h i s g i v e s u c h o i c e o " p o i n t s i z e " i t h c h a r a c t e r m a t r i x o 6 p o i n t s h i g h , a n 4 p o i n t s w i d e .T h i s g i v e s u e x a c t l y 1 c h a r a c t e r s p e l i n e .

O w i t h t h p r o g r a m . S i n c e r e c o n s t r u c t i n g t h c h a r a c t e rg a n e r a t o r t a k e s u s o m e t i m e , w e ' v e d i v i d e d t h p r o g r a m u p T h e f i r s t p r o g r a m g i v e s t h p r i n t e r c o n t r o l o t h f i r s t 6 c h a r a c t e r s i t h c h a r a c t e r g e n e r a t o r . T h d a t a p r o d u c e dh e r e c a b s a v e d a s e q u e n t i a l f i l e o n t h e d i s k d r i v e f o l a t e r u s e .

8

Page 92: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 92/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

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

T h e f i r s t l i m i t a t i o n t t h i s p r o g r a m i t h a t y o m u s t s t a yw i t h t h f i r s t 6 c h a r a c t e r s i t h s e t ; c o n s i d e r i n g h o l i t t l e y o u m i g h t u s t h g r a p h i c c h a r a c t e r s a n c o n t r o lc h a r a c t e r s , t h i s i s s m a l l p r o b l e m . A n o t h e r d i s a d v a n t a g ei t h a t t h d a t a i f o u r t i m e s a l a r g e o d i s k a n o r m a l .F i n a l l y , t h p r i n t i n g p r o c e s s c a t a k e v e r y l o n g t i m e .

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

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

1 0 D I A S ( 6 3 , 7 )1 1 P O K E 5 6 3 2 0 + 1 3 , 1 2 7 R E M A L S O A P P L I E S T V I C - 2 01 2 P O K E 1 , 5 1 R E A S L O A P P L I E S T V I C - 2 01 3 A = 1 3 * 4 0 9 6 R E 8 * 4 0 9 6 F O V I C - 2 01 4 F O R K = 0 T O 6 1 5 P R I N T K ,1 6 F O R I = 0 T O 71 7 A % ( K , I ) = P E E K ( A + I )1 8 N E X T I1 9 A = A + 82 0 N E X T K2 1 P O K E 1 . 5 5 R E M A L S O F O R V I C - 2 02 2 P O K E 5 6 3 2 0 + 1 3 , 1 2 9 R E M A L S O F O V I C - 2 02 3 O P E N 1 5 , 8 , 1 52 4 O P E N 1 , 8 , 4 , " N O R M C H D A T A , S , W "

8

Page 93: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 93/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

2 5 G O S U B 4 6 02 6 P R I N T C H R $ ( 1 4 7 ) ;2 7 F O R K = 0 T O 6 2 8 P R I N T C H R $ ( K + ( ( K < 3 2 ) * - 6 4 ) ) ;2 9 F O R J = 0 T O 73 0 A = A S ( K , J )3 1 F O R I = 7 T O 0 S T E P - l3 2 I F ( 2 / N I ( A A N D 2 / x I ) ) T H E N G O S U B 4 2 0 : G O T O 3 4 03 3 G O S U B 4 4 03 4 N E X T I3 5 P R I N T # 1 , X $3 6 X $ = " "3 7 N E X T J3 8 N E X T K3 9 C L O S E 14 0 C L O S E 1 54 1 0 E N D4 2 X $ = X $ + C H R $ ( 8 ) + C H R $ ( 2 6 ) + C H R $ ( 5 ) + C H R $ ( 2 5 5 )4 3 R E T U R N4 4 X $ = X $ + C H R $ ( 8 ) + C H R $ ( 2 6 ) + C H R $ ( 5 ) + C H R $ ( 1 2 8 )4 5 R E T U R N4 6 I N P U T # 1 5 , E N , E T $ , E T , E S4 7 I F E N = O T H E N R E T U R N4 8 P R I N T E N ; E T $ ; E T , E S4 9 C L O S E 1 5 : C L O S E 1

N o w , t h p r o g r a m t h a t d o e s t h e p r i n t i n g .

8

Page 94: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 94/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

1 0 D I A $ 6 3 , 7 )1 1 P R I N T C H R $ ( 1 4 7 )1 2 O P E N 1 5 , 8 , 1 51 3 O P E N 4 , 8 , 4 , " N O R M C H R D A T A , S , R "1 4 G O S U B 3 8 01 5 F O R K = 0 T O 6 1 6 P R I N T K ,1 7 F O R I = 0 T O 71 8 I N P U T # 4 , A $ ( K , I )1 9 N E X T I , K2 0 C L 0 S E 42 1 C L O S E 1 52 2 P R I N T2 3 A t M 2 4 I N P U T " T E X T ( M A X . 1 0 C H A R A C T E R S ) " ; A $2 5 I F A $ O " " T H E N 2 8 02 6 P R I N T # 1 , C H R $ ( 1 5 )2 7 0 E N D2 8 P R I N T C H R $ ( 1 4 7 ) ; A $2 9 O P E N 1 , 43 0 F O R I = 0 T O 73 1 F O R L = 1 T O L E N ( A $ )3 2 K = A S C ( M I D $ ( A $ , L , 1 ) )3 3 K = K + ( ( K > 6 3 ) * 6 4 )3 4 P R I N T # 1 , A $ ( K , I ) ;3 5 N E X T L : P R I N T # 1 : N E X T I3 6 C L O S E 13 7 G O T O 2 2 03 8 I N P U T # 1 5 , E N , E T $ , E S , E T3 9 I F E N = O T H E N R E T U R N4 0 P R I N T E N ; E T $ ; E S ; E T4 1 C L O S E 1 54 2 C L O S E 4

8

Page 95: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 95/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

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

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

I o r d e r t p r i n t o u l o n g e r t e x t , i c a b t u r n e d 9 d e g r e e s , s t h a t t h c h a r a c t e r s a r p r i n t e d i n d i f f e r e n tf o r m a t . N o w t h e t e x t l e n g t h i l i m i t e d o n l y t t h l e n g t ho t h p r i n t e r p a p e r ( 2 0 0 0 - s h e e t c a r t o n o p a p e r t o t a l s u t 6 0 m e t e r s ) . T h i s a l s o m e a n s t h a t t h e c h a r a c t e r s c a b p r i n t e d m u c h l a r g e r t h a n o r i g i n a l l y . D u r i n g t h r e c o n s t r u c t i o n o p r i n t d a t a , t h p r i n t e r a s k s f o t h s i z ed e s i r e d ( c h o s e n i s t e p s b e t w e e n a n 5 ) S i z e g i v e s y o ut h s t a n d a r d h e i g h t ( f o r 1 c h a r a c t e r s p e l i n e ) , w h i l e s i z e

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

I y o a r p r i n t i n g o u l o n g e r t e x t s , h a v e p a t i e n c e : Y o u rp r i n t e r i n l o n g e r w o r k i n g i s p e e d s o c h a r a c t e r s p e s e c o n d , r a t h e r , o n l y i c h a r a c t e r s p e m i n u t e . S i n c e t h p r i n t e r i p r o d u c i n g l a r g e n u m b e r s o b l a c k b l o c k s , w s u g g e s t t h a t y o g i v e t h m a c h i n e s h o r t b r e a k e v e r y t e c h a r a c t e r s o r s o ( i s i z e 5 ) o t h e r w i s e , t h p r i n t h e a db e c o m e s q u i t e h o t .

8

Page 96: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 96/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

1 0 D I k % 6 3 , 7 )1 1 P R I N T C H R $ ( 1 4 7 )1 2 N A $ = " C H A R A C T E R D A T A "1 3 I N P U T " S I Z E ( 1 - 5 ) " ;1 4 I F V < l O R V > 5 T H E N 1 1 01 5 P R I N T C H R $ ( 1 4 7 ) ;1 6 N A $ = N A $ + S T R $ ( V ) + " , S , W "1 7 P O K E 5 6 3 2 0 + 1 3 , 1 2 7 R E M I N T E R R U P T G I V E N O N L Y F O R C 6 41 8 P O K E 1 , 5 1 R E M C H A R E N O N L Y F O 6 1 9 R E C H A R G E N E R A T O R I A R R A Y A % ( K , I )2 0 A = 1 3 * 4 0 9 6 R E A = 8 * 4 0 9 6 F O V I C - 2 02 1 F O R K = 0 T O 6 3 : P R I N T K , : F O R I = 0 T O 72 2 A * ( K , I ) = P E E K ( A + I )2 3 N E X T : A = A + 8 : N E X T2 4 P O K E 1 , 5 5 : P O K E 5 6 3 2 0 + 1 3 , 1 2 9 R E M I N T E R R U P T R E M O V E D2 6 O P E N 1 5 , 8 , 1 52 7 O P E N 1 , 8 , 4 , N A $2 8 G O S U B 4 4 02 9 P R I N T C H R $ ( 1 4 7 ) ;3 0 F O R K = 0 T O 6 3 : P R I N T C H R $ ( K + ( ( K < 3 2 ) * - 6 4 ) ) ;3 1 F O R I = 7 T O 0 S T E P - l3 2 F O R J = 7 T O 0 S T E P - l3 3 A = A * ( K , J )3 4 I F ( 2 / v I = ( A A N D 2 / v I ) ) T H E N G O S U B 4 0 0 : G O T O 3 6 03 5 G O S U B 4 2 03 6 N E X T J : P R I N T # 1 , X $ : X $ = " "3 7 N E X T I , K3 8 C L O S E 1 : C L O S E 1 53 9 0 E N D4 0 X $ = X $ + C H R $ ( 8 ) + C H R $ ( 2 6 ) + C H R $ ( 1 2 * V ) + C H R $ ( 2 5 5 )4 1 R E T U R N4 2 X $ ^ X $ + C H R $ ( 8 ) + C H R $ ( 2 6 ) + C H R $ ( 1 2 * V ) + C H R $ ( 1 2 8 )4 3 R E T U R N

9

Page 97: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 97/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

4 4 I N P U T # 1 , E N , E T $ , E S , E T4 5 I F E N = O T H E N R E T U R N4 6 P R I N T E N ; E T $ ; E S ; E T4 7 C L O S E 1 : C L O S E 1 5

A g a i n , h e r e ' s t h p r i n t p r o g r a m :

1 0 I N P U T " S I Z E ( 1 - 5 ) " ; V1 1 P O K E 5 6 3 2 0 + 1 3 , 1 2 7 R E I N T E R R U P T P R O H I B I T1 2 P O K E 1 , 5 1 R E C H A R E N T L O 1 3 R E C H A R G E N E R A T O R I A R R A Y A % ( K , I )1 4 D I A S 6 3 , 7 ) , A $ ( 6 3 , 7 )1 5 A = 1 3 * 4 0 9 61 6 F O R K = 0 T O 6 1 7 P R I N T K1 8 F O R I = 0 T O 71 9 A S ( K , I ) = P E E K ( A + I )2 0 N E X T2 1 A = A + 82 2 N E X T2 3 P O K E 1 , 5 5 : P O K E 5 6 3 2 0 + 1 3 , 1 2 9 R E I N T E R R U P T E N A B L E2 4 F O R K = 0 T O 6 2 5 2 6 2 7 2 8 2 9 3 0 3 1 3 2 3 3

P R I N T KF O R I = 7 T O 0 S T E P - l

F O R J = 7 T O 0 S T E P - lA = A * ( K , J )I F ( 2 ~ I = ( A A N D 2 / v I ) ) T H E N G O S U B 4 8 0 : G O T O 3 1 0G O S U B 5 0 0

N E X T JA $ ( K , 7 - I ) = X $X " t

9

Page 98: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 98/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

3 4 N E X T I3 5 N E X T K3 6 I N P U T " T E X T " ; A $3 7 O P E N 1 , 43 8 F O R L = 1 T O L E N ( A $ )3 9 P R I N T C H R $ ( 1 9 ) ; M I D $ ( A $ , L , 1 )4 0 K = P E E K ( 1 0 2 4 )4 1 F O R I = 0 T O 74 2 : F O R J = 1 T O V4 3 : P R I N T # 1 , A $ ( K , I )4 4 : N E X T J4 5 N E X T I4 6 N E X T L4 7 C L O S E 1 : G O T 0 3 6 04 8 X $ = X $ + C H R $ ( 8 ) + C H R $ ( 2 6 ) + C H R $ ( 1 2 * V ) + C H R $ ( 2 5 5 )4 9 R E T U R N5 0 X $ = X $ + C H R $ ( 8 ) + C H R $ ( 2 6 ) + C H R $ ( 1 2 * V ) + C H R $ ( 1 2 8 )5 1 R E T U R N

9

Page 99: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 99/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

5 . H a r d c o p y

J u s t f e y e a r s a g o , p r i n t e r s f o h o b b y i s t s w e r e u n h e a r d -o f . A s i m p l e d o t - m a t r i x p r i n t e r w i t h m i n i m a l f e a t u r e s c o s ta s t r o n o m i c a l s u m s o m o n e y , m u c h m o r e t h a n t h e a r l y u s e r ' sc h e c k b o o k c o u l d h a n d l e . S o i s o m e o n e w a n t e d p r i n t o u t ,t h e y h a d t i m p r o v i s e .

S u r p l u s t e l e t y p e s s o l d v e r y w e l l i s p i t e o t h i n t e r f a c i n gp r o b l e m s ; t h p r i c e w a w e l l w o r t h t h h a s s l e s ( $ 7 5 . 0 0 w a g o o d p r i c e ) . T h e s e u s e r s w e r e o v e r j o y e d w h e n , a f t e rb u i l d i n g s p e c i a l i n t e r f a c e s a n d e s i g n i n g d r i v e r s o f t w a r e ,t h e i r f i r s t p r o g r a m l i s t i n g s r o l l e d o u ( n o i s i l y , a n w i t hl o t s o f g a r b a g e p r i n t e d o u a w e l l ) . T h e s e t e l e t y p e s w e r ea l s o b o u g h t i s p i t e o t h l i m i t e d s t o c k o c h a r a c t e r s , a c o m p a r e d t t h c o m p u t e r ' s c h a r a c t e r s e t .

I t h o s e t i m e s , y o h a t a d m i r e t h p r o g r a m l i s t i n g sp r i n t e d i s o m e t e c h n i c a l j o u r n a l s . S o m e b r i l l i a n t p e o p l ed e v i s e d w a o p r i n t i n g o u p r o g r a m l i s t i n g s f r o m t h s c r e e n c o n t e n t s ( s c r e e n p h o t o c o p i e s w o u l d b b e t t e r t e r m ) .

N o w , o f c o u r s e , t h s i t u a t i o n h a i m p r o v e d c o n s i d e r a b l y .Y o d o n ' t n e e d d a r k r o o m n e x t t t h c o m p u t e r — t h e p r i n t e rw i l l p r o d u c e g r a p h i c s j u s t a w e l l a t h s c r e e n d o e s .

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

9

Page 100: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 100/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

5 . 3 . 1 T e x t H a r d c o p y

T h c h a r a c t e r s a p p e a r i n g o y o u r s c r e e n a r s i m p l yr e p r o d u c t i o n s o p r e d e t e r m i n e d m e m o r y r a n g e i y o u rc o m p u t e r . T h i s m e m o r y ( a l w a y s i R A M ) i f r e e f o r e a d i n ga n w r i t i n g t o c h a r a c t e r c a o n l y b p r i n t e d t t h s c r e e n u s i n g P O K E , w h i l e P E E K a l l o w s y o u t s e t h s c r e e nc o d e .

I f f o e x a m p l e , t h e l e t t e r A i s i n t h u p p e r l e f t c o r n e r o t h s c r e e n , P E E K i n g t h s c r e e n m e m o r y w i l l g i v e y o u t h n u m b e r 1 I o t h e r w o r d s , P R I N T P E E K ( a d d r e s s ) , i w h i c h( a d d r e s s ) w o u l d b i t h r a n g e f r o m 1 0 2 4 t 2 0 2 3 ( 1 0 2 4{ $ 0 4 0 0 h e x } i t h u p p e r l e f t c o r n e r ) f o t h C - 6 4 ; t h V I C -2 0 ' s s c r e e n m e m o r y b e g i n s a 4 0 S 6 ( $ 1 0 0 0 ) o 7 6 8 0 ( $ l E 0 0 ) ,d e p e n d i n g o t h a m o u n t o m e m o r y e x p a n s i o n i n v o l v e d .

C o m m o d o r e I n t e r n a t i o n a l h a r a t h e r s t r a n g e m e t h o d o c o d i n g t h c h a r a c t e r s d i s p l a y e d . T h s c r e e n R A M c o d e s f o P O K E i n g c h a r a c t e r s i s i m i l a r t C H R $ i o n l y f e c a s e s ;m o s t o t h e s e s c r e e n c o d e s n e e d t b r e c a l c u l a t e d t c o r r e s p o n d w i t h t h e i r A S C I I v a l u e s .

T h b e s t p o s s i b l e h a r d c o p y p r o g r a m s h o u l d c a l l i t s e l f , a w e l l a p r o d u c e s c r e e n c o n t e n t s p r i n t o u t . T h i s p r o g r a mh a b o t h . T h e p r o g r a m , c a l l e d w i t h S Y c o m m a n d , g o e s o t h a r d c o p y w i t h o u t f a n f a r e . P r e s s i n g C T R L - F 1s i m u l t a n e o u s l y w i l l p r o d u c e h a r d c o p y . T h a s s e m b l e r l i s t i n gb e l o w i t a i l o r e d f o r t h e C - 6 4 , w h i l e t h B A S I C l o a d e r w h i c hf o l l o w s c a b u s e d w i t h t h C - 6 4 a n t h e V I C - 2 0 . V I C - 2 0u s e r s w h o w i s h t u s t h a s s e m b l e r l i s t i n g s h o u l d c h e c kc o m p a r i s o n t a b l e o t h o p e r a t i n g s y s t e m r o u t i n e s f o b o t hm a c h i n e s .

9

Page 101: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 101/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

0 3 3 C0 3 3 C0 3 3 C0 3 3 C0 3 3 C0 3 3 C0 3 3 C0 3 3 C0 3 3 C0 3 3 C0 3 3 C0 3 3 C0 3 3 C0 3 3 C0 3 3 C0 3 3 C0 3 3 C0 3 3 C0 3 3 C0 3 3 C0 3 3 C0 3 3 D0 3 3 F0 3 4 10 3 4 40 3 4 70 3 4 8

7 A A 8 8 5 6

4 0 1 0 1 0

I R K E C T R LI N T E RI R Q F L A GK E Y SF L T E M PF N L E N ;A M N TS O P E NC K O U TB S O U TS T O PS T O R EC L R C HC L O S E

* = $ 0 3 3 C$ 3 1 4

= $ E A 8 7= $ 0 2 8 D= $ E A 3 1

$ 0 $ C $ B $ B $ 7 $ B $ C $ B

= $ F F C O= $ F F C 9= $ F F D 2= $ F F E 1

$ 6 = $ F F C C= $ F F C 3S E ; I N T E R R U P T O F FL D # < N E W ; I N T E R . V E C T O R O F L D # > N E W ; T U R N D O W N H A R D C O P YS T I R S T I R Q + 1C L R T ; A N D B A C K

N E I N T E R R U P T R O U T I N E0 3 4 9 2 8 \ E N E W J S R K E Y0 3 4 C A 8 0 2 L D C T R L0 3 4 F C 0 C M # 0 3 5 1 D 7 B N E X I T 1

; R E A D K E Y B O A R D; C T R L - K E Y P R E S S E D ?; T H E N S E T B I T; I N O T , T H E N N H

9

Page 102: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 102/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

0 3 5 30 3 5 50 3 5 70 3 5 90 3 5 B0 3 5 D0 3 5 F0 3 6 B0 3 6 30 3 6 50 3 6 70 3 6 90 3 6 B0 3 6 D0 3 6 F0 3 7 10 3 7 30 3 7 50 3 7 70 3 7 90 3 7 C0 3 7 E0 3 8 10 3 8 30 3 8 50 3 8 80 3 8 B0 3 8 D0 3 8 F0 3 9 10 3 9 30 3 9 5

0 3 9 7

A C D A 8 F A 8 A 8 A 8 A A 8 8 8 A 8 2 A 2 A A 2 2 F A B 8 2 0

2

C 0 7 0 C 0 F B 0 B 7 B 0 0 7 7 B 0 B C B C 1 O D E 2 0 7 6 3 6

6

S Y S O N E

H C O P Y

F

F

L O O PF F

L O O P 2

L D C M B N L D S T B E L D S T L D S T L D S T L D L D S T S T S T L D S T J S L D J S L D L D J S J S B E L D

K E Y S# ; F P R E S S E D ?E X I T 1 ; N O ? T H E N N H # A M N TH C O P Y { U N C O N D I T I O N A L J U M P# $ F F ; J U M P F O S Y M A R K E D ,I R Q F L A G ; I F N O O V E R I R # j H A R D C O P Y ( H C )F ; D E V I C E A D D R E S S# 1 2 6L F ; L O G . F I L E N U M B E R# # ; V I D E O R A $ 0 4 0 0T E M PT E M P + 1F N L E N ; N F I L E N A M E# S ; S E C O N D A R Y A D D R E S SC K O U TL C K O U T# 2 ; 2 S C R E E N L I N E S# 1 ; L I N E F E E DB S O U T ; O U T P U TS T O P ; S T O P K E Y P R E S S E D ?E X I T ; T H E N E N D#

L D A ( T E M P ) , Y ; G E T C H A R A C T E R F R O MS T A N A S

B I

S T O R E V I D E O R A M S S T O R E 1 # $ 3 FS T O R E

S T O R E : C O N V E R T S C R E E N C O D E

9

Page 103: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 103/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

0 3 9 9 1 0 0 3 9 B 0 8 0 3 9 D 7 0 0 3 9 F 0 4 0 3 A 1 2 D 2 F F0 3 A 4 C 0 3 A 5 C 2 0 3 A 7 D O E 60 3 A 9 9 0 3 A A 1 0 3 A B 6 7 0 3 A D 8 7 0 3 A F 9 0 0 20 3 B 1 E 6 7 0 3 B 3 C A0 3 B 4 D C 0 3 B 6 A O 0 3 B 8 2 D F 0 3 B B 2 C C F F0 3 B E A 7 0 3 C 0 2 C F 0 3 C 3 A 0 0 3 C 5 F O 0 50 3 C 7 A 0 0 3 C 9 8 0 0 3 C B 6 0 3 C C 4 3 E

E X I T

E X I T 1

B P * + O R # $ 8 0B V S * + 4O R # $ 4 0J S R B S O U TI N C P # 4 B N L O O P 2T Y C L A D T E M PS T A T E M PB C C * + 4I N T E M P + 1D E B N L O O PL D A # 1 3J S R B S O U TJ S C L R C HL D # 1 2 6J S C L O S EL D I R Q F L A GB E Q E X I T 1L D A # $ 0 0S T I R Q F L A GR T J M I N T E R

; I N T O A S C I I C O D E

; A N D P U T O U T

; 4 C H A R S . P R I N T E D ?

; C O U N T E R I V I D E O R A M; R A I S E D T 4

; A L L L I N E S P R I N T E D ?; O U T P U T N E L I N E

; O U T P U T B A C K T O S C R N .

; C L O S E F I L E; H S T O P P E D B C T R L - F 1 ?; T H E N G O T O E X I T 1; C L E A R F L A G

; R E T U R N F O S Y C A L L; C A L L O L D I N T E R R U P T

9

Page 104: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 104/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

A y o c a s e e , t h i s p r o g r a m r e s i d e s i t h c a s e t t e b u f f e r( 8 2 8 d e c i m a l ) . T h i s i t h a d d r e s s u s e d t a c t i v a t e t h

p r o g r a m w i t h S Y 8 2 8 . l o g i c a l f i l e n u m b e r o f 1 2 6 i u s e d .I y o u a l s o w i s h t u s t h i s f i l e n u m b e r i o t h e r p r o g r a m sa f t e r w a r d , b s u r e t h a t t h e f i l e i c l o s e d a f t e r u s i n g t h H a r d C o p y p r o g r a m . I o r d e r t p r e v e n t e r r o r s , r e s e r v e 1 2 a f i l e n u m b e r f o p r i n t i n g h a r d c o p y , a n d d o n ' t u s e 1 2 f o o t h e r f i l e s .

T o g e t h a r d c o p y , a l y o u n e e d d i p r e s s C T R L a n F s i m u l t a n e o u s l y . I y o n e e d t b r e a k o u o f t h e p r o g r a m ,y o c a d o s o w i t h S Y 8 6 3 , o r p r e s s S T O P .

N o f o r t h e B A S I C l o a d e r s f o C - 6 4 a n V I C - 2 0 . T h e 6 p r o g r a m f i r s t :

1 0 F O 8 2 T 9 7 1 1 R E A D P O K E I , S = S + X N E X T1 2 D A T A 1 2 0 , 1 6 9 , 7 3 , 1 6 0 , 3 , 1 4 1 , 2 0 3 , 1 4 0 , 2 1 3 8 1 3 D A T A 9 6 3 2 , 1 3 5 , 2 3 4 , 1 7 3 , 1 4 1 , 2 , 2 0 1 , 4 , 2 0 8 , 1 2 1 , 1 6 51 4 D A T A 1 9 7 , 2 0 1 , 4 , 2 0 8 , 1 1 5 , 1 6 9 , 0 , 1 3 3 , 1 9 8 , 2 4 0 , 4 , 1 6 91 5 D A T A 2 5 5 , 1 3 3 , 2 , 1 6 9 , 4 , 1 3 3 , 1 8 6 , 1 6 9 , 1 2 6 , 1 3 3 , 1 8 4 , 1 6 91 6 D A T A 0 , 1 6 0 , 4 , 1 3 3 , 1 1 3 , 1 3 2 , 1 1 4 , 1 3 3 , 1 8 3 , 1 6 9 , 0 , 1 3 31 7 D A T A 1 8 5 , 3 2 , 1 9 2 , 2 5 5 , 1 6 6 , 1 8 4 , 3 2 , 2 0 1 , 2 5 5 , 1 6 2 , 2 5 , 1 6 91 8 D A T A 1 3 3 2 , 2 1 0 , 2 5 5 , 3 2 , 2 2 5 , 2 5 5 , 2 4 0 , 4 6 , 1 6 0 , 0 , 1 7 71 9 D A T A 1 1 3 , 1 3 3 , 1 0 3 , 4 1 6 3 6 , 1 0 3 , 3 6 , 1 0 3 , 1 6 2 2 0 D A T A 1 2 8 , 1 1 2 , 2 , 9 , 6 4 3 2 , 2 1 0 , 2 5 5 , 2 0 0 , 1 9 2 , 4 0 , 2 0 82 1 D A T A 2 3 0 , 1 5 2 , 2 4 , 1 0 1 , 1 1 3 , 1 3 3 , 1 1 3 , 1 4 4 , 2 , 2 3 0 , 1 1 4 , 2 0 22 2 D A T A 2 0 8 , 2 0 5 , 1 6 9 , 1 3 3 2 , 2 1 0 , 2 5 5 , 3 2 , 2 0 4 , 2 5 5 , 1 6 9 , 1 2 62 3 D A T A 3 2 , 1 9 5 , 2 5 5 , 1 6 5 , 2 , 2 4 0 , 5 , 1 6 9 , 0 , 1 3 3 , 2 9 2 4 D A T A 7 6 4 9 , 2 3 42 5 I < 1 7 8 0 0 T H E N P R I N T " E R R O R I D A T A ! ! " E N 2 6 P R I N T " O K " : S Y S 8 2

9

Page 105: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 105/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

I t h l i s t t h a t f o l l o w s f o t h V I C - 2 0 , t h h i g h b y t e o t h s t a r t i n g a d d r e s s o v i d e o R A h a b e e n u n d e r l i n e d . T h p r e s e n t v a l u e i f o a u n e x p a n d e d V I C ; i y o u h a v e a l e a s t 8 K o f m e m o r y e x p a n s i o n p l u g g e d i n c h a n g e t h i s v a l u ef r o m 3 t 1 6

1 0 F O 8 2 T 9 7 1 1 R E A D P O K E I , S = S + X N E X T1 2 D A T A 1 2 0 , 1 6 9 , 7 3 , 1 6 0 , 3 , 1 4 1 , 2 0 3 , 1 4 0 , 2 1 3 8 1 3 D A T A 9 6 , 3 2 , 3 0 , 2 3 5 , 1 7 3 , 1 4 1 , 2 , 2 0 1 , 4 , 2 0 8 , 1 2 1 , 1 6 51 4 D A T A 1 9 7 , 2 0 1 , 4 , 2 0 8 , 1 1 5 , 1 6 9 , 0 , 1 3 3 , 1 9 8 , 2 4 0 , 4 , 1 6 91 5 D A T A 2 5 5 , 1 3 3 , 2 , 1 6 9 , 4 , 1 3 3 , 1 8 6 , 1 6 9 , 1 2 6 , 1 3 3 , 1 8 4 , 1 6 91 6 D A T A 0 1 6 0 , _ 3 0 . , 1 3 3 , 1 1 3 , 1 3 2 , 1 1 4 , 1 3 3 , 1 8 3 , 1 6 9 , 0 , 1 3 31 7 D A T A 1 8 5 , 3 2 , 1 9 2 , 2 5 5 , 1 6 6 , 1 8 4 , 3 2 , 2 0 1 , 2 5 5 , 1 6 2 , 2 3 , 1 6 91 8 D A T A 1 3 3 2 , 2 1 0 , 2 5 5 , 3 2 , 2 2 5 , 2 5 5 , 2 4 0 , 4 6 , 1 6 0 , 0 , 1 7 71 9 D A T A 1 1 3 , 1 3 3 , 1 0 3 , 4 1 6 3 6 , 1 0 3 , 3 6 , 1 0 3 , 1 6 2 2 0 D A T A 1 2 8 , 1 1 2 , 2 9 6 4 3 2 , 2 1 0 , 2 5 5 , 2 0 0 , 1 9 2 , 2 2 , 2 0 82 1 D A T A 2 3 0 , 1 5 2 , 2 4 , 1 0 1 , 1 1 3 , 1 3 3 , 1 1 3 , 1 4 4 , 2 , 2 3 0 , 1 1 4 , 2 0 22 2 D A T A 2 0 8 , 2 0 5 , 1 6 9 , 1 3 3 2 , 2 1 0 , 2 5 5 , 3 2 , 2 0 4 , 2 5 5 , 1 6 9 , 1 2 62 3 D A T A 3 2 , 1 9 5 , 2 5 5 , 1 6 5 , 2 , 2 4 0 , 5 , 1 6 9 , 0 , 1 3 3 , 2 9 2 4 D A T A 7 6 , 1 9 1 , 2 3 42 5 I < 1 7 8 4 4 T H E N P R I N T " E R R O R I D A T A ! ! " E N 2 6 P R I N T " O K "2 7 S Y 8 2

9

Page 106: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 106/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

5 . 3 . 2 G r a p h i c H a r d c o p y

I o r d e r t p r i n t o u t o f t e x t - s c r e e n s , w s h o u l d s e w h e t h e ro n o s u c h g r a p h i c s c a b p r o d u c e d .

G o o d g r a p h i c e x t e n s i o n s s u c h a V I D E O B A S I C 6 a l r e a d yc o n t a i n s p e c i a l r o u t i n e s a n c o m m a n d s t s e n d t h s c r e e nc o n t e n t s t t h p r i n t e r . H o w e v e r , w h e n g r a p h i c s a r m a d e i B A S I C w i t h P E E K a n d P O K E , t h e r e a r f e u t i l i t y p r o g r a m ss u i t e d t t h i s t a s k .

B e l o w a r e t w o g r a p h i c h a r d c o p y r o u t i n e s f o r t h e C - 6 4 , w h i c hy o u w i l l f i n d v e r y c o n v e n i e n t . T h e f i r s t r o u t i n e o p e r a t e s7 - p i n p r i n t e r . T h s e c o n d r o u t i n e i v e r y s p e c i a l , a i m a k e s p o s s i b l e s c r e e n p r i n t o u t o 1 5 2 6 p r i n t e r — i fy o u ' l l r e m e m b e r t h c h a p t e r f e w p a g e s b a c k , t h e 1 5 2 6 i i n c a p a b l e o h i g h - r e s g r a p h i c s . B o t h r o u t i n e s l i i a a d d r e s s r a n g e t h a t a l l o w s y o u t u s t h e m w i t h t h g r a p h i c si t h b o o k T H G R A P H I C S B O O K F O R T H E C O M M O D O R E 6 b A b a c u sS o f t w a r e .

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

N o w e c o m e t t h g r a p h i c h a r d c o p y p r o g r a m f o r t h e 7 - p i np r i n t e r .

1 0

Page 107: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 107/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

C 2 0 0C 2 0 0C 2 0 0C 2 G 0C 2 0 0C 2 0 0C 2 0 0C 2 0 0C 2 0 0C 2 0 3C 2 0 5C 2 0 8C 2 0 BC 2 0 DC 2 1 0C 2 1 2C 2 1 4C 2 1 6C 2 1 8C 2 1 AC 2 1 CC 2 1 EC 2 2 1C 2 2 3C 2 2 6C 2 2 8C 2 2 BC 2 2 EC 2 2 FC 2 3 1C 2 3 3C 2 3 5C 2 3 7

2 8 2 2 A 2 A 8 A 8 A 8 A 8 A 8 A B 2 C 1 A 8 8 A

F 6 O I 6 C F 6 0 F 1 9 0 O 2 O 0 B D

F 0 6 6 O

B

F F

F

C

C

C F

C

U S X F L O F F XG R M E M

S E V 1

S E V 1 1

S E V 2

*

J S S T J S J S L D J S L D S T L D S T L D S T L D S T L D S T L D L D J S D E B P L D S T S T L D

$ C 2 0 Q$ A A + $ F $ 1 $ 9 $ 6 $ 2 0 0 0$ B 7 F 1$ 6 $ F 3 0 F$ F 3 1 F$ 6 $ F F C 9# $ F F$ 6 # U S # 2 F L A G# B T W N# 4 F L G 2# S E V T A B$ F F D 2

S E V 1 1# $ 6 $ 6 B T W N

; L O O K F O L O G . F I L E; S E T F I L E P A R A M E T E R S

; O P E N C H A N N E L

; M A S K

; S T A C K S I Z E

; L I N E C O U N T E R

; Y K - M A R K B R

; S T A C K C O U N T E R

, ; C E N T E R I N G

; X K = 0

1 0

Page 108: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 108/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

C 2 3 AC 2 3 CC 2 3 EC 2 4 0C 2 4 2C 2 4 4C 2 4 6C 2 4 9C 2 4 BC 2 4 DC 2 4 FC 2 5 2C 2 5 4C 2 5 5C 2 5 7C 2 5 9C 2 5 BC 2 5 DC 2 5 FC 2 6 1C 2 6 4C 2 6 5C 2 6 6C 2 6 8C 2 6 AC 2 6 CC 2 6 FC 2 7 0C 2 7 2C 2 7 4C 2 7 5C 2 7 7C 2 7 9

8 A 8 A A A 2 A B A 9 E E 8 E D A A A I 2 C 1 2 0 2 8 1

A 1 6 8 9

6 0 F 6 6 6 B 0 A F 1 6

F F E 0 0 F 1

F 6 8 D

E 6

0 6 0

S E V 3

C

C

S E V 4C S E V 5

F

S T L D

S T L D L D L D J S L D L D L D S T I N I N S T C P B N L D L D L D A S R O D E B P A N O R J S D E B P L D C L A D S T B C

$ 6 #

U S E + 1$ 6 $ 6 $ 6 H P O S N# ( A ) , YU S B U F F E R ,$ 6

U S E + 1U S S E V 3# # U S B U F F E R ,

S E V 5$ 6 # $ 8 0$ F F D 2

S E V 4$ 6

# $ 6 S E V 6

; Y

; X K - LX

; Y ; C A L C U L A t E P O S I T I O N

; I B U F F E R; Y

; L I N E = # $ 0 F F R L A S T B Y T E; H I G H - B Y T E; S E N D

; X K - L

; X K + 8

1 0

Page 109: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 109/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

C 2 7 BC 2 7 DC 2 8 0C 2 8 2C 2 8 4C 2 8 7C 2 8 AC 2 8 BC 2 8 DC 2 9 0C 2 9 2C 2 9 4C 2 9 7C 2 9 9C 2 9 BC 2 9 DC 2 9 FC 2 A 1C 2 A 3C 2 A 5C 2 A 7C 2 A 9C 2 A BC 2 A EC 2 B 1C 2 B 6C 2 B 8C 2 B AC 2 B BC 2 B CC 2 B DC 2 B EC 2 B F

E C D A 2 A 1 6 8 C F 4 A C F 8 A 8 A 8 D A 2 4 5 8 8 9 4 4 4 A B

6 O 0 O D O

0 O 9 0 2 0 F O F 0 9 O 6 E O D C 0 1 1

E

C

F C

C

C

F F 1

C

S E V 6

S E V 8S E V 8 1

S E V 7

S E V T A BH P O S N

I N D E B N L D J S L D C L A D S T D E B E J M L D C M B E S T L D S T L D S T B N L D J S J M . B Y T

S T S T T Y L S L S L S T A L D

$ 6 F L 6 2S E V 2# $ $ F F D 2B T W N

# B T W NF L S E V 8 1S E V 1# U S S E V 7U S # F L # $ $ 6 S E V 8# 1 $ F F D 2$ F F C C

8 0 , 0 , 1 6X X K + 1

M U L H , X

; X K - H

; M A R K E R + 7

; L A S T L I N E

; M A S K

; N O R M A L M O D E

; C L O S E C H A N N, 2 7 , 8

1 0

Page 110: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 110/343

A B A C U S S o f t w a r e P R I N T B R B O O K f o t h C O N N O D O R B 6

C 2 C 2C 2 C 4C 2 C 5C 2 C 7C 2 C 8C 2 C BC 2 C DC 2 C EC 2 D 0C 2 D 1C 2 D 3C 2 D 5C 2 D 7C 2 D 9C 2 D BC 2 D DC 2 D FC 2 E 1C 2 E 2C 2 E 4C 2 E 6C 2 E 8C 2 E AC 2 E CC 2 E EC 2 E FC 2 F DC 3 0 9C 3 0 0C 3 0 FC 3 1 1

8 8 2 A B 8 9 2 1 6 8 A 2 8 A 0 8 1 A 6 8 A 6 8 6 0 1 0 0 0 0

A

0

0 A

0

A A 1 F 6 2 A A

A 6 A A 1 A

0 1 4 0 0

C

0 1 8

M U L H

M U L LB T W NF L G 2

B U F F E R

S T T X A N T A L D S T T Y A N C L A D S T L D A N S T L D O R S T C L L D A D S T L D A D S T R T

. B Y T O ,. B Y T 1 7. B Y T O ,

#

M U L L , X

#

X # $ F 8O F F X# > G R M E M ; R U N G R A P H I C P A G E

O F F X

X K + 1

1 , 2 , 3 , 5 , 6 , 7 , 8 , 1 0 , 1 1 , 1 2 , 1 3 , 1 5 , 1 6, 1 8 , 2 0 , 2 1 , 2 2 , 2 3 , 2 5 , 2 6 , 2 7 , 2 8 , 3 0 , 3 1$ 4 0 , $ 8 0 , $ C 0

. W O R 0 0 0 0. W O R 0 0 0 0. B Y T 0

1 0

Page 111: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 111/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

N e x t , t h l i s t i n g f o 1 5 2 6 u s e r s .

C 2 0 0C 2 0 0C 2 0 0C 2 0 0C 2 0 0C 2 0 0C 2 0 0C 2 0 3C 2 0 5C 2 0 8C 2 0 BC 2 0 DC 2 1 0C 2 1 2C 2 1 5C 2 1 7C 2 1 AC 2 1 CC 2 1 FC 2 2 1C 2 2 4C 2 2 7C 2 2 9C 2 2 BC 2 2 DC 2 2 FC 2 3 1C 2 3 3C 2 3 5C 2 3 7C 2 3 9

2 8 2 2 A 2 A 2 A 2 A 2 A 2 2 A 8 A 8 A 8 A 8 A 3

F

6 O I 0 2 0 2 1 C 1 D 0 D C 1 6 0 6 0 6 2 6 1

B

F F

Z Z

G R M E M

E I G H TC

C

F

F

F F

H A 1 0

H A 1 0 A

*

J S

S T J S J S L D J S L D J S L D J S L D J S L D J S J S L D S T L D S T L D S T L D S T L D S E

$ C 2 0 0$ 6 $ 6 $ A A + $ 2 0 0 0$ B 7 F 1$ 6 $ F 3 0 F$ F 3 1 F$ O P E N C H ;# O P E N C H ;# $ 1 6$ F F C 9# 2 $ F F D 2# 1 $ F F D 2$ F F C C# 2 $ 6 # Z # $ 6 # 4 $ 6 # 2

L O O K F O R L O G . F I L ES E T F I L E P A R A M E T E R S

O P E N S A = 5

O P E N S A = 6

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

E N C H A R A C T E R

C L E A R C H A N N E LN U M B E R O L I N E SS E T - U PD O U B L E H E I G H TR E P E A T N U M B E RN U M B E R O G U I D I N G B L A N K SS E N U M B E R O C O L U M N SS E

1 0

Page 112: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 112/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

C 2 3 AC 2 3 CC 2 3 DC 2 4 0C 2 4 2C 2 4 4C 2 4 5C 2 4 7C 2 4 8C 2 4 BC 2 4 DC 2 4 FC 2 5 1C 2 5 3C 2 5 6C 2 5 8C 2 5 AC 2 5 CC 2 5 DC 2 5 FC 2 6 1C 2 6 3C 2 6 6C 2 6 7C 2 6 8C 2 6 AC 2 6 DC 2 7 0C 2 7 1C 2 7 3C 2 7 5C 2 7 8C 2 7 A

E A B 0 8 8 2 A B

8 A A A 9 E D E 8 D A A I 2 C D 2 9 8 D A 2 A 2

6

3 2 A

0

5

A 0 0 A 5 A 0 A

F 0 0 5

F O 5

E 0 A 0 A

C

C

C

C

C C

C

C

H A

H A 1 L 2

H A 1 L 0 1

H A 1 L 4H A 1 L 3H A 1 L 3

H A 1 L 0 2

S B T A L D O R S T T X A N T A L D S T L D L D L D S T I N B N I N

D E B N L D L D A S R O D E B N J S S T D E B N L D J S L D J S

$ 6

M U L H , X# > G R M E M

#

M U L L , X

# 0 ; G E T G R A P H I C D # ( A , X )

B U F F E R , X

H A 1 L 2

H A 1 L 2# # B U F F E R , X

H A 1 L 3B S P L I TB U F F E R + 8 , Y

H A 1 L 4# ; P R I N T G R A P H I C SP R D F C H# P R D F C H

1 0

Page 113: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 113/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

C 2 7 DC 2 7 FC 2 8 1C 2 8 3C 2 8 5C 2 8 7C 2 8 9C 2 8 BC 2 8 EC 2 9 0C 2 9 3C 2 9 5C 2 9 8C 2 9 BC 2 9 DC 2 A 0C 2 A 2C 2 A 5C 2 A 6C 2 A 8C 2 A AC 2 A CC 2 A FC 2 B 0C 2 B 1C 2 B 3C 2 B 6C 2 B 9C 2 B CC 2 B EC 2 C 1C 2 C 2C 2 C 4

C D C D C D A 2 A 2 A 2 2 A 2 A 2 6 A 8 A 2 9 4 A B 2 2 0 8 C D 2

6 C 6 A 6 A 1 C 2 D O D C 1

C 1

C

0 6 1 C

0 5 D D 6 6

E C

H A 1 L 5 0

F

F

F F

F

F

P R D F C H

F

C H A 6 2F F

F

D E B N D E B N D E B N L D J S L D J S L D J S J S L D J S L D J S R T L D S T L D J S T Y P H L D L D J S J S O R S T D E B N J S

$ 6 H A Z H A 1 0 A$ 6 H A 1 0# $ 1 6$ F F C 9# 3 $ F F D 2# 1 $ F F D 2$ F F C 3# $ 1 6$ F F C 3# 2

; D E C R E M E N T L I N E; S T I L L N O T R E A D Y

; S

; L I N E D I S T A N C E - T E X T

; E N D C H A R A C T E R

; S A = 6

$ F F C 3 ; C L O S E S P E C I A L C H A R . C H A N N E L

# $ 6 # $ 1 5$ F F C 9

#

; R E A D Y

; C H A R D E F I N I T I O N C H A N N E L

B U F F E R + 8 , Y$ F F D 2$ F F D 2$ 6 $ 6

H A 6 2$ F F C C ; C L O S E C H A N N E L

1 0

Page 114: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 114/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

C 2 C 7C 2 C 9C 2 C BC 2 C DC 2 D 0C 2 D 2C 2 D 4C 2 D 5C 2 D 7C 2 D AC 2 D BC 2 D DC 2 D FC 2 E 2C 2 E 3C 2 E 5C 2 E 7C 2 E 9C 2 E BC 2 E DC 2 E FC 2 F 1C 2 F 3C 2 F 6C 2 F 9C 2 F BC 2 F CC 2 F EC 3 0 0C 3 0 2C 3 0 4C 3 0 7C 3 0 A

A F A 2 A F A A 2 C D A 2 6 C D A C D A D A 2 2 E 6 A C D A 2 4 6

6 3

6 C 6 0

2 D

F F D

0 O 6 0 0 O 0 8 D C

6

6 0 0 6 C E

F

F

F

F F

F C

H A 6 4

H A 6 3

H A 6 1 A

H A 7 5 AH A 7 5

H A 6 1

H A 6 1 B

L D B E

L D J S L D B E T A L D J S D E B N L D J S P L C M B N L D C M B N L D B N L D J S J S I N

R T L D C M B N L D J S J M P L

$ 6 H A 6 1$ 6 $ F F C 9 ; D A T A C H A N N E L$ 6 ; N U M B E R O B L A M K SH A 6 3 ; N O N E

# $ 2 0$ F F D 2

H A 6 4# 2 5 4 ; S P E C I A L C H A R A C T E$ F F D 2

# H A 7 5 A$ 6 # H A 7 5 A# 1 H A 7 5# 1 4 1$ F F D 2$ F F C C ; C L O S E C H A N N E L$ 6

$ 6 # H A 6 1 B$ 6 $ F F C 9H A 6 1 A

1 0

Page 115: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 115/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

C 3 0 BC 3 0 DC 3 0 EC 3 1 0C 3 1 20 3 1 4C 3 1 5C 3 1 6C 3 1 7C 3 1 8C 3 1 AC 3 1 BC 3 1 EC 3 1 FC 3 2 0C 3 2 1C 3 2 2C 3 2 3C 3 2 4C 3 2 5C 3 2 6C 3 2 7C 3 2 8C 3 2 9C 3 2 AC 3 2 BC 3 2 CC 3 2 DC 3 2 EC 3 2 FC 3 3 1C 3 3 3C 3 3 5

E 6 A E F 4 4 4 4 2 A B 6 0 0 O O 3 3 3 3 C C C C F F F F 8 0 8 4

6

6 B S L P I T0 0

O H A 9 0

I C

H A T A B 1

B O P E N C H1 B C O F F

I N C $ 6 5R T L D Z C P # ; P R I N T S E C O N D L I N E ?B E H A 9 0 ; Y E SL S L S L S L S ; F O R M T A B L E I N D E X F R O MA N # $ 0 F ; T O P T B O T T O MT A L D H A T A B 1 , X ; G E T O T H E R S P L I T V A L U E SR T . B Y T £ 0 0 0 0 0 0 0 0. B Y T £ 0 0 0 0 0 0 1 1. B Y T £ 0 0 0 0 1 1 0 0. B Y T £ 0 0 0 0 1 1 1 1. B Y T £ 0 0 1 1 0 0 0 0. B Y T £ 0 0 1 1 0 0 1 1. B Y T £ 0 0 1 1 1 1 0 0. B Y T £ 0 0 1 1 1 1 1 1. B Y T £ 1 1 0 0 0 0 0 0. B Y T £ 1 1 0 0 0 0 1 1. B Y T £ 1 1 0 0 1 1 0 0. B Y T £ 1 1 0 0 1 1 1 1. B Y T £ 1 1 1 1 0 0 0 0. B Y T £ 1 1 1 1 0 0 1 1. B Y T £ 1 1 1 1 1 1 0 0. B Y T £ 1 1 1 1 1 1 1 1S T $ B O R # $ 1 0S T $ B J M P $ F F C O

1 0

Page 116: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 116/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

C 3 3 8 0 0 0 M U L H . B Y T O , 1 , 2 , 3 , 5 , 6 , 7 , 8 , 1 0 , 1 1 , 1 2 , 1 3 , 1 5 , 1 6C 3 4 6 1 1 2 1 4 . B Y T 1 7 , 1 8 , 2 0 , 2 1 , 2 2 , 2 3 , 2 5 , 2 6 , 2 7 , 2 8 , 3 0 , 3 1C 3 5 2 0 4 8 M U L L . B Y T 0 , $ 4 0 , $ 8 0 , $ C 0C 3 5 6 0 B U F F E R . B Y T 0

B o t h p r o g r a m s l o o k a t h g r a p h i c m e m o r y ( $ 2 0 0 0 h e x , 8 1 9 2d e c i m a l ) ; m o s t g r a p h i c s a r f o u n d i t h i s a r e a , a n t h g r a p h i c a i p r o g r a m s f r o m T H G R A P H I C S B O O K F O T H C O M M O D O R E 6 u s e s t h i s r a n g e . I t h g r a p h i c s y o w i s h t p r i n t o u t a r e i a n o t h e r a r e a , a l l y o u h a v e t d i c h a n g et h v a r i a b l e G R M E M i n t o t h a d d r e s s r e q u i r e d .

G r a p h i c m e m o r y i a r r a n g e d i s u c h w a t h a t t h b y t e a a d d r e s s $ 2 0 0 0 i r e s p o n s i b l e f o t h e i g h t s u c c e s s i v eg r a p i h c p o i n t s i t h u p p e r l e f t c o r n e r . I b i i s e i t h i s b y t e , p o i n t a p p e a r s i t h i s s p o t , w h e r e a s i b i i l o w , t h p o i n t r e m a i n s i n v i s i b l e ( b a c k g r o u n d c o l o r ) . T h en e x t b y t e ( $ 2 0 0 1 ) i r e s p o n s i b l e f o r o o p o i n t s b e l o w$ 2 0 0 0 . T h e s e h o r i z o n t a l b i r e p r e s e n t a t i o n s g u t a n i n c l u d i n g $ 2 0 0 7 , w i t h t h n e x t a d d r e s s ( $ 2 0 0 8 ) p i c k i n g u i t h e n e x t c o l u m n , t h u s :

$ 2 0 0 0 $ 2 0 0 8$ 2 0 0 1 $ 2 0 0 9$ 2 0 0 2 $ 2 0 0 A$ 2 0 0 3 . . . . . . . . $ 2 0 0 B$ 2 0 0 4 $ 2 0 0 C e t c .$ 2 0 0 5 $ 2 0 0 D$ 2 0 0 6 $ 2 0 0 E$ 2 0 0 7 $ 2 0 0 F . . . : . . . .

E i g h t b y t e s o b i t s c o m p r i s e 6 4 - b i t b l o c k .

1 1

Page 117: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 117/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

S i n c e t h p r i n t e r c a o n l y p r i n t p o i n t s e q u e n c e s v e r t i c a l l y ,h a r d c o p y p r o g r a m m u s t i s o l a t e a n r e c o m p o s e e q u a l l y

s i g n i f i c a n t b i t s w i t h i n b y t e .

T h i s p r o b l e m i i n c r e a s e d i w e a r e c o n s i d e r i n g a 8 - b y t ec h a r a c t e r p r i n t e d b 7 - p i n p r i n t e r : S o m e h o w t h e i g h t hb i m u s t b t a k e n u b t h n e x t l i n e s e q u e n c e . f u r t h e rd i f f i c u l t y l i e s i t h e f a c t t h a t t h e 2 s c r e e n l i n e s ( = 2 0 0v e r t i c a l p o i n t s ) i n o e a s i l y d i v i s i b l e b 7 O n c e t h g r a p h i c i p r i n t e d , w e s t i l l h a v e p o i n t s ' w o r t hu n a c c o u n t e d - f o r .

N a t u r a l l y , t h e s e p r o b l e m s d o n ' t c r o p u o n a n 8 - p i n p r i n t e r .G r a p h i c s c o v e r a l l 2 0 0 l i n e s w i t h n p r o b l e m .

T h e r e i l i t t l e - k n o w n f a c t a b o u t t h 1 5 2 6 : I t i s c a p a b l eo p r i n t i n g a n c h a r a c t e r i a f o r m a t . T h e 1 5 2 6m a n u a l g i v e s b o r i n g e x a m p l e , w h i c h p r i n t s t h C o m m o d o r el o g o 1 t i m e s . T h a t w o u l d n ' t d a n y o f u a n g o o d f o e v e r y d a y u s a g e .

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

H e r e ' s h e l p !

T h e 1 5 2 6 a c k n o w l e d g e s s p e c i a l c h a r a c t e r w h i c h s i g n i f i e st h e n d - o f - l i n e , b u g i v e s n l i n e f e e d [ C H R $ ( 1 4 1 ) ] , w h i c hc o m e s f r o m t h v a l u e s 1 3 + 1 2 8 . C H R $ ( 1 3 ) i t h v a l u e t h a te n d s l i n e w i t h l i n e f e e d , w h i l e C H R $ ( 1 4 1 ) i s h i f t e dC H R $ ( 1 3 ) , w h i c h t r a n s f e r s t h h i g h e s t s e t b i t .

I l

Page 118: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 118/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

T h i s c h a r a c t e r a l l o w s y o t d e f i n e c u s t o m c h a r a c t e r s a n e w ,a n p r i n t t h e m o u o t h e s a m e l i n e ; y o w i l l s t i l l n e e ds o m e s o r t o c o u n t e r t h e l p a d j u s t t h p r i n t h e a d b i b a c kt t h o r i g i n a l p r i n t p o s i t i o n ( w h e t h e r t h e r e i l i n e f e e do n o t ) . T g e t t h p r o p e r p l a c e , c o r r e s p o n d i n g n u m b e ro s p a c e s m u s t b e p u i n

G r a n t e d , t h i s s o r t o o u t p u t i t i m e - c o n s u m i n g , s i n c e i t ' sn o s i m p l y m a t t e r o p r i n t i n g t h d a t a . A l s o , e a c h l i n er o u t i n e m u s t f i g u r e o u d i f f e r e n t n u m b e r o " r e t u r ns p a c e s " . H o w e v e r , s i n c e t h i s r o u t i n e i w r i t t e n i m a c h i n el a n g u a g e , i w i l l m o v e c o n s i d e r a b l y f a s t e r t h a nc o u n t e r p a r t w r i t t e n i B A S I C . A l l t h e p r o c e d u r e s m e n t i o n e da b o v e a r e f f i c i e n t l y h a n d l e d i t h p r o g r a m , w i t h a e x t r af e a t u r e a d d e d t t h 1 5 2 6 v e r s i o n : T h e g r a p h i c s a r e n l a r g e d b f a c t o r o 2 I o t h e r w o r d s , i y o c a l c u l a t ea m a t r i x w i t h t h i s i m i n d , y o u ' l l g e t o t a l o f 6 4 0p o i n t s ( p o i n t s 8 c h a r a c t e r s ) p e l i n e . S h o u l d y o u w a n ta e x a c t c o p y i n s t e a d , d i v i d e t h p a g e i h a l f .

N o w , h o w e v e r , w c o m e t t h B A S I C l o a d e r s . F i r s t w h a v et h p r o g r a m w h i c h d r i v e s t h 7 - p i n p r i n t e r .

1 0 F O 4 9 6 6 4 T 4 9 9 3 31 1 R E A D P O K E I , S = S + X N E X T1 2 D A T A 3 2 , 2 4 1 , 1 8 3 , 1 3 4 , 1 0 3 , 3 2 1 5 , 2 4 3 , 3 2 3 1 , 2 4 3 , 1 6 61 3 D A T A 1 0 3 , 3 2 , 2 0 1 , 2 5 5 , 1 6 9 , 2 5 5 , 1 3 3 , 9 7 , 1 6 9 , 7 , 1 3 3 , 2 5 31 4 D A T A 1 6 9 , 2 8 , 1 3 3 , 1 5 1 , 1 6 9 , 0 , 1 4 1 , 1 3 , 1 9 5 , 1 6 9 , 4 0 , 1 4 11 5 D A T A 1 5 , 1 9 5 , 1 6 2 , 4 , 1 8 9 , 1 7 7 , 1 9 4 , 3 2 , 2 1 0 , 2 5 5 , 2 0 2 , 1 1 6 D A T A 2 4 7 , 1 6 9 , 0 , 1 3 3 , 9 9 , 1 3 3 , 1 0 0 , 1 7 3 , 1 3 , 1 9 5 , 1 3 3 , 1 0 11 7 D A T A 1 6 9 , 0 , 1 3 3 , 2 5 4 , 1 6 5 , 9 9 , 1 6 6 , 1 0 0 , 1 6 4 , 1 0 1 , 3 2 , 1 8 21 8 D A T A 1 9 4 , 1 6 0 , 0 , 1 7 7 , 1 7 2 , 1 6 6 , 2 5 4 , 1 5 7 , 1 7 , 1 9 5 , 2 3 0 , 1 0 1

1 1

Page 119: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 119/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

1 9 D A T A 2 3 2 , 1 3 4 , 2 5 4 , 2 2 8 , 2 5 3 , 2 0 8 , 2 2 9 , 1 6 9 , 0 , 1 6 0 , 7 , 1 6 62 0 D A T A 2 5 3 , 3 0 1 7 , 1 9 5 , 4 2 , 2 0 2 , 1 6 , 2 4 9 , 3 7 9 7 9 , 1 2 82 1 D A T A 3 2 , 2 1 0 , 2 5 5 , 1 3 6 , 1 6 , 2 3 7 , 1 6 5 , 9 9 2 4 , 1 0 5 , 8 , 1 3 32 2 D A T A 9 9 , 1 4 4 , 2 , 2 3 0 , 1 0 0 , 2 0 6 , 1 5 , 1 9 5 , 2 0 8 , 1 8 1 , 1 6 9 , 1 2 3 D A T A 3 2 , 2 1 0 , 2 5 5 , 1 7 3 , 1 3 , 1 9 5 , 2 4 , 1 0 5 , 7 , 1 4 1 , 1 3 , 1 9 52 4 D A T A 1 9 8 , 1 5 1 , 2 4 0 , 3 7 6 3 3 , 1 9 4 , 1 6 9 , 4 , 1 9 7 , 2 5 3 , 2 4 02 5 D A T A 1 2 , 1 3 3 , 2 5 3 , 1 6 9 , 1 , 1 3 3 , 1 5 1 , 1 6 9 , 1 5 , 1 3 3 , 9 7 , 2 0 82 6 D A T A 2 3 5 , 1 6 9 , 1 5 3 2 , 2 1 0 , 2 5 5 , 7 6 , 2 0 4 , 2 5 5 , 8 0 0 1 2 7 D A T A 2 7 8 , 1 3 3 , 2 0 , 1 3 4 , 2 1 , 1 5 2 , 7 4 7 4 7 4 , 1 7 0 , 1 8 92 8 D A T A 2 3 9 , 1 9 4 , 1 3 3 , 1 7 3 , 1 3 8 , 4 1 3 , 1 7 0 , 1 8 9 , 9 , 1 9 5 , 1 3 32 9 D A T A 1 7 2 , 1 5 2 , 4 1 7 2 4 , 1 0 1 , 1 7 2 , 1 3 3 , 1 7 2 , 1 6 5 , 2 0 4 3 0 D A T A 2 4 8 , 1 3 3 , 9 9 , 1 6 9 , 3 2 5 , 1 7 3 , 1 3 3 , 1 7 3 , 2 4 , 1 6 5 , 1 7 23 1 D A T A 1 0 1 , 9 9 , 1 3 3 , 1 7 2 , 1 6 5 , 1 7 3 , 1 0 1 , 2 1 , 1 3 3 , 1 7 3 , 9 6 3 2 D A T A 1 2 3 5 6 , 7 , 8 1 0 , 1 1 , 1 2 , 1 3 , 1 3 3 D A T A 1 6 1 7 1 8 2 0 2 1 , 2 2 , 2 3 , 2 5 2 6 2 7 2 8 3 3 4 D A T A 3 1 0 6 4 , 1 2 8 , 1 9 2 , 2 0 33 5 I < 3 1 3 5 5 T H E N P R I N T " E R R O R I D A T A ! ! " E N 3 6 P R I N T " O K "

T h i s i s l o o d a t a t t y p e i n b u w i t h t h c h e c k s u mr o u t i n e a t h b o t t o m o e a c h p r o g r a m , e r r o r s c a n b e f o u n db e f o r e t h e y h a p p e n . l e t ' s t a l k a b o u t t h c h e c k s u m f o m o m e n t : T h i s d o e s n ' t c o r r e c t t h e r r o r s , b u t r a t h e r , i j u s t l o c a t e s t h e m g e n e r a l l y . I o t h e r w o r d s , w c o u l dc a l c u l a t e t h c h e c k s u m b h a n d , b u t h C - 6 4 c a a c c o m p l i s ht h t a s k m u c h f a s t e r . s h o r t r o u t i n e s u m s t h D A T As t a t e m e n t s . I a l i w e l l , t h c o n v e r s i o n w i l l b m a d e t

m a c h i n e l a n g u a g e p r o g r a m . I n o t , t h p r o g r a m s t o p s ,a l l o w i n g y o t g i a n f i a n m i s t a k e s c h a n g i n g t h n u m b e r o f t h e c h e c k s u m d o e s n ' t s o l v e t h p r o b l e m , b y t h w a y . S o t y p e a w a y ( r e m e m b e r t S A V E b e f o r e R U N n i n g ! ) ; i t h e r e a r m i s t a k e s , y o u ' l l h e a r a b o u t t h e m .

1 1

Page 120: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 120/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O N N O D O R E 6

N o t h l i s t i n g f o t h 1 5 2 6 p r i n t e r .

1 0 F O 4 9 6 6 4 T 5 0 0 0 61 1 R E A D P O K E I , S = S + X N E X T1 2 D A T A 3 2 , 2 4 1 , 1 8 3 , 1 3 4 , 1 0 3 , 3 2 1 5 , 2 4 3 , 3 2 3 1 , 2 4 3 , 1 6 91 3 D A T A 5 3 2 4 7 , 1 9 5 , 1 6 9 , 6 3 2 4 7 , 1 9 5 , 1 6 2 , 2 2 3 1 4 D A T A 2 0 1 , 2 5 5 , 1 6 9 , 2 0 3 2 , 2 1 0 , 2 5 5 , 1 6 9 , 1 3 3 2 , 2 1 0 , 2 5 51 5 D A T A 3 2 , 2 0 4 , 2 5 5 , 1 6 0 , 2 5 , 1 3 2 , 1 0 0 , 1 6 9 , 2 , 1 3 3 , 1 0 4 , 1 6 91 6 D A T A 0 , 1 3 3 , 1 0 1 , 1 6 9 , 4 0 , 1 3 3 , 9 9 , 1 6 9 , 2 5 5 6 , 2 2 9 , 1 0 01 7 D A T A 1 7 0 , 1 8 9 , 5 6 , 1 9 5 , 9 3 2 , 1 3 3 , 1 7 3 , 1 3 8 , 4 1 3 , 1 7 01 8 D A T A 1 8 9 , 8 2 , 1 9 5 , 1 3 3 , 1 7 2 , 1 6 2 , 0 , 1 6 0 , 8 , 1 6 1 , 1 7 2 , 1 5 31 9 D A T A 8 6 , 1 9 5 , 2 3 0 , 1 7 2 , 2 0 8 , 2 , 2 3 0 , 1 7 3 , 1 3 6 , 2 0 8 , 2 4 2 , 1 6 02 0 D A T A 8 , 1 6 2 , 8 3 0 8 6 , 1 9 5 , 4 2 , 2 0 2 , 2 0 8 , 2 4 9 , 3 2 1 2 1 D A T A 1 9 5 , 1 5 3 , 9 4 , 1 9 5 , 1 3 6 , 2 0 8 , 2 3 8 , 1 6 0 , 8 3 2 , 1 6 6 , 1 9 42 2 D A T A 1 6 0 , 4 3 2 , 1 6 6 , 1 9 4 , 1 9 8 , 9 9 , 2 0 8 , 2 0 4 , 1 9 8 , 1 0 4 , 2 0 82 3 D A T A 1 7 0 , 1 9 8 , 1 0 0 , 2 0 8 , 1 6 2 , 1 6 2 , 2 2 3 2 , 2 0 1 , 2 5 5 , 1 6 9 , 3 2 4 D A T A 3 2 , 2 1 0 , 2 5 5 , 1 6 9 , 1 3 3 2 , 2 1 0 , 2 5 5 , 3 2 , 2 0 4 , 2 5 5 , 1 6 92 5 D A T A 2 2 3 2 , 1 9 5 , 2 5 5 , 1 6 9 , 2 5 3 2 , 1 9 5 , 2 5 5 , 9 6 , 1 6 9 ,2 6 D A T A 1 3 3 , 1 0 2 , 1 6 2 , 2 1 3 2 , 2 0 1 , 2 5 5 , 1 5 2 , 7 2 , 1 6 2 , 4 , 1 8 52 7 D A T A 9 4 , 1 9 5 , 3 2 , 2 1 0 , 2 5 5 , 3 2 , 2 1 0 , 2 5 5 , 5 , 1 0 2 , 1 3 3 , 1 0 22 8 D A T A 1 3 6 , 2 0 2 , 2 0 8 , 2 3 9 , 3 2 , 2 0 4 , 2 5 5 , 1 6 5 , 1 0 2 , 2 4 0 , 4 9 , 1 6 62 9 D A T A 1 0 3 , 3 2 , 2 0 1 , 2 5 5 , 1 6 5 , 1 0 1 , 2 4 0 , 9 , 1 7 0 , 1 6 9 , 3 2 3 3 0 D A T A 2 1 0 , 2 5 5 , 2 0 2 , 2 0 8 , 2 5 0 , 1 6 9 , 2 5 4 , 3 2 , 2 1 0 , 2 5 5 , 1 0 4 , 2 0 13 1 D A T A 4 , 2 0 8 , 1 0 , 1 6 5 , 9 9 , 2 0 1 , 1 , 2 0 8 , 4 , 1 6 9 , 1 3 , 2 0 83 2 D A T A 2 , 1 6 9 , 1 4 1 , 3 2 , 2 1 0 , 2 5 5 , 3 2 , 2 0 4 , 2 5 5 , 2 3 0 , 1 0 1 , 9 3 3 D A T A 1 6 5 , 9 9 , 2 0 1 , 1 , 2 0 8 , 8 , 1 6 6 , 1 0 3 , 3 2 , 2 0 1 , 2 5 5 , 7 3 4 D A T A 2 2 6 , 1 9 4 , 1 0 4 , 2 3 0 , 1 0 1 , 9 6 , 1 6 6 , 1 0 4 , 2 2 4 , 1 , 2 4 0 ,3 5 D A T A 7 4 7 4 , 7 4 , 7 4 4 1 1 5 , 1 7 0 , 1 8 9 , 3 1 , 1 9 5 , 9 0 3 6 D A T A 3 1 2 1 5 4 8 5 1 6 0 6 3 , 1 9 2 , 1 9 5 , 2 0 4 , 2 0 7 , 2 4 03 7 D A T A 2 4 3 , 2 5 2 , 2 5 5 , 1 3 3 , 1 8 5 , 9 1 6 , 1 3 3 , 1 8 4 , 7 6 , 1 9 2 , 2 5 53 8 D A T A 0 , 1 , 2 3 5 , 6 , 7 , 8 1 0 , 1 1 , 1 2 , 1 3 9 D A T A 1 5 , 1 6 , 1 7 , 1 8 , 2 0 , 2 1 , 2 2 , 2 3 , 2 5 , 2 6 , 2 7 2

1 1

Page 121: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 121/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

4 0 D A T A 3 0 3 1 0 6 4 , 1 2 8 , 1 9 2 ,4 1 I < 4 1 9 0 8 T H E N P R I N T " E R R O R I D A T A ! ! " E N 4 2 P R I N T " O K "

I c o n c l u s i o n , h e r e a r s o m e p o i n t s a b o u t o p e r a t i n g t h p r o g r a m o t h 1 5 2 6 p r i n t e r .

A f t e r L O A D i n g a n s t a r t i n g t h p r o g r a m d e s i g n e d f o y o u rp r i n t e r , y o c a n s t a r t m o s t o t h e r p r o g r a m s . I y o w a n th a r d c o p y o t h e s c r e e n , s t a r t y o u r r o u t i n e w i t h ;

S Y 1 2 * 4 0 9 6 + 2 * 2 5 6 , L F .

T h a t l a s t p a r a m e t e r ( L F ) s h o u l d b t h l o g i c a l f i l e n u m b e rp r e v i o u s l y u s e d i t h O P E N c o m m a n d ( p l a c e d u n d e r t h d e v i c ea d d r e s s 4 )

s i m i l a r c h a n g e w i t h i n t h p r o g r a m c a l o o k l i k e t h i s :

1 2 3 a n g r a p h i c p r o g r a m4 G O S U B 1 0 0 0 : R E M H A R D C O P Y5 g r a p h i c p r

9 9 9 E N D1 0 0 0 O P E N 1 , 41 0 1 0 S Y S 4 9 6 6 4 , 11 0 2 0 C L O S E1 0 3 0 R E T U R N

1 1

Page 122: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 122/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

I y o u h a v e t y p e d i t h 1 5 2 6 v e r s i o n ( a s s u m i n g , o c o u r s e ,t h a t y o o w n t h a t p r i n t e r ) , a n t h H a r d c o p y f u n c t i o n s t i l ld o e s n ' t w o r k , t h e n i t ' s p o s s i b l e t h a t y o u h a v e o n w i t h t h e x c h a n g e R O M i n s t a l l e d . T h i s e x c h a n g e R O M , a m e n t i o n e db e f o r e , g e n e r a t e s s l i g h t l y d i f f e r e n t s e t o f o p e r a t i o n s ,m a k i n g t h m a c h i n e b e h a v e l i k e 1 5 2 5 . T h i s m e a n s t h a t a l t h c o n t r o l c h a r a c t e r s a n s e c o n d a r y a d d r e s s e s a c k n o w l e d g e db y t h e o r i g i n a l R O M w i l l b i g n o r e d a l t o g e t h e r .

O n t h e o t h e r h a n d , p r i n t i n g o u g r a p h i c s i i m p o s s i b l e i 1 5 2 5 m o d e .

H o c a w f i g u r e o u w h i c h o p e r a t i n g s y s t e m w h a v e ?

T h e r e a r t w w a y s t o d o t h i s . F o o n e , y o c a o p e n t h p r i n t e r , a n d l o o k a t h o p e r a t i n g s y s t e m E P R O M ( 2 8 - p i n I w i t h s t i c k e r o i t ) , a f t e r r e m o v i n g t h m e t a l c o v e r f r o mt h E P R O M . I t h I b e a r s t h i n s c r i p t i o n " 1 5 2 6 / C " , t h e ny o d e f i n i t e l y h a v e a o r i g i n a l R O M , a n t h a b o v e p r o g r a ms h o u l d w o r k . I t h I r e a d s " 3 2 5 3 4 1 - 0 6 H " y o h a v e" n e w " o p e r a t i n g s y s t e m .

I y o u a r e t h e p r o u d o w n e r o t h e l a t t e r , c h e c k t s e w h e t h e r t h I U 4 ( 6 5 3 2 ) h a s a l l i t p i n s s e i t h

s o c k e t . T h e U 4 D i n d i c a t i o n i o t h g u i d e p l a t e o f t h e I C I p i # 1 ( c o u n t i n g f r o m u p p e r l e f t ) i s n ' t i t h s o c k e t ,r a t h e r , i t ' s c o n n e c t e d t t h g u i d e p l a t e w i t h p i e c e o w i r e , t h e n t h p r i n t e r i s e i 1 5 2 5 o p e r a t i n g m o d e . T h i sm e a n s , o c o u r s e , t h a t t h e 1 5 2 6 v e r s i o n o t h p r o g r a m w o n ' tw o r k .

B e f o r e y o g e t h e t o o l s , t h e r e ' s a n o t h e r w a y t d e t e r m i n ea l t h i s w i t h o u t o p e n i n g u t h p r i n t e r a a l l .

1 1

Page 123: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 123/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

F i r s t , r u n t h e p r i n t e r t h r o u g h s e l f - t e s t . T u r n o t h m a c h i n e w h i l e h o l d i n g d o w n t h p a p e r f e e d k e y ; t h f i r s tl i n e s h o u l d p r i n t o u t h a b b r e v i a t i o n " R E V . " , f o l l o w e d b n u m b e r . I 1 . a p p e a r s , y o u h a v e a o l o p e r a t i n g s y s t e m ;i i t ' s 7 . 0 , y o u h a v e t h e n e w v e r s i o n . N o w , t d e t e r m i n ew h e t h e r t h p r i n t e r i s i n 1 5 2 6 o 1 5 2 5 m o d e , s e n d t h p r i n t e r s e c o n d a r y a d d r e s s o w i t h p r i n t e d t e x t . I t h p r i n t e r r e a c t s a n p r i n t s o u t e x t , t h e 1 5 2 5 m o d e i o p e r a t i n g ( s e e t h U 4 c o n n e c t i o n s m e n t i o n e d a b o v e ) . I t h p r i n t e r d o e s n o t h i n g , t h e n y o u h a v e 1 5 2 6 m o d e o p e r a t i n g , a n t h H a r d c o p y p r o g r a m w i l l i n d e e d w o r k .

M a n u f a c t u r e r s b e i n g w h a t t h e y a r e , t h e r e a r e m a n y o t h e ro p e r a t i n g s y s t e m s o t h m a r k e t : H e r e , h o w e v e r , w e ' v el i m i t e d o u r s e l v e s t t h e t w o m o s t f r e q u e n t l y - e n c o u n t e r e dv e r s i o n s .

W i t h t h a t , w r e a c h t h e n o t h H a r d c o p y c h a p t e r . T h n e x t s e c t i o n d e a l s w i t h t h e m e w e h a v e n ' t t o u c h e d u p o ny e t — g r a p h i c s .

1 1

Page 124: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 124/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

5 . G r a p h i c s W i t h a n W i t h o u t S i n g l e - P i n C o n t r o l

G r a p h i c s e n c o m p a s s s o m e o t h m o s t i n t e r e s t i n g ( y e t s o m e o t h m o s t d i f f i c u l t ) a s p e c t s o p r o g r a m m i n g . O n o f t h e b e s te x a m p l e s i h i g h - r e s o l u t i o n g r a p h i c p r o g r a m m i n g o t h e C - 6 4 .T h i s a l l o w s y o u t p e r f o r m n e a r - m i r a c l e s o t h e 6 4 s c r e e n .T h p r i n t e r c a n b e p r o g r a m m e d i m u c h t h e s a m e w a y :n e a t l y - p r i n t e d p i c t u r e c a b g r e a t r e w a r d f o s e v e r a lh o u r s o p r o g r a m m i n g .

W e ' l l s p e n d t h i s c h a p t e r v i e w i n g m e t h o d s o h i g h - r e sp r i n t i n g , s t e p b s t e p . I y o u r p r i n t e r i s n ' t c a p a b l e o t h i s p a r t i c u l a r p r o c e s s , r e a d o l i t t l e f u r t h e r — w e h a v ep r o g r a m t h a t w i l l g i v e y o u a m a z i n g p i c t u r e s w i t h w h a t ' sa v a i l a b l e .

F i r s t , w e ' l l l o o k a h o t e x t a n d " n o r m a l " g r a p h i c s a r m a d e . T h e n , w e ' l l c o v e r t w o - d i m e n s i o n a l a n t h r e e -d i m e n s i o n a l a r t . S o l e t ' s t u r n t h i g h - r e s g r a p h i c s , t h m e t h o d u s e d t c r e a t e a l l o f t h e a b o v e .

T h s i m p l e s t m e t h o d i c o v e r e d i t h p r o g r a m b e l o w : T h i sp r o g r a m w i l l w o r k w i t h m o s t p r i n t e r s w i t h o u t a n a l t e r a t i o n s( d a i s y - w h e e l o w n e r s t a k e n o t e ) . Y o m a y n e e d t m a k e s o m em i n o r c h a n g e s t c o m p e n s a t e f o t h i d i o s y n c r a c i e s o y o u rp r i n t e r , s u c h a c o n t r o l c h a r a c t e r s , e t c . , b u t h p r o g r a ms h o u l d w o r k " a i s " .

1 1

Page 125: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 125/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

5 . 4 . 1 G r a p h i c s W i t h o u t S i n g l e - P i n C o n t r o l

A m e n t i o n e d a b o v e , t h i s i t h s i m p l e s t t y p e o " h i g h - r e s "p r i n t i n g . T h p r o g r a m w i l l p r i n t s i n e c u r v e u s i n ga s t e r i s k s , w h i l e t h p a p e r w i l l f e e d a u s u a l .

1 P 3 . 1 4 1 5 9 O P E N 4 , 2 F O T 2 * P I S T E P . 2 53 S I N ( A )4 B * 3 9 + 4 05 F O = T C : P R I N T # 4 , C H R $ ( 3 2 ) ; : N E X T6 P R I N T # 4 , " * "7 N E X T8 C L 0 S E 4

W h e n y o u r u n t h i s e x a m p l e , y o m a b d i s a p p o i n t e d i t h r e s u l t . T h e s i n e c u r v e i b u v a g u e s e m b l a n c e o w h a t w c o n s i d e r t b s i n e c u r v e ; b u i y o e x p e r i m e n t b i w i t h t h p a r a m e t e r s , y o s h o u l d b a b l e t g e n e r a t e h a l f -d e c e n t - l o o k i n g s i n e w a v e . O n e w a y t i m p r o v e t h a p p e a r a n c eo t h p r i n t o u t i t p l a y w i t h t h s t e p - s i z e i l i n e 2 0

T h e e f f e c t c a b d i m i n s h e d o s o m e p r i n t e r s , h o w e v e r , b yd e c r e a s i n g t h d i s t a n c e b e t w e e n l i n e s . O n c h a n g e i d i s t a n c e p e r l i n e c a b m a d e o 7 - p i n p r i n t e r s b c h a n g i n gl i n e 6 0 t o t h f o l l o w i n g :

6 P R I N T # 4 , " * " ; C H R $ ( 8 ) : P R I N T # 4 , C H R $ ( 1 5 ) ;

U s u a l l y t h e s e p r i n t e r s r e c o g n i z e o n l y t w d i s t a n c e s :l i n e s p e r i n c h i t e x t m o d e ; a n d l i n e s p e r i n c h i g r a p h i c

1 1

Page 126: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 126/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

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

T h 1 5 2 6 p r i n t e r a l l o w s y o u t a d j u s t t h l i n e d i s t a n c e i i n c r e m e n t s o f 1 4 4 s t e p s p e i n c h . T h p r i n t e r i a l e r t e d t t h i s b y g i v i n g s e c o n d a r y a d d r e s s o 6 t h e n t h s p e c i f i cv a l u e . I y o w i s h t l e s s e n t h l i n e s p a c o n g , y o u s e n d t h p r i n t e r v a l u e l e s s t h a n 3 6 F o i n s t a n c e , t p r i n t l i n e sa l m o s t o n t o p o f o n e a n o t h e r , u s e t h i s c o m m a n d s e q u e n c e :

O P E N 6 , 4 , 6 : P R I N T # 6 , C H R $ ( 2 4 ) : C L O S E 6

I t ' s s a f a c t t h a t c o n t r o l c h a r a c t e r s c h a n g e f r o mm a n u f a c t u r e r t m a n u f a c t u r e r w i t h t h e s e c o m e c h a n g e s i l i n e s p a c i n g . I y o h a v e o n e o f t h p r i n t e r s n o m e n t i o n e dh e r e , c h e c k y o u r m a n u a l ; i s h o u l d h a v e s o m e t h i n g t s a a b o u t t h e s e c h a r a c t e r s .

A n o t h e r i m p r o v e m e n t i a v a i l a b l e o p r i n t e r s t h a t c a s h i f tp r i n t p o s i t i o n s i i n c r e m e n t s o s i n g l e d o t , r a t h e r t h a nc h a r a c t e r - b y - c h a r a c t e r . N a t u r a l l y , y o w o u l d o n l y f i n d t h i sf e a t u r e o d o t - m a t r i x p r i n t e r s , a l t h o u g h f e d a i s y - w h e e lp r i n t e r s h a v e p r o p o r t i o n a l - s h i f t c a p a b i l i t y .

M o s t 7 - p i n p r i n t e r s ( e . g . , C o m m o d o r e 1 5 1 5 , 1 5 2 5 , a n o t h e rb r a n d s ) h a v e t h i s o p t i o n , a l t h o u g h i t i s s e l d o m u s e d . T h i sa l l o w s p r i n t e r t h a t n o r m a l l y c o v e r s 8 c h a r a c t e r s p e r l i n e— i 7 * m a t r i x — t p r o d u c e r e s o l u t i o n o u t 6 * 8 0( 4 8 0 ) p o s i t i o n s p e l i n e .

1 2

Page 127: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 127/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

s m a l l p r o b l e m a c c o m p a n i e s t h i s f e a t u r e , t h o u g h : W h e nd e a l i n g w i t h C H R $ ( X ) , t h p r i n t e r w i l l o n l y a c k n o w l e d g ew h e n i t i s w i t h i n t h r a n g e o 0 - 2 5 5 , a n d t h i s c o u l d l i m i to u s p e c i f y i n g p r i n t p o s i t i o n s . T c i r c u m v e n t t h i s , t h p o s i t i o n s m u s t b e g i v e n i t w o - b y t e f o r m . S u c h c o m m a n dw o u l d b g i v e n a C H R $ ( H I G H B Y T E ) ; C H R $ ( L O W B Y T E ) , f o l l o w i n gt h p r e p a r a t o r y c o d e s C H R $ ( 2 7 ) ; C H R $ ( 1 6 ) . F o r e x a m p l e , l e t ' sp r i n t a a s t e r i s k a p o s i t i o n 2 0 0 . A f t e r O P E N i n g t h f i l e ,w w o u l d s e n d t h f o l l o w i n g :

P R I N T # 1 , C H R $ ( 2 7 ) ; C H R $ ( 1 6 ) ; C H R $ ( 0 ) ; C H R $ ( 2 0 0 ) ; " * "

T o d o t h s a m e a p o s i t i o n 3 0 0 , t h l i n e w o u l d l o o k l i k et h i s :

P R I N T # 1 , C H R $ ( 2 7 ) ; C H R $ ( 1 6 ) ; C H R $ ( 1 ) ; C H R $ ( 4 4 ) ; " * "

I t h i s l a s t c o m b i n a t i o n , t h t h i r d n u m b e r b e c o m e s 1 a n t h f o u r t h n u m b e r i f i g u r e d f r o m 2 5 ( 3 0 0 - 2 5 6 = 4 4 ) . N o y o h a v e 4 8 p r i n t p o s i t i o n s t c h o o s e f r o m .

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

1 0 R E * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *1 1 R E * * * * * *1 2 R E * * F U N C T I O N P L O T T E R * * 1 3 R E * * * * * *1 4 R E * * W I T H S C A L I N G * * 1 5 R E * * * * 1 6 R E * * F O R 1 5 1 5 , 1 5 2 5 E T C . * *

1 2

Page 128: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 128/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

1 7 R E * * * * * *1 8 R E * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *1 9 P I = 3 . 1 4 1 5 9 2 62 0 G O S U B 4 5 0 R E S E B O R D E R2 1 0 P E N 4 . 42 2 F O R I = 1 T 0 8 02 3 P R I N T # 4 , C H R $ ( 2 4 9 ) ;2 4 N E X T2 5 P R I N T # 4 , C H R $ ( 8 )2 6 F O R A = 0 T O 2 * P I S T E P . l2 7 G O S U B 5 3 02 8 C = B * M Y + 2 4 02 9 H B = I N T ( C / 2 5 6 )3 0 L B = C A N D 2 5 53 1 I F O = 2 3 5 A N D C < 2 4 5 T H E N 3 9 03 2 I F C < = 2 4 0 T H E N 3 6 03 3 P R I N T # 4 , C H R $ ( 1 5 ) C H R $ ( 2 7 ) C H R $ ( 1 6 ) C H R $ ( 0 ) C H R $ ( 2 4 0 ) C H R $

( 2 4 5 ) ;3 4 P R I N T # 4 , C H R $ ( 2 7 ) C H R $ ( 1 6 ) C H R $ ( H B ) C H R $ ( L B ) " * " C H R $ ( 8 )3 5 G O T 0 4 0 03 6 P R I N T # 4 , C H R $ ( 1 5 ) C H R $ ( 2 7 ) C H R $ ( 1 6 ) C H R $ ( H B ) C H R $ ( L B ) t f * t t ;3 7 P R I N T # 4 , C H R $ ( 2 7 ) C H R $ ( 1 6 ) C H R $ ( 0 ) C H R $ ( 2 4 0 ) C H R $ ( 2 4 5 ) C H R $ ( 8 )3 8 G O T 0 4 0 03 9 P R I N T # 4 , C H R $ ( 1 5 ) C H R $ ( 2 7 ) C H R $ ( 1 6 ) C H R $ ( H B ) C H R $ ( L B ) f l * t t C H R $

( 8 4 0 N E X T A4 1 P R I N T # 4 , C H R $ ( 1 5 )4 2 C L 0 S E 44 3 E N 4 4 R E S C A L I N G4 5 F O R A = 0 T O 2 * P I S T E P . l4 6 G O S U B 5 3 04 7 I F B > M A T H E N M A ^ B

1 2

Page 129: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 129/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

4 8 I F B < M I T H E N M I = B4 9 N E X T5 0 I F A B S ( M I ) > M A T H E N M Y = 2 3 3 / A B S ( M I ) : R E T U R N5 1 M Y = 2 3 3 / M A : R E T U R N5 2 R E M F U N C T I O N S E I L I N E 5 3 05 3 B = S I N ( A )5 4 R E T U R N

T h z e r o - l i n e c h a r a c t e r i s o m e w h a t e x t r a v a g a n t . T h p o i n tp o s i t i o n m u s t d i c t a t e w h e t h e r t h p o i n t w i l l a p p e a r t t h r i g h t o t h e l e f t o t h z e r o - l i n e , o w h e t h e r t h p o i n tw i l l o v e r l a p t h z e r o - l i n e . T h u s , t h a s t e r i s k s a n t h z e r o - l i n e w i l l a p p e a r i t h e i r p r o p e r s e q u e n c e . H o w e v e r , i t h a s t e r i s k s c o v e r t h z e r o - l i n e , t h z e r o - l i n e w i l l b c o v e r e d o v e r . B e f o r e p r i n t i n g b e g i n s , a l f u n c t i o n v a l u e sa r f i g u r e d o u t . T h r e s u l t s w i l l b n e e d e d w h e nm e a s u r e m e n t s a r d e t e r m i n e d . T h i s c a t a k e c o n s i d e r a b l ea m o u n t o f t i m e i B A S I C , s h a v e s o m e p a t i e n c e .

I t h i s t y p e o p r i n t o u t d o e s n ' t s a t i s f y y o u , s e e t h ec h a p t e r o h i g h - r e s g r a p h i c s f o F u n c t i o n P l o t t e r w h i c hg i v e s a m a z i n g l y c l e a r r e s u l t s .

T c o n c l u d e t h i s c h a p t e r , w o f f e r l i t t l e t i p f o r g r a p h i c si n v o l v i n g l o r e s o l u t i o n . M a n y p r i n t e r s h a v e w h a t i c a l l e d" c o m p r e s s e d m o d e " , w h i c h a l l o w s y o u t p r i n t 1 3 c h a r a c t e r sp e r l i n e ( r a t h e r t h a n t h n o r m a l 8 0 ) . A m e n t i o n e d a b o v e ,t h c l o s e r t h p o i n t s , t h b e t t e r t h g r a p h i c s . U s i n g t h i s ,w e c a n p r o d u c e s t i l l b e t t e r g r a p h i c s . T w o r k t h i s i d e ai n t o t h p r e c e d i n g e x a m p l e , y o u w o u l d f i r s t h a v e t c h a n g et h c o r r e s p o n d i n g v a l u e b m u l t i p l y i n g b y 1 3 2 / 8 0 ( = 1 . 6 5 ) .T h i s t i a l s o a p p l i e s t t h p r o g r a m s t f o l l o w , w h i c hi n v o l v e t h r e e - d i m e n s i o n a l g r a p h i c s .

1 2

Page 130: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 130/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

Y o m a t h i n k , b e f o r e t r y i n g t h f i r s t p r o g r a m i t h n e x tc h a p t e r , t h r e e - d i m e n s i o n a l g r a p h i c s m a d e o a s t e r i s k s d o n ' tw o r k t o w e l l . Y o u m a y b i f o s m a l l s u r p r i s e .

F i r s t , t h o u g h , t h e p r o g r a m .

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

D I M A $ ( 8 0 )[ ) P E N 4 , 4F O R X = 1 T O 7 2

H = 0 : L = 1 2 0F O R I = l T O 8 0 : A $ ( I ) = " " : N E X TF O R Y = 1 T O 4 8

X T = ( X - Y ) * 2I F X T < 1 T H E N 2 9 OI F X T > 4 8 T H E N 2 8 0C = S Q R ( ( X T - 2 4 ) * ( X T - 2 4 ) + ( Y - 2 4 ) * ( Y - 2 4 ) ) + lW = X T + E X P ( - . 0 1 * C * C ) * 4 5 + 3I F W > H T H E N 2 4 0I F W < L T H E N 2 6 0G O T O 2 8 0H = I F W > L T H E N 2 7 0L = A $ ( W ) = " * "

N E X T YF O R I = 1 T 0 8 0 : P R I N T # 4 , A $ ( I ) ; : N E X T

t f E X T X

A l t h o u g h t h i s p r o g r a m i q u i t e s h o r t , t h e l o g i c o i t i s f a f r o m s i m p l e . W e ' r e n o g o i n g t h r o u g h t h e n t i r e r o u t i n el i n e - b y - l i n e ; i n s t e a d , w e ' l l o f f e r y o u s o m e i d e a s f o c h a n g e s a n d e v e l o p m e n t . A n s u g g e s t i o n s , o c o u r s e , c a a l s o b a p p l i e d t a n p r o g r a m s y o u ' v e s e e n u u n t i l n o w .

1 2

Page 131: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 131/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

P r o d u c i n g l o n g e r l i n e ( e . g . , 1 3 2 c h a r a c t e r s p e l i n e )i n v o l v e s m u l t i p l i c a t i o n b 1 . 6 5 ( s e e a b o v e ) . T h i se s p e c i a l l y a p p l i e s t t h D I s t a t e m e n t a t h b e g i n n i n g o t h p r o g r a m . T h e r e a r e t w o e x c e p t i o n s ; t h i l i n e 1 6 0 ,a n t h e 0 . 0 1 i l i n e 2 0 0 .

Y o c a a l s o t r y t h a b o v e m e n t i o n e d m e a s u r e s t d e c r e a s ed i s t a n c e b e t w e e n l i n e s .

T s e u a n o t h e r u p p e r s u r f a c e , y o c a c h a n g e t h f u n c t i o ni l i n e 2 0 0 . G i v e t h i s t r y :

2 0 W = X T - E X P ( - . 0 1 * C * C ) * 4 5 = 2 5

T h e s e t r i c k s a n t i p s n a t u r a l l y w o n ' t g i v e y o t h s a m er e s u l t s a h i g h - r e s , s i n g l e - p i n p r i n t o u t . I f a c t , f o a l l t h e r e d u c t i o n s w e ' v e s u g g e s t e d , y o w o u l d b b e t t e r o f w o r k i n g o s i n g l e - p i n c o n t r o l , w h i c h i t h s u b j e c t o o u n e x t s e c t i o n .

1 2

Page 132: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 132/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

5 . 4 . 2 G r a p h i c s W i t h S i n g l e - P i n C o n t r o l

I t h l a s t c h a p t e r , w t r i e d t p r o d u c e g r a p h i c s o p r i n t e r s t h a t h a n s p e c i a l a b i l i t i e s i t h a t a r e a . T h i sc h a p t e r i f o t h p r i n t e r s w i t h s i n g l e - p i n c a p a b i l i t y .

I w d r a s t i c a l l y r a i s e t h n u m b e r o c o n t r o l l a b l e p o i n t s ,t h g r a p h i c r e s o l u t i o n i n c r e a s e s p r o p o r t i o n a t e l y . Y o u ' v ep r o b a b l y s e e n m a n y h i g h - r e s o l u t i o n p r i n t o u t s ( f i n e e x a m p l ei t h g r a p h i c d e p i c t i n g W i n s t o n C h u r c h i l l ) .

H o d w p r o g r a m s u c h g r a p h i c s ? A f t e r r e a d i n g t h i sc h a p t e r , y o u , t o o , w i l l b e a b l e t o d o s u c h a r t w o r k , r i g h t u t t h r e e - d i m e n s i o n a l a r ( a s s u m i n g t h a t y o u r p r i n t e r a l l o w sf o s i n g l e - p i n c o n t r o l ) .

T h e x a m p l e s l i s t e d h e r e a r i n t e n d e d f o r t h e V I C - 1 5 1 5 ,1 5 2 5 , a n d M P S 8 0 p r i n t e r s , a w e l l a E p s o n m a c h i n e s .O w n e r s o o t h e r b r a n d s ( e . g . I T O H ) s h o u l d n ' t t h r o w i t h t o w e l j u s t y e t ; c o n v e r s i o n s s h o u l d b r e l a t i v e l y e a s y w i t ht h h e l p o y o u r p r i n t e r m a n u a l , a n d o u r e x p l a n a t i o n s .

F i r s t , l e t ' s l o o k a t h f u n d a m e n t a l s o s i n g l e - p i n c o n t r o l .M o s t p r i n t e r m a n u a l s c o v e r t h i s s u b j e c t o n l y n o m i n a l l y ,o f t e n l e a v i n g t h u s e r w i t h m o r e q u e s t i o n s t h a n a n s w e r s .Y e t , t h i s f e a t u r e i w h a t p e r s u a d e s m o s t f o l k s t b u s u c hp r i n t e r s .

I o r d e r t o p e r a t e p r i n t e r i g r a p h i c m o d e , y o u ' l l n e e dt k n o w f e b a s i c s o h o c o m p u t e r w o r k s . T h V I C - 2 0a n C - 6 4 a r " 8 - b i t H m a c h i n e s . A y o u ' v e p r o b a b l y h e a r de l s e w h e r e , t h e b i t i t h s m a l l e s t i n f o r m a t i o n u n i ta v a i l a b l e . b i c a b s e i o n e o f t w w a y s ; o f o o n

1 2

Page 133: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 133/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h C O M M O D O R E 6

T h i s i n d i c a t e s f a l s e a n d t r u e ( o n a n y e s , i f y o p r e f e r ) . T e c h n i c i a n s p r e f e r u s i n g t h t e r m s H i g h a n L o w ,w h i c h c o r r e s p o n d s t m e a s u r i n g c e r t a i n b i t l i n e w i t hv o l t m e t e r . O n o t h e r d e s i g n a t i o n f o b i c o n d i t i o n i f o h i g h , a n f o l o w .

T h l a t t e r ( 1 / 0 ) h a s t h e a d v a n t a g e t h a t t h v a l u e o f t h e b i c a n b e c o m p u t e d u s i n g t h n u m b e r s . T h i s i e x a c t l y w h a tm u s t b d o n e w h e n d e s i g n i n g g r a p h i c p r o g r a m s .

S o n o w h a v e b i w i t h o n l y t w c o n d i t i o n s p o s s i b l e .Y o u m i g h t w e l l a s k , w h o n l y t w p o s i t i o n s ? P u t s i m p l y ,w i t h b i t , y o c a o n l y h a v e " Y e s " o " N o " — t h e r e i n " M a y b e " a m o n g s t b i t s . W e c a n h a v e t o t a l o f o u rc o n b i n a t i o n s b e t w e e n t w b i t s :

B I N N Y E Y E

B I N Y E N Y E

A d d i n g a n o t h e r b i w o u l d g i v e u p o s s i b l e c o m b i n a t i o n s ,f o u r t h w o u l d g i v e u 1 6 , a f i f t h b i t , 3 2 W w o n ' t s h o w y o a l l o f t h e m h e r e — t r y t h e m o y o u r o w n .

T h i s f a s t i n c r e a s e i b i t s i s g e o m e t r i c a l o n e . Y o m a k n o w t h e o l d m a t h p u z z l e : F i r s t d a o t h m o n t h , s o m e o n eg i v e s y o u p e n n y , w i t h p r o m i s e t d o u b l e t h a m o u n t g i v e ny o e a c h d a y . D a b r i n g s t w c e n t s , d a 3 f o u r c e n t s ,d a 4 e i g h t c e n t s , a n s o n u n t i l b t h e n o t h m o n t h , y o u h a v e a r o u n d $ 1 0 , 0 0 0 , 0 0 0 ( o $ 2 0 , 0 0 0 , 0 0 0 , i y o p r e f e r 3 1 - d a y m o n t h ) .

1 2

Page 134: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 134/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

B t a k i n g g o o d l o o k a t h e s e b i t s , y o c a d e t e r m i n ee x a c t l y w h i c h c o m b i n a t i o n s a r i e f f e c t . A l y o n e e d t d i m u l t i p l y b y i t s e l f t h n u m b e r o t i m e s e q u a l t t h n u m b e r o b i t s . F o e x a m p l e , t w b i t s g i v e s y o u 2 * 2 , f o u rb i t s e q u a l 2 * 2 * 2 * 2 , e t c .

N o w , y o p r o b a b l y k n o w t h a t s u c h e x p r e s s i o n s c a n b e w r i t t e nb i m o r e c o n c i s e l y . T h a t i s t h a b o v e t w e x a m p l e s c a b

e x p r e s s e d u s i n g e x p o n e n t i a t i o n , w h i c h u s e s s y m b o l c a l l e dc a r e t [ ~ ] , r e p r e s e n t e d b y a u p - a r r o w i C o m m o d o r e B A S I C .S o 2 * 2 ^ 2 , 2 * 2 * 2 * 2 2 ^ 4 , a n s o n

S i n c e y o u r c o m p u t e r i a 8 - b i t m a c h i n e , w c a s e o u n s e ta n c o m b i n a t i o n o 2 ^ 8 , o 2 5 6 , b i t s , w h i c h g i v e s u v a l u eo t 2 5 5 . Y e s , t h z e r o c o u n t s a v a l u e a w e l l ; w g e t h i s v a l u e , o c o u r s e , w h e n n o n e o t h e i g h t b i t s a r s e t .

W e ' l l n o w n u m b e r o u b i t s , j u s t a w e d i d e a r l i e r w i t h o u o i g i n a l t w o b i t s . I t h i s c a s e , w e u s e n u m b e r s f r o m t t r e p r e s e n t o u b i t s . G r a n t e d , t h i s n u m b e r s y s t e m m a y s e e mm o r e d i f f i c u l t t g r a s p t h a n , s a y , t 8 b u t h e r e i v e r y i m p o r t a n t r e a s o n f o t h i s u n u s u a l s y s t e m . L e t ' s t a k ea n o t h e r l o o k a o u c h a r t f r o m t h e l a s t p a g e o s o a n c h a n g e t h b i t s a c c o r d i n g l y :

B I N N Y E Y E

B I N Y E N Y E

=

=

1 2

Page 135: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 135/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O N N O D O R B 6

I t ' s i m p o r t a n t t r e m e m b e r t h a t e v e r y s e b i h a s p e c i f i cv a l u e . S o B i h a v a l u e o i s e t , a n B i h a s e v a l u e o 2 I b o t h b i t s a r o n t h e n w e g e 3

N e x t , w e ' l l e x t e n d t h i s t a b l e t i n c l u d e b i w i t h t h v a l u e o 4 p l e a s e n o t e t h a t t h b i t v a l u e s i n c r e a s ee x p o n e n t i a l l y . S u c h b i w o u l d a m o u n t t 2 * 2 , o r 4 I n c r e a s i n g t h n u m b e r o b i t s t t o t a l o 8 t h l a r g e s tw o u l d e q u a l 2 * 1 2 ( r e m e m b e r , 0 - b i t s ) . T h e f o l l o w i n gt a b l e s h o w s t h r e s u l t :

B I 7 2 2 2 2 2 2 2 2

2

7

1 3 6

1 2

2 5

W h a t d o e s a l t h i s h a v e t d w i t h s i n g l e - p i n c o n t r o l ?W e l l , u s i n g t h d e c i m a l v a l u e s i c e r t a i n w a y , w c a t u r na n b i o o o f f , a n d a l s o p r i n t o u a n s e q u e n c e o b i t st h a t w e ' d l i k e . T h o n l y t h i n g t h a t w m u s t c a u t i o n y o ua b o u t , i t h a t t h i s p o i n t s e q u e n c e o n l y a p p l i e s t t h V I C -1 5 1 5 p r i n t e r s a n t h l i k e . E p s o n s a n s o m e o t h e r p r i n t e r su s e t h e o p p o s i t e s e q u e n c e : T h e l o w e r m o s t n e e d l e h a v a l u eo 1 w h i l e t h u p p e r m o s t e q u a l s 1 2 8 .

1 2

Page 136: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 136/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

I t h e s e p o i n t v a l u e s a r c l e a r t o y o u , w e ' l l t r o u s o m eg r a p h i c s . R a t h e r t h a n w r i t e p r o g r a m , l e t ' s s t a r t w i t hp r i n t e r t h a t e x i s t s o n l y i t h e o r y : T h i s p r i n t e r h a l o o f e a t u r e s , a n d a l w n e e d d i c a l l t h e m o u t . J u s t f o t h s a k e o a r g u m e n t , l e t ' s s a y w e w a n t t d r a w c i r c l e o t h p r i n t e r , a n d t h a t t h e u p p e r m o s t p o i n t s e q u e n c e e q u a l s 1 O u c i r c l e w o u l d l o o k s o m e t h i n g l i k e t h i s :

* *

* *

* * *

1 3 6

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

T h e f i r s t l i n e c o m e s t 4 + 8 + 1 6 = 2 8 . T h s e c o n d l i n e c o n t a i n s2 + 3 2 = 3 4 , a n d t h t h i r d l i n e g i v e s t h r e s u l t 1 + 6 4 = 6 5 .R e p e a t t h 6 t w i c e m o r e , t h e n u s 3 a g a i n , a n d f i n a l l y ,2 8

A f t e r t h e s e v a l u e s h a v e b e e n f i g u r e d o u t , t h e n w h a t ? W e l l ,o u r n e x t t a s k i t s w i t c h t h p r i n t e r i g r a p h i c m o d e ,w h i c h , i t h c a s e o o u i m a g i n a r y p r i n t e r , i d o n e w i t ht h v a l u e 1 2 8 , w i t h i n t h i s s e q u e n c e :

P R I N T # 1 , C H R $ ( 1 2 8 )

1 3

Page 137: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 137/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

N o t h n u m b e r s w h a v e f r o m a b o v e c a n b e s e n t t t h p r i n t e r b w a o P R I N T c o m m a n d s . S t o r i n g t h e s e f i g u r e s i D A T A s t a t e m e n t s i s c o n v e n i e n t m e t h o d o h o l d i n g t h e m f o t r a n s m i s s i o n .

L e t ' s l o o k a t h l o g i c f o s u c h p r o g r a m :

1 O P E N 4 , 2 P R I N T # 4 , C H R $ ( 1 2 8 ) R E S H O U L D A C T I V A T E G R A P H I C M O D E3 F O R I = 1 T O 7 : R E M A M O U N T O D A T A T B S E N T4 R E A D : R E M G E I N D I V I D U A L B Y T E5 P R I N T # 4 , C H R $ ( A ) ;6 N E X T7 P R I N T # 4 , C H R $ ( 1 2 8 ) : R E M S W I T C H O F G R A P H I C M O D E8 C L O S E 49 D A T A 2 8 , 3 4 , 6 5 , 6 5 , 6 5 , 3 4 , 2 8

T h p r o g r a m a b o v e c a o n l y w o r k i o u i m a g i n a r y p r i n t e r c a c o n t r o l p i n s i g r a p h i c m o d e . I i h a p p e n s t b a 8 p i p r i n t e r , t h e n t h n u m b e r 1 2 i u s e l e s s f o s w i t c h i n gg r a p h i c m o d e o a n o f f . S o w e m u s t t a k e a n o t h e r r o u t e ,w h i c h w i l l s t i l l i n v o l v e t h a b o v e p r o g r a m , a n s t i l l u s 1 2 f o g r a p h i c m o d e . H o w e v e r , w w i l l a l s o s e n d t h n u m b e ro g r a p h i c b y t e s i n v o l v e d , w h i c h m e a n s t h a t l i n e 2 w i l l n o wl o o k s o m e t h i n g l i k e t h i s :

2 P R I N T # 4 , C H R $ ( 1 2 8 ) ; C H R $ ( 7 ) ;

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

B u t , l e t u s t u r n t t h g r a p h i c m o d e s o r e a l p r i n t e r s .F i r s t , c o n s i d e r t h 7 - p i n p r i n t e r : G r a p h i c c o n t r o l i

1 3

Page 138: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 138/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

t u r n e d o v e r t o u s b y t w o c o n t r o l c h a r a c t e r s c o d es w i t c h e s o g r a p h i c s , w h i l e 1 t u r n s g r a p h i c s o f f . T h i sg r a p h i c s w i t c h i n g p o s e s m o d e s t p r o b l e m , t h o u g h ; t h e m o d e l sm e n t i o n e d a b o v e u s g r a p h i c c o d e s f r o m t 1 2 7 . S o c o d e1 i i n t e r p r e t e d a g r a p h i c b y t e , A N i p r i n t e d o u i i t b i t p a t t e r n . M o s t p r i n t e r m a n u f a c t u r e r s h a v e n o t e d t h i sp r o b l e m , a n l e u c i r c u m v e n t i b y a d d i n g 1 2 8 t o t h v a l u e . T h e r e f o r e , t h g r a p h i c b y t e s l i i t h r a n g e o 1 2 8 - 2 5 5 , a n d w e c a n s w i t c h i b a c k t t e x t m o d e u s i n g c o d e1 5

C o d e p e r f o r m s s t i l l a n o t h e r p r i n t e r f u n c t i o n : I i n c r e a s e s t h n u m b e r o p r i n t e d l i n e s f r o m l i n e s p e r i n c ht l i n e s p e r i n c h . T h i s s t e p p u t s u i p o s i t i o n t p r i n t s m o o t h g r a p h i c s ( u n b r o k e n l i n e s ) . I y o u s a E p s o no y o u r V I o 6 4 w i t h o w i t h o u t s p e c i a l i n t e r f a c e , y o h a v e v e r y p o w e r f u l f o r m o s i n g l e - p i n c o n t r o l a y o u rf i n g e r t i p s ; t h i s p a r t i c u l a r p r i n t e r c a h a v e u t p i n s a h a n d , b u i y o u ' r e t r y i n g t p r i n t 7 - p i n g r a p h i c s , t h i s c a b p r o b l e m . E a c h g r a p h i c b y t e w i l l s e n d o u a n p r i n tb i t s , w h i l e t h e l a s t p i w i l l b e i g n o r e d .

O n e c o m m e n t o t h i s l a s t i t e m : T h E p s o n F X - 8 0 r e c o g n i z e s9 - p i n g r a p h i c m o d e , w h i c h m u s t a l w a y s b t r a n s m i t t e d u s i n gt w g r a p h i c b y t e s . T h e h i g h e s t m o d e l i t h E p s o n l i n e ( t h eL 1 5 0 0 ) i e q u i p p e d w i t h 2 n e e d l e s w h i c h a r c o n t r o l l e d b

s p e c i a l g r a p h i c m o d e . T h i s m e a n s t h a t y o c a p r o d u c eg r a p h i c s w h i c h a p p r o a c h p h o t o g r a p h i c q u a l i t y .

T h v a l u e s w h i c h a p p l y t t h E p s o n m a c h i n e s a r e x a c t l yr e v e r s e d f o t h C o m m o d o r e p r i n t e r s , i . e . , t h l o w e s t n e e d l ei 1 a n t h h i g h e s t i 1 2 8 . T h n u m b e r s o t h d a t a b y t e sm u s t a l s o b r e w o r k e d , t h i s d o e s n ' t p o s e m u c h o p r o b l e m .

1 3

Page 139: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 139/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

L e t ' s r e t u r n t t h e f i r s t s h o r t p r o g r a m ; f u n c t i o n p l o t t e rs i m i l a r t t h p l o t t e r i t h p r e v i o u s c h a p t e r . T h i sv e r s i o n o t h p r o g r a m h a t r e m e n d o u s a d v a n t a g e o v e r t h o t h e r t h r e s u l t c a b s e e n q u i c k l y , a n t h p r o g r a mm o v e s f a i r l y q u i c k l y . T h e r e a r e t w o f u n c t i o n p l o t t e r s h e r e :O n f o t h C o m m o d o r e p r i n t e r s , a n d o n e f o r E p s o n m o d e l s .B o t h w i l l b e d o c u m e n t e d i t h n e x t f e w p a g e s , s t h a t y o c a e a s i l y a d a p t t h e m f o y o u r o w p r i n t e r ( e . g . , S e i k o s h ao r I t o h ) .

T h p r o g r a m b e l o w c o n t a i n s n f a n c y r o u t i n e s , n " c u t e " u s e rp r o m p t s . W e ' v e d e l i b e r a t e l y m a d e t h i s p r o g r a m s i m p l e , s t h a t t h r o u t i n e s a r e a s i l y r e a d a b l e f o y o u .

1 R E 2 R E M F U N C T I O N P L O T T E R3 R E 4 R E I S I N G L E - P O I N T C O N T R O L5 R E 6 R E F O C O M M O D O R E 7 - P I N P R I N T E R S7 R E 8 R E 3 P 3 . 1 4 1 5 31 0 D E F F N A < X > = S I N < X >1 1 I N P U T " H O R I Z O N T A L R E S O L U T I O N " ; X ' 1 2 I F X X < 1 O R X X > 4 7 3 T H E N 1 1 01 3 I N P U T " V E R T I C A L R E S O L U T I O N " ; Y Y 1 4 I F Y X O T H E N 1 3 01 5 I N P U T " R A N G E O D E F I N I T I O N " ; A , B1 6 A = A * P I : B = B * P I : I F A > = B T H E N 1 5 01 7 I N P U T " R A N G E O V A L U E S " ; C 1 8 I F O = D T H E N 1 7 01 3

2 0 2 1 H F = ( B - A ) / X X2 2 H = 2 3 F O R I = 6 T O 0 S T E P - 12 4 0 Y * < I ) = C H R * < H + 1 2 8 >

1 3

Page 140: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 140/343

A B A C U S S o f t w a r e P R I N T B R B O O K f o r t h e C O M M O D O R B 6

2 5 H = H + H2 6 N E X T2 7 F O R I = 1 T O X X2 8 0 Y = F N A < A + H F * I >2 9 Y X < I ) = < Y - C ) * V F + . 53 0 N E X T3 1 O P E N 1 , 43 2 P R I N T # 1 , C H R * < 8 > ;3 3 A $ = C H R * < 1 2 8 >3 4 F O R H = Y % - 6 T G 0 S T E P - 73 5 R E 3 6 3 7 3 8 I F Y < 7 A N D Y > = 0 T H E N P R I N T # 1 , Y * < Y > J : N E X T : G O T O 4 1 03 9 P R I N T H 1 , A $ ;4 0 N E X T4 1 P I N T * 14 2 N E X T4 3 P R I N T # 1 , C H R $ < 1 5 ) : C L Q S E 1R E A D Y .

T h e l i n e s b e l o w a r e t h e o n e s y o u ' l l h a v e t c h a n g e t r u t h p r o g r a m o n a n E p s o n p r i n t e r . T h i s v e r s i o n i f o a E p s o n r u n n i n g a i n t e r f a c e f r o m t h s e r i a l p o r t , s O P E Nc o m m a n d s h a v e b e e n c h a n g e d a c c o r d i n g l y .

1 3

Page 141: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 141/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

2 R E F U N C T I O N P L O T T E R3 0 R E M6 0 R E M F O R E P S O N M X / R X / F X1 2 I F X 7 . < 1 O X 5 C M 1 5 2 T H E N 1 1 2 3 F 0 R I = 0 T 0 73 1 O P E N 1 , 4 , 43 2 P R I N T # 1 , C H R * ( 2 7 ) " * S H A > " C H R * ( 8 ) ;3 3 0 A * = C H R * ( O )3 4 F 0 R H = Y 7 . - 7 T 0 0 S T E P - 83 5 P R I N T # 1 , C H R * ( 2 7 ) < S H L > " C H R * ( X 7 . A N D 2 5 5 ) C H R * ( X 7 . / 2 5 6 )3 8 I F Y < 8 A N D Y > = 0 T H E N P R I N T # l , Y * ( Y ) $ : N E X T : G 0 T 0 4 1 04 3 0 C L O S E 1R E A D Y .

L i n e 1 0 d e f i n e s t h f u n c t i o n o f t h e g r a p h i c o u t p u t . Y o c a d e f i n e t h i s f u n c t i o n a y o s e f i t — e x p e r i m e n t .

N e x t , y o a r a s k e d f o r t h e m o s t i m p o r t a n t p a r a m e t e r s . T h h o r i z o n t a l r e s o l u t i o n r e f e r s t t h w i d t h o f t h e g r a p h i c o p a p e r . A q u i c k t e s t , y o u c a n i n p u t s m a l l e r v a l u e( e . g . , 1 0 0 ) . T h i s w i l l g i v e y o n a r r o w g r a p h i c ( w h i c ht a k e s l e s s t i m e t p r i n t o u t ) . T h m a x i m u m i 4 7 9 , t h n u m b e r o p o s s i b l e g r a p h i c p o i n t s p e l i n e .

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

T h d e f i n i t i o n r a n g e V A L U E d e c i d e s t w h a t e x t e n t t h v e r t i c a l d i r e c t i o n s h o u l d t r a v e l . I f f o e x a m p l e ,p r i n t o u t d o e s n o t s h o w t h e d g e s o f s a y , s i n e c u r v eg r a p h i c , t h d e f i n i t i o n r a n g e s h o u l d b l a r g e r , s o t h a t a l lo f t h e p i c t u r e w i l l f i o n t o t h e p a p e r .

1 3

Page 142: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 142/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

A f t e r i n p u t t i n g t h e s e v a l u e s , v a r i a b l e s H a n V a r C A L C U L A T E D , w h i c h a r n e c e s s a r y f o d e t e r m i n i n g t h l o c a t i o n s o t h p l o t t e d p o i n t s . N e x t , t h p o s s i b l e b i p a t t e r n s a r c a l c u l a t e d a n s t o r e d i a r r a y d $ ( I ) ( i l i n e s2 3 0 - 2 6 0 ) . T h h i g h e s t b i i s e f o 7 - p i n p r i n t e r s ( + 1 2 8 ) ,s i n c e a m e n t i o n e d a b o v e , t h e g r a p h i c d a t a f o t h e s ep r i n t e r s l i e s i t h r a n g e f r o m 1 2 t 2 5 5 . H e r e i w h e r et h b i g d i f f e r e n c e s e x i s t b e t w e e n s u c h m a c h i n e s a n t h E p s o n m o d e l s . F o o n e t h i n g , t h e p i n s a r e n u m b e r e d f r o mb o t t o m t t o o n a n E p s o n , a n t h e r e a r p i n s i n s t e a d o 7 S o t h C o m m o d o r e v e r s i o n o f t h e p r o g r a m h a s i x f o l dl o o p i l i n e s 2 3 0 - 2 6 0 , w h i l e t h E p s o n v e r s i o n e x e c u t e ss e v e n f o l d l o o p . A n o t h e r d i s t i n c t i o n b e t w e e n t h e t w op r o g r a m s : T h s e q u e n c e o f p i n s c o u n t s i t h l o o p f r o m t

f o C o m m o d o r e p r i n t e r s , a n f r o m t f o r t h e o t h e rm a c h i n e .

I y o u a r e a d a p t i n g t h i s p r o g r a m f o r , s a y , a I t o h m a c h i n e ,k e e p i m i n d t h a t t h n e e d l e s e q u e n c e i s i m i l a r t C o m m o d o r e p r i n t e r s ( h i g h e s t = l , l o w e s t = 1 2 8 ) . T h l o o p a l s or u n s i r e v e r s e , s s h o u l d e x e c u t e f r o m t 0 T h f u n c t i o n s f o a l v a l u e s w i l l b r u t h r o u g h , a n d s t o r e d i Y ( l i n e s 2 7 0 - 3 0 0 ) .

N o f o r t h e p r i n t o u t , b e g i n n i n g w i t h t h o p e n i n g o t h p r i n t e r c h a n n e l . T h e O P E N c o m m a n d w i l l h a v e t b c h a n g e dt c o n c u r w i t h y o u r i n d i v i d u a l m o d e l o p r i n t e r .

T h p r i n t o u t o c c u r s i t w l o o p s . F i r s t l o o p i t h e l i n el o o p , w h i c h e x e c u t e s t h a m o u n t o v e r t i c a l r e s o l u t i o n i Y - i s t e p s o ( o p i n s - 6 a g a i n d e p e n d e n t o p r i n t e rm o d e l ) . L i n e 3 4 h a s t h e v a l u e w h i c h y o u ' l l h a v e t c h a n g ef o a 8 - p i n m o d e l . T h e s e c o n d l o o p r u n s f r o m t t h

1 3

Page 143: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 143/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

n u m b e r g i v e n f o r h o r i z o n t a l r e s o l u t i o n . T h e v a r i a b l e i u s e d i t h i s l o o p i c o n j u n c t i o n w i t h t h c o r r e s p o n d i n gv a l u e f o t h e X - a x i s . T h e l i n e l o o p d r a w s i t v a l u e f r o mt h i s f u n c t i o n v a l u e . I t h r e s u l t l i e s i t h r a n g e f r o mt ( 0 - 7 f o E p s o n ) , t h e n t h i s i i u m b e r i s u s e d t s e t u p t h p r o p e r p o i n t d i s t a n c e b e t w e e n l i n e s . T h e s e p o i n t p a t t e r n sa r p r e d e f i n e d i t h e i r p r o p e r s e q u e n c e i a r r a y Y $ I a l o t h e r c a s e s , o n l y v a l u e o f 1 2 8 w i l l b e s e n t t t h p r i n t e r , w h i c h p r o d u c e s b l a n k p o i n t s e q u e n c e . ( N O T E : i t h c a s e o a E p s o n , C H R $ ( 0 ) i s e n t .

S o h o p e f u l l y y o u ' v e g o a u n d e r s t a n d i n g o y o u r f i r s ta t t e m p t a s i n g l e - p i n g r a p h i c s ; w k n o w i t ' s n o e a s y t f o l l o w , b u y o c a n ' t t a k e t h e s e g r a p h i c s a n f a r t h e rw i t h o u t k n o w i n g w h a t ' s g o i n g o n Y o u ' l l f i n d k n o w l e d g e o t h b a s i c s e s p e c i a l l y i m p o r t a n t w h e n w o r k i n g o t h r e e -d i m e n s i o n a l f i g u r e s , w h i c h i n v o l v e s s o m e v e r y d i f f i c u l tp r o g r a m l o g i c t y i e l d g o o d l i k e n e s s .

T h i s c h a p t e r w i l l h e l p y o i a d a p t i n g t h f o l l o w i n gp r o g r a m s f o o t h e r p r i n t e r s , s i n c e n o e v e r y o n e o w n sC o m m o d o r e p r i n t e r .

1 3

Page 144: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 144/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

5 . 4 . 3 T h r e e - D i m e n s i o n a l H I R E S G r a p h i c s

O n t r u e c h a l l e n g e t p r o g r a m m e r i p r e p a r i n g t h r e e -d i m e n s i o n a l o b j e c t s u s i n g p r i n t e r . N o t h a t t h b a s i c s o o u t p u t a r t a k e n c a r e o f w c a n s e t t w o r k l e a r n i n g h o w t d t h i s s o r t o g r a p h i c . B f o r e w a r n e d , t h o u g h ; a l o n g w i t ht h p r o g r a m m i n g , s o m e k n o w l e d g e o m a t h e m a t i c s i n e c e s s a r y .

T h o b v i o u s p r o b l e m i 3 - p r i n t i n g l i e s i t h f a c t t h a tt h p a p e r i o n l y t w o - d i m e n s i o n a l . T h t h i r d d i m e n s i o n ,d e p t h , c a o n l y b e r e p r e s e n t e d b s h a d e s o b l a c k a n g r e y .S o c o n v i n c i n g t h r e e - d i m e n s i o n a l g r a p h i c s a r p o s s i b l e o n l yb y u s i n g s i n g l e - p i n c o n t r o l .

W e ' v e d e v e l o p e d t w p r o g r a m s w h i c h w i l l p r o d u c e n e a tp i c t u r e s o y o u r p r i n t e r . F i r s t l y , w e h a v e p r o g r a m w h i c hw i l l i l l u s t r a t e b a l l f o y o u . T h r e s u l t l o o k s r e m a r k a b l yl i k e i t ' s h a n d - d r a w n i v i e w e d f r o m d i s t a n c e .

T h s e c o n d p r o g r a m i s o r t o t h r e e - d i m e n s i o n a l f u n c t i o np l o t t e r . W i t h t h i s p r o g r a m , y o u c a m a k e s u r f a c e s o f l e x i b l e n a t u r e , s u c h a w a v e s ; t h i s m e a n s t h a t y o c a

m a k e d e s i g n s s u c h a s s a y , h a i p e r s p e c t i v e .

O t t h b a l l p r o g r a m : A l t h o u g h p r i m a r i l y d e s i g n e d f o d r a w i n g s p h e r e , t h i s c a n b e c h a n g e d f o o t h e r f i g u r e s a n e e d e d .

1 3

Page 145: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 145/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M I O D O R B 6

1 0 R E M * * * * * * * * * * * * * * * * * * * * * * * * * * * *1 1 R E * * 1 2 R E * 3 - B A L L * 1 3 R E * * 1 4 R E * * * * * * * * * * * * * * * * * * * * * * * * * * * *1 5 P R I N T C H R $ ( 1 4 7 )1 6 P R I N T " B A L L "1 7 I N P U T " D I A M E T E R I P O I N T S ( 4 8 0 M A X . ) " ; D1 8 H D = D / 2 : F F = D / 1 01 9 I N P U T " P R I N T E R O D I S K " ; D *2 0 I F D * = " P " T H E N O P E N 1 , 4 : P R I N T # 1 : P R I N T * 1 , C H R * ( 8 ) ;2 1 I F D * = " D " T H E N 0 P E N l , 8 , 4 , " 0 : B A L L D A T A , S , W "2 2 S K = 1 / 1 0 0 0 0 : R = l2 3 F 0 R I = 0 T 0 62 4 M K ( I ) = R2 5 R = R + R2 6 N E X T2 7 0 R = 02 8 D I M W E 7 . ( D )2 9 F O R Z = - 1 T O 1 S T E P 1 / H D3 0 0 Z Z = Z Z + 13 1 P R I N T Z Z ;3 2 0 R = R + 13 3 M Y = S Q R < 1 - Z * Z ) - S K3 4 Y = - M Y3 5 X = S Q R ( A B S ( 1 - Y * Y - Z * Z ) ) + S K3 6 A = S D R ( A B S ( ( 1 + Y * Y / X / X ) * ( 1 + Z * Z / X / X ) ) )3 7 S = 1 / A / F F3 8 I F S < O T H E N S = O3 9 Y = Y + S4 O I F Y > M Y T H E N W E 7 - ( H D + M Y * H D ) = W E " / - ( H D + M Y * H D ) O R M K < R — 1 ) G 0 T 0 4 3 04 1 W E 7 . ( H D + Y * H D ) = W E 7 . ( H D + Y * H D ) O R M K ( R - l )4 2 G 0 T 0 3 5 04 3 I F R > 6 T H E N G 0 S U B 4 9 04 4 N E X T Z4 5 I F R > 0 T H E N G 0 S U B 4 9 04 6 P R I N T # 1 , C H R * ( 1 5 )4 7 0 C L O S E 14 8 0 E N D4 9 F O R Q = 1 T O D5 0 P R I N T # 1 ? C H R * ( W E 7 - < Q ) + 1 2 S ) 55 1 W E 7 . < Q ) = 65 2 N E X T : P R I N T # l s R = O5 3 R E T U R NR E A D Y .

1 3

Page 146: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 146/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

O n c e t h p r o g r a m i s t a r t e d , y o u w i l l b a s k e d t i n p u t t h d i a m e t e r o f t h e b a l l t b p r i n t e d ; y o u r m a x i m u m d i a m e t e rw i l l b e 4 8 ( t h e n u m b e r o p o i n t s p e l i n e ) . R e m e m b e r t h a tt h s m a l l e r t h d i a m e t e r c h o s e n , t h f a s t e r t h p i c t u r e w i l lb e c o m p l e t e d . I y o d w a n t s p h e r e w i t h t h m a x i m u ma l l o w a b l e d i a m e t e r , t h e n y o u ' d b e t t e r n o b n e e d i n g y o u rc o m p u t e r f o t h e n e x t f e w h o u r s . T h e b e s t t h i n g t d i l e a v e y o u r s y s t e m r u n n i n g o v e r n i g h t t h n e x t m o r n i n gy o u ' l l h a v e y o u r p r i n t o u t . O f c o u r s e , t h i s i d e a i n o e v e r y o n e ' s c u p o f t e a , e i t h e r , s i n c e p r i n t e r s t e n d t m a k eg r e a t d e a l o n o i s e . A a l t e r n a t i v e t t h i s i t s a v e t h d a t a o d i s k e t t e ( w h i c h t a k e s c o n s i d e r a b l y l e s s t i m e t h a np r i n t i n g ) , a n d p r i n t i o u a l a t e r d a t e . T h i s h a s t h a d v a n t a g e o a l l o w i n g y o t p r i n t o u n u m b e r o i d e n t i c a ls p h e r e s i y o u w i s h , w i t h o u t r e g e n e r a t i n g t h p r o g r a m e v e r yt i m e .

Y o u ' l l n e e d t h f o l l o w i n g p r o g r a m t p r i n t o u y o u r d a t a .

1 0 0 P E N 4 , 41 1 P R I N T # 4 , C H R $ ( 8 >1 2 O P E N 1 , 8 , 4 , " B A L L D A T A , S , R "1 3 G E T # 1 , A * : I F S T = 6 4 T H E N 1 5 01 4 P R I N T # 4 , A * ; : G 0 T 0 1 3 01 5 P R I N T # 4 , C H R * ( 1 5 )1 6 C L 0 S E 41 7 C L O S E 1R E A D Y .

L e t ' s l o o k a g a i n a t h m a i n p r o g r a m , t h o u g h . A f t e r y o i n p u t t h e d i a m e t e r a n d t h e o u t p u t d e v i c e , t h n e c e s s a r y

v a l u e s a r e c o m p u t e d f r o m t h d i a m e t e r , s u c h a t h e r a d i u s ,t h l o c a t i o n o f t h e m i d d l e p o i n t , a n t h v a r i a b l e F ( f i l l

1 4

Page 147: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 147/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

f a c t o r ) , w h i c h w i l l b e v i t a l i d e t e r m i n i n g h o m a n y p o i n t sw i l l b e p r i n t e d a n d w h e r e . Y o u s h o u l d t r e x p e r i m e n t i n gw i t h t h i s l a s t v a r i a b l e ; s e h o l a r g e v a l u e i n e e d e d f o

p e r c e p t i b l e c h a n g e .

N e x t , t h p r i n t e r a n d d i s k d r i v e c h a n n e l s a r e o p e n e d , a n dt h v a r i a b l e s S K ( s e h r k l e i n , o v e r y s m a l l i E n g l i s h ) a n

a r i n i t i a l i z e d . S i a i n f i n i t e s i m a l n u m b e r w h i c hp r e v e n t s a n D I V I S I O N B Z E R O - E R R O R i l i n e 3 6 0 . T h v a r i a b l e R m e a n w h i l e , r e f e r s t t h e p i n s e q u e n c e , a n d w i l lb n e e d e d a t h b e g i n n i n g o t h p r o g r a m t s t o r e t h p r o p e r b i p a t t e r n s i t h a r r a y M K

T h p r o p e r c a l c u l a t i o n s a r p e r f o r m e d i t h F O R - N B X T l o o pi l i n e s 2 9 0 - 4 4 0 . W i t h i n t h a t s e t o l i n e s , 3 5 a n 3 6 0 a r eh e l d r e s p o n s i b l e f o r t h e s h a p e o t h d r a w i n g , w h i c h c h e c kv a r i a b l e f o n e e d l e s e q u e n c e . I f a l l p o i n t s a r f i g u r e df o r a l l p i n s , t h e n t h c a l c u l a t i o n s a r e s e n t t t h o u t p u td e v i c e , a n d t h n e x t r o w o p o i n t s a r w o r k e d o u t .

T h e r e i o n v a r i a b l e o p a r t i c u l a r i m p o r t a n c e t a d a p t a t i o nt o t h e r p r i n t e r s ; t h v a r i a b l e H D I c o n t r o l s t h n u m b e ri t h p o i n t s e q u e n c e i t h F O R - N E X T l o o p .

N o w , i t h s a m e w a y t h a t s o m e p r i n t e r s w i l l t a k e 1 0 1 0 p o i n t s a n p r o d u c e r e c t a n g l e i n s t e a d o s q u a r e ( w h i c h i w h a t y o u ' d l o g i c a l l y e x p e c t ) , t h e s e s a m e p r i n t e r s w i l lp r o b a b l y g i v e y o a e g i n s t e a d o s p h e r e . U s i n gp r o p e r p r o p o r t i o n o v e r t i c a l o h o r i z o n t a l r e s o l u t i o n , y o c a a d j u s t t h e g t s t a n d o n i t s s i d e , o r i t s e n d , o r m a k et h s p h e r e c o m e o u j u s t r i g h t . A l t h i s i c o n t r o l l e d b t h v a r i a b l e H D T h s m a l l e r H i s t h " f l a t t e r " t h s p h e r e , w h i l e h i g h e r v a l u e g i v e s a e g s t a n d i n g o e n d .

1 4

Page 148: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 148/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

O t h e r m o d i f i c a t i o n s c a b B a d e u s i n g t h c o n t r o l c o d e s f o s w i t c h i n g o g r a p h i c s . I o r d e r t c a l c u l a t e g r a p h i c d a t af o a 8 - p i n p r i n t e r , t h n e c e s s a r y i n f o r m a t i o n m u s t b p u i n t o v a r i a b l e ( d i a m e t e r ) . T h i s v a r i b l e s t o r e s t h n u m b e ro p o i n t s i h o r i z o n t a l r e s o l u t i o n .

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

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

T h i s p r o g r a m l e t s y o u m a k e p r i n t o u t s o f t h e m o s t c o m p l i c a t e df i g u r e s . A m a t t e r o f a c t , i w i l l a l l o w y o t d e s i g ns e r i e s o w a v e s o d i f f e r e n t l e n g t h a n d h e i g h t . T h p o s s i b i l i t i e s o f t h i s p r o g r a m a r e n d l e s s .

A w i t h a l B A S I C p r o g r a m s r e q u i r i n g g o o d d e a l o r e p e a t e dc a l c u l a t i o n s , t h i s p r o g r a m i q u i t e s l o w . A i l o f t h ep r o g r a m s i t h i s c h a p t e r , f o r t u n a t e l y , a r e a s i l y c o m p i l e d( t r y B A S I C 6 f r o m A b a c u s S o f t w a r e ) ; c o m p i l i n g w i l l g r e a t l yc u e x e c u t i o n t i m e .

U n d e r n o r m a l c o n d i t i o n s , a e n t i r e s u r f a c e c a t a k e u t t w o h o u r s , s o y o m i g h t w a n t t s a v e y o u r d a t a t d i s k e t t e .

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

1 4

Page 149: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 149/343

A B A C U S S o f t w a r e P R I N T B R B O O K f o t h C O M M O D O R B 6

1 0 P I = 3 - 1 4 1 5 91 1 D I M L . 7 . ( 4 8 0 ) N ( 6 H ( 4 X ( 4 Y ( 4 W ( 4 W ( 4 1 2 0 X = l1 3 F 0 R I = 0 T 0 61 4 N S < I ) = X1 5 X = X + X1 6 N E X T1 7 P R I N T C H R * ( 1 4 7 )1 8 P R I N T : P R I N T " 3 D - P L 0 T T E R "1 9 F 0 R I = 0 T a 4 8 02 0 L 7 . ( I ) = 1 2 82 1 N E X T2 2 1 = 2 3 P R I N T : P R I N T " B E S T V A L U E O R R A N G E "2 4 P R I N T " W I L L B E N C L O S E D I P A R E N T H E S E S "2 5 0 P R I N T : P R I N T " D O Y O U W A N T T O U T P U T T O 2 6 P R I N T : P R I N T " T H ( D I S D R I V E O T H ( P ) R I N T E R ? 1 12 7 I N P U T " " ; A *2 8 I F A * = " D " T H E N O P E N 1 , 8 , 4 , " 3 D - D A T A , S , W " : G 0 T 0 3 1 O2 9 I F A * = " P " T H E N O P E N l , 4 : 6 0 T 0 3 1 03 0 0 G O T O 2 7 03 1 P R I N T # 1 : P R I N T # 1 , C H R * ( 8 ) 53 2 P R I N T : P R I N T " P L E A S E G I V E P A R A M E T E R S "3 3 P R I N T : P R I N T3 4 I N P U T " V E R T I C A L D O T S " ; A * : L N 7 . = V A L ( A * )3 5 M F 7 . = ( L N 7 . * 2 / 3 ) I F L N 7 . < 1 0 R L N 7 . > 3 6 0 T H E N 3 4 03 6 P R I N T : I N P U T " N U M B E R O F E D G E S 1 - 4 ) " A * : N P 7 . = V A L ( A * )3 7 I N P 7 . < 1 0 R N P 7 - > 4 T H E N 3 6 03 8 P R I N T : I N P U T " L E F T B O R D E R ( 1 5 0 ) A * : L M 7 . = V A L < A * >3 9 P R I N T C H R * ( 1 4 7 ) : G 0 T 0 4 2 04 0 F O 1 T O N P 7 .4 1 P R I N T C H R * ( 1 9 )4 2 P R I N T : P R I N T " P O I N T N O . " I s P R I N T " P O S I T I O N ( T O " MF 7 - " ) " ;4 3 0 I F F F = 1 T H E N I N P U T A * : X P ( I ) = V A L ( A * )4 4 I F F F = O T H E N P R I N T4 5 0 P R I N T : P R I N T " P O I N T N O . " I : P R I N T " P O S I T I O N ( T O " MP V m "4 6 0 I F F F = 1 T H E N I N P U T A $ Y ( I = V A L ( A * ) M 7 . = M F 7 . / 74 7 0 I F F F = O T H E N P R I N T4 8 0 P R I N T : P R I N T " P O I N T N O . " I : P R I N T " W A V E L E N G T H < M 7 . " ) " ;4 9 0 I F F F = 1 T H E N I N P U T A * : W X ( I ) = 2 * P I / V A L ( A * )5 0 I F F F = O T H E N P R I N T5 1 0 P R I N T s P R I N T " P O I N T N O . " I : P R I N T " W A V E L E N G T H ( M 7 - " ) " ;

1 4

Page 150: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 150/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

5 2 I F F F = 1 T H E N I N P U T A * W ( > = 2 * P I / V A L ( A * ) M 7 . = L M 7 . + X P ( I - 2 5 3 I F F F = O T H E N P R I N T5 4 P R I N T : P R I N T " P O I N T N O . " I : P R I N T " H E I G H T ( 2 T O M 7 . " ) " ;5 5 0 I F F F = 1 T H E N I N P U T A * : H M < I ) = V A L < A * )5 6 0 I F F F = O T H E N F F = 1 s G 0 T 0 4 0 05 7 N E X T I : P R I N T5 8 0 G N = l / 1 0 0 0 0 : K = 0 : M M > . = 4 8 05 9 F O R I = 1 T G L N 7 . * 1 . 2 5 : P R I N T I ;6 0 I L = 2 0 0 0 : I H = - I L6 1 F O R J = 1 T O M F 7 .6 2 I T H E N J = M F 7 . : G 0 T 0 7 4 06 3 0 I X = ( I - J ) * 2 : I F I X > M F 7 . T H E N 7 4 06 4 X = I X : Y = J : Z = 7 X + L M 7 .6 5 F O R N = 1 T O N P 7 .6 6 X 1 = ( X - X P ( N ) ) * W X ( N ) + G N6 7 Y 1 = ( Y - Y P ( N ) ) * W Y ( N ) + G N6 8 W = S Q R ( X 1 * X 1 + Y 1 * Y 1 ) + G N : Z = Z - S I N < W ) / W * H M ( N )6 9 N E X T N7 0 I Z = Z7 1 I F I Z < 0 0 R I Z > M M 7 . G 0 T 0 7 4 07 2 I F I Z > I H T H E N I H = I Z : L 7 . ( I Z ) = L 7 - ( I Z ) 0 R N S ( K )7 3 I F I Z < I L T H E N I L = I Z : L 7 - ( I Z ) = L 7 . ( I Z ) 0 R N S ( K )7 4 0 N E X T J7 5 K = K + 17 6 0 I F K > 6 T H E N G 0 S U B 8 2 07 7 N E X T I7 8 0 I F K > O T H E N G 0 S U B 8 2 07 9 G 0 S U B 8 2 08 0 P R I N T # 1 5 C H R * ( 1 5 ) : C L O S E 18 1 E N 8 2 F O R J = 1 T O M M 7 .8 3 P R I N T # 1 , C H R * ( L 7 . J ; L 7 ( J = 1 2 88 4 N E X T J : K = O : P R I N T : P R I N T # 18 5 R E T U R NR E A D Y .

1 4

Page 151: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 151/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

Y o h a v e t h o p t i o n o c h o o s i n g o u t p u t e i t h e r s t r a i g h t t t h p r i n t e r , o f i r s t t t h d i s k d r i v e . S h o u l d y o u s t o r ey o u r d a t a o d i s k e t t e , y o u c a p r i n t i o u l a t e r u s i n g t h s h o r t l o a d e r p r o g r a m w h i c h w g a v e y o w i t h t h b a l lp r o g r a m . O n r e m i n d e r , t h o u g h : R e m e m b e r t p u i t h p r o p e r f i l e n a m e , o e l s e y o u ' l l g e F I L E N O F O U N Dm e s s a g e .

T h p r o g r a m w i l l a s y o f o s o m e p a r a m e t e r s . W s u g g e s tt h a t f o r t e s t i n g p u r p o s e s , y o u c h o o s e t h m o s t c o n v e n i e n tv a l u e s o r a n g e s .

F i r s t , y o u ' l l b a s k e d f o r t h e n u m b e r o v e r t i c a l p r i n tp o i n t s . s m a l l e r v a l u e ( 5 8 p o i n t s ) w i l l d o f o rd e m o n s t r a t i o n . O n c e y o s e t h a t t h p r o g r a m w o r k s w e l l ,t h e n y o c a i n c r e a s e t h n u m b e r .

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

w h e n y o u t h r o w s t o n e i n t o p o n d ( p r o d u c i n g r i p p l e s ) .

A f t e r t h i s i n p u t , m a s k a p p e a r s o t h s c r e e n , i n t o w h i c ht h p a r a m e t e r s f o p o s i t i o n i n g s h o u l d b g i v e n ( i . e . ,w a v e l e n g t h ) .

M a y b e y o u ' v e b e e n w o n d e r i n g w h t h w a v e l e n g t h i g i v e n i a n r e g i s t e r s . W e l l , t h i s l e t s y o c r e a t e o v a l w a v e f o r m s ,r a t h e r t h a n j u s t c i r c u l a r s y s t e m s .

O n c e a l l i n p u t h a s b e e n g i v e n , t h e m a j o r c a l c u l a t i o n s t a k ep l a c e . T h e f a c t o r 1 . 2 5 i l i n e 5 9 0 c a n v a r y f r o m p r i n t e r t p r i n t e r , a c a t h p r o p o r t i o n o h o r i z o n t a l a n v e r t i c a lp r i n t p o s i t i o n s . I t h m o s t e x t r e m e c a s e , t h w a v e c a e n

1 4

Page 152: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 152/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

u a s a n o v a l , d e s p i t e e q u a l n u m b e r s f o a n Y T h e b e s ty o c a d u n d e r t h e s e c i r c u m s t a n c e s i e x p e r i m e n t w i t hs m a l l e r a n l a r g e r n u m b e r s u n t i l y o u f i n d t h m o s t w o r k a b l ec o m b i n a t i o n .

L i n e s 6 2 0 - 6 7 0 c a l c u l a t e t h e p o i n t s , w h i l e 6 9 0 - 7 2 0 d e c i d eo t h v i s i b i l i t y o t h p o i n t ( w h e t h e r t p r i n t i o r n o t ) .T h i s c o r r e s p o n d s w i t h t h b i p a t t e r n p r o p e r f r o m a r r a y N S T h p r i n t o u t r o u t i n e i l i n e s 8 1 0 - 8 3 0 i a l m o s t i d e n t i c a l t t h s p h e r e p r i n t o u t r o u t i n e .

S o w c o m e t t h e n o t h i s c h a p t e r . W i t h t h e s ep r o g r a m s a n l i t t l e i m a g i n a t i o n y o u c a c o m e u w i t hp r a c t i c a l l y a n g r a p h i c y o w i s h . I y o k e e p g e t t i n g t h i n f a m o u s S Y N T A X E R R O R i y o u r f i r s t a t t e m p t s , h a v e c o u r a g e :P r o g r a m m i n g g e t s e a s i e r w i t h e x p e r i e n c e .

1 4

Page 153: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 153/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

6 . P R I N T E R P R I N C I P L E S

L o o k i n g a a o l t y p e w r i t e r a n h i g h - t e c h p r i n t e r w i l lt e l l y o t h a t p r i n t i n g h a c o m e l o n g w a i t h e l a s t f e y e a r s . A f t e r t h i n t r o d u c t i o n o e l e c t r o n i c d a t a p r o c e s s i n ge q u i p m e n t , w h i c h o f f e r e d c a l c u l a t i o n s a l i g h t n i n g s p e e d , i w a d i s c o v e r e d t h a t t h e s e s a m e c a l c u l a t i o n s d i d n ' t m a k e i t p a p e r q u i t e s q u i c k l y . I t ' s h a r d t b e l i e v e ( o a d m i t )t h a t p a p e r i s t i l l t h m o s t i m p o r t a n t d a t a m e d i u m . L o o k a i t h i s w a y : W h e n w a t h e l a s t t i m e y o m a d e h a n d w r i t t e nn o t e s o d i s k e t t e ?

W h a t h a p p e n s w h e n r e m o t e p r i n t i n g i r e q u i r e d ? T h e m o s tp o p u l a r a n s w e r l i e s i t h g o o d o l d t e l e t y p e . M a n y c o m p u t e rf r e a k s s a y t h a t t h e s e d a y s , t h t e l e t y p e s a r e a s i l ya f f o r d a b l e , b u w i t h p r i n t s p e e d s i u p w a r d s o s i c h a r a c t e r s p e s e c o n d ( w h o o s h ) , t h o s e o l d m a c h i n e s a r d e f i n i t e l y n o p r i z e w i n n e r s .

M a i n f r a m e c o m p u t e r s h a v e m a n y n e w , f a s t p r i n t i n g p r o c e d u r e s .S i n c e t h f i r m s t h a t o w n s u c h m a c h i n e s h a v e l o t s o s p a c e t w o r k w i t h , i t ' s p o s s i b l e t f i n d p r i n t e r s t h s i z e o c l o s e t s i e x i s t e n c e . D o n ' t l e t h s i z e f o o l y o t h e s ep r i n t e r s c a p r o d u c e 6 0 l i n e s p e r m i n u t e ( ! ) . T h e s ep r i n t e r s u s u a l l y r e s i d e i c e n t r a l s p o t i t h e r o o m , s t h e m p l o y e e s c a e a s i l y g e t h e i r p r i n t o u t s .

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

1 4

Page 154: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 154/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

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

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

T h p r i n t e r s f o u n d i m o s t h o m e s c a n b e d i v i d e d i n t o t h r e eg e n e r a l t y p e s , c o r r e s p o n d i n g w i t h t h e i r m e t h o d s o p r i n t i n ga n o p e r a t i o n . W e h a v e l i s t e d t h e s e t h r e e t y p e s b e l o w .

1 4

Page 155: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 155/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

6 . T h D a i s y - W h e e l P r i n t e r

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

v i t a l p r e r e q u i s i t e t w o r k i n g w i t h s t a n d a r d p r i n t e r p a p e r( " e n d l e s s " s h e e t s , c o n n e c t e d w i t h p e r f o r a t i o n s ) i t h a s s u r a n c e t h a t t h e p a p e r d o e s n ' t m o v e h o r i z o n t a l l y . M o s tb a l l - h e a d t y p e w r i t e r s a r s c o m p l i c a t e d t h a t t h e b a l lr e m a i n s s t a t i o n a r y , w h i l e t h r o l l e r i o c a r r i a g e ,m o v i n g t h p a p e r a c r o s s t h p r i n t h e a d . I f e e x c e p t i o n a lc a s e s , t h e p r i n t b a l l i m o v e a b l e , b u h o r i z o n t a l m o v e m e n t o t h b a l l i v e r y e x p e n s i v e p r o p o s i t i o n .

A i t h i s w e r e n ' t e n o u g h , t h t y p e b a l l s t h e m s e l v e s a r q u i t e e x p e n s i v e , a n d h a v i n g n u m b e r o t y p e f a c e s a v a i l a b l ec a n r u n i n t o g r e a t d e a l o m o n e y .

T h e r e f o r e , m a n y t h o u g h t a b o u t s o l v i n g t h e s e d i f f i c u l t i e s .L e t ' s s e e , w n e e d s i m p l e a n i n e x p e n s i v e c o u n t e r p a r t t t h b a l l - h e a d , w h i c h c a b e a s i l y m o v e d a c r o s s t h p a p e r ,t p r e v e n t t h p a p e r i t s e l f F R O M M O V I N G

T h d a i s y - w h e e l w a b o r n . T h e p r i n c i p l e i i n g e n i o u s l ys i m p l e : Y o u t a k e d i s k w i t h c i r c u m f e r e n c e a l a r g e a n e e d e d t o f i t t h n e c e s s a r y c h a r a c t e r s , n u m b e r s a n s p e c i a lc h a r a c t e r s ; f i i w i t h i t c e n t e r c o n n e c t e d t s m a l lm o t o r ; d r i v e t h m o t o r u n t i l i r e a c h e s t h d e s i r e dc h a r a c t e r ; a n p r e s s t h c h a r a c t e r a g a i n s t t h p a p e r . S o m et o t y p e w r i t e r s w o r k o t h i s p r i n c i p l e , o n l y y o u h a v e t t u r n t h w h e e l b y h a n d .

1 4

Page 156: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 156/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

N a t u r a l l y , t h e n t i r e d i s k i s n ' t p u s h e d a g a i n s t t h p a p e ro n l y t h s e g m e n t c o n t a i n i n g t h c h a r a c t e r w w a n t . I o r d e rt a c c o m p l i s h t h i s , t h d i s k i c u i n t o t o n g u e s r a d i a t i n gf r o m t h c e n t e r . A t h h i g h e s t p o i n t o t h p r i n t w h e e l ,y o u ' l l s e t i n y e l e c t r i c a l l y p r o p e l l e d h a m m e r , w h i c hf o r c e s t h c h a r a c t e r s i n t o t h e r i b b o n , t h e n t h e p a p e r .

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

L e t ' s d i g r e s s f o m o m e n t , t t h s u b j e c t o s t e p p i n g -m o t o r s : m o t o r r u n s t h e m o m e n t t h a t c u r r e n t i t u r n e d o n W h e n t h c u r r e n t i s h u t o f f , n o r m a l m o t o r w i l l c o n t i n u et r u n f o r f e r e v o l u t i o n s b e f o r e c o m i n g t s t a n d s t i l l .T h i s s o r t o m o t o r j u s t i s n ' t s u i t e d f o p o w e r i n g d a i s y -w h e e l , s i n c e w w a n t t h m o t o r t s t o p a t h p o i n t t h a t w es p e c i f y . s t e p p i n g - m o t o r , o t h o t h e r h a n d , s t a r t s a n s t o p s a p r e d i c t a b l e p o i n t s .

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

T h p r i n t q u a l i t y o s u c h m a c h i n e i f i r s t - c l a s s .C h a n g i n g t y p e f a c e s ( f o n t s ) i s i m p l e m a t t e r o c h a n g i n gt h d a i s y - w h e e l .

D a i s y - w h e e l m o v e m e n t t a k e s s o m e t i m e ; t h e r e f o r e , d o n ' te x p e c t i n c r e d i b l e a m o u n t s o s p e e d f r o m t h i s t y p e o p r i n t e r( f i g u r e o 1 5 - 8 0 c h a r a c t e r s p e r s e c o n d ) . P r i c e i m o r e - o r -l e s s i p r o p o r t i o n t t h s p e e d o t h p r i n t e r . T h p r i c ec a b a l o a $ 3 5 0 , a n a h i g h a w e l l , u s y o u ri m a g i n a t i o n .

1 5

Page 157: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 157/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

6 . T h P a r a l l e l M a t r i x P r i n t e r

I s t r i v i n g f o h i g h - s p e e d p r i n t i n g a l o p r i c e , n e p a t h s h a d t b c l e a r e d . T h t y p i n g p r i n c i p l e , w h i l e v e r yp r e t t y , w a s u n s u i t a b l e f o m o v i n g q u i c k l y . S o a n o t h e rs y s t e m a l t o g e t h e r h a d t b e d e v e l o p e d .

T h b a s i c r e q u i r e m e n t f o r t h i s n e s y s t e m w a t h i s : P r i n ta m a n y c h a r a c t e r s a p o s s i b l e , w i t h a l i t t l e m o v e m e n t a p o s s i b l e . A d d i t i o n a l l y , t h c h a r a c t e r s s h o u l d b m a d e u o

m i n i m u m o i n t e r c h a n g e a b l e s e g m e n t s , r a t h e r t h a n u s i n gs p e c i f i c l e t t e r - f o r - l e t t e r s e t u p .

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

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

p o i n t c a b d r a w n b f o r c i n g p i a g a i n s t t y p e w r i t e rr i b b o n a n d p a p e r . T h e s e p i n s h a v e l i t t l e p r o b l e m s w i t hi n e r t i a ( t h e y a r e s m a l l a n l i g h t ) , a n d c a n t h e r e f o r e m o v es w i f t l y .

T h a d v a n t a g e t t h i s p r i n c i p l e l i e s r i g h t b e f o r e y o u : Y o a r e n ' t l i m i t e d t o n f i x e d c h a r a c t e r s e t . R a t h e r , y o u c a c a l l u v i r t u a l l y a n t y p e o c h a r a c t e r y o w i s h , j u s t a y o w e r e w o r k i n g w i t h s i n g l e - p i n h i g h - r e s o l u t i o n g r a p h i c s i t h l a s t c h a p t e r .

1 5

Page 158: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 158/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

T h c h a r a c t e r s e i b u i l t i n t o t h e o p e r a t i n g s y s t e m o t h p r i n t e r . Y o u c a n s e e h o i i d e s i g n e d b p e e k i n g a h e a d t S e c t i o n 7 . 3 . T h c h a r a c t e r s e s i m p l y t a k e s t h c h a r a c t e r ss e n t f r o m t h c o m p u t e r , c o m p a r e s t h e m t t h p r i n t e r ' sv a l u e s , a n d d r i v e s t h n e e d l e s o n t o p a p e r a c c o r d i n g l y . T h e n d r e s u l t i t h p r i n t e d c h a r a c t e r .

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

T h p r i n t s p e e d c a v a r y f r o m 1 0 0 - 4 0 0 c h a r a c t e r s p e s e c o n d .T h i s s p e e d d r o p s t 2 0 - 4 0 c h a r a c t e r s p e s e c o n d i " l e t t e r -q u a l i t y ' 4 m o d e , i w h i c h t h p r i n t h e a d m a k e s t w p a s s e s i p r i n t i n g l i n e , s h i f t i n g b t i n y f r a c t i o n o t h s e c o n dp a s s . T h u s , t h l e t t e r s a r b i t t h i c k e r , a n d m o r ed i s t i n c t . W i t h s o m e m o d e l s , y o u h a v e t l o o k v e r y c l o s e l yt s e e t h e d i f f e r e n c e b e t w e e n d a i s y - w h e e l p r i n t a n " l e t t e r -q u a l i t y ' 1 d o t - m a t r i x p r i n t i n g .

P r i c e s c a g f r o m $ 1 5 0 . 0 0 t $ 7 0 0 . 0 0 .

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

1 5

Page 159: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 159/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

6 . T h S e r i a l M a t r i x P r i n t e r

T h i s t e r m w a u n k n o w n u n t i l q u i t e r e c e n t l y . I a p p l i e s t t h o s e w h o o w c o m p u t e r i t h u n d e r - $ 1 5 0 . 0 0 b r a c k e t ( s u c ha t h V I C - 2 0 a n d , a t t i m e o w r i t i n g , t h C - 6 4 ) .E x p e r i e n c e s h o w s t h a t m o s t p e r i p h e r a l d e v i c e s ( i n c l u d i n gp r i n t e r s ) t e n d t c o s t g o o d d e a l m o r e t h a n t h c o m p u t e ri t s e l f . R e s o u r c e f u l t e c h n i c i a n s h a v e s u c c e e d e d i r e d u c i n gt h p r i n t m e c h a n i s m t t h b a r e s t m i n i m u m , t h u s d r i v i n g t h p r i c e o p r i n t e r e q u a l t o b e l o w t h p r i c e o f t h ec o m p u t e r .

H o i t h i s p o s s i b l e ? S i m p l e ; t h e p r i n c i p l e s u s e d i C h a p t e r 6 . h a v e b e e n c u t d o w n , b d e c r e a s i n g t h n u m b e r o n e c e s s a r y s e g m e n t s i t h p r i n t h e a d . I f a c t , t h n u m b e ro s e g m e n t s h a b e e n c u d o w n t O N n e e d l e i t h e h e a d .

T h i s s i n g l e n e e d l e p o s e s p r o b l e m , t h o u g h o n l y s i n g l e -l i n e p r i n t i n g i p o s s i b l e , u n l e s s w h a v e s o m e w a y o m o v i n gt h p a p e r a n d / o r h e a d v e r t i c a l l y a w e l l a h o r i z o n t a l l y .Y o c o u l d n ' t p o s s i b l y c o n v i n c e a n y o n e t h a t t h i s m e t h o d i c h e a p e r t h a n m o s t .

N e i t h e r h e a d n o p a p e r m o v e . ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

T h a n s w e r t t h i s p r o b l e m i i n c r e d i b l y s i m p l e . D e s c r i b i n gt h i s p r i n c i p l e v e r b a l l y j u s t w o n ' t w o r k ; p l e a s e l o o k a t h i l l u s t r a t i o n o t h n e x t p a g e f o c r o s s - s e c t i o n o t h s y s t e m .

1 5

Page 160: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 160/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

D i a g r a m o S e r i a l D o M a t r i x P r i n t e r

1 5

Page 161: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 161/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

U u n t i l n o w , t h e t w o m e t h o d s o p a p e r t r a n s p o r t h a v e b e e nf r i c t i o n - f e e d ( r u b b e r r o l l e r ) a n d t r a c t o r - f e e d ( p i n s f i t t i n gi n t o p e r f o r a t i o n s o t h p a p e r b o r d e r s ) . H e r e , h o w e v e r , w eh a v e " s p i k e d r o l l e r " t w o r k w i t h . T h i s s p i k e d r o l l e r i c o u p l e d c l o s e l y w i t h t h h e a d - m o v e m e n t m e c h a n i s m . T h e h e a d ,o c o u r s e , h a s i t o w c a r r i a g e . T h p r i n t h a m m e r i n l o n g e r d e s i g n e d a n e e d l e , b u r a t h e r a s m a l l b l o c k .T h u s , w h e n p o i n t i l e f t o t h p a p e r , b o t h h a m m e r a n r o l l e r m o v e i t h e i r r e s p e c t i v e d i r e c t i o n s .

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

T h o p e r a t i n g s y s t e m o t h i s p r i n t e r k n o w s w h e n t h h a m m e rs h o u l d b m o v e d , a n w h e n t h r o l l e r s h o u l d m o v e . I c o o r d i n a t e s m o v e m e n t s u s i n g " t i m e d i s k " , i w h i c h s l o t i m o v e d p a s t t i n y l i g h t b o x . l i g h t i m p u l s e f i r e s t h h a m m e r , a n d s h i f t s t h r o l l e r b y o n p o i n t - t h i c k n e s s .

T h s p e e d o t h i s p r i n t e r i s n ' t e x a c t l y t h r i l l i n g , s i n c e t h p r i n t h a m m e r h a t m o v e m u c h m o r e o f t e n t h a n p a r a l l e lm a t r i x p r i n t h e a d s , t a c c o m p l i s h t h s a m e j o b . F i g u r e o 5 0 - 8 0 c h a r a c t e r s p e r s e c o n d .

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

1 5

Page 162: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 162/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

{ T h i s p a g e l e f t b l a n k i n t e n t i o n a l l y }

1 5

Page 163: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 163/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

7 . T H O P E R A T I N G S Y S T E M O T H M P 8 0

M u c h h a b e e n w r i t t e n a b o u t o p e r a t i n g s y s t e m s o e v e r yc o n c e i v a b l e k i n d , a l t h o u g h t o u k n o w l e d g e , p r i n t e ro p e r a t i n g s y s t e m s h a v e y e t b d o c u m e n t e d . I i o u o p i n i o n t h a t t h i s b o o k w o u l d h a r d l y b w e l l - r o u n d e d p i e c eo w r i t i n g i s o m e t h i n g w e r e n o i n c l u d e d f o b o t h a d v a n c e dh o b b y i s t s a n l a i t y a l i k e . P e r h a p s " o p e r a t i n g s y s t e m " i p o m p o u s - s o u n d i n g t e r m t u s f o p r i n t e r ; b u t a y o u ' l ls o o n s e e , t h s i m p l e r p r i n t e r ' s d e s i g n , t h e m o r e p o w e r f u li t o p e r a t i n g s y s t e m .

T h M P 8 0 i s p r i m e e x a m p l e o m i n i m u m e x p e n s e i d e s i g n .I f a c t , i t ' s p r i n t e r t h a t o p e r a t e s o t h p r i n c i p l ed i s c u s s e d i C h a p t e r 6 . ( i . e . , t h M P 8 0 i s e r i a lm a t r i x p r i n t e r ) . W c h o s e t h M P 8 0 b e c a u s e i t ' sr e l a t i v e l y n e o t h m a r k e t , a n d b e c a u s e i w i l l g i v e y o ug o o d i d e a a t h o t h s e r i a l p r i n t e r w o r k s .

I w a s n ' t e a s y t g a t h e r i n f o r m a t i o n o t h i s o p e r a t i n gs y s t e m : T b e g i n w i t h , w h a t w r i t e d i s a s s e m b l e r f o t h 8 0 3 9 m i c r o p r o c e s s o r . N e x t c a m e t h p r o b l e m s w i t h t h d i f f e r e n t c o m m a n d s e ( w e ' r e a c c u s t o m e d t 6 5 0 2 o Z 8 m a c h i n e l a n g u a g e , n o 8 0 3 9 ) .

A l m o s t a t r o u b l e s o m e D w a s t h c o m m e n t a r y , f o w h i c h w e ' l lo f f e r a p o l o g i e s n o w . N o w u n d e r s t a n d t h i s p r o c e s s o r . T h 8 0 3 9 h a s o m e s i m i l a r i t i e s t t h 6 5 1 0 m i c r o p r o c e s s o r , b u t h i d i o s y n c r a c i e s o t h f o r m e r c a u s e d u l o o t r o u b l ew h i l e l e a r n i n g a b o u t i t

B e f o r e g o i n g o t t h m / l i s t i n g , l e t ' s e x p l o r e s o m eh a r d w a r e , a n t h b l o c k d i a g r a m s o o n t c o m e .

1 5

Page 164: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 164/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

7 . T h 8 0 3 9 M i c r o p r o c e s s o r

T h e 8 0 3 9 b e l o n g s t t h c l a s s o m i c r o p r o c e s s o r k n o w n a " s i n g l e - c h i p " , i . e . , i t i s s e l f - c o n t a i n e d i h a v i r t u a l l ya l t h i n f o r m a t i o n i n e e d s f o r u n n i n g t h h a r d w a r e ,w i t h o u t b e n e f i t o s u p p l e m e n t a r y c h i p s , o I / O p o r t s . A l lt h a t i d o e s r e l y o i e x t e r n a l p r o g r a m m e m o r y t t e l l i w h a t t p r i n t ; t h e c h i p i t s e l f r u n s t h e m o t o r s a n c a r r i a g e .

H e r e a r f e s p e c i f i c a t i o n s :1 2 b y t e s R A MC o u n t e r / T i m e r1 I / l i n e s

* s e p a r a t e t e s t i n p u t s

M i n d y o u , t h i s i a l i n s i d e t h i s o n c h i p .

N o w , f o a l i t c o m p a c t n e s s , t h e r e a r s o m e p r o b l e m s . O n ei t h a t o n l y 2 o p r o g r a m m e m o r y c a b a d d r e s s e d a t i m e . f u r t h e r 2 c a b e s w i t c h e d o n b u y o u s t i l l o n l yh a v e 4 m a x i m u m . A n o t h e r l i m i t a t i o n i t h a t t h e s t a c k o n l yh a e i g h t l e v e l s , s s u b p r o g r a m m i n g i l i m i t e d t s m a l la r e a , b u t m o s t o f t h e s t a c k i s e l d o m u s e d a n y w a y .

N o f o s o m e c o m m a n d s w h i c h y o u ' v e p r o b a b l y n e v e r h e a r d o f

J u m p C o m m a n d s :

j t O o r j n t O : j u m p i l i n e T i h i g h o l o j t o j n t l : a a b o v e , b u f o r l i n e T j n j u m p i l i n e I N T = l o wj f j u m p w h e n f l a g O i s e j f a a b o v e , b u f o r f l a g l

1 5

Page 165: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 165/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

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

A l j u m p c o m m a n d s , w i t h t h e x c e p t i o n o f j m p a n d c a l l , c a o n l y j u m p w i t h i n p a g e o m e m o r y . T h e r e f o r e , t h e i ro p e r a n d s a r o n l y o n b y t e i l e n g t h . F o r e x a m p l e :

O A B F j n 0

T h j u m p ( w h i c h o c c u r s w h e n t h c o n t e n t s o f t h e a c c u m u l a t o ra r u n e q u a l t 0 w i l l n o t b e t 0 0 0 0 a e x p e c t e d , b u t 0 A 0 0 . I o t h e r w o r d s , o u r e x a m p l e i l i m i t e d i j u m p s i z et p a g e 0 A

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

0 0 0 0 s e m b 0 0 0 1 j m p 0 0 0

T h i s j u m p d o e s n ' t g t 0 0 0 0 , b u t 0 8 0 0 , a t h m e m o r y h a b e e n s h i f t e d a r o u n d f i r s t . T h l o w e r 2 r a n g e c a n b eb r o u g h t b a c k w i t h t h c o m m a n d s e l m b O , a n m o v e d b a c k t t h u p p e r s e a g a i n w i t h s e m b l . O u e x a m p l e r e q u i r e s t h i sc h a n g e , o t h e r w i s e t h e x a m p l e w o u l d n o b e x e c u t a b l e .

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

1 5

Page 166: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 166/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

T r a n s f e r C o m m a n d s : T r a n s f e r r i n g r e f e r s t m o v i n g c o n t e n t st a n f r o m t h a c c u m u l a t o r . I m m e d i a t e o p e r a t i o n s ( p r e c e d e dw i t h # a r o b v i o u s l y t r a n s f e r r e d i m m e d i a t e l y , a o p p o s e d t w a i t i n g f o s i g n a l o s p e c i f i c a d d r e s s .

M e m o r y L a y o u t : A y o u c a n s e f r o m t h m e m o r y m a o t h n e x t p a g e , m e m o r y i d i v i d e d i n t o t w o r e g i s t e r b a n k s , t h s t a c k , a n r e m a i n i n g m e m o r y . T h m e m o r y c a n b e i n d i r e c t l ya d d r e s s e d f r o m a l p o s i t i o n s . D i r e c t a c c e s s i p o s s i b l ew i t h i n c e r t a i n r a n g e s .

E x a m p l e :0 0 0 0 m o r l , # 0 30 0 0 2 s e l r b l0 0 0 3 m o v r l , # 0 4

T h e f i r s t c o m m a n d l o a d s m e m o r y c e l l 1 t h e t h i r d c o m m a n d ,h o w e v e r , l o a d s m e m o r y c e l l 2 5 s i n c e r e g i s t e r b a n k h a b e e n s w i t c h e d b y t h s e c o n d c o m m a n d . I c a n b e c h a n g e d b a c ku s i n g s e r b O . Y o u ' v e p r o b a b l y n o t i c e d t h a b s e n c e o c o m p a r i s o n c o m m a n d s . T h 8 0 3 9 d o e s n ' t c a r r y t h o s e c o m m a n d si i t s s e t . C o m p a r i s o n s c a b d o n e o n l y i n d i r e c t l y . F o e x a m p l e , y o h a v e v a l u e i t h a c c u m u l a t o r , a n y o u w a n tt k n o w i f t h e v a l u e i e q u a l t 3 H e r e ' s w h a t t d o

0 1 2 3 a d d a , # F D0 1 2 5 j 4

I t h a c c u m u l a t o r d i i n d e e d c o n t a i n 3 t h j u m p w i l l b e x e c u t e d . G r a n t e d , t h i s i r o u n d a b o u t w a o d o i n g t h i s ,b u i w o r k s . W e ' l l l e a v e i t a t t h a t f o r n o w . Y o u w i l lf i n d e x a m p l e s a n e x p l a n a t i o n s o I / p r o g r a m m i n g i t h n e x t c h a p t e r .

- 1 6 0

Page 167: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 167/343

A B A C U S S o f t w a r e P R I N T B R B O O K f o r t h e C O M M O D O R E 6

A D R .

8 0 3 9 M e m o r y - M a n

2

3

R

R E G I S T E RB A N K O

2

R

S T A C K

R

R E G I S T E RB A N K 1

R 3

1 2

F R E EM E M O R Y

I t h M P S - 8 0 1 . m e m o r y l o c a t i o n s 3 t h r o u g h 1 2 a r u s e d a i n p u t l i n e

b u f f e r .

1 6

Page 168: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 168/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

7 . B l o c k D i a g r a . o t h M P 8 0

P r a c t i c a l l y a l l o f t h 8 0 1 ' s w o r k i n g s a r d i s p l a y e d i t h b l o c k i l l u s t r a t i o n . O u o v e r v i e w f e a t u r e s p r o g r a m m e m o r yo n l y , s o w e h a v e o m i t t e d t h d r i v e r s f o t h m o t o r s y s t e m ,e t c . W w a n t t s p e n d s o m e t i m e h e r e j u s t e x p l a i n i n g s o m es i g n a l n a m e s .

T h l e f t - h a n d s i g n a l s b e l o n g t t h s e r i a l b u s , w h i c h y o m i g h t w a n t t r e v i e w i C h a p t e r 2 . 1 . T h r i g h t - h a n d s i g n a l sc o n t r o l t h i n t e r n a l w o r k i n g s o t h e p r i n t e r .

T E S T T h i s s i g n a l t e s t s f o t h s w i t c h a t h r e a r o t h p r i n t e r . L i n e l o i t h i s T E S T s o u t .

4 / T h i s i a l s o s w i t c h s i g n a l , a n i l o w h e n t h s w i t c h o d e v i c e a d d r e s s i s o n ; o t h e r w i s e , i i h i g h .

T I M E W H E E L T h i s i t h s i g n a l d i s c u s s e d i C h a p t e r 6 . 3 .

S T A R T P O S I T I O N P u t s t h e p r i n t c a r r i a g e t t h l e f t ,i n t e r r u p t e d b l i g h t b o x . I t h i s b e t h e c a s e , t h i ss i g n a l h i g h .

L F - K E Y W h e n t h l i n e f e e d k e y i p r e s s e d , t h i s l i n e l o w .

H E A D M O T O R O N T h i s o u t p u t i l o w h e n t h t r a n s p o r tm e c h a n i s m f o r t h e p r i n t h e a d i m o v i n g . I s i m u l t a n e o u s l yt u r n s t h r o l l e r a n t i m i n g d e v i c e .

C A R R I A G E R E T U R N O l o r e a d i n g o t h i s l i n e r e l e a s e sc o u p l i n g w h i c h s e p a r a t e s t h p r i n t h e a d f r o m t h d r i v e r ,s p r i n g t e n s i o n s e n d s t h p r i n t h e a d t t h s t a r t p o s i t i o n .

1 6

Page 169: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 169/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h C O M M O D O R E 6

L I N E F E E D O T h i s i t h m a i n p o w e r s u p p l y f o t h l i n e f e e dt r a n s p o r t s t e p - m o t o r . I a c t u a l i t y , t h m o t o r o n l y m o v e sw h e n s i g n a l i s e n t o v e r l i n e s L F 1 , L F 2 , L F A N L F 4 .

P R I N T H A M M E R O A t h n a m e i n d i c a t e s , l o r e a d i n g f i r e st h p r i n t h a m m e r .

P r o g r a m m i n g t h P o r t L i n e s :

S i g n a l o u t p u t i d i r e c t l y c o n t r o l l e d a r u l e . l o r e a d i n g c a b p r o d u c e d u s i n g l o g i c a l A N D , h i g h w i t hl o g i c a l O R e . g . :

0 0 1 1 a n p l , # F E0 0 1 3 o r p i , # 0 1

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

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

0 0 2 5 m o v a , p 20 0 2 6 j b 4

T h i s s e q u e n c e w i l l j u m p t o 0 0 4 7 , i t h a d d r e s s s w i t c h r e a d s4

T h e l i n e s T a n T c a b f o u n d i t h a b o v e m e n t i o n e dm a t e r i a l o j u m p c o m m a n d s j t O , j t l , j n t O a n j n t l .

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

1 6

Page 170: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 170/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

B l o c k D i a g r a m o t h M P 8 0

t

t o » ~

1 6

Page 171: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 171/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O N M O D O R B 6

7 . M P S - 8 0 1 R O M - L i s t i n g

0 0 0 00 0 0 20 0 0 30 0 0 40 0 0 50 0 0 6

0 4 1 00 0 0 0 0

j m n o n o n o n o n o

0 1

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * E r r o r r o u t i n e0 0 0 70 0 0 80 0 0 90 0 0 Ao o o c0 0 0 E0 0 1 00 0 1 20 0 1 40 0 1 50 0 1 60 0 1 70 0 1 80 0 1 90 0 1 B0 0 1 C0 0 1 E0 0 1 F

6 3 1 8 9 F F8 A F C0 4 0 E8 9 F F8 a F C1 E C 6 3 9 9 F DF D 4 3 7E 8 9 F F

s t o pd i d i o r o r j m o r o r d i s e s e s t o pd i a n s e c a l ls e o r

t e n tt c n t i

p l , # F Fp 2 , # F C0 0 p l , # F Fp 2 , # F C

m b r b t e n tt c n t ip l , # F Dm b 6 3 m b p l , # F F

( 2 5 5 )( 2 5 2 )

( 2 5 5 )( 2 5 2 )

( 2 5 3 )

( 2 5 5 )

D e a d l o c k

D e l a y

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *0 0 2 10 0 2 20 0 2 40 0 2 60 0 2 7

2 B 8 0 2B 9 1 6A A

c l m o m o

c l m o

r 0 , # 0 2r l , # 1 6f @ r 0 , a

( 2 ( 2 2 )

R e g i s t e r b a n ka n d s t a c kb o t h

c l e a r e d

1 6

Page 172: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 172/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

0 0 2 8 1 i n r 0 0 2 9 E 9 2 7 d j n z r l , 2 7* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *0 0 2 B0 0 2 C0 0 2 E0 0 3 00 0 3 20 0 3 40 0 3 60 0 3 70 0 3 90 0 3 A0 0 3 C0 0 3 E0 0 4 00 0 4 2

0 F 2 2 B9 9 7 FB C 0 15 4 0 0B 8 1 1F 5 3 F CA 5 4 0 29 9 F BB 4 C DB 8 1 0B 0 1 8

i j b a n m o c a l lm o m o a n m o c a l la n c a l lm o m o

a , p 22 p l , # 7 Fr 4 , # 0 12 0 r 0 , # l la , @ r 0a , # F C@ r 0 , a2 0 p l , # F B5 C r 0 , # 1 0@ r O , # 1 8

( 1 2 7 )( 1

( 1 7 )

( 2 5 2 )

( 2 5 1 )

( 1 6 )( 2 4 )

A T N ?i s o w a i tf o D A T A

t e s t h e a d m v t .

m o v e p r i n t h e a dt s t a r t i n gp o s i t i o n

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *0 0 4 40 0 4 50 0 4 70 0 4 80 0 4 90 0 4 A0 0 4 C0 0 4 E0 0 4 F0 0 5 0

2 B 8 1 6A 1 A B 8 1 AB 9 6 6A 1 E 9 4 E

c l m o m o i n

m o m o m o m o i n d j n z

r O , # 1 6@ r 0 , ar @ r 0 , ar O , # l Ar l , # 6 63 r 0 , ar r l , 4 E

( 2 2 )

( 2 6 )( 1 0 2 )

c l e a r

r e g i s t e r b a n k

a n

m e m o r y

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *0 0 5 20 0 5 30 0 5 40 0 5 5

8 A

A A

c l m o

m o m o

f r 2 , ar 3 , ar 5

I n i t i a l i z e

1 6

Page 173: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 173/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

0 0 5 60 0 5 70 0 5 90 0 5 B0 0 5 C0 0 5 D0 0 5 E0 0 6 00 0 6 20 0 6 40 0 6 60 0 6 80 0 6 90 0 6 B0 0 6 D0 0 6 F0 0 7 00 0 7 10 0 7 20 0 7 3

A B 8 2 1B 0 0 21 F 3 B 0 0 81 2 6 8B O O FF 2 6 8B O O E1 B 9 1 8B 1 0 02 3 7 95 A F A E 4 0 0

m o m o

m o i n

m o c p m o j b

m o j b m o i n

m o m o m o a n m o m o m o j m

r b , ar O , # 2 1@ r 0 , # 0 2r a , r 4

@ r 0 , # 0 86 @ r 0 , # 0 F6 @ r 0 , # 0 Br r l , # 1 83 r l , # 0 0a , # 7 9a , r 4r 4 a r r 7 , a7 0

( 3 3 )( 2

( 8

( 1 5 )

( 1 4 )

( 2 4 )( 0 ( 1 2 1 )

r e g i s t e r b a n k

E N D O F R E S E Tb y t e i R w i l l c a u s e

j u m p t L I S T E N0 0 7 50 0 7 60 0 7 80 0 7 A0 0 7 B0 0 7 D0 0 7 E0 0 8 00 0 8 20 0 8 40 0 8 6

F C 6 7 A4 4 2 7F 1 2 8 EF F 2 8 22 4 0 0B 8 2 1B 0 0 0B B 0 1

m o j j m m o j b m o j b j m

m o

m o m o

a r 7 2 2 a r 8 a , r 28 1 0 r O , # 2 1

@ r 0 , # 0 0r 3 , # 0 1

( 3 3 )

( 0 ( 1

D a t a b y t e > 1 2 7 ? y e s >

1 6

Page 174: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 174/343

A B A C U S S o f t w a r e P R I N T B R B O O K f o t h C O M M O D O R E 6

0 0 8 80 0 8 A0 0 8 C

B 9 1 8B 1 0 0) 4 B 5

m o m o

j m

r l , # 1 8@ r l , # 0 00 B

( 2 4 )( 0

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *0 0 8 E0 0 8 F0 0 9 10 0 9 30 0 9 50 0 9 60 0 9 80 0 9 A0 0 9 C0 0 9 E0 0 9 F0 0 A 10 0 A 20 0 A 40 0 A 50 0 A 70 0 A 80 0 A 9O O A BO O A CO O A EO O A F0 0 B 00 0 B 20 0 B 3

F 5 3 6 09 6 9 52 4 0 0F 0 3 B FF 6 A 40 3 1 F9 6 A 2F D 3 0 2A 0 4 8 2F 7 2 A EF F 9 4 0 0E 0 4 8 2F F 3 4 D 8E 0 4 8 2

m o a n j n j m m o a d j a d j n m o x r m o j m m o j b m o s e c a l ls e j m m o s e c a l ls e j m

a , r 2a , # 6 09 1 0 a , r 2a , # B FA a , # l FA a , r 4a , # 0 2r 4 0 8 a , r 4A a , r 2m b C O m b 0 8 a r m b 9 D m b 0 8

( 9 6 )

( 1 9 1 )

( 3 1 )

( 2

P r i n t a b l e c h a r a c t e r ?y e s >

> 6 4 ?y e s >Q u o t a t i o n m a r k s ?n o p e )S w i t c hq u o t ef l a g

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * B y t e b u f f e r0 0 B 50 0 B 60 0 B 7

F A F

m o m o m o

a , r 7r 0 , aa , r 2

1 6

Page 175: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 175/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R B 6

0 0 B 80 O B 9O O B AO O B BO O B DO O B EO O C O0 0 C 20 0 C 30 0 C 50 0 C 60 0 C 70 0 C 8O O C AO O C CO O C EO O D OO O D 10 0 D 2

A I F 9 6 C CF F 2 C E2 3 8 46 F 6 D 4D F C 0 3 F BF 6 D 4E 4 0 0B 8 2 0F A O 4 E 9

m o i n m o j n m o j b m o a d j s e m o s e a d j j m m o m o m o j r a p

@ r O , ar a r C a r C

, # 8 4a , r 7D

r b a r r b a , # F BD 7 0 r 0 , # 2 0a , r 3@ r O ,0 E

( 1 3 2 )

( 2 5 1 )

( 3 2 )

B u f f e r p o i n

P o i n t e r > 1 y e s >

r e t u r n t

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * B u f f e r f u l lO O D 40 0 D 50 0 D 60 0 D 70 0 D 80 0 D 9O O D AO O D BO O D DO O D EO O D FO O E 10 0 E 3

D F C E E E E 5 3 7 0A F 5 3 8 F4 8 B 82

s e m o s e r r r r a n m o m o a n j n t lx c

r b a , r Or b

a , # 7 0r 0 , aa , r 4a , # 8 FB a , @ r 0

( 1 1 2 )

( 1 4 3 )

1 6

Page 176: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 176/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

0 0 E 40 0 E 50 0 E 60 0 E 70 0 E 9O O E BO O E CO O E EO O E F0 0 F 1

0 0 F 3

A F A B O O A2 3 7 85 4 3 0 1A B F 2 24 4 A D

0

m o m o m o m o m o a n o r m o m o j m

0

@ r 0 , aa , r 7r 0 , a3 r 0 , # 0 Aa , # 7 8a , r 4a , # 0 1r 4 , ar 7 , # 2 22 A

0 0 0 0

( 1 0 )( 1 2 0 )

( 1

( 3 4 )

0 0

L i n e f e e da t t a c h e dt b u f f e r

r e s e t b u fp r i n t b u

0 0 0 0 0 0

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * I n t e r p r e t c o n t r o l c h a r s .0 1 0 0 F m o v a , r 40 1 0 1 3 c p 0 1 0 2 3 2 0 7 j b 0 0 1 0 4 F s e m b 0 1 0 5 0 4 C 3 j m p 8 C 30 1 0 7 2 3 F 2 m o v a , # F 20 1 0 9 6 a d a , r 20 1 0 A c 6 3 8 j z 3 80 1 0 C 0 d e 0 1 0 D C 6 3 8 j 3 0 1 0 F 0 d e 0 1 1 0 C 6 6 9 j 6 0 1 1 2 0 d e 0 1 1 3 C 6 7 3 j 7 0 1 1 5 0 d e 0 1 1 6 C 6 8 2 j 7 0 1 1 8 2 3 F 8 m o a , # F 80 1 1 A 6 a d d a , r 20 1 1 B C 6 5 F j 5

I q u o t e m o d e ?n

( 2 4 2 ) D o u b l e - w i d t h o n

y e D o u b l e - w i d t h o f f ?y e P r i n t p o s i t i o n d e t e r m i n e d ?y e T e x t m o d e o n y e R e v e r s e o n y e

( 2 4 8 )B i t - I m a g e m o d e ?y e

1 7

Page 177: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 177/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

0 1 1 DO 1 1 F0 1 2 00 1 2 20 1 2 30 1 2 50 1 2 60 1 2 80 1 2 A0 1 2 B0 1 2 D0 1 2 F0 1 3 00 1 3 20 1 3 40 1 3 6

2 3 E 5 m o v6 a d C 6 9 C j 1 d e

C 6 A 1 j F m o 0 3 6 F a d C 6 A 8 j 0 d e C 6 B 2 j 2 3 F 6 m o 6 A a d dC 6 B E j 0 3 F D a d dC 6 B E j E 4 0 0 j m

0 1 3 80 1 3 A0 1 3 C0 1 3 E0 1 3 F0 1 4 00 1 4 20 1 4 30 1 4 50 1 4 70 1 4 80 1 4 90 1 4 A0 1 4 C0 1 4 E0 1 5 0

B 8 1 0B 0 1 82 3 0 14 A B 9 2 1F 3 2 5 A1 2 4 CD 1 C 2 4 5 BB 4 F 0B 4 F 0B 4 F 0

m o m o m o o r m o m o m o j b j b s e i n s e

a , # E 5a , r 29

A a , r 2a , # 6 FA

B a , # F 6d , r 2B a , # F DB 7 0

( 2 2 9 )

c a l lc a l lc a l l

r 0 , # 1 03 r 0 , # 1 8a , # 0 1a r r 4 r l , # 2 1a , @ r l5 4 r b r r b 1 5 5 F 5 F 5 F

( 1 1 1 )

( 2 4 6 )

( 2 5 3 )

P r i n t s t a r t p o s i t i o n ( 2 7 ) ?y e

G r a p h i c m c d e ?y e R e v e r s e o f f ?y e

L i n e f e e d ?y e C R y e r e t u r n t w a i t l o o p

C h a r s . 1 4 / 1 5( 1 6 )( 2 4 )( 1

( 3 3 )

T h l a s t t h r e e b y t e so t h b u f f e r a r z e r o e d o u

1 7

Page 178: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 178/343

Page 179: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 179/343

A B A C U S S o f t w a r e P B I M T B R B O O K f o r t h e C O & S M O D O S B 6

0 1 8 0 E 4 0 0 j m 7 0 # * * * * * * * * * * * * * * * * * # * * * * * * * * * * * * * # R e v e r s e o 0 1 8 20 1 8 30 1 8 50 1 8 70 1 8 90 1 8 B0 1 8 D0 1 8 E0 1 9 00 1 9 10 1 9 20 1 9 40 1 9 50 1 9 60 1 9 70 1 9 80 1 9 A

F 1 2 8 72 4 7 65 2 7 65 3 7 84 3 0 5A B 9 2 1F C 5 2 9 8D 1 C I B 1 0 40 4 B 5

m o j b j m j b a n o r m o m o m o d e j b s e i n s e i n m o j m

a r 8 1 7 7 a , # 7 8a , # 0 5r 4 , ar l , # 2 1a , @ r lr 9 r b r r b r @ r l , # 0 40 B

( 1 2 0 )( 5

( 3 3 )

( 4

s t a r t 2 0 1 9 C B D 0 1 m o v0 1 9 E I i n 0 1 9 F E 4 0 0 j m

( 1 r 5 , # 0 1r 7 0

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * C o n t r o l C h a r . 2 80 1 A 1 F m o a , r 40 1 A 2 1 2 9 F j b O 9 F0 1 A 4 B D 0 4 m o r 5 , # 0 4 ( 4 0 1 A 6 2 4 6 D j m 1 6 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * G r a p h i c m o d e o 0 1 A 8 B 8 1 4 m o v r O , # 1 4 ( 2 0 )0 1 A A 2 3 0 2 m o v a , # 0 2 ( 2

0 1 A C 4 o r a , @ r 00 1 A D 5 3 F E a n a , # F E ( 2 5 4 )

1 7

Page 180: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 180/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

0 1 A F A m o 3 r O , a0 1 B 0 E 4 0 0 j m p 7 0 0

o f 0 1 B 20 1 B 30 1 B 50 1 B 70 1 B 90 1 B B0 1 B C♦ ♦ *

0 1 B E0 1 B F0 1 C 10 1 C 20 1 C 40 1 C 50 1 C 70 1 C 90 1 C B0 1 C D

F 5 2 B 7E 4 0 05 3 7 84 3 0 1A 2 4 8 E

F 5 3 F DA B A O AF C 6 C BB B 8 10 4 B 5B B 8 00 4 B 5

m o j b j m a n o r m o

k * * * *F

m o a n m o m o m o j m o j m m o j m

a , r 4B 7 0 a , # 7 8a , # 0 1r 4 , a1 8

* * * * * * * * *+ . M , * . i f + +

a r a , # F Dr 4 , ar 2 , # 0 Aa r C r 3 , # 8 10 B r 3 , # 8 00 B

( 1 2 0 )( 1

* * * * * * *♦ ♦ ♦ ♦ ♦ ♦ ♦

( 2 5 3 )

( 1 0 )

( 1 2 9 )

( 1 2 8 )

o C

0 1 C F 0 0 1 D 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 E 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 F 0 0 0 0 0 0 0 0 0 G O 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

0 2 0 0 9 9 F 3 a n p l , # f 3 ( 2 4 3 )0 2 0 2 9 9 F B a n p l , # F B ( 2 5 1 )0 2 0 4 B 4 C D c a l l 5 C D0 2 0 6 F m o v a , r 4

0 2 0 7 5 3 8 F a n a , # 8 F ( 1 4 3 )0 2 0 9 A m o r 4 , a

C / a n h e a d m o t o r o C / o P r i n t h e a d b r o u g h t t s t a r t

p o s i t i o n

1 7

Page 181: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 181/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O N M O D O R B 6

0 2 0 A0 2 0 C0 2 0 D0 2 0 F0 2 1 10 2 1 30 2 1 50 2 1 70 2 1 80 2 1 A0 2 1 B0 2 1 C0 2 1 D0 2 1 F0 2 2 10 2 2 30 2 2 40 2 2 6

♦ +

0 2 2 70 2 2 80 2 2 A0 2 2 C0 2 2 D0 2 2 E0 2 3 00 2 3 20 2 3 30 2 3 50 2 3 70 2 3 90 2 3 A0 2 3 B

D 4 6 DF 0 3 E 7F 6 1 8B 0 0 10 3 0 CF 6 1 81

B 8 1 02 6 5 1 6 2 14 4 1 DE 8 1 D6 8 9 0 88 ♦ ♦

F 1 2 4 73 2 8 2F 0 9 6 3 22 4 6 DF F 2 4 3B 4 F 0B 4 F 0D C C

c a l lm o a d j m o a d j i n

m o c l m o s t r tj t j m d j n zs t o po r r e * F $ Y * * 3m o j b j b m o d e j n j m m o j b c a l lc a l ls e d e s e

6 6 a , r la , # E 71 @ r 0 , # 0 1a , # 0 C1 @ r r 0 , # 1 0

t ,

2 2 1 r 0 , l Dt e n tp i , # 0 8

f ^ ^ ^ ^ | O t C Y * * * * * * ) |

a , r 54 8 a , r 6

3 1 6 a , r 24 5 F 5 F r b r r b

( 2 3 1 )

( 1 ( 1 2 )

( 1 6 )

( 8

C * * * * * * * ) j

T e s t h e a d m o v e m e n t a n t i m e w h e e l

H e a d m o t o r o f

| C

- 1 7 5

Page 182: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 182/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

0 2 3 C0 2 3 E0 2 4 00 2 4 10 2 4 30 2 4 50 2 4 70 2 4 80 2 4 90 2 4 B0 2 4 CG 2 4 E0 2 5 00 2 5 10 2 5 20 2 5 40 2 5 50 2 5 70 2 5 80 2 5 A0 2 5 C0 2 5 E0 2 5 F0 2 6 10 2 6 30 2 6 50 2 6 70 2 6 80 2 6 90 2 6 A

B 4 C 9B 9 1 7A E 4 0 0B 4 C 90 4 8 2F 0 C 6 7 20 C 6 7 9B 9 1 7F A C 6 5 C0 9 6 3 7F 0 3 2 0F 6 3 7B 8 2 1F 1 2 A 7B 0 8 13 2 6 7B 0 0 1F 2 A I

c a l li d O V

f f i O V

j m c a l lj m

E 1 O Vd e j d e j m o m o m o j d e j n m o a d j m o m o j b m o j b m o m o x c m o i n

5 C r l , # 1 7© r l , a7 0 5 C 0 8 a r

7

7 r l , # 1 7a , 0 r li l , a5

3 a , r 2a , # 2 03 r O , # 2 1a , @ r 0A 3 r 0 , # 8 16 3 r 0 , # 0 1a , r 7a , r l@ r l , ar

( 2 3 )

( 2 3 )

( 3 2 )

( 3 3 )

( 1 2 9 )

( 1

0 2 6 B B 4 C 9 c a l l 5 C

0 2 6 D B 9 1 7 r a o v r l , # 1 7 ( 2 3 )0 2 6 F A m o 6 r l , a

1 7

Page 183: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 183/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

0 2 7 0 0 4 B 5 j m 0 B 0 2 7 2 2 3 F 0 m o a , # F 0 ( 2 4 0 )0 2 7 4 6 a d a , r 20 2 7 5 9 6 3 C j n 3 0 2 7 7 2 4 6 D j m 1 6 0 2 7 9 F m o v a , r 20 2 7 A 5 3 0 1 a n a , # 0 1 ( 1 0 2 7 C B 9 1 7 m o r l , # 1 7 ( 2 3 )0 2 7 E A m o @ r l , a0 2 7 F I i n c r 60 2 8 0 E 4 0 0 j m p 7 0 00 2 8 2 F m o a , r 60 2 8 3 0 d e 0 2 8 4 9 6 8 9 j n z 8 90 2 8 6 F m o a , r 20 2 8 7 4 4 7 C j m p 2 7 C0 2 8 9 B 9 1 7 m o v r l , # 1 7 ( 2 3 )0 2 8 B F m o a , Q r l0 2 8 C 5 3 0 F a n a , # 0 F ( 1 5 )0 2 8 E E r 0 2 8 F A 8 m o v r O , a0 2 9 0 B 9 0 4 m o r l , # 0 4 ( 4 0 2 9 2 6 a d a , r 00 2 9 3 E 9 9 2 d j n z r l , 9 20 2 9 5 A m o r 0 , a0 2 9 6 F m o a , r 20 2 9 7 5 3 0 F a n a , # 0 F ( 1 5 )0 2 9 9 6 a d d a , r 00 2 9 A A m o r 0 , a0 2 9 B B E 0 5 m o r 6 , # 0 5 ( 5 0 2 9 D 6 a d a , r 0

0 2 9 E E 6 A 1 j n A 0 2 A 0 1 i n r

1 7

Page 184: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 184/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O N N O D O R B 6

0 2 A 1 E E 9 D d j n z r 6 , 9 D0 2 A 3 A m o v r 2 , a0 2 A 4 F m o v a , r l0 2 A 5 4 4 5 2 j m p 2 5 20 2 A 7 B 4 F 0 c a l l 5 F 00 2 A 9 C F d e c r 0 2 A A C F d e c r 0 2 A B 4 4 6 7 j m p 2 6 7* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * P r i n t o u b u f f e r c o n t e n t s0 2 A D 2 c l

( 2 1 )( 3

0 2 A E B 8 1 5 m o v0 2 B 0 B 0 0 3 m o v0 2 B 2 8 c l 0 2 B 3 A m o 0 2 B 4 B E 1 8 m o 0 2 B 6 B 8 1 E m o 0 2 B 8 A m o 0 2 B 9 1 i n 0 2 B A A m o 0 2 B B B D 8 0 m o v0 2 B D 6 4 0 1 j m p

r O , # 1 5@ r 0 , # 0 3f r 3 , ar 6 , # 1 8r O , # l E© r O , ar @ r O , ar 5 , # 8 03 0

0 2 B F0 2 C 00 2 C 20 2 C 40 2 C 50 2 C 70 2 C 80 2 C A0 2 C B0 2 C C0 2 C D

F F 2 C 48 4 0 06 9 9 F BF 5 3 8 FA 2 A A

m o v a , r 5j b C j m 4 0 s t o p t e n ta n p l , # F Bm o v a , r 4a n a , # 8 Fm o r 4 , ac l m o r 5 , am o v r 0 , a

( 2 4 )( 3 0 )

( 1 2 8 )

R e s e t c h e i r a c t e r c o u n t e r

S t a r t p r i n t o u t

P r i n t c h a r a c t e r

( 2 5 1 ) C / o n r e s t o s y s t e m o u

( 1 4 3 )

1 7

Page 185: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 185/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

0 2 C E0 2 C F0 2 D 10 2 D 30 2 D 50 2 D 70 2 D 90 2 D A0 2 D C

0 2 D E0 2 E 00 2 E 10 2 E 30 2 E 50 2 E 70 2 E 90 2 E A0 2 E C0 2 E E

O S 2 D 70 4 1 0E 8 C E0 4 C 7D 4 6 DF C 6 E 03 2 E 9

8 4 0 0F 0 3 F 3F 6 D ED 4 A 1j m F 0 3 E 7F 6 D E4 4 E 5

i j b c a l ld j n zj m c a l lm o j j b

j m m o a d j c a l l4 0 m o a d j j m

a , p 2D 6 1 r O , C E0 0 6 6 a , 0 r OE E

4 0 a , r la , # F 3D 6 A

a r a , # E 7D 2 E

( 2 4 3 )

( 2 3 1 )

P r i n t h e a d a s t a r t p o s i t i o n ?y e T i m e c o n t r o l

D e a d l o c kW a i t u n t i l p r i n t h e a d h a l e f t s t a r t p o s i t i o n

P r i n t c h a r a c t e r

T i m e w h e e l w a i t i n g .P r i n t c h a r a c t e r

0 2 F 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

♦ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * P r i n t o u b u f f e r0 3 0 0 A m o v r 4 , a0 3 0 1 F m o v a , r 7

G e b y t eB u f f e r p o i n t e r + B y t e - > R 2

( 2 4 0 ) P r i n t p o s i t i o n s e u p n

0 3 0 20 3 0 30 3 0 40 3 0 50 3 0 60 3 0 80 3 0 A0 3 0 B

A F I A 0 3 F 09 6 1 A8 9

m o m o i n m o a d j n c l c p

r 0 , aa , @ r 0r r 2 , aa , # F 01 f f

1 7

Page 186: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 186/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R B 6

0 3 0 C0 3 0 D0 3 0 E0 3 0 F0 3 1 00 3 1 20 3 1 30 3 1 40 3 1 50 3 1 60 3 1 70 3 1 8* * * * i0 3 1 A0 3 1 B0 3 1 D0 3 1 E0 3 2 00 3 2 1

F A F I B 9 1 7A C 1 F A I 8 4 7 2♦ * ♦ *

1 9 6 2 3F 5 3 7 C1 6 4 0 0

m o m o m o i n

m o m o d e i n

m o m o i n

d e j n m o a n d e j m

a , r 7r 0 , aa , @ r 0r r l , # 1 7@ r l , ar r a , @ r 0@ r l , ar 4 7

* * * * * * * * *f $ f f f « v f f

2 a r a , # 7 C

3 0

( 2 3 )

* * * * * * * * )

( 1 2 4 )

C a l c u l a t e

T e x t m o d en

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *0 3 2 30 3 2 40 3 2 60 3 2 70 3 2 90 3 2 B

1 9 6 2 DF 5 3 7 C4 3 8 16 4 0 0

d e j n m o a n o r j m

2 a , r 4a , # 7 Ca , # 8 13 0

( 1 2 4 )( 1 2 9 )

R e v e r s e o n

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *0 3 2 D0 3 2 F0 3 3 10 3 3 20 3 3 4

0 3 F C9 6 3 6F 4 3 0 46 4 0 0

a d j n m o o r j m

a , # F C3 a , r 4a , # 0 4

3 0

( 2 5 2 )

( 4

2 2 n

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

1 8

Page 187: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 187/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

0 3 3 6 0 3 8 0 a d d a , # 8 0 ( 1 2 8 ) = 1 5 0 ?0 3 3 8 9 6 4 3 j n 4 3 n o0 3 3 A F m o v a , r 40 3 3 B 1 2 3 F j b 3 0 3 3 D 4 4 B F j m 2 B 0 3 3 F 5 3 F 9 a n a , # F 9 ( 2 4 9 )0 3 4 1 6 4 0 0 j m p 3 0 0* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *0 3 4 3 0 3 8 A a d a , # 8 A ( 1 3 8 ) = 1 2 ?0 3 4 5 9 6 4 D j n 4 n 0 3 4 7 8 c l f 0 3 4 8 F m o a , r 40 3 4 9 5 3 7 C a n a , # 7 C ( 1 2 4 ) Q u o t e f l a g o f f0 3 4 B 6 4 0 0 j m 3 0 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *0 3 4 D 0 3 E E a d a , # E E ( 2 3 8 ) = 3 0 ?0 3 4 F 9 6 6 0 j n 6 n 0 3 5 1 F m o a , r 70 3 5 2 A m o r 0 , a0 3 5 3 F m o a , @ r 00 3 5 4 A m o r 3 , a0 3 5 5 I i n r 0 3 5 6 1 i n r 0 3 5 7 F m o v a , @ r 00 3 5 8 A m o r 2 , a0 3 5 9 I i n r 0 3 5 A F m o v a , r 40 3 5 B 4 3 0 2 o r a , # 0 2 ( 2 0 3 5 D A m o r 4 , a0 3 5 E 4 4 B F j m 2 B * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *0 3 6 0 0 3 1 0 a d a , # 1 0 ( 1 6 ) D o u b l e - w i d t h o n 0 3 6 2 9 6 6 6 j n z 6 6 n

1 8

Page 188: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 188/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M N O D O R B 6

0 3 6 4 8 4 F E j m 4 F * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *0 3 6 6 F m o a , r 40 3 6 7 1 2 6 B j b O 6 B0 3 6 9 4 4 B F j m 2 B * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * A n y c h a r a c t e r s t b

p r i n t e d i e n l a r g e d f o r m a ta r p l a c e d i a d d r e s s 2 4

0 3 6 B B 8 1 F m o r O , # l F ( 3 1 )0 3 6 D F m o v a , 3 r 00 3 6 E C 6 8 4 j 8 0 3 7 0 C 8 d e r 0 3 7 1 F m o v a , r 40 3 7 2 F 2 7 B j b 7 0 3 7 4 F m o a , @ r 00 3 7 5 0 3 2 5 a d d a , # 2 5 ( 3 7 )0 3 7 7 F 6 8 2 j 8 0 3 7 9 6 4 8 4 j m p 3 8 40 3 7 B F m o a , @ r 00 3 7 C 0 3 2 B a d d a , # 2 B ( 4 3 )0 3 7 E F 6 8 2 j c 8 20 3 8 0 6 4 8 4 j m 3 8 0 3 8 2 8 4 9 A j m 4 9 0 3 8 4 F m o v a , r 20 3 8 5 0 3 4 0 a d a , # 4 0 ( 6 4 )0 3 8 7 E 6 9 6 j n 9 0 3 8 9 D 4 6 1 c a l l 6 6 0 3 8 B F m o v a , r 00 3 8 C F s e m b 0 3 8 D 7 4 D 8 c a l l B D 0 3 8 F E s e m b 0 3 9 0 1 i n r 0 3 9 1 1 i n r

L i n e f e e d

C h a r a c t e r > 1 9 1 ?n P o s i t i o n i c h a r a c t e r

g e n e r a t o r c o m p u t e d

G e m a t r i x c o l u m n

- 1 8 2

Page 189: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 189/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

0 3 9 20 3 9 40 3 9 60 3 9 80 3 9 A0 3 9 C0 3 9 D0 3 9 E0 3 A 00 3 A 10 3 A 20 3 A 30 3 A 50 3 A 70 3 A 90 3 A B0 3 A D0 3 A E0 3 A F0 3 B 10 3 B 20 3 B 30 3 B 40 3 B 60 3 B 80 3 B A0 3 B C0 3 B E0 3 B F0 3 C 00 3 C 2

0 3 C 30 3 C 4

E B 8 B6 4 D 60 3 2 0E 6 A 7D 4 6 1F F 5 4 C 0E 1 1 E B 9 C6 4 D 60 3 4 0E 6 B 8D 4 6 1F F B 4 C 0E 1 1 E B A D6 4 D 60 3 2 0E 6 C 9D 4 6 1F F 3 4 C 0E

1 1

d j n zj m a d j n c a l lm o s e c a l ls e i n i n d j n zj m a d j n c a l lm o s e c a l ls e i n i n d j n zj m a d j n c a l lm o s e c a l ls e

i n i n

r 3 , 8 B3 D a , # 2 0A 6 6 a , r 0m b A C m b r r r 3 , 9 C3 D a , # 4 0B 6 6 a , r 0m b D C m b r r r 3 , A D3 D a , # 2 0C 6 6 a r m b 9 C m b

r r

R e p e a t p r o c e s s u n t i lc o l u m n s h a v e p r i n t e d o u

( 3 2 ) C h a r a c t e r > 1 5 9 ?n P o s i t i o n i c h a r a c t e r

g e n e r a t o r c o m p u t e d

G e m a t r i x c o l u m n

R e p e a t u n t i l c o l u m n sa r p r i n t e d o u

( 6 4 ) C h a r a c t e r > 9 5 ?n P o s i t i o n i c h a r a c t e rg e n e r a t o r c o m p u t e d

G e m a t r i x c o l u m n

R e p e a t u n t i l c o l s , a r p r i n t e d o u

( 3 2 ) C h a r a c t e r > 6 3 ?n P o s i t i o n i c h a r . g e n .

c a l c u l a t e d

G e m a t r i x c o l u m n

1 8

Page 190: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 190/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

0 3 C 50 3 C 70 3 C 90 3 C B0 3 C D0 3 C E0 3 C F0 3 D 10 3 D 20 3 D 30 3 D 40 3 D 60 3 D 70 3 D 80 3 D 90 3 D A0 3 D B0 3 D D0 3 D F0 3 E 00 3 E 10 3 E 2

E B B E6 4 D 60 3 2 0D 4 6 1F F 1 4 C 0E 1 1 E B C DF A F A F 5 2 D F4 4 D FF 3 A 4 4 B F

d j n zj m a d c a l lm o s e c a l ls e i n i n d j n zm o m o m o m o m o j b j m m o c p m o j m

r 3 , B E3 D a , # 2 06 6 a , r Om b 8 C m b r r r 3 , C Da , r 6r l , aa , S r ir 2 , aa , r 4D 2 B a , r 2

r 2 , a2 B

( 3 2 )

R e p e a t u n t i l c o l s , a r ep r i n t e d o u

C a l c u l a t e p o s i t i o n i c h a r ,g e n e r a t o r

G e m a t r i x c o l u m n

R e p e a tu n t i l

s i c o l u m n s

h a v eb e e n

p r i n t e d o u

p r i n t o u

0 3 E 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 F 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

0 4 0 00 4 0 20 4 0 40 4 0 50 4 0 70 4 0 8

D 4 E 8F 6 9 0F 5 3 7 FA B 8 1 5

c a l lj m o a n m o m o

6 E 9 a , r 2a , # 7 Fr l , ar O , # 1 5

( 1 2 7 )

( 2 1 )

c h a r a c t e r sE n d - o f - l i n e r e a c h e d ? ?y e

1 8

Page 191: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 191/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M N O D O R B 6

0 4 0 A0 4 0 B0 4 0 C0 4 0 E0 4 1 00 4 1 20 4 1 30 4 1 50 4 1 70 4 1 90 4 1 B0 4 1 C0 4 1 E0 4 2 00 4 2 10 4 2 30 4 2 40 4 2 50 4 2 60 4 2 70 4 2 80 4 2 90 4 2 A0 4 2 C0 4 2 E0 4 3 00 4 3 10 4 3 30 4 3 40 4 3 60 4 3 70 4 3 90 4 3 B

1 F D 3 0 4C 6 1 BB 8 F 04 D 3 0 2C 6 1 EE 8 1 20 4 0 7A 8 4 2 04 6 1 E6 2 3 C 06 5 2 F 7 A 3 5 6 2 AF 2 3 D9 9 F E2 B 8 4 2F D 2 3 90 B 8 4 EE 8 3 98 9 0 1

i n m o x r j m o m o x r j d j n zj m m o j m j n t ls t o pm o m o s t r te m o r m o c p j t j b a n c l m o m o j b n o m o d j n zo r

@ r a , @ r 0a , # 0 4I r O , # F Oa , a , # 0 2I r O , 1 20 0 ® r 0 , a4 2 I t e n ta , # C 0t ,

t c n t ia , r l

r l

2 3 p l , # F E

r O , # 4 2a , r l3

r 0 , # 4 Er O , 3 9p i , # 0 1

( 4

( 2 4 0 )

( 2

( 1 9 2 )

( 2 5 4 )

( 6 6 )

( 7 8 )

( 1

D e a d l o c k

T i m e r w a i t i n g

T i m e r c o n t r o lo

G e t t h e n e x t p o i n t i t h m a t r i x c o l u m n

T i m e r w a i t s . . .P o i n t p r i n t e d ? n F i r e h a m m e r

H a m m e r o f

1 8

Page 192: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 192/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O N N O D O R B 6

0 4 3 D0 4 3 E0 4 4 00 4 4 10 4 4 20 4 4 40 4 4 50 4 4 70 4 4 90 4 4 B0 4 4 D0 4 4 F0 4 5 10 4 5 30 4 5 50 4 5 60 4 5 80 4 5 90 4 5 B0 4 5 D0 4 5 F0 4 6 00 4 6 20 4 6 40 4 6 50 4 6 60 4 6 80 4 6 A0 4 6 C0 4 6 E0 4 7 0

I 4 6 3 E6 3 2 3 F 96 E 6 2 1C 6 5 10 3 F 99 6 2 1F 4 C D8 4 6 4F 4 C DB 6 7 2F 1 2 6 23 3 2 5 DE B O O4 3 0 23 6 4 0 0F 2 6 EI F 0 3 E 29 6 7 0B E 1 86 4 0 1B D 0 76 4 D 6

i n j n t ls t o pd i m o a d j n j a d j n c a l lj m c a l lj f m o j b c p j b d j n zo r c p j m j b i n

m o a d j n m o j m m o j m

r 3 t e n tt c n t ia , # F 9a r 2 5 a , # F 92 7 C 4 6 7 C 7 a r 6

5 r 3 , 0 0a , # 0 2

3 0 6 r a , r 6a , # E 27 r 6 , # 1 83 0 r 5 , # 0 73 D

( 2 4 9 )

( 2 4 9 )

( 2

( 2 2 6 )

( 2 4 )

( 7

P o i n t c o u n t e r + T i m e g a w a i t i n gC o n t r o l o f

p o i n t s p r i n t e d ? ?

n o > n e x t p o i n ty e D o u b l e - w i d t h r e a d y ?n C o l u m n - c o u n t + t i m e r

s t a r t( s a m e a 0 4 4 D )

G e n e x t b y t e

* * * * # * * * * * * * * * * * * # * * * * * * * * * * * * * * * C a l c u l a t e p r i n t s t a r t p o 0 4 7 2 B 8 1 F m o r 0 , # l F ( 3 1 )

1 8

Page 193: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 193/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

0 4 7 4 B 9 1 7 m o v r l , # 1 7 ( 2 3 )0 4 7 6 F m o a , @ r l0 4 7 70 4 7 80 4 7 90 4 7 A0 4 7 B0 4 7 D0 4 7 B0 4 8 00 4 8 10 4 8 20 4 8 30 4 8 40 4 8 50 4 8 60 4 8 70 4 8 90 4 8 A0 4 8 C0 4 8 D0 4 8 E

A F 3 6 F 6 8 C3 9 6 8 9C C F A F 3 6 F 6 8 C8 6 4 0 12 A 4 4 B F

m o m o c p a d j c p j n d e d e m o m o m o c p a d j c l j m c l m o j m

r 2 , aa , @ r 0

a , r 28

8 r r a , S r ir 2 , aa , @ r 0

a r 8

f 3 0

r 2 , a2 B

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *0 4 9 00 4 9 10 4 9 20 4 9 40 4 9 50 4 9 60 4 9 70 4 9 80 4 9 90 4 9 A

F 3 3 2 9 AC C F A F A C

m o c p j b d e d e m o m o m o m o d e

a r

9 r r a , r 7r 0 , aa , r 3@ r 0 , ar

1 8

Page 194: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 194/343

A B A C U S S o f t w a r e P R I N T E R B O O S f o r t h e C O M M O D O R E 6

0 4 9 B0 4 9 C0 4 9 E0 4 A 00 4 A 10 4 A 20 4 A 40 4 A 50 4 A 70 4 A 80 4 A A0 4 A C0 4 A D0 4 A E0 4 B 00 4 B 20 4 B 3

0 4 B 50 4 B 70 4 B 9O 4 B B0 4 B DO 4 B E0 4 B F0 4 C 00 4 C 10 4 C 20 4 C 30 4 C 50 4 C 70 4 C 80 4 C 90 4 C A

6 B 4 F CB 8 2 0F 3 F 2 A AF 5 3 8 FA 4 4 A DB 8 2 2F 3 5 2 B 3B 0 1 21 B 0 0 8

1 2 B DB O O FF 2 B DB O O EF A F A 1 F 0 3 8 1F 6 C C1 F A 8 4 B F

s t o pc a l lm o m o c p J b m o a n m o j m m o m o c p j b m o i n m o

j b m o j b m o m o m o m o m o i n m o a d j i n m o m o j m

t e n t5 F r 0 , # 2 0a , @ r O

A a , r 4a , # 8 Fr 4 , a2 A r O , # 2 2a r

B @ r O , # 1 2r @ r 0 , # 0 8B @ r O , # O FB @ r O , # O Ea , r 7r l a , @ r lr 2 , ar a , r la , # 8 1C r a r @ r O , a4 B

( 3 2 )

( 1 4 3 )

( 3 4 )

( 1 8 )

( 8

( 1 5 )

( 1 4 )

( 1 2 9 )

L i n e f e e d

p r i n t o

1 8

Page 195: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 195/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

0 4 C C0 4 C D0 4 C E0 4 C F0 4 D 00 4 D 10 4 D 20 4 D 40 4 D 60 4 D 70 4 D 80 4 D 90 4 D A0 4 D B0 4 D C0 4 D B0 4 E 00 4 E 20 4 E 40 4 E 50 4 E 60 4 E 70 4 E 80 4 E 90 4 E B0 4 E C0 4 E D0 4 E E0 4 F 00 4 F 20 4 F 40 4 F 50 4 F 7

C F A 2 A F 0 3 F 69 6 C CF A 2 A 1 F 0 3 8 0E 6 D 8B 4 C 9B 8 2 0F 7 7 7 7 5 3 0 7D A C D 3 0 59 6 F 40 4 E 5F 4 3 2 0A 4 4 A

d e m o m o c l m o m o a d j n

m o m o

c l m o i n m o a d j n c a l lm o m o r r r r a n s e m o s e x r j n j m m o o r j m

r a , @ r Or l . a

@ r O , aa r a , # F 6C a , r Or 7 , a

@ r O , ar a , r Oa , # 8 0D 5 C r 0 , # 2 0a , @ r 0

a , # 0 7r b r 0 , ar b a , # 0 5F 0 E a , @ r 0a , # 2 05 4

( 2 4 6 )

( 1 2 8 )

( 3 2 )

( 7

( 5

( 3 2 )

1 8

Page 196: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 196/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

0 4 F 90 4 F A0 4 F B0 4 F C0 4 F D4 4 4 4 4

0 4 F E0 5 0 00 5 0 10 5 0 30 5 0 50 5 0 60 5 0 80 5 0 A0 5 0 C0 5 0 D0 5 0 F0 5 1 10 5 1 30 5 1 40 5 1 60 5 1 80 5 1 90 5 1 A0 5 1 C0 5 1 E0 5 1 F0 5 2 10 5 2 30 5 2 50 5 2 70 5 2 90 5 2 A

0 0 0 0 0

t 4 4 4 4 4

B 8 2 0F F 2 5 18 9 0 8F D 3 8 0C 6 0 F9 9 F B6 B 4 C DB 8 2 1B O O O1 B 9 1 8B 1 0 0F 3 5 2 1 FB 0 1 21 B 0 0 81 2 2 9B O O FF 2 2 9B O O E1 B 0 1 0

n o n o n o n o n o

t 4 4 4 4 i

m o m o J b o r m o x r j a n s t o pc a l lm o m o i n

m o m o m o c p j b m o i n m o j b m o J b m o i n m o

k 4 4 4 4 4 4 4 4 4^ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ^r 0 , # 2 0a , 3 r 05 p i , # 0 8

a , r 5a , # 8 0O p l , # F Bt e n t5 C r O , # 2 1@ r 0 , # 0 0r r l , # 1 8@ r l , # 0 0a , r 4

I 6 r O , # 1 2r 2 r 0 , # 0 82 2 r 0 , # 0 F2 @ r O , # O Er @ r 0 , # 1 0

( 4 4 4 4 4 4

( 3 2 )

( 8

( 1 2 8 )

( 2 5 1 )

( 3 3 )( 0

( 2 4 )( 0

( 1 8 )

( 8

( 1 5 )

( 1 4 )

( 1 6 )

s - w i d t h p r i n t i n g

1 9

Page 197: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 197/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

0 5 2 C0 5 2 D0 5 2 F0 5 3 00 5 3 10 5 3 20 5 3 30 5 3 40 5 3 50 5 3 60 5 3 70 5 3 80 5 3 A0 5 3 B0 5 3 C0 5 3 E0 5 3 F0 5 4 00 5 4 10 5 4 20 5 4 40 5 4 60 5 4 70 5 4 90 5 4 A0 5 4 C0 5 4 D0 5 4 F0 5 5 10 5 5 30 5 5 50 5 5 60 5 5 8

1 B 9 1 FF A C 1 F A 1 F A B 4 C 9F 3 0 3 8 1A 2 A 1 E 9 4 0B 8 2 0F 5 3 0 24 5 3 2 FA B B 0 1E 4 0 0B 4 F CB 8 7 FF C 6 6 2O

i n m o m o m o d e i n

m o m o i n m o

m o c a l lm o c p a d m o c l m o i n d j n zm o m o a n o r a n m o m o j m c a l lm o m o j i

r r l , # l Fa , @ r l@ r 0 , ar r a , @ r l@ r 0 , ar a r r 7 5 C a , r 0

a , # 8 1r l

@ r 0 , ar r l , 4 0r 0 , # 2 0a , @ r 0a , # 0 2a , r 4a , # 2 Fr 4 , ar 3 , # 0 17 0 5 F r O , # 7 Fa , @ r 06 a , p 2

( 3 1 )

( 1 2 S

( 3 2 )

( 2

( 4 7 )

( 1

( 1 2 7

1 9

Page 198: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 198/343

A B A C U S S o f t w a r e P R I N T B R B O O K f o t h C O M M O D O R E 6

0 5 5 90 5 5 A0 5 5 C0 5 5 D0 5 5 F0 5 6 10 5 6 20 5 6 40 5 6 60 5 6 70 5 6 90 5 6 B0 5 6 D0 5 6 E0 5 6 F0 5 7 10 5 7 30 5 7 40 5 7 50 5 7 70 5 7 80 5 7 A0 5 7 C0 5 7 E0 5 7 F0 5 8 00 5 8 20 5 8 40 5 8 60 5 8 70 5 8 80 5 8 90 5 8 A

3 B 2 6 4F 5 3 7 14 3 0 1A 0 4 4 4B 8 7 FF 9 6 6 FB 0 2 02 3 F 75 A B 9 2 2B 1 0 F1 F B C O O3 7 2 7 CB C 0 1B B 5 0F A 0 3 B FF 6 A D0 3 4 1A 1 1 F C 6 B F

c p j b m o a n o r m o j n m o m o j n m o m o a n m o m o m o i n m o m o c p j b m o m o m o m o a d j a d m o i n i n m o j

C a , r 4a , # 7 1a # 0 r 4 , a0 4 r O , # F 7a , @ r 06 3 r O , # 2 Oa , # F 7a r r 4 , ar l , # 2 2@ r l , # 0 Fr a , r 4r 4 , # 0 0

7 r 4 , # 0 1r 3 , # 5 0a , @ r 0r 2 , aa , # B FA a , # 4 1@ r l , a© r r a , @ r 0B

( 1 1 3 )( 1

( 2 4 7 )

( 3 2 )( 2 4 7 )

( 3 4 )( 1 5 )

( 0

( 1 ( 8 0 )

( 1 9 1 )

( 6 5 )

1 9

Page 199: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 199/343

A B A C U S S o f t w a r e P R I N T B R B O O K f o r t h e C O N M O D O R B 6

0 5 8 C0 5 8 E0 5 9 00 0 9 20 5 9 40 5 9 60 5 9 80 5 9 A0 5 9 B0 5 9 D0 5 9 F0 5 A 10 5 A 30 5 A 50 5 A 70 5 A 90 5 A B0 5 A D0 5 A E0 5 B 00 5 B 10 5 B 30 5 B 40 5 B 60 5 B 70 5 B 90 5 B A0 5 B B0 5 B C0 5 B E0 5 C 00 5 C 20 5 C 4

0 3 8 09 6 9 2B O A OE B 7 EB 1 0 AB B 8 1B F 2 2F C 6 A 1B C 0 9A 4 A 3B C 0 1B 8 2 0B 0 8 1B 8 1 0B 0 1 84 4 A DF C 6 B 6F 3 4 D 8E A 4 B AF 9 4 0 0E F B 8 7 FA 4 8 6F B C 0 1C 6 C 5C

a d j n m o d j n zm o m o m o m o j m o j m m o m o m o m o m o j m m o j s e c a l ls e j m s e c a l ls e m o m o j m m o m o j d e

a , # 8 09 @ r 0 , # A 0r 3 , # 7 E@ r l , # 0 Ar 3 , # 8 1r 7 , # 2 2a , r 4A r 4 , # 0 95 A r 4 , # 0 1r 0 , # 2 03 r 0 , # 8 1r 0 , # 1 03 r 0 , # 1 82 A a , r 4B m b 9 D m b 5 B m b C O m b a , r 2r O , # 7 F5 8 a r r 4 , # 0 1C r

( 1 2 8 )

( 1 6 0 )

( 1 0 )( 1 2 9 )( 3 4 )

( 9

( 1 ( 3 2 )( 1 2 9 )( 1 6 )( 2 4 )

( 1 2 7 )

( 1

1 9

Page 200: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 200/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

0 5 C 5 B 0 2 0 m o @ r 0 , # 2 0 ( 3 2 )0 5 C 7 A 4 9 2 j m 5 9 0 5 C 9 2 c l 0 5 C A A m o r 5 , a0 5 C B A m o v r 6 , a0 5 C C 8 r e * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *0 5 C D F m o a , r 40 5 C E B 2 E 6 j b E 0 5 D 0 D 4 2 5 c a l l 6 2 50 5 D 2 O i a , p 20 5 D 3 3 c p 0 5 D 4 9 2 E 7 j b E 0 5 D 6 D 4 2 5 c a l l 6 2 50 5 D 8 4 3 2 0 o r a , # 2 0 ( 3 2 )0 5 D A A m o v r 4 , a0 5 D B F m o a , r 40 5 D C 3 c p 0 5 D D B 2 E 6 j b E 0 5 D F D 4 3 0 c a l l 6 3 00 5 E 1 O i a , p 20 3 E 2 9 2 D B j b D 0 5 E 4 A 4 D 2 j m p 5 D 20 5 E 6 8 r e 0 5 E 7 D 4 3 0 c a l l 6 3 0 T e s t t i m e r0 5 E 9 A 4 D 2 j m p 5 D 2* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * L i n e f e e d0 5 E B F s e m b 0 5 E C C 4 0 0 j m E 0 0 5 E E E s e m b 0 5 E F 8 r e * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *0 5 F 0 C F d e c r L a s t b y t e

c a l l i t i m e r

H e a d i s t a r t p o s i t i o n ?n

1 9

Page 201: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 201/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O N N O D O R B 6

0 5 F 10 5 F 20 5 F 30 5 F 40 5 F 5

F A 2 A 8

m o m o c l m o r e

a , r 7r O , a

© r O ,

i b u f f e rz e r o e d o u

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *0 5 F 6 D 4 1 0 c a l l 6 1 0 5 F 8 D 4 1 0 c a l l 6 1 00 5 F A C 4 1 0 j m p 6 1 0* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * L i n e f e e d0 5 F C 8 9 0 8 o r p i , # 0 8 ( 8 H e a d m o t o r o f 0 5 F E B 8 2 0 m o v r 0 , # 2 0 ( 3 2 )0 6 0 0 F m o v a , @ r 00 6 0 1 3 c p 0 6 0 2 F 2 0 6 j b 7 0 60 6 0 4 1 2 0 D j b O 0 0 6 0 6 9 9 F B a n p l , # F B ( 2 5 1 )0 6 0 8 B 4 E B c a l l 5 E B0 6 0 A B 4 C D c a l l 5 C D0 6 0 C 8 r e 0 6 0 D B 4 E B c a l l 5 E B0 6 0 F 8 3 r e t* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * T i m e C o n t r o l0 6 1 0 2 3 4 F m o a , # 4 F ( 7 9 )

t ,

C a r r i a g e r e t u r n o L i n e f e e dW a i t u n t i l h e a d i s i n

s t a r t p o s i t i o nL i n e f e e d

0 6 1 2 6 m o 0 6 1 3 5 s t r t0 6 1 4 1 6 1 8 j t 1 0 6 1 6 C 4 1 4 j m 6 1 0 6 1 8 1 6 1 C j t f 1 0 6 1 A C 4 1 8 j m 6 1 0 6 1 C 1 6 2 0 j t f 2 0 6 1 E C 4 1 C j m p 6 1 C0 6 2 0 F m o a , r 4

1 9

Page 202: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 202/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

0 6 2 10 6 2 30 6 2 4

B 2 3 36 8

j b s t o pr e

3 t e n t

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *0 6 2 50 6 2 60 6 2 70 6 2 80 6 2 90 6 2 A0 6 2 B0 6 2 C0 6 2 E0 6 2 F

2 D A C 6 5 F 5 3 A FA 8

c l s e m o s e m o s t r tm o a n m o r e

r b r l , ar b t ,

a , r 4a , # A Fr 4 , a

( 1 7 5 )

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *0 6 3 00 6 3 20 6 3 30 6 3 40 6 3 50 6 3 60 6 3 70 6 3 80 6 3 90 6 3 B0 6 3 C0 6 3 D0 6 3 F0 6 4 10 6 4 30 6 4 40 6 4 60 6 4 7

1 6 3 58 D 1 D 1 F C 9 6 4 8F 3 9 2 4 3D 2 5 C0 4 0 73 4 3 1 0A 8

j t r e s e i n s e i n m o s e j n m o c p j b j b j m c p o r m o r e

3

r b r r b r a . r lr b 4 a , r 4

4 5 0 0

a , # 1 0r 4 , a

( 1 6 )

1 9

Page 203: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 203/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h C O M M O D O R E 6

0 6 4 8 0 3 F 3 a d a , # F 3 ( 2 4 3 )0 6 4 A F m o a , r 40 6 4 B 3 c p 0 6 4 C B 2 3 2 j b 3 0 6 4 E E 6 3 2 j n 3 0 6 5 0 F m o a , r 40 6 5 1 5 3 8 F a n a , # 8 F ( 1 4 3 )0 6 5 3 A m o r 4 , a0 6 5 4 8 9 0 4 o r p i , # 0 4 ( 4 0 6 5 6 2 q l 0 6 5 7 D s e r b 0 6 5 8 A m o r l , a0 6 5 9 C 5 s e l r b 0 6 5 A 6 s t o p t e n t0 6 5 B 8 r e 0 6 5 C 3 c p 0 6 5 D 4 3 4 0 o r a , # 4 0 ( 6 4 )0 6 5 F A m o r 4 , a0 6 6 0 8 r e * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

C a r r i a g e r e t u r n o f f

0 6 6 10 6 6 20 6 6 30 6 6 40 6 6 50 6 6 60 6 6 70 6 6 80 6 6 A0 6 6 C

A 9 F A F 6 A B 9 1 8B B 0 68

m o c l r l m o r l a d m o m o m o r e

r 2 , a

r 2 , a

a , r 2r 0 , ar l , # 1 8r 3 , # 0 6

( 2 4 )( 6

P o s i t i o ni c h a r a c t e rg e n e r a t o rc a l c u l a t e d

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

0 6 6 D0 6 6 F

9 9 F 32

a n c l

p l , # F 3 ( 2 4 3 ) H e a d m o t o r a n d c / r o

1 9

Page 204: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 204/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O N N O D O R B 6

0 6 7 00 6 7 10 6 7 30 6 7 40 6 7 60 6 7 80 6 7 A0 6 7 B0 6 7 D0 6 7 E0 6 7 F0 6 8 00 6 8 20 6 8 40 6 8 60 6 8 80 6 8 90 6 8 A0 6 8 C0 6 8 D0 6 8 E0 6 8 F0 6 9 10 6 9 20 6 9 40 6 9 50 6 9 70 6 9 90 6 9 A0 6 9 C0 6 9 E0 6 9 F0 6 A 0

6 B 8 0 D5 1 6 7 8C 4 7 4E 8 7 46 2 3 C 06 5 2 4 6 8 45 6 8 24 6 8 45 6 8 66 3 8 9 0 42 6 5 B 9 2 00 9 2 B D0 9 2 B DB 9 0 06 1 6 9 C2 3 C 06 5 2

m o m o

s t r tj t j m d j n zs t o pm o m o s t r te j n t lj t j n t lj t s t o pd i o r c l m o s t r tm o i j b i j b m o s t o pj t

m o m o s t r te

t , r O , # O D

7 6 7 r O , 7 4t e n ta , # C 0t ,

t c n t i8 8 8 8 t e n tt c n t ip i , # 0 4

t ,

r l , # 2 0a , p 2B a , p 2B r l , # 0 0t e n t9 a , # C 0t ,

t c n t i

( 1 3 )

( 1 9 2 )

( 4

( 3 2 )

( 0

( 1 9 2 )

D e a d l o c k — i f n b e a tf o l l o w s t w s u c c e s s i v eb e a t s ,t h t i m e w h e e lp a u s e s w a i t s

C a r r i a g e r e t u r n o f

H a t h p r i n t h e a dl e f t s t a r t i n gp o s i t i o n ?n

1 9

Page 205: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 205/343

s t o pd i i n c l m o m o m o i n m o

t e n tt c n t ir

t , r O , # l E@ r O , ar @ r O , a

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * W a i t f o b e a t f r t i m e r0 6 A 1 5 6 A 1 j t A 0 6 A 3 4 6 A 3 j n t l A 0 6 A 5 6 0 6 A 6 3 0 6 A 7 1 0 6 A 8 2 0 6 A 9 6 0 6 A A B 8 1 E m o v r O , # l E ( 3 0 )

0 6 A C A 0 6 A D 1 0 6 A E A 0 6 A F 5 s t r t0 6 B 0 4 6 A 3 j n t l A 0 6 B 2 4 m o a , 0 6 B 3 3 c p 0 6 B 4 7 2 B 0 j b 3 B O0 6 B 6 1 2 B 0 j b O B 0 6 B 8 6 s t o p t e n t0 6 B 9 B 8 1 1 m o v r O , # l l ( 1 7 )0 6 B B S c l 0 6 B C 8 r e * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *0 6 B D 1 6 C 1 j t C T i m e r r u n n i n g ? y e s —0 6 B F C 4 9 1 j m 6 9 0 6 C 1 E 9 9 1 d j n z r l , 9 1 R e p e a t u n t i l R l = 0 , t h e n0 6 C 3 0 4 0 7 j m p 0 0 7 d e a d l o c k .* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * L i n e f e e d0 6 C 5 8 9 0 8 o r p i , # 0 8 ( 0 8 ) H e a d m o t o r o f 0 6 C 7 B 8 1 0 m o v r 0 , # 1 0 ( 1 6 )0 6 C 9 B 0 1 8 m o @ r O , # 1 8 ( 2 4 )0 6 C B 0 i a , p 20 6 C C 9 2 D 2 j b D

1 9

Page 206: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 206/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

0 6 C E 9 9 F B a n p l , # F B ( 2 5 1 ) C a r r i a g e r e t u r n o 0 6 D 0 B 4 C D c a l l 5 C 0 6 D 2 0 i a , p i L i n e f e e d k e p r e s s e d ?0 6 D 3 D 2 D D j b D n o p e0 6 D 5 B 4 E B c a l l 5 E 0 6 D 7 B 4 F 6 c a l l 5 F 0 6 D 9 B 4 F 6 c a l l 5 F 60 6 D B C 4 D 2 j m p 6 D 20 6 D D E 4 0 0 j m 7 0 W a i t - l o o p* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *0 6 D F 9 9 7 F a n p l , # 7 F ( 1 2 7 ) D A T A f l i p f l o p r e l e a s e d0 6 E 1 9 m o v x @ r O , a D A T A b y t e s e t l o w0 6 E 2 8 r e

0 6 E 3 8 9 8 0 o r p l , # 8 0 ( 1 2 8 ) D A T A b y t e s e h i g h0 6 E 5 9 9 7 F a n p l , # 7 F ( 1 2 7 )0 6 E 7 8 r e * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * C h e c k f o e n d - o f - l i n e0 6 E 8 9 c l

( 3 1 )

( 2 5 4 )

( 3 2 )

0 6 F 7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * W a i t - l o o v0 7 0 0 7 6 1 3 j f 1 A d d r e s s e d a L I S T E N E R ? y e s - >

2 0

0 6 E 90 6 E B0 6 E C0 6 E E0 6 F 00 6 F 20 6 F 30 6 F 40 6 F 6

B 8 1 FF C 6 F 60 3 F EF 6 F 6C F 0 3 2 08

m o m o j a d j d e m o a d r e

r 0 , # l Fa , 3 r 0F a , # F EF r a , @ r 0a , # 2 0

Page 207: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 207/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O N M O D O R B 6

0 7 0 20 7 0 30 7 0 50 7 0 70 7 0 80 7 0 A0 7 0 C0 7 0 E0 7 0 F0 7 1 10 7 1 30 7 1 40 7 1 60 7 1 8

"

0 7 1 A0 7 1 C0 7 1 E0 7 2 00 7 2 20 7 2 30 7 2 40 7 2 60 7 2 80 7 2 A0 7 2 B0 7 2 C0 7 2 E0 7 3 00 7 3 20 7 3 40 7 3 60 7 3 7

0 F 2 1 AD 4 E 3O F 2 1 AB 2 0 EA 4 6 40 D 2 0 0C 4 C 5O F 2 1 A3 6 4 CE 4 0 0

D 4 D FB 8 D CD 4 D FE 8 1 E0 3 9 2 0 0B 8 1 42 3 C F5 A B 8 1 4B 9 0 88 9 8 0B A 0 18 6 3 CO 3

i j b c a l li j b j b j m i j b

j m i j b j t j m

^ ♦ ♦ ♦ 'c a l lm o c a l ld j n zi c p j b m o m o a n m o m o m o o r m o j n i c p

a , p 21 6 E a , p 21 0 5 6 a , p i0 6 C a , p 21 4 7 0

6 D r O , # D C6 D r O , l Ea , p i

0 r O , # 1 4a , # C Fa , @ r 0@ r 0 , ar O , # 1 4r l , # 0 8p i , # 8 0r 2 , # 0 13 a , p 2

* * * * * * *^ ^ ^ ♦ ♦ ^ *

( 2 2 0 )

( 2 0 )( 2 0 7 )

( 2 0 )( 8 ( 1 2 8 )( 1

A T N ?Y e D A T A s e h i g hA T N ?y e T e s t m o d e ?y e L i n e f e e d k e y p r e s s e d ?n

L i n e f e e d c l e a r e dA T N ?y e C L h i g h ? y e w a i t

♦ J u m p t A T D A T A s e t l o wC o u n t e r s e D A T A s e t l o ww a i tC L l o w ?

n

c o u n t e r s e t w a i t b y C L B i c o u n t e r s e D A T A o p e n e d f o i n p u t

D A T A h i g h ? y e A T s t i l l l o w ?

2 0

Page 208: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 208/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

0 7 3 8 F 2 0 0 j b 0 0 7 3 A E 4 3 4 j m 7 3 0 7 3 C 2 6 4 3 j n t O 4 0 7 3 E O i a , p 20 7 3 F F 2 4 8 j b 0 7 4 1 E 4 0 0 j m 0 7 4 3 O i 0 7 4 4 F 2 7 D j b 0 7 4 6 E 4 0 0 j m

n o E r r o r A l a r m

C L s t i l l l o w ?A T N s t i l l l o w ?y e E r r o r A l a r m — >A T N S T I L L l o w ?y e E r r o r A l a r m — >W a i t u n t i l C L K = l o w

y e

4 7 0 a , p 27 7 0

0 7 4 8 E 8 3 C d j n z r O , 3 C0 7 4 A E 4 6 9 j m 7 6 ♦ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * W a i t f o b y t e

S e b i c o u n t e rs e D A T A h i g h

A T l o w ?y e D A T A h i g h ? y e

I n o t , w a i tC L s t i l l l o w ? y e sA T l o w ?y e

A T l o w ?y e

D A T A s e l o

w a i ts e D A T A h i g h

0 7 4 C0 7 4 E0 7 5 00 7 5 20 7 5 40 7 5 50 7 5 70 7 5 90 7 5 B0 7 5 D0 7 5 E0 7 6 00 7 6 20 7 6 40 7 6 50 7 6 70 7 6 90 7 6 B0 7 6 D

0 7 6 F0 7 7 1

B 8 1 4B 9 0 88 9 8 0B A 1 40 F 2 1 A8 6 5 BE 4 5 22 6 6 40 F 2 1 AE 8 5 BE 4 6 90 F 2 1 AE 4 7 DD 4 D FB 8 2 1E 6 8 D8 9 8 00

m o m o o r m o i j b j n j m j n t Oi j b d j n zj m i j b j m c a l lm o d j n zo r i

r O , # 1 4r l , # 0 8p i , # 8 0r 2 , # 1 4a , P 21 5 7 5 6 a , P 21 r O , 5 B7 6 a , p 21 7 7 6 D r O , # 2 1r O , 6 Dp i , # 8 0a , P 2

( 2 0 )( 8 ( 1 2 8 )( 2 0 )

( 3 3 )

( 1 2 8 )

2 0

Page 209: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 209/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

0 7 7 20 7 7 40 7 7 60 7 7 80 7 7 A0 7 7 B^ ^ ^ ^ ^

0 7 7 D0 7 7 F0 7 8 00 7 8 20 7 8 30 7 8 40 7 8 50 7 8 60 7 8 80 7 8 90 7 8 B0 7 8 D0 7 8 F0 7 9 10 7 9 20 7 9 40 7 9 50 7 9 60 7 9 70 7 9 80 7 9 A0 7 9 C0 7 9 E0 7 A 00 7 A 20 7 A 3

E A 7 8F 2 7 AE 4 0 0F 2 1 A1 3 6 7 1

2 6 7 D9

8 6 8 3A F 6 A E 9 7 10 E A 8 FF 2 9 1E 4 0 0F 2 1 A1 3 6 8 8F 3 A O F 2 A 77 6 9 EE 4 0 0D 4 D FB 8 1 4F F 2 0 0

d j n zj b j m j b i n j t

j n t Oc l

j n c p m o r r m o d j n zi d j n zj b j m j b i n j t m o c p m o i j b j f j m c a l lm o m o j b

r 2 , 7 87 7 0 1 r 7

^ ^

7

8

a r

r 0 , ar l , 7 1a , p 2r 2 , 8 F9 7 0 1 r 8 a , r 0

r 2 , aa , P 2A 9 7 0 6 D r 0 , # 1 4a , @ r 00

k G e t b y t eW a i t ' t i l C L K = h i g hS h i f tb i t st R

R e p e a t u n t i l b i t c o u n t e r = 0A T N = l o w ?

y e W a i t - l o o pA T l o w ? y e

W a i t u n t i l C L K = l o w t i n v e r t b y t e r e c e i v e da n b r i n g t

R 2 A T l o w ?y e a d d r s d a L I S T E N E R ? y e s — >W a i t - l o o pD A T A s e l o ( r e c e i v e d )

( 2 0 )

2 0

Page 210: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 210/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O N M O D O R B 6

0 7 A 50 7 A 70 7 A 90 7 A A0 7 A B0 7 A D0 7 A F0 7 B 00 7 B 20 7 B 30 7 B 50 7 B 70 7 B 80 7 B A0 7 B C0 7 B E0 7 B F0 7 C 10 7 C 30 7 C 40 7 C 6

0 4 7 52 3 7 F5 A B 8 1 42 3 C 16 9 6 B 7A B 0 0 0E 4 B AF C 4 7 8D 4 D F3 6 C 3O F 2 B CE 4 0 0O F 2 2 CE 4 C 1

j m m o

a n m o m o m o a d j n c l m o j m s e j m c a l lj t i j b j m i j b j m

0 7 a , # 7 Fa , r 2r 2 , ar O , # 1 4a , # C la , r 2B f @ r 0 , # 0 07 B m b E 7 6 D C a , p 2B 7 0 a , p 22 7 C

( 1 2 7 )

( 2 0 )( 1 9 3 )

( 0

B r i n g a d d r e s sr e c e i v e d t o R 2d u r i n g A T N

U N L I S T E N ?

n L I S T E N - f l a g r e s e t

C h e c k a d d r e s sD A T A s e t l o wC L h i g h ? y e sA T l o w ?y e W a i t - l o o pA T l o w ?y e

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * W a i t u n t i l a d d r e s s i n gc y c l e e n d s

0 7 C 8 0 i a , p 2 A T N l o w ?0 7 C 9 F 2 C 8 j b 7 C 8 y e 0 7 C B E 4 0 0 j m p 7 0 0 W a i t - l o o p

0 7 C D 4 s t r t c n 0 7 C E 2 c l 0 7 C F 6 m o 0 7 D 0 A m o

t , r 5 , a

0 7 D 1 B 8 1 E m o v r O , # l E0 7 D 3 1 i n @ r

S t a r t b e a t - c o u n t e ra n L i n e -c o u n t e r

( 3 0 ) + 1

2 0

Page 211: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 211/343

A B A C U S S o f t w a r e P R I N T B R B O O K f o r t h e C O M M O D O R E 6

0 7 D 4 F i o v a , @ r O0 7 D 5 1 i n r

0 7 D 6 9 6 D 9 j n D 0 7 D 8 1 i n @ r 0 7 D 9 8 r e 0 7 D A 0 0 0 0 0 0 0 0 0 0 0 7 E 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 F 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

2 0

Page 212: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 212/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

0 8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8 0 6 0 0 0 0 5 0 0 0 0 0

0 8 0 C 0 0 0 0 0 0 * *

0 8 1 8 2 2 7 2 1 0

* * * *

* *

* * * *

0 8 2 4 3 4 E 5 9 2 6 5 0 0

*

* *

*

0 8 1 2 1 7 1 7 1 0

* * * * *

* * * * *

0 8 1 E 6 1 0 8 6 4 6 3 0 0* *

* *

0 8 2 A 0 0 0 0 0 0 0 0

2 0

Page 213: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 213/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

0 8 3 0 0 1 C 2 2 4 1 0 0 0 0

0 8 3 C 2 1 7 1 2 0

* * * *

* * * * ** *

*

0 8 4 8 0 4 3 0 0 0 0 0 0

0 8 3 6 0 4 2 1 0 0 0 0

0 8 4 2 0 8 0 8 3 0 8 0 8 0

* * * * *

0 8 4 E 0 0 0 8 0 8 0 8 0

* * * * *

0 8 5 4 0 0 6 0 6 0 0 0 0 0 0 0 0 8 5 A 6 1 0 0 4 0 3 0 0

* *

2 0

Page 214: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 214/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

0 8 6 0

0 8 6 C

0 8 7 8

0 8 8 4

3 E 5 1 4 * *

*

*

* * 6 5 5

* * *

*

* * * * *1 1 1

* *

* * * * *

3 4 4 * *

* * * *

* *

4

4

7

4

3

4

1

3

0

0

0

0

0 8 6 6

0 8 7 2

0 8 7 E

0 8 8 A

0

2

2

0

4 7

*

* * 4 4 * *

*

*

* * 4 5 4 5

* * * * *

* * * *

* * 7 0

* * * * *

4

4

4

0

0

3

3

0

0

0

0

0

2 0

Page 215: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 215/343

A B A C U S S o f t w a r e P R I N T B R B O O K f o r t h e C O M M O D O R E 6

0 8 9 0 3 4 4 4 3 0 * *

* *

* * *

0 8 9 C 0 0 1 0 0 0 0 0

0 8 9 6 4 6 4 9 4 2 I 0 * *

* * * *

* * 0 8 A 2 0 4 3 0 0 0

0 8 A 8 0 1 4 2 2 4 1 4 1 0 *

0 8 A E 1 4 1 4 1 4 1 1 0

*

* * * * *

* 0 8 B 4 4 1 4 1 2 2 1 4 0 0

* 0 8 B A 0 0 5 0 0 0

* *

2 0

Page 216: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 216/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

0 8 C 0 A m o v p a , @ a G e m a t r i x0 8 C 1 A m o @ r l , a c o l u m n0 8 C 2 8 r e * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *0 8 C 3 F A m o v a , r 20 8 C 4 F 2 D 7 j b 0 8 C 6 0 3 E 0 a d 0 8 C 8 F 6 D 1 j 0 8 C A 0 3 1 3 a d 0 8 C C C 6 D 4 j 0 8 C E F m o 0 8 C F 1 2 D 7 j b 0 8 D 1 E s e 0 8 D 2 E 4 0 0 j m 0 8 D 4 E s e 0 8 D 5 2 4 0 7 j m 0 8 D 7 3 4 C 3 c a l l 9 C 0 8 D 9 F m o a , r 20 8 D A 0 3 4 0 a d d a , # 4 00 8 D C A A m o v r 2 , a0 8 D D C 4 7 0 j m p E 7 00 8 D F F m o v a , r 40 8 E 0 7 2 E 6 j b 3 E 60 8 E 2 9 4 0 0 c a l l C 0 0 00 8 E 4 0 4 E 8 j m 8 E

D a , # E 0D a , # 1 3d a , r 4D m b 7 0 m b 1 0

( 2 2 4 )

( 1 9 )

C h a r . > 3 1 ?y e C R y e

W a i t - l o o p

U t i l i z e

0 8 E 60 8 E 80 8 E 90 8 E A0 8 E B0 8 E C0 8 E D

3 4 D 8F A F A I F

c a l lm o m o m o m o i n

m o

9 D a , r 7r 0 , aa r @ r 0 , ar a r

( 6 4 )

E x e c u t e R V S - O N —c h a n g e c o n t r o l c h a r s .i n t op r i n t a b l e c h a r s .

2 1

Page 217: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 217/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

0 8 E E0 8 F 00 8 F 10 8 F 30 8 F 50 8 F 70 8 F 90 8 F B0 8 F D0 8 F E

5 3 F BA B 8 2 1B 0 0 4B B 0 1B 8 1 8B 0 0 1B A 9 2E 0 4 B 5

a n m o

m o m o m o m o m o m o s e j m

a , # F Br 4 , ar O , # 2 1@ r 0 , # 0 4r 3 , # 0 1r O , # 1 8@ r 0 , # 0 1r 2 , # 9 2m b 0 B

( 2 5 1 )

( 3 3 )( 4 ( 1 ( 2 4 )( 1 ( 1 4 6 )

2 1

Page 218: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 218/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

0 9 0 0

0 9 0 C

0 9 1 8

0 9 2 4

3 E 4 1 5 D* *

* * *

* *

* * * *4 7 F 4 9

* * * *

* *

* * * * *

4 7 4 * * * *

*

* * * *

7 F 0 9 0 * * * * *

* * * *

5

4

4

0

5

3

3

0

0

0

0

0

0 9 0 6

0 9 1 2

0 9 1 E

0 9 2 A

7 0 0 * *

* * * * **

3 4 4 * *

* * *

7 4 9 4 9* * * * *

* * * *

* * * * *

3 E 4 1 4 * *

*

* *

0

4

4

4

7

2

4

3

0

0

0

0

2 1

Page 219: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 219/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

0 9 3 0

0 9 3 C

0 9 4 8

0 9 5 4

7 0

* *

2 4

0

*

4 * *

* 7 4 4

* * * * *

7 F 0 4

*

0

*

0

3

4

1

7

0

4

7

0

0

0

0

0 9 3 6

0 9 4 2

0 9 4 E

0 9 5 A

0 4 * *

* * 7 0

*

7 0

7

1

O

* * * **

3 E 4 1* *

* *

4

4

2

0

4

0

4

7

3

0

0

0

0

2 1

Page 220: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 220/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

0 9 6 0

0 9 6 C

0 9 7 8

0 9 8 4

7 F 0 9 0 9* * * *

* * * * *

7 0 1 * * * *

* * * *

0 1 0 1 7 * * * * *

0 7 1 8 6

*

*

0

2

0

1

0

4

0

0

0

0

0

0

0 9 6 6

0 9 7 2

0 9 7 E

0 9 8 A

3 4 * *

*

* 2 4

* *

* *

* * 3 F 4 0

* * 7 2

*

5 2 5 0

4 9 4 9 3 0

4 4 0 3 F 0

1

* * * *

2 1

Page 221: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 221/343

A B A C U S S o f t w a r e P R I N T B R B O O K f o r t h e C O N N O D O R B 6

0 9 9 0 6 1 0 1 6 0

*

*

0 9 9 C 6 5 4 9 4 5 4 0 * * * * *

* * * * *0 9 A 8 4 7 4 4 4 0

*

* * * *

* * * * *

0 9 B 4 0 0 0 7 0 2 0 4

* * *

0 9 9 6 0 0 7 0 8 0 7 0 0

* *

0 9 A 2 0 7 F 4 1 4 1 0 0 * *

* * 0 9 A E 0 4 4 7 0 0 0 0

* *

* * 0 9 B A 0 1 2 0 8 0 8 0

* * * * * *

2 1

Page 222: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 222/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *0 9 C 0 A m o v p a , @ a G e 0 9 C 1 A m o © r l , a m a t r i x c o l u m n0 9 C 2 8 r e * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *0 9 C 30 9 C 40 9 C 60 9 C 80 9 C 90 9 C A0 9 C C0 9 C D0 9 C E0 9 C F0 9 D 10 9 D 2

F 5 2 D 2B 8 2 1F C 5 2 D 2I F A B 0 1 2I 8

m o j b m o m o d e j b i n

m o m o m o i n r e

a , r 4D r O , # 2 1a , @ r Or D r a , r 7r O , a@ r O , # 1 2r

( 3 3 )

( 1 8 )

I n s e r t

R V

c h a r a c t e r

i

b u f f e r

t c o n v e r t

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *0 9 D 30 9 D 40 9 D 60 9 D 7

F 0 3 4 0A 8

m o a d m o r e

a , r 2a # 4 r 2 , a

( 6 4 )c o n t r o l c o d e si n t op r i n t a b l ec h a r a c t e r s

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * C h a r a c t e r c o n v e r s i o n0 9 D 8 B 8 1 4 m o r O , # 1 4 ( 2 0 )0 9 D A F m o a , @ r O0 9 D B 3 c p 0 9 D C 3 2 E 0 j b l E O0 9 D E 8 4 0 9 j m 4 0 0 9 E 0 9 4 0 9 c a l l 4 0 0 9 E 2 F m o v a , r 2 C h a r a c t e r 2 1 9 ?0 9 E 3 0 3 2 5 a d d a , # 2 5 ( 3 7 )0 9 E 5 F 6 F E j c F E y e

2 1

Page 223: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 223/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h C O M M O D O R E 6

0 9 E 70 9 E 90 9 E B0 9 E D0 9 E F0 9 F 10 9 F 30 9 F 50 9 F 60 9 F 80 9 F A0 9 F B0 9 F D0 9 F E

0 3 1 BC 6 F EE F 6 10 3 4 02 4 F D0 3 2 0F 6 F EF 0 3 A 5F 6 F EF 0 3 8 0A C 4 4 B

a d j j n a d j m a d j m o a d j m o a d m o j m

a , # l BF F a , # 4 01 F a , # 2 0F a , r 2a , # A 5F a r

a , # 8 0r 2 , a6 4

( 2 7 )

( 6 4 )

( 3 2 )

( 1 6 5 )

( 1 2 8 )

1 9 2 ?

< 1 9 2 y e

> 1 6 0 ?y e

> 9 1 ?y e

2 1

Page 224: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 224/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

0 A 0 0 0 0 0 0 0 0 0 0 0 0 0 0

O A O C 7 8 7 8 7 8 7 8 7 8 7 8

0 A 0 6 7 7 7 0 0 0 * * * * * * * * * * * * * *

0 A 1 2 0 0 0 1 0 1 0 1 0 1

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

0 A 1 8 4 4 4 0 4 0 4 0 4 0 0 A 1 E 7 0 0 0 0 0 0 0 0

* * * * * *0 A 2 4 5 2 5 2 5 2

* * *

*

* *

* *

0 A 2 A 0 0 0 0 0 0 0 0 7

2 1

Page 225: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 225/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h C O M M O D O R E 6

0 A 3 0 5 0 2 8 5 0 2 5 0 2 8 0 A 3 6 3 I O 0 0 0

* *

* 0 A 3 C 0 0 0 0 0 0 0 0 0 0 7

0 A 4 8 0 0 0 0 0 0 7 8 7 8 7 8

* * * * * * * *

0 A 5 4 0 8 0 8 0 7 0 0 0 0

* * * ** * *

0 A 4 2 0 0 0 7 0 0

* *

0 A 4 E 0 0 0 O 0 0

* *

0 A 5 A 6 6 6 0 6 0 6 6

* * * *

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

2 1

Page 226: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 226/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

0 A 6 0 0 0 0 0 0 0 7 8 0 0 0 A 6 6 0 0 8 0 8 O F 0 8 0

* * * * * * * *

0 A 6 C 0 0 0 8 7 8 0 8 0 8 0 A 7 2 0 8 0 8 0 8 7 0 0 0 0

* * * * * * * * * **

* 0 A 7 8 7 0 0 0 0 0 0 0 0 A 7 E 7 F 7 F 0 0 0 0 0 0 0 0

* * * * * * *

0 A 8 4 0 0 0 0 0 0 7 7 0 A 8 A 0 1 0 1 0 1 0 1 0 0 * * * * * * ** * * * * *

2 2

Page 227: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 227/343

A B A C U S S o f t w a r e P R I N T B R B O O K f o t h C O M M O D O R E 6

0 A 9 0 0 0 0 0 3 0 3 0 0 A 9 6 7 7 7 7 0 7 0 7

* * * * * *

* * * * * *

* * * * * *0 A 9 C 4 4 0 4 0 4 0 4 7 0 A A 2 7 7 8 7 8 0 0 0

* * * * * *0 A A 8 0 0 0 0 0 0

* * * * * *

* * * * * * * *

O A A E 0 0 0 8 O F 0 0 0 0

* * * *

0 A B 4 0 7 0 7 0 7 0 0 0 0 * * * * * *

O A B A 0 7 0 7 0 7 7 8 7 8 7 8* * * * * *

* * * * * * * *

2 2

Page 228: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 228/343

A B A C U S S o f t w a r e P R I N T B R B O O K f o r t h e C O M N O D O R B 6

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *O A C O A m o v p a , @ a G e 0 A C 1 A m o 6 r l , a m a t r i x c o l u m n0 A C 2 8 r e * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *0 A C 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 O A D O 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0O A E O 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 O A F O 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

0 B 0 0 0 8 0 8 0 8 0 8 0 0 0 B 0 6 1 4 7 4 1 0

* * * * * * *

* * * * * * * * * * *

* * O B O C 0 0 0 0 7 0 0 0 0 B 1 2 0 4 0 4 0 0 4 0 4 0 4

* * * * * *

0 B 1 8 0 2 0 2 0 2 0 0 2 0 2 0 B 1 E 0 1 0 1 0 1 0 1 0 1 0 1

* * * * * *

2 2

Page 229: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 229/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

0 B 2 4 2 0 2 0 2 0 2 0 2 2 0 B 2 A 0 0 7 F 0 0 0 0 0 0

0 B 3 0 0 0 0 0 0 0 0 0 7 0 0 B 3 6 0 0 1 6 0 0 0 0 0

*

0 B 3 C 0 0 0 0 0 0 0 3 0 4 0 0 B 4 2 0 0 8 0 4 0 3 0 0

*

0 B 4 8 7 4 0 4 0 4 0 4 0 4 0 0 B 4 E 0 2 0 4 0 1 2 4

2 2

Page 230: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 230/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

0 B 5 4 4 2 1 0 0 0 0 B 5 A 7 0 0 1 0 1 0 1 0 * * * * * *

0 B 6 0 0 1 0 1 0 1 0 0 1 7 F* * * * * *

0 B 6 C 2 0 2 0 2 0 2 0 2 2

0 B 6 6 3 C 7 E 7 E 7 E 3 C 0 0

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

* * 0 B 7 2 1 3 E 7 C 3 E 1 0

* * * * * *

0 B 7 8 0 7 0 0 0 0 0 0

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

* *

0 B 7 E 0 0 0 0 0 0 6 0 1 0

2 2

Page 231: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 231/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

0 B 8 4 4 2 1 8 1 8 2 4 0 B 8 A 3 4 4 2 4 2 3 0

* * *

* *

0 B 9 0 1 O A 7 F O 1 0

* * *

* * * * *

0 B 9 C 1 8 3 C 7 3 1 0

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

* *

0 B A 8 5 2 5 0 0 0 0 0

* *

*

* * *

0 B 9 6 0 0 0 0 0 0 7 F 0 0

0 B A 2 0 0 0 8 7 F 0 0

* * * * * *

O B A E 0 0 0 7 0 0

2 2

Page 232: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 232/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

0 B B 4 0 7 0 7 C 0 4 0 O B B A 0 0 0 O I 3 * * * * * *

* * * * ** * * *

* *

O B C O 0 0 0 0 0 0 7 F 7 F 7 * * * * * * * * * * * * * *

O B C C 7 2 1 0 0 0

* * *

* * * ** *

*

0 B C 6 1 0 1 0 1 0 1 0 1 0 1

* * * * * *

0 B D 2 1 4 2 1 4 2

*

* *

*

2 2

Page 233: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 233/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O H N O D O R B 6

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *0 B D 8 A m o v p a , 6 a G e 0 B D 9 A m o v § r l , a m a t r i x c o l u m nO B D A 8 r e * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

O B D B 0 0 0 0 0 0 0 0 0 O B E O 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 O B F O 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

0 C 0 0 B 8 1 4 m o v r O , # 1 40 C 0 2 F m o v a , 3 r 00 C 0 3 1 2 0 7 j b 0 0 C 0 5 8 4 0 9 j m C 0 0 C 0 7 2 4 E 0 j m p 9 E 0

( 2 0 )

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * C h a r . c o n v e r s i o n0 C 0 9 F m o a , r 2O C O A 0 3 6 0 a d a , # 6 0 ( 9 6 )O C O C E 6 2 0 j n 2 O C O E 0 3 C 0 a d d a , # C 0 ( 1 9 2 )0 C 1 0 E 6 3 4 j n 3 0 C 1 2 0 3 E 1 a d d a , # E l ( 2 2 5 )0 C 1 4 C 6 1 D j I 0 C 1 6 0 3 0 9 a d a , # 0 9 ( 9 0 C 1 8 9 6 3 0 j n 3 0 C 1 A B A E O m o v r 2 , # E 0 ( 2 2 4 )0 C 1 C 8 r e 0 C 1 D B A D E m o v r 2 , # D E ( 2 2 2 )0 C 1 F 8 r e 0 C 2 0 0 3 4 0 a d d a , # 4 0 ( 6 4 )0 C 2 2 E 6 3 4 j n 3 0 C 2 4 0 3 F A a d d a , # F A ( 2 5 0 )0 C 2 6 9 6 2 B j n 2

C h a r a c t e r< 1 6 0 ?y e < 2 2 4 ?y e = 2 5 5 ?y e

2 4 6 ?n

< 9 6 ?y e

1 0 2 ?n

2 2

Page 234: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 234/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

0 C 2 80 C 2 A0 C 2 B0 C 2 C0 C 2 E0 C 3 00 C 3 10 C 3 30 C 3 4

0 C 3 50 C 4 0O C 5 00 C 6 00 C 7 00 C 8 00 C 9 0O C A OO C B OO C C OO C D OO C E OO C F O

B A E 18 F 0 3 6 08 4 3 3F 0 3 C 0A 8

0 0 0 0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0 0 0 0

m o r e m o a d j m m o a d m o r e

0 0 0 0 0 0 0 0 0 0 0 0 0

r

a a

, # E 1

r # 6

C 3 a a r

0 0 0 0 0 0 0 0 0 0 0 0 0

r # C

,

0 0 0 0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0 0 0 0

( 2 . 2 5 )

( 9 6 )

( 1 9 2 )

0 0 0 0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0 0 0

0 0 0 0 d 0 0 0 0 0 0 0

2 2

Page 235: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 235/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

0 D 0 0 0 0 0 0 8 0 8 0 8 0 D 0 6 2 5 4 5 4 3 C 4 0 0 0

* * * *

O D O C 7 F 4 8

* *

* * * *0 D 1 8 3 8 4 4

*

*

4 4 3 0

4 4 4 8 7 F 0

*

* * * *0 D 2 4 0 7

*

* *

0 0 0 2 0 0

* *

* *

* 0 D 1 2 3 4 4 4 4 4 4 4 0

* * * *

* * * *0 D 1 E 3 8 5 4 5 4 5 4 0 8 0 0

* *

* * * *

* * 0 D 2 A O 5 5 2 5 2 3 C 0 0

* * *

* * * *

* *

2 2

Page 236: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 236/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

0 D 3 0 7 F 0 8 0 0 7 0 0 D 3 6 0 4 7 4 0 0

* *

0 D 3 C 0 0 2 0 4 3 0 0

0 D 4 8 0 0 7 F 4 0 0 0 0 *

*

* * 0 D 4 2 7 1 2 4 0 0 0 0

* *

0 D 4 E 7 0 4 3 8 0 4 7 0

*

0 D 5 4 0 4 7 8 0 0 7 0

* *

0 D 5 A 3 4 4 4 4 4 3 0

* *

* *

*

* *

2 3

Page 237: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 237/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

0 D 6 0 7 1 2 1 2 O C 0 0 0 0 0 D 6 6 O 1 2 1 2 7 E 0 0 0 0

* * *

* *

* *

* *

0 D 6 C 7 C 0 8 0 0 0 0 0 D 7 2 4 8 5 4 5 4 5 4 2 0

* *

* *

* *

0 D 7 8 0 4 3 F 4 4 2 0 0 0* *

0 D 7 E 3 4 0 4 0 3 4 0 0 0

* * * *

* 0 D 8 4 O 3 4 0 3 0 O 0

* 0 D 8 A 3 4 3 4 3 C 0 0

* * *

2 3

Page 238: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 238/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

0 D 9 0 4 4 2 1 2 4 0 0 D 9 6 4 C 5 0 5 0 3 0 0

*

* 0 D 9 C 4 4 6 5 4 4 0

* *

* * 0 D A 2 0 8 0 8 0 8 7 F 0 8 0

* * * * *

* * * * *0 D A 8 5 2 5 5 0 0 0 0 0 0

*

*

0 D B 4 7 3 7 3 0 C O C 7 3 7 3* * * ** * * *

* *

* * * ** * * ** *

* * * * * *

O D A E 0 0 0 0 0 0 7 0 0 0 0

O D B A 2 4 1 2 4 1

*

2 3

Page 239: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 239/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R B 6

O D C O A m o v p a , @ a0 D C 1 A m o v © r l , a0 D C 2 8 r e * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

G e m a t r i x c o l u m n

0 D C 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0O D D O 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0O D E O 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0O D F O 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * L i n e f e e d s t e p # i m e m o r y l o c a t i o n 1

( 1 6 )

( 2 5 3 ) L i n e f e e d m o t o r o D e l a yM o t o r a d v a n c e s o n s t e p

D e l a y

D e l a y

D e l a y

M o t o r a d v a n c e s o n e s t e p

D e l a y( 2 L i n e f e e d - m o t o r o f

0 E 0 00 E 0 20 E 0 30 E 0 40 E 0 60 E 0 8O E O AO E O CO E O E0 E 1 00 E 1 20 E 1 40 E 1 60 E 1 80 E 1 90 E 1 B0 E 1 D0 E 1 F0 E 2 10 E 2 2

B 9 1 0F A 9 9 F DD 4 3 7D 4 2 4E 9 0 EC 4 1 DD 4 3 BC 4 1 9D 4 3 FE 9 1 8D 4 3 F1 D 4 2 4E 9 1 2D 4 3 78 9 0 2E A 4 E E

m o m o m o a n c a l lc a l ld j n zj m c a l lj m c a l ld j n zc a l li n c a l ld j n zc a l lo r s e j m

r l , # 1 0a , @ r lr l , ap l , # F DE 3 E 2 r l , 0 EE 1 E 3 E 1 E 3 r l , 1 8E 3 r E 2 r l , 1 2E 3 p i , # 0 2m b 5 E

2 3

Page 240: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 240/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * L i n e f e e d m o t o r m o v e so n s t e p b a c k

0 E 2 4 O i a , p 20 E 2 5 1 2 2 C j b 2 0 E 2 70 E 2 90 E 2 B0 E 2 C0 E 2 E0 E 3 00 E 3 10 E 3 30 E 3 40 E 3 6

3 2 3 48 A 0 28 3 2 3 19 A F E8 9 A F D8 8 A 0 18

j b o r r e j b a n r e a n r e o r r e

3 P 2 , # 0 2

3 p 2 , # F E

P 2 , # F D

P 2 , # 0 1

( 2

( 2 5 4 )

( 2 5 3 )

( 1

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * D e l a y0 E 3 70 E 3 90 E 3 B0 E 3 D0 E 3 F0 E 4 1

2 3 3 0C 4 4 12 3 5 1C 4 4 12 3 A 76

m o j m m o j m m o m o

a , # 3 0E 4 a , # 5 1E 4 a , # A 7t ,

( 4 8 )

( 8 1 )

( 1 6 7 )

0 E 4 2 5 s t r t0 E 4 3 1 6 4 5 j t 4 0 E 4 5 1 6 4 9 j t f0 E 4 7 C 4 4 5 j m 0 E 4 9 6 0 E 4 A 8

4 E 4

s t o p t e n tr e

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * C h a r a c t e r c o n v e r s i o n0 E 4 B F m o 0 E 4 C 0 3 1 F a d 0 E 4 E 9 6 5 3 j n 0 E 5 0 B A 4 6 m o 0 E 5 2 8 r e

a r a , # l F5 r 2 , # 4 6

( 3 1 )

( 7 0 )

C h a r a c t e r2 2 5 ?

n

2 3

Page 241: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 241/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

0 E 5 3 0 3 0 1 a d d a , # 0 1 ( 1 = 2 2 4 ?0 E 5 5 9 6 5 8 j n z 5 8 n o0 E 5 7 8 r e 0 E 5 8 0 3 2 0 a d d a , # 2 0 ( 3 2 )0 E 5 A C 6 5 7 j 5 0 E 5 C E 6 6 2 j n 6 0 E 5 E 0 3 6 0 a d d a , # 6 0 ( 9 6 )0 E 6 0 A A m o v r 2 , a0 E 6 1 8 r e 0 E 6 2 0 3 0 6 a d a , # 0 6 ( 6 0 E 6 4 9 6 6 9 j n z 6 90 E 6 6 B A E 2 m o v r 2 , # e 2 ( 2 2 6 )0 E 6 8 8 r e 0 E 6 9 0 3 1 1 a d d a , # 1 1 ( 1 7 )0 E 6 B 9 6 5 7 j n 5 0 E 6 D B A E 3 m o v r 2 , # E 3 ( 2 2 7 )0 E 6 F 8 r e * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *0 E 7 0 0 3 C 0 a d d a , # C 0 ( 1 9 2 )0 E 7 2 C 6 7 6 j 7 0 E 7 4 0 4 D F j m p 8 D F0 E 7 6 0 4 E 8 j m 8 E * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * T e s t a d d r e s s

1 9 2 ?y e < 1 9 2 ? y e

1 8 6 ?n

1 6 9 ?n

0 E 7 80 E 7 90 E 7 B

0 E 7 C0 E 7 E0 E 8 00 E 8 20 E 8 40 E 8 5

F 9 2 9 50

D 2 8 22 3 D BC 4 8 42 3 D C6 C 6 8 A

m o j b i

j b m o j m

m o a d j

a , @ r 09 a , p 2

8 a , # D BE 8 a , # D Ca , r 28

( 2 1 9 )

( 2 2 0 )

— a l r e a d y a d d r e s s e d ? ?y e s — > D o e s t h s e c o n d a r ya d d r e s s h a v e p r i n t e r a

d r e s s o f 4 ? ?y e

P r o p e r L I S T E N E R - a d d r e s s ?y e

2 3

Page 242: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 242/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

0 E 8 7 E s e m b O t h e r w i s e ,0 E 8 8 E 4 C 8 j m p 7 C 8 r e t u r n* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ? r i n t e r i a d d r e s s e d0 E 8 A 2 3 1 0 m o a , # 1 0 ( 1 6 )

a , @ r O L I S T E N E R - F L A G S3 r 0 , af s e f

0 E 9 0 C 4 A E j m p E A E* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *0 E 9 2 E s e m b 0 E 9 3 E 4 B A j m 7 B * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * C h e c k s e c o n d a r y a d d r e s s —

d o e s i a l r e a d y e x i s t ? y e s >

0 E 8 C0 E 8 D0 E 8 E0 E 8 F

4 A A B

o r m o c l c p

0 E 9 50 E 9 70 E 9 90 E 9 A0 E 9 B0 E 9 C0 E 9 EO E A O0 E A 20 E A 40 E A 50 E A 70 E A 8O E A AO E A CO E A EO E B O0 E B 10 E B 20 E B 4

B 2 9 22 3 2 04 A F 0 3 9 6C 6 B E0 3 0 2C 6 A E1 C 6 B 41 C 6 B E0 3 0 69 6 B E2 3 F 75 A C 4 B 82 3 0 8

j b m o o r m o m o a d j a d j d e j d e j a d j n m o a n m o j m m o

9 a , # 2 0a , @ r 0§ r 0 , aa , r 2a , # 9 6B a , # 0 2A

B

B a , # 0 6B a , # F 7a , r 4r 4 , aE B a , # 0 8

( 3 2 )

( 1 5 0 )

( 2

( 6

( 2 4 7 ]

( 8

2 3

Page 243: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 243/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

0 E B 6 4 C o r l a , r 40 E B 7 A m o v r 4 , a0 E B 8 2 3 7 C r a o v a , # 7 C ( 1 2 4 )O E B A 5 a n a , @ r OO E B B A m o @ r O , aO E B C C 4 C 2 j m p E C 2O E B E 2 3 8 0 m o v a , # 8 0 ( 1 2 8 )O E C O 4 0 o r l a , @ r O0 E C 1 A m o @ r O , a0 E C 2 E s e m b 0 E C 3 E 4 B A j m p 7 B A

T h m e m o r y r e g i s t e r s r e m a i n i n g ( f r o m h e r e t $ O F F F ) r e a do n l y $ 0 0 .

2 3

Page 244: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 244/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

{ T h i s p a g e l e f t b l a n k i n t e n t i o n a l l y }

2 3

Page 245: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 245/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h C O M M O D O R E 6

8 . 0 T H E V I C - 1 5 2 0 P R I N T E R - P L O T T E R

8 . U s e f u l n e s s a n O p e r a t i o n

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

b a l l p o i n t p e n s ( b l a c k , b l u e , g r e e n , r e d )d i f f e r e n t c h a r a c t e r s i z e s

1 0 2 0 4 0 o r 8 c h a r a c t e r s p e p l o t t e r l i n e1 c h a r a c t e r s p e s e c o n d i t h s m a l l e s t p r i n t m o d e9 d i f f e r e n t c h a r a c t e r s5 c h a r a c t e r s t e p s p e c e n t i m e t e r4 8 c h a r a c t e r s t e p s i x - d i r e c t i o n+ / - 9 9 9 c h a r a c t e r s t e p s i y - d i r e c t i o n2 6 c h a r a c t e r s t e p s p e s e c o n d

c e n t i m e t e r s c h a r a c t e r d i s t a n c e p e s e c o n d ( x o r y -d i r e c t i o n )

c e n t i m e t e r s c h a r a c t e r d i s t a n c e p e s e c o n d i 4 5 - d e g r e ea n g l e s1 1 . 4 c e n t i m e t e r - w i d e p a p e r ( 4 . 5 i n c h e s )

T h e s e s t a t e m e n t s s h o u l d b e n o u g h t g i v e y o u a i d e a o t h p l o t t e r ' s c a p a b i l i t i e s . T h i s d e v i c e i s m a l l m i r a c l e o t e c h n o l o g y . F o e x a m p l e , y o u a l r e a d y k n o w a b o u t i t f i n er e s o l u t i o n f r o m t h l i s t a b o v e : T h p l o t t e r c a d r a ws q u a r e i 4 8 0 x 4 8 0 s t e p s ( 2 3 0 , 4 0 0 p o i n t s ) , w i t h e a c h p o i n ti n d e p e n d e n t o o n e a n o t h e r . T h e p r i n t i n g s p e e d i n o t h i n gg r e a t a b o u t c m p e r s e c o n d , s a n p l o t t i n g t a k e s g o o dd e a l o f t i m e .

2 3

Page 246: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 246/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

O n t h i n g t h a t y o u m a y h a v e f o u n d c o n f u s i n g i t h a b o v el i s t i t h d i f f e r e n c e i p r i n t i n g s p e e d s : T h s t a n d a r d x a n y r e g i s t e r s r u a c m p e r s e c o n d , w h i l e t h s p e e d i 4 5 - d e g r e e a n g l e s i n c r e a s e s t c p e r s e c o n d . A l t h o u g ht h i s m a s e e m c o n t r a d i c t o r y , w c a e x p l a i n i i m a t h e m a t i c a l t e r m s :

I m a g i n e l i n e d r a w n f o r o n e s e c o n d i t h x - r e g i s t e r , t h e nc o n n e c t i n g l i n e d r a w n f o r o n e s e c o n d i t h y - r e g i s t e r .

W h a v e h e r e p a i r o c l i n e s d r a w n p e r p e n d i c u l a r t o n a n o t h e r , w i t h r e s u l t i n g 9 0 - d e g r e e l i n e . N o w t u r n t t h P y t h a g o r e a n T h e o r e m w h a v e r i g h t a n g l e , t w o s i d e s ,a n n e e d t c a l c u l a t e t h l e n g t h o f t h e m i s s i n g s i d e .

T h t h e o r e m u s e d i X 2 + Y 2 = Z 2— o r , w i t h o u n u m b e r s : 5 2 + 5 2 = Z 2

T h s o l u t i o n i s 5 0 , o a b o u t s e v e n c m T h c o m b i n a t i o n o b o t h c h a r a c t e r t i m e s l e a v e s u w i t h t i m e o a b o u t o n s e c o n d t p r i n t t h i s l o n g e r l i n e . T h i s c o n c e p t i i m p o r t a n tf o u n d e r s t a n d i n g t h p r o g r a m m i n g o t h p l o t t e r . O n c ey o u ' r e t h r o u g h t y p i n g i t h p r o g r a m s w h i c h f o l l o w , y o u ' l lu n d e r s t a n d t h o r o u g h l y t h w o r k i n g s o f t h i s d e v i c e .

N e x t , y o u s h o u l d G E N T L Y r e m o v e t h p r o t e c t i v e c o v e r o t h p l o t t e r , s t h a t w e c a t a k e s h o r t t o u r o f t h m a c h i n e ' si n t e r i o r .

T h e f i r s t t h i n g y o u ' l l p r o b a b l y s e i t h d r u m c o n t a i n i n gt h b a l l p o i n t p e n s , w h i c h c o n t r o l s t h p e n ( s ) c o n t a c t w i t ht h e p a p e r . T h e r e i a n o t h e r " m e c h a n i c a l p a r t " t h a t w i l lm a k e o b r e a k t h p l o t t e r ' s a c c u r a c y c o m p l i c a t e dg e a r i n g s e t t h e l e f t a n d r i g h t o t h r u b b e r r o l l e r ,

2 4

Page 247: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 247/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

w h i c h c o n t r o l s t h r o l l e r ' s m o v e m e n t . Y o u s e e , t h d r u m c a o n l y m o v e i t h x - d i r e c t i o n ; t h p a p e r i t s e l f m u s t m o v e i t h y - d i r e c t i o n .

O n t h e r o l l e r , y o u ' l l f i n d n e e d l e - t r a c t o r d r i v e ( w i t hp o i n t s s t i n y y o u ' l l b a r e l y b a b l e t s e t h e m ) , w h i c ha c c u r a t e l y m o v e s t h p a p e r w i t h o u t a n d a m a g e t t h p a p e r .T h l a s t i t e m i o u t o u r o f t h e p l o t t e r ' s " i n n a r d s " i s m a l l g r e e n b l o c k i t h r i g h t - h a n d c o r n e r o t h d r i v e .T h i s i s s m a l l e l e c t r o m a g n e t w h i c h p l a c e s p e t p a p e r , a n r e m o v e s p e w h e n o r d e r e d t d s o

T h i s s h o u l d b e n o u g h t e c h n i c a l t a l k t g i v e y o t h b a s i c so t h 1 5 2 0 p l o t t e r . H o w e v e r , t h e r e a r s o m e r u l e s o e t i q u e t t e t b f o l l o w e d w h e n w o r k i n g w i t h t h i s m a c h i n e .

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

D o n ' t t u r n t h e r o l l e r e x c e p t w h e n a b s o l u t e l y n e c e s s a r y( e . g . , w h e n p u t t i n g i n n e r o l l o f p a p e r ) .

N e v e r t u r n t h e p e n - d r u m b h a n d .M e c h a n i c a l p a r t s s h o u l d n ' t b h a n d l e d , o t h a c c u r a c y

o t h p l o t t e r m a y g d o w n h i l l .T h p r i n t e r s h o u l d n ' t b o p e r a t e d w i t h o u t p a p e r .I s h o u l d b s e l f - e v i d e n t t h a t t h p r i n t e r s h o u l d n ' t b

u n p l u g g e d w h i l e p r i n t i n g .

N o w , h e r e a r s o m e h i n t s o t h e c a r e a n f e e d i n g o y o u r1 5 2 0 p l o t t e r :

D u s t i p r i n t e r ' s w o r s t e n e m y ; i s l o w s u t h a c t i o n , a n d t h e r e f o r e f o u l s u p t h e f u n c t i o n s o f t h e m a c h i n e .

2 4

Page 248: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 248/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

I t h r o l l e r h a b e e n m a r k e d u b p e n s , i m m e d i a t e l yr e m o v e t h c o v e r a n d w i p e t h r o l l e r w i t h d a m p c l o t h .

I t h u n l i k e l y e v e n t o p a p e r j a m , t a k e t h c o v e ro f f a n d r e m o v e t h p a p e r b y h a n d ( D N O P R E S S T H P A P E R -F E E D K E Y ! ! ! ) .

I y o l o o k a t h p l o t t e r i t e r m s o i t b a s i c f e a t u r e s ,y o u ' l l n o t i c e f r o m t h p r e c e d i n g m a t e r i a l s t h a t t h e r e ' s m o r et t h i s m a c h i n e t h a n s i m p l e g e o m e t r i c f i g u r e s . A w i t h s m a n y a s p e c t s o l i f e , y o g e o u o t h p l o t t e r w h a t y o up u i n t o i t T h i s c h a p t e r w i l l h e l p y o u l e a r n w h a t t p u i n t o t h e m a c h i n e — y o u ' l l f i n d s i m p l e p r o g r a m s , p o s s i b l es o l u t i o n s t s o m e d i f f i c u l t i e s , a n s u g g e s t i o n s t a i y o i p l o t t e r p r o g r a m m i n g , a l i t h p a g e s t f o l l o w .

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

O n t h i n g b e f o r e w s t a r t : T h P l o t t e r c a n o n l y r u u s i n gs p e c i f i c p r o g r a m r o u t i n e s , w h i c h w w i l l l i s t s o o n , a l o n gw i t h t h p l o t t e r c o m m a n d s e t .

T h e 1 5 2 0 p l o t t e r f a l l s u n d e r t h c a t e g o r y o " i n t e l l i g e n t "p e r i p h e r a l d e v i c e s . T h a t i s n m e m o r y w i t h i n t h C o m m o d o r e6 ( o V I C - 2 0 ) i s e a s i d e f o c o n t r o l l i n g t h p l o t t e r :R a t h e r , t h p l o t t e r h a i t o w m e m o r y , o p e r a t i n g s y s t e m ,a n c o m m a n d s e t . C o m m u n i c a t i n g w i t h t h p l o t t e r i d o n em u c h l i k e t h o t h e r d e v i c e s ( 1 5 4 1 d i s k d r i v e o D a t a s e t t e ) ,u s i n g O P E N , P R I N T * a n C L O S E . T h e s e c o m m a n d s a r c o m b i n e dw i t h a d d r e s s e s , a n c a n b e d i v e r s i f i e d s t i l l m o r e u s i n gs e c o n d a r y a d d r e s s e s .

2 4

Page 249: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 249/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

O P E N

T h i s c o m m a n d o p e n s c h a n n e l t t h d e v i c e n u m b e r e d . A f t e rO P E N i n g t h d e v i c e , y o c a i n s t r u c t t h d e v i c e t p e r f o r mc e r t a i n t a s k s , e i t h e r i d i r e c t m o d e o p r o g r a m m o d e .

T h O P E N c o m m a n d i u s u a l l y f o l l o w e d b s e o n u m b e r ss e p a r a t e d b y c o m m a s ( e i t h e r s e o t w o t h r e e n u m b e r s ,d e p e n d i n g o t h w o r k b e i n g a s k e d o f t h e d e v i c e ) :

O P E N n r d v s

n r e p r e s e n t s t h n u m b e r l a t e r u s e d i P R I N T * o C L O S Ec o m m a n d s . T h i s n u m b e r c a b a n y w h e r e f r o m t 2 5 5 , b u t h n u m b e r s m u s t m a t c h i l a t e r c o m m a n d s ( e . g . , O P E N1 5 , 8 , 1 5 , P R I N T # 1 5 , C L O S E 1 5 ) , o y o u ' l l g e F I L EN O O P E N e r r o r m e s s a g e . W e * 1 1 d i s c u s s t h i s n u m b e r l i t t l el a t e r .

d s t a n d s f o r t h e n u m b e r o t h d e v i c e : E a c h p e r i p h e r a l h a i t s p e c i f i c d e v i c e n u m b e r , a n t h u s e r c a n n o t c h a n g e t h i sn u m b e r o t h e 1 5 2 0 p l o t t e r . T h 1 5 2 0 p l o t t e r , f o r e x a m p l e ,h o l d s t h d e v i c e n u m b e r ( s a n o t c o n f u s e i w i t h t h t a p e d r i v e [ 1 ] , t h p r i n t e r [ 4 ] , o t h d i s k [ 8 ] ) . Y o u ' l lf i n d t b e t h e s e c o n d n u m b e r i t h O P E N c o m m a n d s o e v e r ye x a m p l e .

O n n u m b e r r e m a i n s t h s e c o n d a r y a d d r e s s s c T h i s n u m b e rg i v e s s p e c i f i c i n f o r m a t i o n t t h 1 5 2 0 c o n c e r n i n g s p e c i a l" e x t r a s " t h a t t h e u s e r m i g h t w a n t i p r i n t i n g . Y o u c a nc h o o s e t h a t f e a t u r e n o f o l a t e r p r i n t i n g . B e l o w a r e t h es e c o n d a r y a d d r e s s e s u s e d b t h e 1 5 2 0 p l o t t e r :

2 4

Page 250: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 250/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

s c = 0 N o r m a l p r i n t i n g o f t e x t o l i s t ss c = l E x e c u t e c h a r a c t e r r o u t i n es c = 2 C o n t r o l t h c o l o r d r u ms c = 3 C h o i c e o c h a r a c t e r s i z es c = 4 T u r n t h c h a r a c t e r 9 d e g r e e s .s c = 5 C h o o s e t y p e o f l i n e d e s i r e ds c = 6 S w i t c h e s p l o t t e r b e t w e e n u p p e r - c a s e , l o w e r - c a s e a n

g r a p h i c m o d e ss c = 7 R e t u r n s p l o t t e r t s t a r t i n g p o s i t i o n , c l e a r i n g a l

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

W i t h t h a t i m i n d , h e r e a r e f e s a m p l e O P E N c o m m a n d s , a n dw h a t t h e y ' l l d o

O P E N 3 4 , 6 , 2 o p e n s t h f i l e n u m b e r 3 r e l a t i n g t t h p l o t t e r d e v i c e ( 6 ) , a n c o n t r o l s t h o p e r a t i o n o f t h e c o l o rd r u m .

O P E N 1 | 6 , 1 o p e n s f i l e n u m b e r 1 d e v i c e n u m b e r 6 a n p r e p a r e s t h d e v i c e f o w o r k i n g t h r o u g h t h c h a r a c t e rr o u t i n e .

O P E N 9 9 , 9 , 9 d o e s n ' t d a n y t h i n g f o r t h e p l o t t e r 9 c o u l d c o n c e i v a b l y b u s e d a t h f i r s t n u m b e r , b u d e v i c e

d o e s n ' t o p e n t h e p l o t t e r ( r a t h e r , f o t h o s e w h o o w n t w od i s k d r i v e s , t h e s e c o n d d r i v e w i l l o p e n ) , a n d s e c o n d a r ya d d r e s s o i n o n s e n s i c a l . Y o u s h o u l d r e c e i v e D E V I C EN O P R E S E N T e r r o r , u n l e s s y o h a v e t w d i s k d r i v e s .

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

2 4

Page 251: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 251/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

P R I N T *

T h i s c o m m a n d e x e c u t e s i n s t r u c t i o n s g i v e n t t h p l o t t e r . I i r e s p o n s i b l e f o s e n d i n g d a t a t t h p l o t t e r t b p u t o np a p e r , a w e l l a s e l e c t i n g t h c o l o r i w h i c h t p r i n t .

T h c o m m a n d u s u a l l y s o u n d s l i k e t h i s :

P R I N T * n r c o m m a n d

R e m e m b e r t h p r e v i o u s p a r a g r a p h s ? n i t h n u m b e r w i t hw h i c h y o u h a d O P E N e d t h f i l e , w h i c h c a l i b e t w e e n a n 2 5 5 . I o r d e r t u s P R I N T * p r o p e r l y , t h v a l u e n a f t e rO P E N n r m u s t e q u a l t h e n r i P R I N T * n r I o t h e r w o r d s , i y o o p e n f i l e w i t h O P E N 1 , 6 , 1 , y o w o u l d u s P R I N T * i c o n j u n c t i o n w i t h O P E N 1

T h c o m m a n d m e n t i o n e d a b o v e i P R I N T * n r c o m m a n d s h o u l dn e e d n d e t a i l e d e x p l a n a t i o n . I y o u ' r e s t i l l u n c l e a r o t h i s i t e m , p l e a s e s e e t h e s e c t i o n o s e c o n d a r y a d d r e s s e s .

O n t h i n g b a r e l y m e n t i o n e d i t h C - 6 4 h a n d b o o k i t h a b b r e v i a t i o n f o r P R I N T * : L o g i c w o u l d t e l l y o t u s t h a b b r e v i a t i o n ? # b u t t h i s w i l l g i v e y o u s y n t a x e r r o r .R e m e m b e r t a b b r e v i a t e P R I N T * b y u s i n g P [ s h i f t - R ] , a n y o u ' l l h a v e n p r o b l e m s i t h a t r e s p e c t .

C L O S E

T h i s c o m m a n d c l o s e s a O P E N e d f i l e . A w i t h P R I N T * , C L O S Eu s e s t h v a l u e n r w i t h t h s y n t a x

C L O S E n

2 4

Page 252: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 252/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

S o y o w o u l d c l o s e f i l e O P E N e d w i t h O P E N 2 , 6 , 2 b y u s i n gC L O S E 2 N o w , a f t e r c l o s i n g t h e f i l e , t r t y p i n g P R I N T *2 , 2 ; t h p l o t t e r c a n ' t r e s p o n d , a n d t h e c o m p u t e r w i l l g i v ey o F I L E N O T O P E N m e s s a g e .

C M

B a s i c a l l y , C M i u s e d b y t h p l o t t e r f o l i s t i n g o u p r o g r a m s a n r o u t i n e s . H o c a w l i s t p r o g r a m ? W e c a nd o s o i t w w a y s . F i r s t , a f t e r l o a d i n g t h p r o g r a m , t y p ei t h e s e c o m m a n d s i d i r e c t m o d e ( n o t p r o g r a m m o d e ) .

O P E N 4 , C M L I S TP R I N T *C L O S E

C M D c a n a l s o b u s e d i p r o g r a m m o d e : H e r e i s h o r tp r o g r a m r o u t i n e w h i c h s h o w s C M i t h i s a p p l i c a t i o n .

1 O P E N 4 , 62 C M D 4 , " P L O T T E R 1 5 2 0 "3 L I S T

L i n e 1 o p e n s t h e p l o t t e r f o w r i t i n g , l i n e 2 o p e r a t e su n d e r t h C M 4 c o m m a n d . I o u e x a m p l e t h e t e x t s t r i n g ,p l a c e d i q u o t e s , i p r i n t e d . O n c e t h r o u t i n e h a f i n i s h e dl i s t i n g , y o u ' l l h a v e t e n t e r P R I N T * a n C L 0 S E 4 b h a n d .O r i y o p r e f e r , t y p e i i n t o t h e p r o g r a m :

4 P R I N T * 45 C L O S E 4

2 4

Page 253: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 253/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

R U t h r o u t i n e . O n c e i h a r u n , i n p u t C M 4 " P L O T T E R1 5 2 0 " , b u t b e f o r e w a r n e d t h a t y o w o n ' t g e t a n e r r o r

m e s s a g e , d e s p i t e t h f i l e h a v i n g b e e n c l o s e d i l i n e 5 0 T h e r e ' s n o t h i n g w r o n g w i t h y o u r p r o g r a m , o e v e n w i t h y o u rp l o t t e r . p e c u l i a r i t y o f t h e 6 4 ' s o p e r a t i n g s y s t e m c a u s e st h p r o g r a m t b r e a k w h e n L I S T i c a l l e d f o r , r e n d e r i n gl i n e s 4 a n 5 u s e l e s s , a n r e q u i r i n g y o t c l o s e t h f i l eb h a n d .

2 4

Page 254: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 254/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

8 . S e c o n d a r y A d d r e s s e s o n t h e V I C - 1 5 2 0

Y o u ' l l r e c a l l t h a t t h s e c o n d a r y a d d r e s s i t h e l a s t n u m b e ri t h a d d r e s s s e q u e n c e . I c a n b e n u m b e r b e t w e e n a n 7 a n f u l f i l l s c e r t a i n t a s k s w h e n c a l l e d w i t h P R I N T * n r I y o u ' v e f o r g o t t e n w h i c h s e c o n d a r y a d d r e s s i w h i c h , f l i pb a c k f e w p a g e s t t h p a r a g r a p h o O P E N , w h e r e y o u ' l l f i n d

c o m p l e t e l i s t o t h e s e n u m b e r s . N o w e ' l l t a k e s h o r tl o o k a t h e s e a d d r e s s e s , a n d s o m e e x a m p l e s .

a s c = l

T h i s n u m b e r a c t i v a t e s t h c o m m a n d s e f o r t h e d r a w r o u t i n ei t h e p l o t t e r , w h i c h i e s p e c i a l l y o i n t e r e s t t t h

b e g i n n e r .

A y o p r o b a b l y k n o w , t h s e c o n d a r y a d d r e s s i s e n t t t h p l o t t e r w i t h t h O P E N c o m m a n d . I o u e x a m p l e , l e t ' s u s eO P E N 1 , 6 , 1 . N o w w e c a u s t h c o m m a n d s e i t h p l o t t e r ,w h i c h i s t a r t e d b y P R I N T # . T h e p r o p e r f o r m f o i n p u t l o o k sl i k e t h i s :

P R I N T # 1 " C O M M A N D " ; X - d a t a ; Y - d a t a [ o r ]P R I N T * 1 " C O M M A N D " , X - d a t a , Y - d a t a [ o r ]P R I N T * 1 " C O M M A N D " X - d a t a , Y - d a t a

T h d e s i g n a t i o n s f o X - d a t a a n Y - d a t a c a a l s o b s e p a r a t e db s e m i c o l o n , c o m m a o s p a c e . T h e r e a r t o t a l o f s i i n s t r u c t i o n s a c k n o w l e d g e d b t h p l o t t e r .

1 ( H o m e ) b r i n g s t h b a l l p o i n t p e d r u m i n t o s t a r tp o s i t i o n , i . e . , a t h l e f t s i d e o f t h e r o l l e r . T h i sl o c a t i o n i t h " a b s o l u t e z e r o - p o i n t " — X = 0 ; Y = 0 . T w

2 4

Page 255: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 255/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

a d d i t i o n a l c o m m a n d s c a n b e g i v e n w h e n a z e r o - p o i n t ; " D a n " M " .

2 ( M o v e ) s h i f t s t h d r u m f r o m t h h o m e p o s i t i o n a t h l e f t s i d e o f t h e p l o t t e r . T h s t a r t i n g p o i n t a l w a y s r e m a i n sx = 0 ; y = 0 . T h p e i w i t h d r a w n f r o m t h p a p e r , a n t h d r u mw i l l m o v e t w h a t e v e r p o s i t i o n y o t e l l i t ( x = 0 -4 8 0 : y = + 9 9 9 \ - 9 9 9 ) , b u i w i l l n o d r a w .

3 ( D r a w ) i e s s e n t i a l l y t h s a m e a M b u p e s p e c i f i e d b y y o u i p u t i n t o o p e r a t i o n , s t h p l o t t e r w i l ld r a w a t h r e q u e s t e d c o o r d i n a t e s . w i l l a l w a y s s t a r t f r o mt h h o m e p o i n t ( 0 / 0 ) .

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

4 T h e r e i r e l a t i v e z e r o - p o i n t t h a t e x i s t s i a d d i t i o n t t h a b s o l u t e z e r o ( 0 - 0 ) , w h i c h y o c a c h a n g e a w i l l . S i m p l y m o v e t h d r u m t t h p o s i t i o n o y o u r c h o i c e( s e e M a n i n p u t P R I N T * 1 " I " . W h a t e v e r c o o r d i n a t e t h a tt h p l o t t e r i a t b e c o m e s t h " r e l a t i v e h o m e " . M o v e t h p l o t t e r t a n o t h e r p o s i t i o n , a n P R I N T * 1 " I " , a g a i n ; t h eo l " r e l a t i v e z e r o " c o o r d i n a t e s h a v e c h a n g e d t t h o s e o f t h en e w p o s i t i o n . A w i t h H t w o t h e r c o m m a n d s w o r k i c o n c e r tw i t h I

5 i t h e q u i v a l e n t o f t h e M - c o m m a n d , i . e . , t h e p e nm o v e s a w a y f r o m t h p a p e r a n t h d r u m m o v e s t t h g i v e nx / y c o o r d i n a t e s . T h m a i n d i f f e r e n c e b e t w e e n a n i t h a t i u s e d w i t h t h r e l a t i v e h o m e p o i n t .

2 4

Page 256: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 256/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

6 i t h d r a w c o m m a n d u s e d w i t h t h r e l a t i v e z e r o -p o i n t , a n o p e r a t e s m u c h l i k e D T h e p e n i p u t p a p e r ,a n t h d e s i r e d l i n e i d r a w n .

B e l o w i s r o u t i n e t s h o w y o t h p l o t t e r ' s c o m m a n d s e i a c t i o n . H e r e w w a n t e d t m a k e t r i a n g l e , a n s h o w y o ut h d i f f e r e n c e s b e t w e e n a b s o l u t e a n r e l a t i v e d r a w i n gr o u t i n e s .

1 O P E N 1 , 6 , 12 P R I N T t l / W j l O O j O3 P R I N T # l , " D " ; 3 0 0 ; 04 P R I N T # l , " D t f ; 2 0 0 ; 1 0 05 P R I N T # l . " D M ; 1 0 0 ; 06 P H I N T # l f M H "7 P R I N T # l , l f M " ; 0 ; - 1 0 08 C L O S E 1

S t a r t t h e p r o g r a m ; y o u s h o u l d g e t h a b o v e m e n t i o n e dp i c t u r e . P l e a s e n o t e t h a t t h c o m m a n d s i t h a b o v e p r o g r a ma r a b s o l u t e o n e s ( H , M , D ) . L i n e 2 m o v e s t h h e a d t t h p o s i t i o n 1 0 0 / 0 . L i n e s 3 0 - 5 0 d r a w t h t r i a n g l e , w h e r e b y a l p o s i t i o n s a r c a l c u l a t e d f r o m 0 / 0 . L i n e s 6 0 - 7 0 s h i f t t h p a p e r u p s o t h a t y o u r w o r k i v i s i b l e . Y o u ' v e p r o b a b l yf i g u r e d o u t h a t c o m p l e x d r a w i n g s a r n o p o s s i b l e w i t ha b s o l u t e n u l l p o i n t a b a s e ; r a t h e r , t h e y ' r e m i x t u r e o a b s o l u t e a n r e l a t i v e h o m i n g . N o w , t r t h i s p r o g r a m :

1 O P E N 1 , 6 , 12 P R I N T # 1 , " M M ; 1 0 0 , 03 P R I N T # l , f t I "4 P R I N T # l , " J " ; 2 0 0 ; 05 P R I N T # 1 , " J ° ; 1 0 0 ; 1 0

2 5

Page 257: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 257/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

6 P R I N T # l , " J " ; 0 ; 07 P R I N T # l , " R " ; - 1 0 0 ; - 1 0 08 C L O S E 1

T h r e s u l t l o o k s t h e s a m e a t h a b o v e p r o g r a m , b u d i f f e r e n t m e t h o d w a u s e d t g e t h a t r e s u l t . T h e s t a r t i n gp o i n t i s t i l l 1 0 0 / 0 ( l i n e 2 0 ) ; h o w e v e r , t h i s c o o r d i n a t e i i m m e d i a t e l y t u r n e d i n t o r e l a t i v e n u l l p o i n t w i t h P R I N T * 1 " I ( l i n e 3 0 ) . L i n e s 4 0 - 6 0 d r a w t h t r i a n g l e ( " J " ) . T h s a m e e n d i r e a c h e d l i t t l e m o r e q u i c k l y .

W r e c o m m e n d t h a t y o u w o r k i m i x e d c o m m a n d s a m u c h a p o s s i b l e d u r i n g t h i s c h a p t e r , s t h a t t h e s e p r o c e d u r e s w i l lb e c o m e s e c o n d n a t u r e t o y o u . L e t ' s t r y t h e t r i a n g l e p r o g r a ma g a i n , o n l y t h i s t i m e , u s i n g m i x e d c o m m a n d s :

1 O P E N 1 , 6 , 12 P R I N T # 1 , " R " ; 1 0 0 , 03 P R I N T # 1 , " I "4 P R I N T # l , " J t f ; 2 0 0 ; 05 P R I N T # l , t f J " ; 1 0 0 ; 1 0 06 P R I N T # l , " J " ; 0 ; 07 P R I N T # l , " R " ; 0 ; - 1 0 08 C L O S E 1

L i n e 2 h a a n c o m m a n d r a t h e r t h a n a M T h i s c a n b e d o n es i n c e b o t h a b s o l u t e a n r e l a t i v e n u l l p o i n t s a r i d e n t i c a l ,a n d t h u s n p r o g r a m m i n g c h a n g e s a r n e c e s s a r y . R e m e m b e r t u s t h c o m b i n a t i o n s o c o m m a n d s m o s t c o n v e n i e n t t y o u a n dt h c o m p u t e r . T h i s i i m p o r t a n t a f i g u r e s b e c o m e m o r ec o m p l i c a t e d , o w h e n m a t h e m a t i c a l f o r m u l a s a r i n v o l v e d .g r e a t h e l p w i l l b c a r e f u l s t u d y o t h i s c h a p t e r ; d o n ' t r u s ht h r o u g h !

2 5

Page 258: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 258/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

b s c = 2

T h i s s e c o n d a r y a d d r e s s l e t s y o u e x c h a n g e t h e p e n f o r o n e o d i f f e r e n t c o l o r w i t h i n p r o g r a m . T h i s a d d r e s s a c t i v a t e s

t h C O L O R C H A N G E k e o y o u r p l o t t e r . Y o u ' l l n e e d t o p e nt h f i l e w i t h O P E N n r 6 ( n = 1 t o 2 5 5 ) . P R I N T # 2 a l l o w sy o t c h o o s e f r o m o n o f o u r c o l o r s . T h e c o l o r s a r r e p r e s e n t e d b t h f o l l o w i n g n u m b e r s :

B L A C K P E N 0 , 4 , 8 , 1 2 , 1 6 ( 0 + N * 4 < 2 5 5 )B L U E P E 1 , 5 , 9 , 1 3 , 1 7 ( 1 + N * 4 < 2 5 5 )G R E E N P E 2 , 6 , 1 0 , 1 4 , 1 8 ( 2 + N * 4 < 2 5 5 )R E P E 3 , 7 , 1 1 , 1 5 , 1 9 ( 3 + N * 4 < 2 5 5 )

I y o u c h o o s e n u m b e r l a r g e r t h a n 2 5 5 , t h d e f a u l t c o l o rw i l l b i e f f e c t ( b l a c k ) . F o r l a t e r r e f e r e n c e , r e m e m b e rt h a t b l a c k i a l w a y s t h s t a r t i n g c o l o r , b a s e d o t h m a t h e m a t i c a l p r o c e s s e s a b o v e .

Y o u c a n c h o o s e y o u r p e c o l o r t h r o u g h n u m b e r i q u o t e s ,n o r m a l n u m b e r , o v a r i a b l e . T h i s n e x t p r o g r a m s h o w s

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

1 0 R E M = = = = = 1 5 2 0 S E T U P = = = = = = = = =1 1 0 P E N 4 , 41 2 O P E N 2 , 6 , 21 3 R E M = = = = R E A D N A M E S = = = = = = =1 4 F O F = T 1 5 R E A D F $ ( F )1 6 N E X T1 7 R E M = = = = = P R I N T C O L O R T P L O T T E R =1 8 F O F = T

2 5

Page 259: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 259/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h C O M M O D O R E 6

1 9 P R I N T # 2 , F2 0 P R I N T # 4 , F $ ( F )2 1 N E X T2 2 R E M = = = = = = D A T A = = = = = = = = = = = = =2 3 D A T A B L A C K , B L U E , G R E E N , R E D2 4 R B M = = = = = E N D = = = = = = = = = = = =2 5 C L 0 S E 22 6 C L 0 S E 4

T h f i r s t s e c t i o n o t h p r o g r a m s t o r e s t h n a m e s o t h f o u r c o l o r s i a a r r a y . T h e s e c o n d s e c t i o n ( f r o m l i n e 1 8 0 )p r i n t s t h n a m e o f t h e r e s p e c t i v e c o l o r .

T h s e c o n d p r o g r a m i t h i s s e t a k e s t h c o l o r n u m b e r w h i c hy o i n p u t ( N B : b e t w e e n a n 2 5 5 ) , a n p r i n t s i t h a t c o l o r ,s u p p l y i n g t h n a m e o f t h e c o l o r . T h e f i n a l p r o g r a m i t h s e q u e n c e r e v e r s e s t h p r o c e d u r e , g i v i n g y o u a l p o s s i b l en u m b e r s f o e a c h c o l o r .

1 0 R E M = = = = R E A D D A T A = = = = = = = = = = = = = = = = = = =1 1 F O R F = 0 T O 31 2 R E A D F $ C F D1 3 N E X T1 4 R E M = = = = I N P U T / C A L C U L A T I O N = = = = = = = = = = =1 5 I N P U T ' s C O L O R N U M B E R " ; K $1 6 K = U A L C K $ D1 7 K 1 = U A L C K $ D1 8 I F K > 2 5 5 O R K < 0 T H E N 1 5 01 9 I F K > 3 T H E N K = K - 42 0 I F K > = 4 T H E N 1 9 02 1 R E M = = = = O U T P U T = = = = = = = = = = = = = = = = = = = = = =2 2 0 P R I N T2 3 P R I N T K 1 " = " F $ C K D2 4 R E M = = = = = R E S T A R T = = = = = = = = = = = = = = = = = = = =2 5 F O R N = 1 T O 1 0 0 02 6 N E X T2 7 R E S T O R E2 8 G O T O 1 0 02 9 R E M = = = = D A T A = = = = = = = = = = = = = = = = = = = = = = = =3 0 D A T A B L A C K , B L U E , G R E E N , R E DR E A D Y .

2 5

Page 260: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 260/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

1 0 R E M = = = = I N P U T = = = = = = = = = = = = = = = =1 1 0 P R I N T " § U I H I C H C O L O R ? "1 2 P R I N T1 3 P R I N T B S U j f t C K g B u l U E & B i £ E E N1 4 P R I N T1 5 G E T A $ : U I A I T 2 0 3 , 6 31 6 R E M = = = = A N S U E R = = = = = = = = = = = = = = =1 7 I F A * " L < 1 T H E N K = 0 : G O T O 2 3 01 8 I F A $ = " B " T H E N K = 1 : G O T O 2 3 01 9 I F A $ = " G " T H E N K = 2 : G O T O 2 3 02 0 I F A $ = " R " T H E N K = 3 : G O T O 2 3 02 1 G O T O 1 5 02 2 R E M = = = = C A L C U L A T I O N = = = = = = = = = =2 3 0 F O R F = 0 T O 6 32 4 0 G = K + F * 42 5 0 P R I N T G , -2 6 N E X T2 7 R E M = = = = D O I A G A I N = = = = = = = = = =2 8 P R I N T2 9 P R I N T " < H I T K E Y > "3 0 W A I T 2 0 3 , 6 33 1 G O T O 1 0 0R E A D Y .

c s c = 3

T h i s a d d r e s s c o n t r o l s t h p r i n t r o u t i n e f o r t h e c h a r a c t e rs e b u i l t i n t o t h p l o t t e r , o f f e r i n g y o u f o u r d i f f e r e n t -s i z e d c h a r a c t e r s e t s , c h a n g e a b l e w i t h i n l i n e . O p e n f i l e sw i t h O P E N n r , 6 , 3 , a n c h a n g e c h a r a c t e r s e t s u s i n g P R I N T # 3 ,n u m b e r [ o p r i n t s i z e ] . T h n u m b e r s a r f i g u r e d u n d e r t h s a m e m a t h e m a t i c a l c o n d i t i o n s a t h e p e n c o l o r s i P R I N T # 2 ;h o w e v e r , f o r t h e s a k e o b r e v i t y , w e ' l l u s e 0 , 1 , 2 , 3 .

T h n u m b e r c a b i n p u t w i t h i n q u o t e s , o r e p r e s e n t e d b v a r i a b l e . T h e f o l l o w i n g i t h b a s i c i n f o r m a t i o n o t h e s en u m b e r s :

2 5

Page 261: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 261/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

P R I N T # 3 , 0 p r o d u c e s t h s m a l l e s t c h a r a c t e r s i z e o 8 c h a r a c t e r s p e l i n e .

P R I N T # 3 , 1 g i v e s n o r m a l p r i n t i n g ( 4 c h a r a c t e r s p e l i n e ) .

P R I N T # 3 , 2 y i e l d s m i d d l e - s i z e d l e t t e r i n g ( 2 c h a r a c t e r s p e l i n e ) .

P R I N T # 3 , 3 i t h l a r g e s t c h a r a c t e r s e a 1 p e l i n e .

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

1 0 R E M = = = = 1 5 2 0 S E T U P = = = = = = = = = = = = = =1 1 O P E N 4 , 61 2 O P E N 3 , 6 , 31 3 P R I N T # 3 , 01 4 R E M = = = = C H A R A C T E R S I Z E S = = = = = = = = =1 5 F O R Z = 0 T O 31 6 P R I N T # 3 , Z1 7 R E M = = = = P R I N T = = = = = = = = = = = = = = = = = = =1 8 P R I N T # 4 , " P L O T T E R "1 9 Y = X + 22 0 I F X < Y T H E N X = X + 1 : P R I N T # 4 : G O T O 2 0 02 3 N E X T Z2 4 R E M = = = = E N D = = = = = = = = = = = = = = = = = = = = =2 5 P R I N T # 3 , 02 6 C L O S E 32 7 C L O S E 4R E A D Y .

2 5

Page 262: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 262/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

T h f o l l o w i n g w i l l b p r i n t e d w h e n y o r u t h i s p r o g r a m :

P L O T T E R

P L O T T E R

P L O T T E RN o w t h a t w e ' v e c o v e r e d s o m e b a s i c s o c h a r a c t e r s , l e t ' s g o n t o s o m e t e c h n i c a l t h o u g h t s . H o w i c h a r a c t e r d r a w n o

p l o t t e r , a n y w a y ? T a n s w e r t h i s q u e s t i o n , l e t ' s t a k e t h l e t t e r a a e x a m p l e . O t h 1 5 2 0 , Y i d r a w n f r o m t h b o t t o m t t h u p p e r r i g h t . B e g i n n i n g a t h b o t t o m , t h p e d r a w s t t h u p p e r - l e f t - h a n d c o r n e r o f t h e l e t t e r , j u m p s t t h r i g h t w i t h t h e p e n w i t h d r a w n , s e t s t h e p e d o w n , a n d r a w s t h l a s t s e c t i o n o f t h e l e t t e r .

O t h e r , m o r e c o m p l i c a t e d l e t t e r s h a v e s t r u c t u r e t h a t a l l o w sf o p l o t t i n g w i t h o u t t h p e l e a v i n g t h p a p e r , e . g . , t h 6 S t i l l o t h e r s r e q u i r e m u c h m o v e m e n t o f t h e p e ( o p a p e r a n o f f ) , w i t h t h p h i l o s o p h y o t a k i n g t h s h o r t e s t r o u t e .

O n g o o d e x a m p l e i t h # S t a r t i n g f r o m t h l e f t , t h p l o t t e r d r a w s t h u p p e r h o r i z o n t a l a n t h r i g h t v e r t i c a l i m o r e - o r - l e s s o n m o v e m e n t . N e x t , t h e d r u m a n d p a p e r s h i f t ,a n t h e l e f t v e r t i c a l a n b o t t o m l i n e i d r a w n .

2 5

Page 263: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 263/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

W e ' r e t e l l i n g y o u a l t h i s t r e m i n d y o u o w h t h p l o t t e ri s s l o w ; w i t h c h a r a c t e r s p e e d o 1 c h a r a c t e r s p e s e c o n d a t h s m a l l e s t c h a r a c t e r s i z e , i t ' s e a s y t b e c o m ei m p a t i e n t w i t h t h p l o t t e r . R e m e m b e r h o m u c h w o r k i h a t a c c o m p l i s h t d r a w t h e s e c h a r a c t e r s , t h o u g h .

A n o t h e r t h i n g t b e a r i m i n d i t h f a c t t h a t t h e p l o t t e rw a n e v e r s p e c i f i c a l l y d e s i g n e d f o r l e t t e r i n g ; t h a t ' s b e s ta c c o m p l i s h e d w i t h s t a n d a r d d o t - m a t r i x p r i n t e r . T h ep l o t t e r h a a b i l i t i e s t h a t n d o t - m a t r i x m a c h i n e h a s ,t h o u g h !

d s c = 4

T h 1 5 2 0 p l o t t e r h a s o m e o t h e r f u n c t i o n s , w h i c h a r c o n t r o l l e d b s e c o n d a r y a d d r e s s 4 F o e x a m p l e , t h i sa d d r e s s w i l l t u r n a l c h a r a c t e r s 9 d e g r e e s i t h p r i n t o u t .T h i s m a y s e e m a u n n e c e s s a r y m o v e b u m a n y p r o b l e m s c a b s o l v e d w i t h t h i s t u r n . F o e x a m p l e , s a y y o u ' r e p r i n t i n g

c h a r t w h i c h r e q u i r e s l o n g e r - t h a n n o r m a l a x i s : T h X a x i s c a b h a n d l e d i n o r m a l m o d e , w h i l e t h Y - a x i s i c o v e r e d i t h t u r n a r o u n d o c h a r a c t e r s .

I n p u t f o r m a t l o o k s l i k e t h i s :

O P E N n r , 6 , 4P R I N T * 4 , n u m b e r

N u m b e r c a b a n y w h e r e b e t w e e n a n 2 5 5 , a l t h o u g h t h e t w on u m b e r s u s u a l l y u s e d a r a n 1 T h d e f a u l t v a l u e i 0 w h i c h r e p r e s e n t s n o r m a l m o d e . I f h o w e v e r , y o u t y p e dP R I N T # 4 , 1 , y o u w o u l d g e t h a t 9 d e g r e e t u r n . A l A S C I I

2 5

Page 264: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 264/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

c h a r a c t e r s t f o l l o w w i l l a u t o m a t i c a l l y p r i n t e d 9 d e g r e e st t h e r i g h t , f o l l o w i n g t h p r e v i o u s l y s t a t e d c o l o r a n c h a r a c t e r s i z e . T h d e s i g n a t i o n n u m b e r c a n b e g i v e n a v a r i a b l e , o a n u m b e r i q u o t e s .

T h i s n e x t p r o g r a m w i l l g i v e y o g o o d l o o k a w h a ts e c o n d a r y a d d r e s s c a n d o f e e l f r e e t e x p e r i m e n t .

1 0 R E M = = = = 1 5 2 0 S E T U P = = = = = = = = = = = = = = = = = =1 1 O P E N 5 , 61 2 O P B N 4 , 6 , 41 3 P R I N T # 4 , 01 4 R E M = = = = P R I N T = = = = = = = = = = = = = = = = = = = = = = =1 5 P R I N T # 5 , " 1 5 2 0 P L O T T E R "1 6 P R I N T # 4 , 11 7 P R I N T # 5 , " 1 5 2 0 P L O T T E R "1 8 R E M = = = = E N D = = = = = = = = = = = = = = = = = = = = = = = = =1 9 P R I N T # 4 , 02 0 C L 0 S E 42 1 C L O S E 5R E A D Y .

T h i s i t h s i m p l e s t m e t h o d o t u r n i n g c h a r a c t e r s t o w a r d t h X - a x i s , b u a l s o t h m o s t a w k w a r d . I o r d e r t d e c i p h e r t h s t r i n g " P L O T T E R 1 5 2 0 " , y o u w i l l h a v e t r e a d f r o m b o t t o m t t o p . O b v i o u s l y , r e a d i n g t e x t f r o m t o t b o t t o m ( o l e f t -t o - r i g h t ) i p r e f e r a b l e , s w e ' l l h a v e t o d o s o m e r e w o r k i n g .O n e w a y o f i x i n g t h p r o g r a m i t r e v e r s e t h t e x t i l i n e 1 7 0 , i . e . , " 0 2 5 1 R E T T O L P " . T h t e x t w i l l p r i n tc o r r e c t l y , b u t h e r e m u s t b b e t t e r w a y , f o r t h ee x p e n d i t u r e o t i m e i n v o l v e d i s p e l l i n g w o r d s i r e v e r s e .

T h n e x t p r o g r a m s h o w s o n w a o s o l v i n g t h i s p r o b l e m .

2 5

Page 265: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 265/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

1 0 R E M = = = = 1 5 2 0 S E T U P = = = = = = = = = = = =1 1 O P B N 5 , 61 2 0 P E N 4 , 6 , 41 3 O P E N 1 , 6 , 11 4 P R I N T # 4 , 11 5 R E M = = = = C A L C U L A T E C H A R A C T E R S = =1 6 X $ = " 1 5 2 0 P L O T T E R "1 7 F O R X = L E N ( X $ ) T O 1 S T E P - 11 8 Y $ = M I D $ ( X $ , X , 1 )1 9 R E M = = = = P R I N T C H A R A C T E R S = = = = = =2 0 P R I N T # l , M M " , 2 0 * ( L E N ( X $ ) - X ) ; 02 1 P R I N T # 5 , Y $ ; :2 2 N E X T2 3 R E M = = = = E N D = = = = = = = = = = = = = = = = = = =2 4 P R I N T # 4 , 02 5 P R I N T # l , f l M f t ; 0 ; 02 6 C L O S E 12 7 C L O S E 42 8 C L O S E 5R E A D Y .

T h s e c r e t t t h i s p r o g r a m l i e s i l i n e s 1 5 0 - 2 2 0 : F i r s t ,t h t e x t s t r i n g " P L O T T E R 1 5 2 0 " i s t o r e d i t h v a r i a b l e X ( l i n e 1 6 0 ) . F O R - N E X T l o o p t h e n p i c k s u i l i n e 1 7 0 ,w h i c h v i e w s t h c h a r a c t e r s f r o m r i g h t - t o - l e f t . N e x t , t h t e x t i p r i n t e d i w h a t t h c o m p u t e r b e l i e v e s t b r i g h t -t o - l e f t , t h a n k s t t h F O R - N E X T l o o p ( S T E P - 1 ; s e l i n e 1 7 0 ) ,b u o c o u r s e , t h e t e x t p r i n t s n o r m a l l y t o u s . T h i sp r o c e d u r e i d e p e n d e n t o L E N ( X $ ) - X a n d t h e M I D $ c o m m a n d .

L o o k a g a i n a t h p a r e n t h e s e s ; L E N ( X $ ) s i g n i f i e s t h l e n g t ho f t h e t e x t , n o t h i n g m o r e . I w r i t e s f r o m l e f t t r i g h tf r o m h o m e p o i n t . T h i s e x a m p l e m u s t a l l o w f o s u b t r a c t i o n o t h L E N ( X $ ) u s i n g c o n s t a n t , i t h i s c a s e , 2 0 L i n e 2 1 0g i v e s u o u p r i n t o u t . R e m e m b e r , t h o u g h , t p u t h s e m i c o l o n i n o t h t e x t w i l l b p r i n t e d d i a g o n a l l y !

2 5

Page 266: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 266/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

A w e ' v e s a i d , t h i s i o n w a o s o l v i n g t h p r o b l e m — s e et h p l o t t e r h a n d b o o k f o a n o t h e r m e t h o d .

L e t ' s d e p a r t o u w o r k o t h X - a x i s , a n d l o o k t t h Y - a x i s .I y o t y p e d i t h e l a s t p r o g r a m , d o n ' t w a s t e y o u r t i m et y p i n g t h i s o n i f r o m s c r a t c h ; t h e s e p r o g r a m s a r d e s i g n e dw i t h s i m i l a r r o u t i n e s a n l i n e n u m b e r s , s t h a t c h a n g i n g o n p r o g r a m i n t o a n o t h e r i s i m p l e m a t t e r .

1 0 R E M = = = = 1 5 2 0 S E T U P = = = = = = = = = = = = = = = = = =1 1 O P E N 5 , 61 2 O P E N 4 , 6 , 41 3 O P E N 1 , 6 , 11 4 P R I N T # 4 , 11 5 R E M = = = = C A L C . C A R A C T E R S = = = = = = = = = = = = =1 6 X $ = " 1 5 2 0 P L O T T E R "1 7 F O R X = 1 T O L E N ( X $ )1 8 Y $ = M I D $ ( X $ , X , 1 )1 9 R E M = = = = P R I N T C H A R A C T E R S = = = = = = = = = = = =2 0 P R I N T # 5 , Y $2 1 N E X T2 2 R E M = = = = E N D = = = = = = = = = = = = = = = = = = = = = = = = =2 3 P R I N T # 4 , 02 4 P R I N T # 52 5 C L O S E 12 6 C L 0 S E 42 7 C L O S E 5

E a c h c h a r a c t e r i " P L O T T E R 1 5 2 0 " i i n d i v i d u a l l y r e a d a n p r i n t e d ( l i n e s 1 5 0 - 2 1 0 ) . S o n o w y o u h a v e t h r e e m e t h o d s o p e r f o r m i n g t h s a m e t a s k — y o u m a y w a n t t r e v i e w t h p r e c e d i n g p r o g r a m s .

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

2 6

Page 267: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 267/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

e s c = 5

O n o t h m o s t u s e f u l f u n c t i o n s i t h e 1 5 2 0 ' s o p e r a t i n gs y s t e m i t h l i n e f u n c t i o n , c a l l e d w i t h s e c o n d a r y a d d r e s s5 T h i s a d d r e s s a l l o w s y o t c a l l a n d p l o t 1 d i f f e r e n tt y p e s o f l i n e s . T h e s e l i n e s c a v a r y i a p p e a r a n c e f r o ms o l i d l i n e t s e r i e s o f d a s h e s . T h e f i l e i o p e n e d f o t h i s u s i n g O P E N n r , 6 , 5 .

N e x t f o l l o w s P R I N T # 5 , n u m b e r c o m m a n d , w i t h n u m b e r b e t w e e na n 2 5 5 , b u t h m o s t u s e f u l n u m b e r s f o r t h i s a d d r e s s a r

0 - 1 5 .

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

1 0 R E M = = = = 1 5 2 0 S E T U P = = = = = = = = = = = = = = = = = =1 1 0 P E N 4 , 61 2 0 P E N 5 , 6 , 51 3 0 P E N 1 , 6 , 11 4 P R I N T » 5 , 01 5 R E M = = = = I N P U T = = = = = = = = = = = = = = = ^ = = = = = = =1 6 0 I N P U T ' - s U H I C H L I N E N U M B E R 1 1 ; ^ *1 7 A = U A L C A $ D1 8 I F A < 0 O R A > 1 5 T H E N 1 6 01 9 P R I N T2 0 I N P U f L E N G T H I C M C M A X . C 3 " ; B $2 1 B = U A L f . B $ D2 2 I F B < 0 O R B > 8 T H E N P R I N T " a s _ : ' : G O T O 2 0 02 3 R E M = = = = D R A W I N G = = = = = = = = = = = = = = = = = = = = =2 4 L = 5 0 * C B + 1 32 5 0 P R I N T * 4 , A ;2 6 P R I N T » 5 f A ;2 7 P R I N T # 1 , " D " ; l ; 02 8 P R I N T * 5 , 02 9 P R I N T * 43 0 R E = = E N D = = = = = = = = 3 1 0 C L O S E 13 2 C L O S E S3 3 0 C L 0 S E 4R E A D Y .

2 6

Page 268: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 268/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

L i n e s 1 0 0 - 1 4 0 s e t h p l o t t e r f o i n p u t o l i n e v a l u e s , a n do p e n s t h n e c e s s a r y f i l e s . L i n e 1 6 w a i t s f o r y o u r i n p u t o

n u m b e r f r o m t 1 5 L i n e 1 6 h a s o m e t h i n g e l s e o i n t e r e s t i n s t e a d o t h r e v e r s e h e a r t s i g n i f y i n gC L E A R / H O M E , t h e 1 5 2 0 p l o t t e r p r i n t s a u n d e r l i n e d l e t t e r s L o o k i n g a h e a d a l i n e 2 2 0 , t h u n d e r l i n e d g ' r e p r e s e n t t w c u r s o r - d o w n c h a r a c t e r s , f o l l o w i n g r e q u e s t f o r l i n e l e n g t h .T h e l i n e s a r p r i n t e d o u b l i n e s 2 4 0 - 2 9 0 . I y o m e a s u r et h l i n e s w i t h m e t r i c r u l e r , y o u ' l l f i n d t h a t t h m e a s u r e m e n t s a r q u i t e a c c u r a t e .

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

1 0 R E M = = = = 1 5 2 0 S E T U P = = = = = = = = = = = = = = = = = =1 1 O P E N 1 , 6 , 11 2 O P E N S , 6 , 51 3 P R I N T # 5 , 51 4 R E M = = = = D R A W = = = = = = = = = = = = = = = = = = = = = = = =1 5 P R I N T # l , " M M ; 1 0 0 ; 01 6 P R I N T # 1 , " I "1 7 P R I N T # l , w J H ; 2 0 0 ; 01 8 P R I N T # l , M J w ; 1 0 0 ; 1 0 01 9 P R I N T # l , " J M ; 0 ; 02 0 P R I N T # l , M R M ; - 1 0 0 ; - 1 0 02 1 R E M = = = = E N D = = = = = = = = = = = = = = = = = = = = = = = = =2 2 P R I N T # 5 , 02 3 C L O S E 12 4 C L O S E S

2 6

Page 269: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 269/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

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

f s c = 6

Y o u ' v e p r o b a b l y r u a c r o s s u p p e r - a n l o w e r - c a s e l e t t e r i n gi y o u r p l a y i n g a r o u n d o C o m m o d o r e c o m p u t e r s . T h p l o t t e rc a a l s o d t h i s l e t t e r i n g . A y o u ' v e s e e n , t h e p l o t t e r h a n g r a p h i c c h a r a c t e r s p e s e s t h d e v i c e c o n s t a n t l yo p e r a t e s i u p p e r - c a s e o n l y , u n l e s s o t h e r w i s e t o l d . A m a t t e r o f a c t , h o l d i n g d o w n t h S H I F T k e y g i v e s y o u l o w e rc a s e l e t t e r i n g ( t h e o p p o s i t e o w h a t w e ' r e a c c u s t o m e d t o ! ) .N o t h i n g c h a n g e s i t h p l o t t e r s y s t e m b t y p i n g i P R I N T C H R $ ( 1 4 ) , j u s t t h c o m p u t e r c h a n g e s c a s e . S e c o n d a r ya d d r e s s 6 h o w e v e r , a l l o w s u s t o c o n t r o l t h i s p r o b l e m .T h e r e a r e b u t t w o a d d i t i o n a l n u m b e r s y o u h a v e t k n o w :

1 0 u p p e r - c a s e w i t h S H I F T e d l o w e r - c a s e ( d e f a u l t ) .2 1 l o w e r - c a s e w i t h S H I F T e d u p p e r - c a s e .

T h i n p u t f o r m a t r u n s a f o l l o w s : O p e n t h f i l e w i t h O P E Nn r , 6 , 6 , a n p r o c e e d w i t h P R I N T # 6 , d g w i t h d e q u a l l i n ge i t h e r o 1 I y o s e n d P R I N T # 6 , 1 , y o u ' l l i m m e d i a t e l y b i l o w e r - c a s e m o d e , a n d b e a b l e t p r i n t u p p e r - c a s ec h a r a c t e r s b p r e s s i n g S H I F T .

N o y o c a u s t h p l o t t e r a n c o m p u t e r j u s t a y o w o u l dt y p e w r i t e r . I n c i d e n t a l l y , i m a k e s n d i f f e r e n c e t t h p l o t t e r w h e t h e r y o u h a v e g r a p h i c s y m b o l o s h i f t e dc h a r a c t e r o n s c r e e n ( d e p e n d s o t h e m o d e , t h o u g h ) i w i l l

2 6

Page 270: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 270/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

p r i n t a u p p e r - c a s e c h a r a c t e r e i t h e r w a y . T o r e t u r n t h p l o t t e r t o i t s o r i g i n a l s t a t u s , s e n d P R I N T # 6 , 0 .

T m a k e t h d i f f e r e n c e s b e t w e e n t h e t w o m o d e s c l e a r , t r o u t h p r o g r a m b e l o w . W e s u g g e s t t h a t y o u s w i t c h t h C - 6 4 t l o w e r - c a s e m o d e b e f o r e t y p i n g t h r o u t i n e i n j u s t t m a k ef i n d i n g g r a p h i c c h a r a c t e r s a n s u c h e a s i e r o n y o u . T h l i s t i n g i t s e l f i s i n l o w e r - c a s e m o d e ( 1 ) .

1 0 r e m = = = = 1 5 2 0 s e t u p = = = = = = = = = = = = = = = = = =1 1 o p e n 4 , 61 2 o p e n 6 , 6 , 61 3 p r ! n t # 6 , 01 4 0 r e m = = t e x t = = = = = = = = = = = = 1 5 p r i n t # 4 , " 6 , 0 n o r m a l m o d e "1 6 9 o s u b 2 7 01 7 p i n t # 6 , 11 8 9 o s u b 2 7 01 9 p r I n t # 4 , " 6 , 1 L o w e r - c a s e m o d e "2 0 9 o s u b 2 7 02 1 p r ! n t # 6 , 02 2 9 o s u b 2 7 02 3 r e m = = = = e n d = = = = = = = = = = = = = = = = = = = = = = = = =2 4 c l o s e 62 5 c l o s e 4 : e n d2 6 r e = = p l o t t = = = = = = = = 2 7 f o r x = l t o 3 52 8 p r l n t # 4 , c h r $ C 9 0 - x D ; s2 9 n e x t3 0 p r I n t # 43 1 0 r e t u r nr e a d y .

T h f o l l o w i n g p r i n t o u t w i l l r e s u l t a f t e r r u n n i n g t h p r o g r a m :

6 . N O R M A L M O D EY X W U U T S R Q P O N M L K J I H G F E D C B A @ ? > = O : 9 8 7y x w v u t s r q p o n m l k j I h g f e d e b & - ? > = < - 9 8 76 . L o u i e r - c & s e m o d ey x w u u t s r q p o n m l k j 9 f e d c b a - ? > < 9 8 V X W U U T S R Q P O N M L K J I H G F E D C B A @ ? > = < ; : 9 8 7

2 6

Page 271: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 271/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

T h r e s u l t f r o m t h p r o g r a m c o n f i r m s t h e s e t w o m o d e s :N o r m a l m o d e h a u p p e r - c a s e w i t h s h i f t e d l o w e r - c a s e , w h i l e" l o w e r - c a s e " m o d e d o e s t h e x a c t o p p o s i t e . W e ' l l n e e d t h i ss e c o n d a r y a d d r e s s b i t l a t e r w h e n w c r e a t e t y p i n gp r o g r a m i d i r e c t m o d e .

g s c = 7

A t l a s t , w c o m e t t h s e v e n t h a n f i n a l s e c o n d a r y a d d r e s s .T b p e r f e c t l y h o n e s t w i t h y o u , y o w o n ' t h a v e m u c h n e e df o r t h i s a d d r e s s . O P E N 7 , 6 , 7 a n P R I N T # 7 , a n y o u ' l l s e e :T h e 1 5 2 0 i m m e d i a t e l y p u t s i t s e l f t h r o u g h s e l f - t e s t . I w i n p u t t h i s m a t e r i a l a g a i n , t h s y s t e m w i l l r e s e t t o i t so r i g i n a l v a l u e a n d e l e t e a n d a t a f o u n d i m e m o r y .

N o w t h a t y o u ' v e r e a d t h d e s c r i p t i o n s i t h i s s e c t i o n , e v e nn o v i c e p l o t t e r o w n e r s s h o u l d b a b l e t u n d e r s t a n d , a n a l y z e ,a n d e v e n d e s i g n p l o t t e r s u b r o u t i n e s . T h 1 5 2 0 i s u c hv e r s a t i l e i n s t r u m e n t t h a t b o o k t h s i z e o t h i s v o l u m ec o u l d b f i l l e d w i t h r o u t i n e s f o d r a w i n g f i g u r e s . T h i s ,h o w e v e r , i s n ' t e v e r y o n e ' s c u o t e a . I n s t e a d , w e ' l l s p e n dt h r e s t o t h b o o k w i t h b a s i c f i g u r e s , m a d e w i t h r o u t i n e st h a t y o c a t a i l o r t y o u r o w n n e e d s .

S o m e o f t h e m o r e o b s e r v a n t r e a d e r s h a v e p r o b a b l y n o t i c e dt h a t w e l e f t o u s e c o n d a r y a d d r e s s 0 a n s t a r t e d o u l i s to d e f i n i t i o n s w i t h i n s t e a d . E s s e n t i a l l y , a d d r e s s i r e s p o n s i b l e f o r t h e o u t p u t o A S C I I c h a r a c t e r s , a n d t h d i f f e r e n c e s b e t w e e n s c r e e n a n d p r i n t e r . L e t ' s p o n d e r t h 1 5 2 0 ' s " n o r m a l " m o d e f i r s t : T h f o l l o w i n g t a b l ed e m o n s t r a t e s t h c h a r a c t e r s e t s , b o t h n o r m a l a n d s h i f t e d .

2 6

Page 272: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 272/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

1

<

2 6

Page 273: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 273/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

Y o u ' l l n o t i c e t h a t t h e c h a r a c t e r s e c o r r e s p o n d s w i t h t h s c r e e n o u t p u t f r o m C H R $ ( 3 3 ) t C H R $ ( 9 5 ) . S h i f t e d c h a r a c t e r sw h i c h a p p e a r o n s c r e e n a g r a p h i c s y m b o l s ( f r o m C H R $ ( 1 6 1 ) )a p p e a r i l o w e r - c a s e o p l o t t e r p r i n t o u t . S w i t c h i n g i P R I N T # 6 , 1 w i l l d t h e x a c t o p p o s i t e C H R $ ( 3 3 ) w i l l b i l o w e r - c a s e , a n d t h g r a p h i c c h a r a c t e r s w i l l a p p e a r i u p p e rc a s e .

T h e r e a r n o t h e r r e a l d i f f e r e n c e s i o u t p u t b e t w e e n s c r e e na n d p l o t t e r , w i t h o n e e x c e p t i o n : W h a t a b o u t t h c o n t r o lc h a r a c t e r s ? W h a t ' s w r o n g w i t h t h p l o t t e r t h a t i d o e s n ' tp r i n t r e v e r s e - v i d e o c h a r a c t e r s ?

T h C - 6 4 h a m a n y r e v e r s e - v i d e o c h a r a c t e r s , f r o m t h c u r s o rc o n t r o l s y m b o l s t t h c o l o r s y m b o l s . W e a l r e a d y k n o w t h a tt h p l o t t e r i s n ' t e q u i p p e d t p r i n t t h e s e c h a r a c t e r s , s i n c et o m u c h t i m e w o u l d b i n v o l v e d i p r i n t i n g o u t h o s e l i t t l eb o x e s . O t h o t h e r h a n d , y o m i g h t w o n d e r , w o u l d n ' t i t a k e a l m o s t a l o n g t p r i n t o u a l t h s y m b o l s i c h a r a c t e r - s t r i n g ( C H R $ ( X ) ) f o r m ?

T c i r c u m v e n t t h i s p r o b l e m , t h e 1 5 2 0 p l o t t e r p r i n t s t h c o n t r o l c h a r a c t e r s a s t a n d a r d c h a r a c t e r s w i t h a u n d e r s c o r et d i s t i n g u i s h t h e m f r o m s t a n d a r d c h a r a c t e r s ( e . g . , C U R S O RD O W N w o u l d b a u n d e r l i n e d Q ) H e r e i c h a r t o t h e s ec h a r a c t e r s , s i d e - b y - s i d e w i t h 1 5 2 5 p r i n t o u t :

2 6

Page 274: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 274/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

■ ' E L f u n c t i o k e 1 " L f u n c t I o k e 2 ' E f u n c t i o k e 3

J _ f u n c t o k e 4 " Q f u n c t o k e 5 ' ! < _ f u n c t o k e 6

" b f u n c t i o k e 7 " L f u n c t i o k e 8 ' ! d e l e t e "" s h o m e

" £ e a " g c u r s o r d o w n "' Q c u r s o r u p ' ^ c u r s o r g h

" c u r s o r l e f t "" f c o n t r o l / b l k "" § _ = c o n t r o l / u h t "' _ _ = c o n t r o l / r e d "

" l c o n t r o / c y n" < c o n t r o l / p u r "" i c o n t r o l / g r n "" Q c o n t r o l / b

" r c o n t r / r < v » s o n " B _ = c o n t r o l / r < j s o f

" c = / b l k "" L c = / u h t" U c = / r e d "" W = = / c y n" K = / p u r" i c = / 9 r n "" Z = = / i u

c = / y e l

" f i L F U N C T I O N K E Y 1 " j F U N C T I O N K E 2 ■ ' £ . F U N C T I O N K E 3 ' J F U N C T I O N K E 4

" ' s l F U N C T I O N K E 5 1 ' F U N C T I O N K E Y 6 " F U N C T I O N K E Y 7 " F U N C T I O N K E Y 8 " I D E L E T E "1 1 S . H O M E "" S C L E A R "" G C U R S O R D O W N "" 1 C U R S O R U P " C U R S O R R I G H T "" a C U R S O R L E F T "" £ C O N T R O L / B L K "' E C O N T R O L / W H T "' £ C O N T R O L / R E D "

1 1 D . C O N T R O L / C Y N "" _ C O N T R O L / P U R "' £ C O N T R O L / G R N "

± . C O N T R O L / B L U "B C O N T R O L / R U S O N

" r C O N T R O L / R U S O F F "" a C = / B L K M

u _ C = / U I H T "! J C = / R E D "b L C = / C Y N "Z C = / P U R "Z C = / G R N "A C = / B L U "

C = / Y E L '

" F U N C T I O N K E Y l a F U N C T I O N K E Y 2 " F U N C T I O N K E 3 " F U N C T I O N K E Y 4 " H F U N C T I O N K E Y 5 " F U N C T I O N K E Y 6 " F U N C T I O N K E Y 7 1 F U N C T I O N K E Y 8 " I D E L E T E "" H O M E " ." C L E A R "" C U R S O R D O W N "1 1 C U R S O R U P " C U R S O R R I G H T 1 1" I C U R S O R L E F T "1 1 C O N T R O L / B L K 1 1" C O N T R O L / W H T "" C O N T R O L / R E D "1 1 C O N T R O L / C Y N" C O N T R O L / P U R "n C O N T R O L / G R N 1 1" C O N T R O L / B L U 1 1" f C O N T R O L / R V S O N " C O N T R O L / R V S O F F "- c = / b l k d" C = / W H T Ma C = / R E D "" c = / c Y t 4 nn c = / p u r "" C = / G R N °n c = / b l u w" 5 C = / Y E L n

2 6

Page 275: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 275/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

8 . C o n s t r u c t i n g F i g u r e s o A l K i n d s

N o t h a t w e ' v e c o v e r e d s o m e b a s i c s , i t ' s t i m e t p u t t h et h e o r i e s i n t o p r a c t i c e . T h i s c h a p t e r c o v e r s p r o g r a m m i n gm y r i a d o g e o m e t r i c f i g u r e s , f r o m s q u a r e s t a r c s a n e l l i p s e s . J u s t f o r t h e s a k e o f u n i t y , w e ' l l b u s i n gm e a s u r e m e n t s i c e n t i m e t e r s t h r o u g h o u t t h i s s e g m e n t . T h ep r o g r a m w i l l a l w a y s c o m e f i r s t , f o l l o w e d b d r a w i n g o f t h ef i g u r e , t h e n d e s c r i p t i o n o w h a t t h p r o g r a m d o e s a n da w h a t l i n e n u m b e r t h a c t i o n o c c u r s . I t h p r o g r a md o e s n ' t w o r k t h f i r s t t i m e , j u s t k e e p d e b u g g i n g .

8 . 3 . 1 S q u a r e

1 0 R E M = = = = S Q U A R E = = = = = = = = = = = = = = = = = = = = = =1 1 O P E N 1 , 6 , 11 2 O P E N 2 , 6 , 21 3 P R I N T # 2 , 11 4 R E M = = = = D R A W = = = = = = = = = = = = = = = = = = = = = = = =1 5 P R I N T # l , M M M ; 1 0 0 ; - 5 01 6 0 P R I N T # l , " I f t1 7 S = 2 0 01 8 P R I N T # l , " J " ; S ; 01 9 P R I N T # l , " J f t ; S ; S2 0 P R I N T # l , " J " ; 0 ; S2 1 P R I N T # l , " J " ; 0 ; 02 2 R E M = = = = D I A G O N A L S = = = = = = = = = = = = = = = = = = =2 3 P R I N T # 2 , 32 4 P R I N T # 1 , " J " ; S ; S2 5 P R I N T # l , M R M ; S ; 02 6 P R I N T # l , " J " ; 0 ; S2 7 R E M = = = = E N D = = = = = = = = = = = = = = = = = = = = = = = = =2 8 P R I N T # l , t f R " ; - 1 0 0 ; - 1 0 03 1 C L O S E 13 2 C L O S E 2

2 6

Page 276: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 276/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

A y o u c a n s e f r o m t h l i s t i n g , d r a w i n g s q u a r e i f a i r l ye a s y t a c c o m p l i s h , s i n c e a l s i d e s a r i d e n t i c a l i l e n g t h .L i n e 1 7 d e t e r m i n e s l e n g t h o f t h e s i d e s ( S ) , w h i l e l i n e s 1 8 t 2 1 p e r f o r m t h p l o t t i n g p r o c e s s . T h i s e x a m p l e u s e s t h l a t t e r c o m m a n d l e t t e r s , w h i c h m i g h t b w o r t h y o u r r e v i e w i n g .T h n e x t f i g u r e , r e c t a n g l e , i b i m o r e c o m p l i c a t e d , b u i r e q u i r e s m o s t o t h a b o v e p r o g r a m l o g i c .

8 . 3 . 2 R e c t a n g l e

F i r s t , t h e l i s t i n g f o r e c t a n g l e w i t h d i a g o n a l s :

1 0 R E M = = = = R E C T A N G L E = = = = = = =1 1 O P E N 1 , 6 , 11 2 O P E N 2 , 6 , 21 3 P R I N T # 2 , 11 4 R B M = = = = D R A W = = = = = = = = = = = =1 5 P R I N T # l , t f M f t ; 1 0 0 ; - 5 01 6 P R I N T # 1 , M I "1 7 S = 2 0 0 : H = 1 0 01 8 P R I N T # l , f f J " ; S ; 01 9 P R I N T # 1 , M J " ; S ; H2 0 P R I N T # l , " J " ; 0 ; H2 1 P R I N T # l , " J " ; 0 ; 02 2 R E M = = = = D I A G O N A L S = = = = = = =

2 7

Page 277: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 277/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

2 3 P R I N T # 2 , 32 4 P R I N T # 1 , " J " ; S ; H2 5 P R I N T # l , f f R " ; S ; O2 6 P R I N T # 1 , " J " ; O ; H2 7 R E M = = = = E N D = = = = = = = = = = = =2 8 P R I N T # l , " R " ; - 1 0 0 ; - 1 0 03 1 C L O S E 13 2 C L O S E 2

W h e n y o u c o m p a r e t h s q u a r e a n r e c t a n g l e p r o g r a m s , y o u ' l li m m e d i a t e l y s e t h d i f f e r e n c e s b e t w e e n t h t w o : L i n e 1 7 c o n t a i n s t w v a r i a b l e s f o r t h e t w o p a i r s o s i d e s , a n d t h ed r a w r o u t i n e h a b e e n a l t e r e d a c c o r d i n g l y . T h i s p r o g r a m i s s i m i l a r t t h p r e v i o u s o n e , t h o u g h , t h a t d e t a i l e de x p l a n a t i o n s w o u l d b e a l l r e p e t i t i o n h e r e .

N o w w e ' l l t r y t c o n s t r u c t s p a t i a l f i g u r e , u s i n gs t a n d a r d c u b e a b a s i s . B e f o r e y o u d i v e i n t o t h i sp r o j e c t , r e m e m b e r t h a t m o s t o t h p r o g r a m s i t h i s s e c t i o nh a v e s i m i l a r s t r u c t u r e s , m o s t l y t s a v e y o t y p i n g t i m e , b u a l s o t h e l p y o u g r a s p t h p r o g r a m l o g i c . T h e r e a d a b i l i t yo t h e s e p r o g r a m s w i l l c u d o w n o e x e c u t i o n t i m e , h o w e v e r .

1 0 R E M = = = = 1 5 2 0 S E T U P = = =1 1 O P E N 1 , 6 , 11 2 O P E N 2 , 6 , 21 3 O P E N 5 , 6 , 5 : P R I N T # 5 , 01 4 R E M = = = = D R A W = = = = = = = = =

2 7

Page 278: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 278/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

1 5 X = 1 0 0 : Y = - 5 0 : S = 2 0 01 6 P R I N T # 1 , M M " ; X ; Y1 7 P R I M T f l , " ! "1 8 P R I N T # 1 , " J M ; S ; O1 9 P R I N T # 1 , H J M ; S ; S2 0 P R I N T # 1 , H J " ; O ; S2 1 P R I N T # l , " J " ; 0 ; 02 2 X = 7 0 : Y = 7 02 3 0 P R I N T # l , t f R M ; S ; O2 4 P R I N T # 1 , M I M ;2 5 P R I N T # 1 , " J M ; X ; Y2 6 P R I N T # 1 , " J M ; X ; Y + S2 7 0 P R I N T # l , M J l f ; O ; S2 8 P R I N T # l , t f R M ; - S ; S2 9 P R I N T f l / ' J ' ^ - S + X j Y + S3 0 P R I N T # l , t f J t t ; X ; Y + S3 1 R E M = = = = D R A W D A S H E D = = = = = = = = = = = = = = = = =3 2 P R I N T # 5 , 73 3 P R I N T # 1 , " R M ; X ; Y3 4 P R I N T # l , t f J M ; - S + X ; Y3 5 P R I N T # 1 , " J M ; - S ; O3 6 P R I N T # 1 , " R " ; - S + X ; Y + S3 7 P R I N T # l , t l J " ; - S + X ; Y3 8 R E M = = = = E N D = = = = = = = = = = = = = = = = = = = = = = = = =3 9 P R I N T # l , M M t f j 0 ; - 1 0 04 0 C L O S E 14 1 C L O S E 14 2 C L O S E 24 3 C L O S E 5

I l i n e s 1 5 a n 2 2 t h s i d e - l e n g t h s a r s e i n t o t h v a r i a b l e s X , a n S O u r f i g u r e i p r i n t e d u s i n g t h c o o r d i n a t e v a r i a b l e s i P R I N T # 1 , C O M M A N D , b o t h i s o l i d l i n e sa n d o t t e d l i n e s . A n c h a n g e s t t h i s p r o g r a m m e a n t h a ty o u ' l l h a v e t f i g u r e o u n e l e n g t h s m e n t a l l y . O u r o u t i n eh e r e i d o w n r i g h t u n e c o n o m i c a l i i t s l o g i c , s i m p l y b e c a u s eo a l t h P R I N T * s t a t e m e n t s — w a t c h i n g t h e p e n d r u m g t h r o u g h a l i t m o v e m e n t s i t h i s p r o g r a m c a b p r e t t ya m u s i n g . H o w e v e r , n o w t h a t t h p r o g r a m h a s e r v e d i t p u r p o s e , w c a s h o r t e n t h i s r o u t i n e i t w w a y s , l e a v i n g u w i t h m o r e e f f i c i e n t p r o g r a m .

2 7

Page 279: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 279/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

F i r s t , w s h o u l d r e d u c e t h n u m b e r o P R I N T # s t a t e m e n t s , a n w o r k o m a k i n g t h p e d r u m t r a v e l a l i t t l e a p o s s i b l e .W e ' l l p u t o u r r e l a t i v e n u l l - p o i n t a 1 0 0 / 2 0 0 , t m a k e t h i n g sm o v e b i f a s t e r f o r t h e p e n . T h o t h e r c h a n g e w c a m a k ei t h i s a r e a i t r e a d t h c o o r d i n a t e s d i r e c t l y a D A T As t a t e m e n t s , r i d d i n g u o v a r i a b l e o u t p u t a n d a l l t h o s eP R I N T * c a l l s .

A l l t h e 1 5 2 0 c o m m a n d s c a b r e a l i z e d i D A T A s t a t e m e n t s( M , D , J , H ) . U s i n g o u p r e v i o u s p r o g r a m a p a t t e r n , l o o k a i n o a f t e r t h e s e c h a n g e s :

1 0 R E M = = = = 1 5 2 0 S E T U P = = = = = = = = = = = = = = = = =1 1 O P E N 5 , 6 , 51 2 O P E N 1 , 6 , 11 3 P R I N T # 5 , 01 4 0 P R I N T # l , f t M f t ; 1 0 0 ; 2 0 01 5 P R I N T # 1 , " I "1 6 R E M = = = = R E A D D A T A / L I N E S = = = = = = = = = = = =1 7 F O R X = 0 T O 71 8 R E A D Y , Z1 9 P R I N T # 1 , " J " ; Y ; Z2 0 N E X T2 1 R E M = = = = R E A D D A T A / L I N E S S T R O K B S = =2 2 F O R X = 0 T O 72 3 R E A D X $ , Y , Z2 4 I F X = 2 T H E N P R I N T # 5 , 72 5 P R I N T # 1 , X $ , Y , Z2 6 N E X T2 7 R E M = = = = E N D = = = = = = = = = = = = = = = = = = = = = = = =2 8 P R I N T # 5 , 02 9 C L O S E 13 0 C L O S E 53 1 R E M = = = = D A T A ( L I N E S ) = = = = = = = = = = = = = = =3 2 D A T A 0 , - 2 0 0 , 2 0 0 , - 2 0 0 , 2 7 0 , - 1 3 03 3 D A T A 2 7 0 , 7 0 , 7 0 , 7 0 , 0 , 0 , 2 0 0 , 03 4 D A T A 2 7 0 , 7 03 5 R E M = = = = D A T A ( L I N E S & S T R O K E S ) = = = = = = = =3 6 D A T A R , 2 0 0 , 0 , J , 2 0 0 , - 2 0 0 , R , 2 7 0 , - 1 3 03 7 D A T A J , 7 0 , - 1 3 0 , J , 0 , - 2 0 0 , R , 7 0 , - 1 3 03 8 D A T A J , 7 0 , 7 0 , M , 0 , - 1 0 0R E A D Y .

2 7

Page 280: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 280/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

S t a r t t h p r o g r a m w i t h R U N . Y o u ' l l g e e x a c t l y t h s a m ef i g u r e a b e f o r e , b u w i t h c o n s i d r e a b l y l e s s w o r k t h a n t h o t h e r p r o g r a m , w h i c h m e a n s s h o r t e n e d e x e c u t i o n t i m e .

T h e r e i a n o t h e r p r o c e d u r e w e c a n f o l l o w t m a k e t h e s er o u t i n e s r u b e t t e r : I y o u a r e n ' t c o m p l e t e l y c l e a r o t h f i r s t s t e p s , r e r e a d t h e l a s t f e p a r a g r a p h s , s i n c e m o s t o t h p r o g r a m s t f o l l o w c o n t a i n D A T A l i n e s .

T s h o r t e n o u c u b e r o u t i n e f u r t h e r , y o u c a n c u d o w n t h n u m b e r o R E A D l o o p s , g i v i n g t h e n t i r e r e s p o n s i b i l i t y o d r a w i n g t h c u b e t t h D A T A s t a t e m e n t s .

1 0 R E M = = = = 1 5 2 0 S E T U P = = = = = = = = = = = = = = = = =1 1 O P E N 5 , 6 , 51 2 O P E N 1 , 6 , 11 3 P R I N T # 5 , 01 4 P R I N T # l , t l M l t ; 1 0 0 ; 2 0 01 5 P R I N T # 1 , " I "1 6 R E M = = = = R E A D / D R A W D A T A = = = = = = = = = = = =1 7 F O R X = 0 T O 1 51 8 R E A D X $ , Y , Z1 9 I F X = 1 0 T H E N P R I N T # 5 , 72 0 P R I N T # 1 , X $ , Y , Z2 1 N E X T2 2 R E M = = = = E N D = = = = = = = = = = = = = = = = = = = = = = = =2 3 P R I N T # 5 , 02 4 C L O S E 12 5 C L O S E 52 6 R E M = = = = D A T A = = = = = = = = = = = = = = = = = = = = = = =2 7 D A T A J , , - 2 0 0 , J , 2 0 0 , - 2 0 0 , J , 2 7 0 , - 1 3 02 8 D A T A J , 2 7 0 , 7 0 , J , 7 0 , 7 0 , J , , , J , 2 0 0 , 02 9 D A T A J , 2 7 0 , 7 0 , R , 2 0 0 , , J , 2 0 0 , - 2 0 03 0 D A T A R , 2 7 0 , - 1 3 0 , J , 7 0 , - 1 3 0 , J , , - 2 0 03 1 D A T A R , 7 0 , - 1 3 0 , J , 7 0 , 7 0 , M , , - 1 0 0R E A D Y .

2 7

Page 281: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 281/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

C o m p a r e t h i s l a s t l i s t i n g w i t h t h f i r s t e x a m p l e ; y o c a s e e t h a t t h e y a l p e r f o r m t h s a m e f u n c t i o n , b u e a c hv e r s i o n i m o r e e c o n o m i c a l b e t t e r w r i t t e n a n d f a s t e rt h a n i t p r e d e c e s s o r .

S o e f f i c i e n t l y - w r i t t e n r o u t i n e s f o t h 1 5 2 0 c a n b e m a d ew i t h t h f o l l o w i n g c r i t e r i a :

A c c u r a t e p l a n n i n g f o t h f i g u r e ( d r a w i n g )W o r k i n g o u t t h e p a t h o l e a s t m o v e m e n t f o t h p l o t t e r( w o r k e d o u o p a p e r f i r s t )A v o i d l a r g e n u m b e r s o P R I N T * s t a t e m e n t s ( u s e D A T As t a t e m e n t s i n s t e a d )T r t k e e p t h p r o g r a m r e a d a b l e ( R E M s a n d d e c e n tp r o g r a m s t r u c t u r e )

I y o u k e e p t h e s e r u l e s i m i n d w h e n d e s i g n i n g p l o t t i n gp r o g r a m s , y o u ' l l h a v e m o r e t i m e t e n j o y y o u r p r o g r a m m i n ge f f o r t s , a n e x p l o r e t h f a r t h e s t b o r d e r s o y o u r p l o t t e r .

2 7

Page 282: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 282/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

T h l a s t t h r e e p r o g r a m s d o c u m e n t t h d e v e l o p m e n t a l p r o c e s si " s t r e a m l i n i n g " B A S I C . T h r e m a i n i n g p r o g r a m s u s e t h e s es t r e a m l i n i n g t e c h n i q u e s , i . e . , s u b d i v i d i n g t h p r o g r a m i n t ot w R E A D l o o p s a n a t t a c h i n g D A T A b l o c k s .

N o w p r e s e n t t w e x a m p l e s o s i m p l e f i g u r e s w h i c h h a v es o l i d p l a c e i g e o m e t r y ; t h p a r a l l e l o g r a m a n t h d i a m o n d .D o t t e d l i n e s r e p r e s e n t h e i g h t s a n d w i d t h s . .

8 . 3 . 3 P a r a l l e l o g r a m

1 0 R E M = = = = P A R A L L E L O G R A M = = = = = = = = = =1 1 O P E N 1 , 6 , 11 2 O P E N 5 , 6 , 51 3 P R I N T # 5 , 01 4 R E M = = = = S T A R T P O S I T I O N = = = = = = = = =1 5 P R I N T # l , f t M " ; 1 0 0 ; 01 6 0 P R I N T # l , f t I "1 7 R E M = = = = D R A W P A R A L L E L O G R A M = = = = =1 8 F O R X = 0 T O 31 9 R E A D Y , Z2 0 P R I N T # l , " J l f ; Y j Z2 1 N E X T2 2 R E M = = = = D R A W H E I G H T L I N E S = = = = = =2 3 P R I N T # 5 , 32 4 F O R X = 0 T O 42 5 R E A D X $ , Y , Z2 6 P R I N T # 1 , X $ , Y , Z2 7 N E X T2 8 R E M = = = = E N D = = = = = = = = = = = = = = = = = = = =2 9 P R I N T # 5 , 03 0 C L O S E 13 1 C L O S E 53 2 R E M = = = = P A R A L L E L O G R A M D A T A = = = = =3 3 D A T A 2 0 0 , 0 , 2 5 0 , 1 0 0 , 5 0 , 1 0 0 , 0 , 03 4 R E M = = = = H E I G H T D A T A = = = = = = = = = = = =3 5 D A T A R , 5 0 , 0 , J , 5 0 , 1 0 0 , R , 2 0 0 , 1 0 03 6 D A T A J , 2 0 0 , 0 , M , 0 , - 1 0 0R E A D Y .

2 7

Page 283: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 283/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

O b v i o u s l y t h p r o g r a m p r e s e n t s n p r o b l e m s , s w e ' l l p a s s o g i v i n g y o a n d e t a i l e d e x p l a n a t i o n s . T h d i a m o n d i e q u a l l y a s i m p l e t m a k e :

1 0 R E M = = = = D I A M O N D = = = = = = = = = = = = = = = = = = = =1 1 O P E N 1 , 6 , 11 2 O P E N 5 , 6 , 51 3 P R I N T # 5 , 01 4 R E M = = = = S T A R T I N G P O S I T I O N = = = = = = = = = =1 5 P R I N T # l , " M " ; 1 0 0 ; 01 6 P R I N T # 1 , " I "1 7 R E M = = = = R E A D D A T A = = = = = = = = = = = = = = = = = =1 8 F O R X = 0 T O 71 9 R E A D X $ , Y , Z2 0 I F X = 4 T H E N P R I N T # 5 , 32 1 P R I N T # 1 , X $ , Y , Z2 2 N E X T2 3 R E M = = = = E N D = = = = = = = = = = = = = = = = = = = = = = = =2 4 P R I N T # 5 , 02 5 C L O S E 12 6 C L O S E 52 7 R E M = = = = D A T A = = = = = = = = = = = = = = = = = = = = = = =2 8 D A T A J , 1 0 0 , - 5 0 , J , 2 0 0 , , J , 1 0 0 , 5 0 , J , ,2 9 D A T A J , 2 0 0 , , R , 1 0 0 , 5 0 , J , 1 0 0 , - 5 03 0 D A T A M , , - 1 5 0R E A D Y .

2 7

Page 284: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 284/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

Y o u ' l l n o t i c e t h a t i a d d i t i o n t t h f i g u r e i t s e l f , w e ' v ei n c l u d e d d o t t e d l i n e s d r a w n f r o m t h d i a g o n a l s . A l s o , n o t et h a t t h e D A T A i r e a d i l a r g e b l o c k s ( e . g . , l i n e 1 9 0 , w h e r eR E A D i f o l l o w e d b X $ , a c o m m a , Y c o m m a , Z ) T h r e m a i n d e r o o u p r o g r a m s u s t h i s f o r m .

8 . 3 . 4 T r i a n g l e

B e f o r e w e g e t o n w i t h t h i s f i g u r e , l e t ' s b a c k t r a c k b i t a n dh a v e l o o k a t r i a n g l e c o n s t r u c t i o n . T h e r e a r e s s e n t i a l l yt h r e e i m p o r t a n t f o r m s o t r i a n g l e :

a E q u i l a t e r a lb I s o s c e l e sc R i g h t ( a n g l e )

L e t ' s b e g i n w i t h a ) A i t n a m e i m p l i e s , a e q u i l a t e r a lt r i a n g l e h a t h r e e e q u a l s i d e s , a n d t h r e e 6 d e g r e e a n g l e s( y o u ' l l r e c a l l t h a t a l a n g l e s i t r i a n g l e m u s t a d u t 1 8 d e g r e e s ) . T h e r e i p r o b l e m i t r a n s c r i b i n g t h i s t p l o t t e r , t h o u g h ; h o d w d e t e r m i n e h o t p l o t t h s i d e s( t h e b a s e i n p r o b l e m ) , s i n c e t h Y - d i r e c t i o n d o e s n ' tr e a l l y r u a a a n g l e ?

O n e s m a l l e q u a t i o n w i l l h e l p u a r o u n d t h i s d i f f i c u l t y :

Y o k n o w t h l e n g t h o f t h e s i d e s i y o d r a w l i n ep e r p e n d i c u l a r t t h b a s e ( f r o m t h c e n t e r o f t h e b a s e )y o g e s u b d i v i s i o n o t h e q u i l a t e r a l t r i a n g l e i n t o t w or i g h t t r i a n g l e s s t a n d i n g b a c k - t o - b a c k . N o y o c a c a l c u l a t e t h h e i g h t u s i n g t h a t h e i g h t - l i n e , a n d f i l l i t h t w r e m a i n i n g s i d e s .

2 7

Page 285: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 285/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

T h e r e a r t w w a y s t c a l c u l a t e t h h e i g h t : Y o c o u l d u s t h P y t h a g o r e a n T h e o r e m ; o r u s i n g t h c o m p u t e r , c a l c u l a t et h s i n e .

I y o u r e m e m b e r a n y g e o m e t r y , y o u ' l l r e m e m b e r t h P y t h a g o r e a n T h e o r e m , w h i c h h e l p s d e t e r m i n e l e n g t h o s i d e ,o s i z e o a a n g l e , u s i n g t h r e m a i n i n g m a t e r i a l s o f t h ef i g u r e . F o e x a m p l e :

S i d e l e n g t hH e i g h t

H = S Q R ( 3 / 4 * 1 2 )

T h i s f o r m u l a g i v e s y o t h h e i g h t o a e q u i l a t e r a lt r i a n g l e . N o w , l e t ' s u s m o r e c o n c r e t e e x a m p l e c m s i d e l e n g t h , w h i c h g i v e s u H = S Q R ( 1 2 ) , o r 3 . 4 6 4 . N o w , g e s h e e t o f p a p e r , d r a w 4 - c e n t i m e t e r b a s e , a n c e n t e r - l i n eo 3 . 4 6 4 c m T h e r e s u l t w i l l g i v e y o u s i d e s o e x a c t l yc m i l e n g t h .

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

1 0 R E M = = = = T R I A N G L E = = = = = = = = =1 1 0 P E N 5 , 6 , 51 2 O P E N 1 , 6 , 11 3 P R I N T t f l . " M " ; 2 0 0 ; - 5 01 4 P R I N T # 1 f " l "1 5 R E M = = = = I N P U T = = = = = = = = = = = =1 6 0 P R I N T ' s J U 1 - C M 1 7 I N P U T Q L E N G T H O S I D E S " ;

2 7

Page 286: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 286/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

1 8 L = U A L C A $ D1 9 I F L < 1 O R L > 8 T H E N 1 6 02 0 L = L * 5 02 1 R E M = = = = C A L C U L A T E = = =2 2 H = S Q R C 3 / 4 * L t 22 3 P R I N T « l f " J - ; - L / 2 ; 02 4 P R I N T * 1 , " J " ; 0 ; H2 5 P R I N T t t l , " J " ; L / 2 ; 02 6 P R I N T t t l , " J " ; 0 ; 02 7 R E M = = = = D R A W H E I G H T =2 8 P R I N T * 5 f 52 9 P R I N T * 1 , " J " ; 0 ; H3 0 P R I N T # 5 , 03 1 R E N = = = = E N D = = = = = = = = =3 2 P R i N T t t i / ' r i " ; 0 ; - i 0 03 3 C L O S E 13 4 C L 0 S E 5R E A D Y .

T h f o r m u l a p r o p e r f o r t h i s r o u t i n e a p p e a r s i l i n e 2 2 0 o ft h l i s t i n g . I n p u t c o u p l e o d i f f e r e n t v a l u e s f o s i d el e n g t h w h e n p r o m p t e d ( l i n e 1 7 0 ) ; t h r o u t i n e w i l l w o r k o u t h t r i a n g l e s i z e , a n d d r a w t h f i g u r e i c e n t i m e t e r s ( s e el i n e 2 0 0 c m = 5 0 s t e p s o f t h e d r u m ) . T h d e s c r i p t i o n o t h r i g h t t r i a n g l e ( s e e b e l o w ) w i l l n o b q u i t e a d e t a i l e da t h i s , s i n c e t h e p r o c e d u r e s a r q u i t e s i m i l a r .

Y o c o u l d a d a p t t h i s p r o g r a m t a c c e p t a n y t h r e e l i n el e n g t h s ( o n e p e s i d e ) b y c r e a t i n g s u b r o u t i n e w h i c hp e r f o r m s t a s k s i m i l a r t c o m p a s s f o m e a s u r i n g a n g l e s .

A l w a y s r e m e m b e r t h a t t h i n k i n g o u t h p r o g r a m f i r s t ( b e f o r et y p i n g i n e w p r o g r a m ) w i l l l e a d t b e t t e r p r o g r a m !

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

2 8

Page 287: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 287/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

1 B a s e l e n g t h ; a n 2 S i d e l e n g t h ( s i d e s a r e e q u a l t e a c h o t h e r , b u t n o t e q u a l

t t h e b a s e )

O n c e t h i s i n p u t i c r e a t e d , t h c e n t e r - p o i n t o t h b a s e c a b c a l c u l a t e d . N e x t , t h e h e i g h t o t h " c e n t e r p o l e " c a n b ec o m p u t e d , a n d t h e s i d e s d r a w n a c c o r d i n g l y . T h p r o g r a m ' ss t r u c t u r e f o l l o w s t h i s f o r m a t :

A l g o r i t h m s

1 O P E N a n s e t u p p l o t t e r2 B a s e S i d e s p r o m p t e d3 H e i g h t c o m p u t e d4 D r a w t r i a n g l e5 D r a w h e i g h t m a r k ( d o t t e d l i n e )6 E n

i 0 R E M = = = = 1 5 2 0 S E T U P = = = = = = = = = = =1 1 O P E N 1 , 6 , 11 2 0 P E N 5 , 6 , 51 3 P R I N T t t l , ' ! v l " ; 2 0 0 ; - 5 01 4 P R I N T t t l / T "1 5 R E M = = = = B A S E / S I D E S = = = = = = = = = = =1 6 P R I N T ' ^ J I A X . C F O B A S E " '1 7 P R I N T " Q H A X . 1 5 C F O R S I D E S "1 8 I N P U T - Q Q g A S E " A 1 9 I N P l i r ' Q Q S I D E S - j B *2 0 A = U A L C A $ 3 : A = A B S C A D2 1 B = U A L C B $ D : B = A B S C B )2 2 I F A > 8 O R B > 1 5 O R A < 1 T H E N 1 6 02 3 R E M = = = = C O M P U T E H E I G H T = = = = = = =2 4 A = A * 5 02 5 B = B * 5 02 6 H = S Q R C B t 2 - C A / 2 D t 2 D2 7 R E M = = = = D R A W T R I A N G L E = = = = = = = =2 8 P R I N T S , " J " ; - A / 2 ; 02 9 P R I N T a l , " J " ; 0 ; H3 0 P R I N T # l , " J " ; A / 2 ; 03 1 P R i N T a i , " J " ; 0 ; 03 2 R E M = = = = D R A W H E I G H T = = = = = = = = = :

2 8

Page 288: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 288/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

3 3 P R I N T * 5 , 53 4 P R I N T # 1 , " J " ; 0 ; H3 5 R E = E N D = = = = 3 6 P R I N T * 5 , 03 7 P R I N T # 1 , " P 1 " ; 0 ; - 1 0 03 8 C L O S E 13 9 C L 0 S E 5R E A D Y .

T h e r e a r c o u p l e o p o i n t s i t h i s p r o g r a m t h a t a r e w o r t hy o u r a n a l y s i s :

Y o u ' v e p r o b a b l y n o t i c e d t h a t t h I N P U T s t a t e m e n t s ( l i n e s 1 8 1 9 0 ) h a v e s t r i n g v a r i a b l e s , r a t h e r t h a n n u m b e r v a r i a b l e s .

T h m a i n r e a s o n f o t h i s i t a v o i d R E D O F R O M S T A R T ?e r r o r ; i o t h e r w o r d s , i l e t t e r o g r a p h i c s y m b o l i i n a d v e r t e n t l y i n p u t , l i n e s 2 0 0 - 2 2 0 w i l l s i m p l y c h e c k f o t h i s i n p u t , a n d s t a r t t h e i n p u t r o u t i n e a l o v e r a g a i n ( l i n e1 6 o n ) . I n u m b e r s a r g i v e n w i t h i n t h r a n g e s t a t e d ( s e el i n e s 1 6 0 - 1 7 0 ) , t h e p r o g r a m c o n t i n u e s o n b a s e v a l u e o w i l l a l s o r e s t a r t t h i n p u t r o u t i n e ; h o w e v e r , b a s e o m o r et h a n a n s i d e l e n g t h o W I L L r u t h r o u t i n e a l y o u ' l l g e i s h o r i z o n t a l l i n e , t h o u g h ( t h e b a s e a l o n e ) .

T h m o r e o b s e r v a n t r e a d e r s h a v e s u r e l y s e e n t h c h a n g e i t h h e i g h t f o r m u l a ( l i n e 2 6 0 ) :

H = S Q R ( 3 / 4 * L 2 ) b e c o m e s H = S Q R ( B 2 - ( A / 2 ) * ) .

T h i s i c o r r e c t ; t h p r e v i o u s f o r m u l a ( P y t h a g o r e a n T h e o r e m )w a s p e c i f i c a l l y f o a e q u i l a t e r a l t r i a n g l e . T h i s n e wh e i g h t f o r m u l a w i l l s e r v e o u i s o s c e l e s f i g u r e b e s t .

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

2 8

Page 289: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 289/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

O u r f i n a l i t e m i t h i s s e c t i o n i t h r i g h t t r i a n g l e , w h i c hm u s t h a v e 9 0 - d e g r e e a n g l e s o m e w h e r e w i t h i n t h f i g u r e .T h i s t r i a n g l e i v e r y e a s y t c o n s t r u c t , b u t i o r d e r t m a k e a n y r i g h t t r i a n g l e , w s h o u l d r u t h r o u g h l i t t l eg r o u n d w o r k o s u c h f i g u r e s , f o y o u r r e f e r e n c e .

T h e r e a r t h r e e p o s s i b i l i t i e s i p l o t t i n g r i g h t t r i a n g l e :

1 Y o c a p u t t h e r i g h t a n g l e a t h e l e f t s i d e o f t h eb a s e ( p o i n t A )

2 Y o c a n s e t t h e r i g h t a n g l e a t h r i g h t e n d o t h b a s e .

3 W i t h s o m e e f f o r t , y o c a p l a c e t h 9 0 - d e g r e e a n g l e a t h t o o f t h e t r i a n g l e ( " p o i n t " ) .

2 8

Page 290: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 290/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

I t h i s p a i r o i l l u s t r a t i o n s , t h b a s e i r e p r e s e n t e d b p o i n t s B w i t h t h 9 0 - d e g r e e a n g l e a p o i n t C T h r e m a i n i n g t w a n g l e s a d u t 9 d e g r e e s ( e a c h a n g l e i 4 d e g r e e s ) . T h i s m e a n s t h a t t h i s p r o g r a m w i l l t u r n o u t r i g h tt r i a n g l e s t h a t a r e a l s o i s o s c e l e s t r i a n g l e s ( e x t r a n o t e ; t h eh e i g h t w i l l b o n e - h a l f t h s i z e o f t h e b a s e ) .

W e ' v e g i v e n y o n r o u t i n e s f o r t h e f i r s t t w o t r i a n g l e s ,s i n c e y o u h a v e t h e r a w m a t e r i a l s f r o m t h e l a s t f e w p a g e s t w r i t e o n y o u r s e l f . T h f o l l o w i n g p r o g r a m w i l l c r e a t ed u p l i c a t e o E x a m p l e 3

1 " R E M = = = = T R I A N G L E U / R I G H T A N G L E =2 R E 1 0 R E N = = = = 1 5 2 0 S E T U P = = = = = 1 1 0 P E N 1 , 6 , 11 2 0 P E N 5 , 6 , 51 3 P R I N T * 5 , 0 / 1 4 P R I N T S , " M " ; 2 4 0 ; - 5 01 5 P R I N T * l , " r '1 6 R E M = = = = I N P U T = = = = = = = = = = = = = = = = = =1 7 P R I N T " £ £ A S E - M A X . C M 1 8 I N P U T Q f l B A S E L E N G T H " ; A 1 9 A = U A L C A $ 3 : A = A B S C A 32 0 I F A > 8 T H E N 1 7 02 1 B = A * 2 52 2 R E M = = = = D R A W T R I A N G L E = = = = = = = = = =2 3 P R I N T t t l , " J " ; - B ; 02 4 P R I N T # 1 " J ^ ^ B2 5 P R I N T s l , M J " ; B ; 02 6 P R I N T * l , f l J " ; 0 ; 02 7 R E M = = = = D R A W H E I G H T = = = = = = = = = = = =2 8 P R I N T # 5 , 52 9 P R I N T t t l / ' J - ' ^ J B3 0 R E M = = = = E N D = = = = = = = = = = = = = = = = = = = =3 1 P R I N T * 5 , 03 2 P R I N T t t l , ' N " ; 0 ; - 1 0 03 3 0 C L 0 S E 13 4 C L 0 S E 5

2 8

Page 291: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 291/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

L i n e s 1 7 0 - 2 1 0 p r o m p t f o b a s e l e n g t h i c e n t i m e t e r s , t h e nc h e c k f o v a l i d i n p u t ; l i n e 2 1 i n i t i a l i z e s t h p l o t t e rr o u t i n e . N e x t , t h t r i a n g l e i t s e l f i d r a w n , f o l l o w e d b t h h e i g h t - l i n e ( d o t t e d ) .

B e f o r e g o i n g o t c i r c l e s a n e l l i p s e s , w e ' l l t o u c h o o n l a s t s p a t i a l f i g u r e t h e p y r a m i d . I c o n s i s t s o s q u a r e

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

1 R E = = = = P R Y A M I D = = = = = = = = = = = = = = = = = =2 R E 1 0 R E M = = = = 1 5 2 0 S E T U P = = = = = = = = = = = = = = =1 1 O P E N 1 , 6 , 11 2 O P E N 5 , 6 , 51 3 P R I N T # l , " M " ; 1 0 0 ; 01 4 P R I N T # 1 , " I "1 5 R E M = = = = R E A D D A T A = = = = = = = = = = = = = = = =1 6 F O R X = 0 T O l l1 7 R E A D X $ , Y , Z1 8 I F X = 6 T H E N P R I N T # 5 , 51 9 I F X = 1 0 T H E N P R I N T # 5 , 32 0 P R I N T # 1 , X $ , Y , Z2 1 N E X T2 2 R E M = = = = E N D = = = = = = = = = = = = = = = = = = = = = =2 3 P R I N T # 5 , 02 4 C L O S E 12 5 C L O S E 52 6 E N 2 7 R E M = = = = D A T A = = = = = = = = = = = = = = = = = = = = =2 8 D A T A J , 2 0 0 , 0 , J , 2 7 0 , 7 0 , J , 1 3 5 , 2 0 02 9 D A T A J , 2 0 0 , 0 , R , 1 3 5 , 2 0 0 , J , 0 , 03 0 D A T A J , 7 0 , 7 0 , J , 2 7 0 , 7 0 , R , 7 0 , 7 03 1 D A T A J , 1 3 5 , 2 0 0 , J , 1 3 5 , 3 5 , M , 0 , - 1 0 0

R E A D Y .

2 8

Page 292: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 292/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

L i n e s 2 8 0 - 2 9 0 d r a w t h f o r e g r o u n d o t h p y r a m i d , w h i l el i n e s 3 0 0 - 3 1 0 s k e t c h o u t t h e h e i g h t a n b a c k g r o u n d . L i n e s1 6 0 - 2 1 0 h a v e b e e n m a d e a e f f i c i e n t a t h e y c a b e l i n e s1 8 0 - 1 9 0 c h a n g e t h e l i n e t y p e s u s e d b t h p l o t t e r .

2 8

Page 293: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 293/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

8 . 3 . 5 A r c s

Y o h a v e p r o b a b l y h a d e n o u g h o d r a w i n g s t r a i g h t l i n e sn o w c o m b i n e b o t h X a n Y - r e g i s t e r s t d r a w c u r v e s . I o r d e r t m a k e c u r v e s h e r e , t h o u g h , y o u ' l l h a v e t d i s r e g a r da n f o r m u l a s y o u ' v e l e a r n e d u u n t i l n o w ; S I N E a n d C O S I N Ea r i n c o m p a t i b l e . L o o k a o u s a m p l e d r a w i n g b e l o w , w h i c hu s e s b o t h r e g i s t e r s ; t h s i n e c u r v e i s c o n n e c t e d l i n e ,w h i l e t h c o s i n e i s s e r i e s o d o t s , t h r o u g h p r o c e d u r ew h i c h w e ' l l c o m e t i m o m e n t .

I o r d e r t p r o d u c e b o t h l i n e s i t h s a m e r o u t i n e , w n e e dn e r o u t i n e u s e d b t h e 1 5 2 0 p l o t t e r f o c i r c l e s a n

e l l i p s e s . W e ' l l b e g i n w i t h l i s t i n g w h i c h w i l l g i v e y o t h b a s i c s o f a r c d r a w i n g , a n d d e t a i l e d a n a l y s i s o t h i sl i s t i n g .

1 0 R E M = = = = 1 5 2 0 S E T U P = = = = = = = = = = = = = = = = = =1 1 O P E N 1 , 6 , 11 2 O P E N 5 , 6 , 51 3 P R I N T # l , " M M ; 2 4 0 ; 01 4 P R I N T # 1 , " I "1 5 R E M = = = = D R A W C I R C L E = = = = = = = = = = = = = = = = =1 6 F O R X = - 1 . 6 T O 4 . 8 S T E P . 0 41 7 Y = 1 5 0 * C O S ( X )

2 8

Page 294: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 294/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

1 8 Z = 1 5 0 * S I N ( X )1 9 I F X = - 1 . 6 T H E N P R I N T # 1 , " R " ; Y ; Z2 0 P R I N T # l , " J t f ; Y } Z2 1 N E X T2 2 R B M = = = = R A D I U S = = = = = = = = = = = = = = = = = = = = = =2 3 P R I N T # 5 , 52 4 P R I N T # l , " J " ; 0 ; 02 5 R E M = = = = E N D = = = = = = = = = = = = = = = = = = = = = = = = =2 6 P R I N T # 5 , 02 7 P R I N T # l , M M " ; 0 ; - 2 0 02 8 C L O S E 12 9 C L O S E 5

T h i s e x p l a n a t i o n b e g i n s w i t h l i n e s 1 6 0 - 2 1 0 , s i n c e t h O P E Nr o u t i n e s h o u l d p o s e n p r o b l e m .

1 6 T h r a n g e o n u m b e r s n e e d e d i t h s i n e a n c o s i n e a r s e e n t i r e l y i n t o t h e S T E P l o o p . O u e x a m p l e g i v e s y o uS T E P 0 . 4 , o r 1 6 0 m o v e s . T h s t e p l e n g t h d e t e r m i n e s t h r e s o l u t i o n o f t h e d r a w i n g . L a r g e r v a l u e s a r e n ' tr e c o m m e n d e d , s i n c e t h f i g u r e w i l l b d r a w n m u c h t o l a r g e f o r t h e p a p e r a n t h p r i n t o u t t i m e i n c r e a s e sd r a m a t i c a l l y . T h u s , - 1 . 6 i o u s t a r t i n g p o i n t f o q u a r t e r - c i r c l e t b d r a w n . I y o c h a n g e d t h l i n e t F O X = 0 T O 6 . 4 , y o u ' d g e r o u g h l y t h s a m e r e s u l t w i t ht h s t a r t i n g p o i n t p l a c e d e l s e w h e r e o t h p a g e .

1 7 V a r i a b l e h o l d s t h r e s p e c t i v e X - v a l u e f o C O S . T h r e s u l t i m u l t i p l i e d b c o n s t a n t ( 1 5 0 i o u e x a m p l e ) . T h i s c o n s t a n t f i x e s t h r a d i u s f o t h X d i r e c t i o n . P a r t o t h i s a r w i l l u s e t h i s f u n c t i o n .

1 8 V a r i a b l e a r r a n g e s t h S I N E - p o r t i o n o f t h e a r c . T h S I N E - v a l u e m u s t t h e n b m u l t i p l i e d b c o n s t a n tf a c t o r , t d e t e r m i n e t h r a d i u s o t h Y - d i r e c t i o n . T h c o m b i n e d r a d i i g i v e u s a n a r c .

2 8

Page 295: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 295/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

1 9 L i n e 1 3 g a v e u t h m i d d l e p o i n t o t h e a r c ( 2 4 0 / 0 ) .B e f o r e t h p l o t t e r b e g i n s t h d r a w r o u t i n e , i w i l ld r a w d a s h e d l i n e s h o w i n g t h m i d p o i n t a n r a d i u s ; i s t a r t s t h i s p r o c e d u r e i m m e d i a t e l y a f t e rt h f i r s t v a l u e ( - 1 . 6 ) i g i v e n . I y o u s t a r t t h l o o p ( l i n e 1 6 0 ) w i t h 0 l i n e 1 9 m u s t a l s o b ec h a n g e d t 0

2 0 T h i s l i n e d r a w s o u r c u r v e .

2 1 T h e n t i r e p r o c e d u r e b e g i n s a n e w .

T h i s a n a l y s i s w i l l b o p a r t i c u l a r i n t e r e s t t t h n e o p h y t e1 5 2 0 o w n e r , s i n c e s i m i l a r ( u n d o c u m e n t e d ) r o u t i n e i p r i n t e d i t h e 1 5 2 0 h a n d b o o k . E x p e r i m e n t w i t h t h i s l i s t i n g ,c h a n g e n u m b e r s a r o u n d , p l a y w i t h t h i s p r o g r a m u n t i l y o h a v ea i d e a o f w h a t w o r k s a n d w h a t d o e s n ' t .

T h e n e x t l i s t i n g i f o t h o s e o y o w h f e e l b i m o r ec o m f o r t a b l e w i t h t h a r c f u n c t i o n :

1 0 R E M = = = = 1 5 2 0 S E T U P = = = = = = = = = = = = = = = = = =1 1 O P E N 1 , 6 , 11 2 0 P E N 5 , 6 , 51 3 P R I N T » 1 , l l ! y l " ; 2 4 0 ; 01 4 P R I N T * 1 , " I "1 5 R E M = = = = I N P U T = = = = = = = = = = = = = = = = = = = = = = =1 6 P R I N T s P A D I U S M A C M 1 7 P R I N T ' Q R E S O L U T I O N . 0 . 1 1 8 I N P U T " Q F A D I U S 1 1 s ; A $1 9 I N P U T " Q R E S O L U T I O N " ; B i2 0 A = U A L C A $ 3 : A = A B S C A D2 1 B = U A L C B i D : B = A B S C B D2 2 I F A > 4 T H E N 1 6 02 3 I F B > . 1 O R B < . 0 1 T H E N 1 6 02 4 A = A * 5 02 5 R E M = = = =

C U R U E = = = = = = = = = = = = = = = = = =

2 8

Page 296: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 296/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

2 6 F O R X = - 1 . 6 T 0 4 . 8 S T E P B2 7 Y = A X C O S C X D2 8 Z = A * S I N C X D2 9 I F X = - 1 . 6 T H E N P R I N T * ! f " R " ; Y ; Z3 0 P R I N T # 1 , " J ' ; V ; Z3 1 N E X T3 2 R E M = = = = R A D I U S = = = = = = = = = = = = = = =3 3 P R I N T * 5 , 53 4 0 P R I N T * 1 , " J " ; t o ; Q3 5 R E M = = = = E N D = = = = = = = = = = = = = = = = = =3 6 P R I N T # 5 , 03 7 P R I N T t t l , " f 1 " ; 0 ; - 2 0 03 8 0 C L O S E 13 9 0 C L 0 S E 5

O n c e t h p r o g r a m h a b e e n s t a r t e d , y o c a n i n p u t t h e r a d i u sa n d l i n e r e s o l u t i o n d u r i n g t h p r o g r a m r u ( a f f e c t i n gp l o t t i n g t i m e p r o p o r t i o n a t e l y ) . T h d r a w i n g w i l l c o n c l u d ew i t h t h r a d i u s d r a w n i d a s h e s .

T h a n a l y s i s o t h a r p r o b l e m s h o w e d t h a t t w o d i f f e r e n tr a d i i a r a v a i l a b l e ( f o r X a n d Y - r e g i s t e r s ) . T h i sk n o w l e d g e w i l l h e l p u t c o n s t r u c t a e l l i p s e .T h e f i n a l l i s t i n g i t h i s s e c t i o n w i l l d r a w a e l l i p s e ; i y o u w a n t c i r c l e i n s t e a d , j u s t m a k e t h e t w o r a d i u s i n p u t se q u a l .1 0 R E M = = = = 1 5 2 0 S E T U P = = = = = = = = = = = = = = = = = ^1 1 O P E N 1 , 6 , 11 2 0 P E N 5 , 6 , 51 3 P R I N T # 1 , " i r ; 2 4 0 ; 01 4 P R I N T * 1 , " 1 "1 5 R E M = = = = I N P U T = = = = = = = = = = = = = = = = = = = = = = =1 6 P R I N T " s J R A D I U S M A C < ■ 1 7 P R I N T " ' Q R A D I U S M A C t 1 8 P R I N T " Q J R E S O L U T I O N . 0 . 1 1 9 I N P U T ' O R A D I U S « • " ; A 2 0 I N P U T - Q F A D I U S ^ " s ; A l $2 1 I N P U T " Q R E S O S U T I O N " ; B $2 2 0 A = U A L f . A $ D i A = A B S C A D2 3 R E M = = = = I N P U T = = = = = = = = = = = = = = = = = = = = = =2 4 A l = U A L C A l $ D i A l = A B S C A l D2 5 B = U A L C B $ D : B = A B S C B D2 6 I F A > 4 T H E N 1 6 02 7 I F A 1 > 8 T H E N 1 6 02 8 I F B > . 1 O R B < . Q 1 T H E N 1 6 02 9 A = A ^ 5 03 0 A 1 = A 1 * 5 0

2 9

Page 297: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 297/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

3 1 R E M = = = = D R A W E L L I P S E = = = = = = = = =3 2 F O R X = - 1 . 6 T 0 4 . 8 S T E P B3 3 Y = A * C O S C X : )3 4 Z = A 1 * S I N C X 33 5 I F X = - 1 . 6 T H E N P R I N T * 1 , " R " ; Y ; Z3 6 P R I N T * 1 , " J " ; y ; Z3 7 N E X T3 8 R E M = = = = R A D I I = = = = = = = = = = = = = = = =3 9 P R I N T # 5 , 54 0 P R I N T t t l , " R M ; 0 i ; 04 1 P R I N T t t l , " J " ; f \ ; Q4 2 P R I N T f t l , " R " ; 0 ; 04 3 0 P R I N T * ! t l J I i ; 0 ; A 4 4 R E f 1 = = E N D = = = 4 5 0 P R I N T * 5 , 04 6 P R I N T < * 1 > " M l l ; 0 ; - 2 0 04 7 C L O S E 14 8 0 C L 0 S E 5R E A D Y .

I a n p r o b l e m s a r i s e w i t h t h i s p r o g r a m , i i s u g g e s t e dt h a t y o r e r e a d t h t h e o r y o c o n s t r u c t i n g c i r c l e .N o w , w e ' l l p u p a s t t h e o r i e s i n t o p r a c t i c e a n d r a w t w s p a t i a l o b j e c t s c o m b i n i n g c u r v e s a n d s t r a i g h t l i n e s : t h ec y l i n d e r a n d t h e c o n e . B o t h o b j e c t s w i l l b e d r a w n i p e r p e c t i v e .

c y l i n d e r i m a d e u p o f t w o p a r a l l e l e l l i p s e s c o n n e c t e d b yt w p a r a l l e l l i n e s . T h t w e l l i p s e s a r p l o t t e d o n e - h a l fa t i m e ( - 3 . 2 t 0 t h e n t o 3 . 2 ) .

2 9

Page 298: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 298/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

1 0 R E M = = = = 1 5 2 0 S E T U P = = = = = = = = = = = = = = = = = =1 1 O P E N 1 , 6 , 11 2 O P E N 5 , 6 , 51 3 P R I N T # l , " M " ; 2 4 0 ; 01 4 0 P R I N T # l , f t I "1 5 R E M = = = = —

E L L I P S E = = = = = = = = = = = = = = = =1 6 F O R X = - 3 . 2 T O 3 . 2 S T E P . 0 41 7 Y = 1 2 0 * C O S ( X )1 8 Z = 3 0 * S I N ( X )1 9 I F X = - 3 . 2 T H E N P R I N T # 1 , " R " , Y , Z2 0 I F B N = 1 T H E N V = V + 12 1 I F V = 8 0 T H E N P R I N T # 5 , 52 2 P R I N T # l , f f J f f ; Y ; Z2 3 0 N E X T2 4 I F B N = 1 T H E N 3 2 O2 5 R E M = = = = S E T U P 2 N E L L I P S E = = = = = = = = = = =2 6 P R I N T # l , " J " ; - 1 2 0 ; - 3 0 02 7 P R I N T # l , f t R " ; 0 ; - 3 0 02 8 P R I N T # 1 , " I "2 9 B N = 13 0 G O T O 1 6 03 1 R E M = = = = D R A W H E I G H T = = = = = = = = = = = = = = = = =3 2 P R I N T # l , t t R l t ; 1 2 0 ; 03 3 P R I N T # 5 , 03 4 P R I N T # l , " J " j l 2 0 ; 3 0 03 5 P R I N T # l , " R " ; 0 ; 3 0 03 6 P R I N T # 5 , 53 7 P R I N T # l , f t J f t ; 0 ; 03 8 R E M = = = = E N D = = = = = = = = = = = = = = = = = = = = = = = = =3 9 P R I N T # 5 , 04 0 P R I N T # l , " R " ; - 2 4 0 ; - 1 0 04 1 C L O S E 14 2 C L O S E 5R E A D Y .

T h p r o g r a m b e g i n s w i t h t h u p p e r e l l i p s e ( f r o m l i n e 1 6 0 ) .T h f a c t o r f o r t h e r a d i u s l i e s i 1 2 f o t h X - r e g i s t e r( l i n e 1 7 0 ) , a n i 3 f o r t h e Y - r e g i s t e r ( l i n e 1 8 0 ) .R e m e m b e r t h a t a n a l t e r a t i o n s w i l l h a v e t e n c o m p a s s b o t ht h e s e v a l u e s .

2 9

Page 299: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 299/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

L i n e s 2 6 t 3 0 d r a w t h s e c o n d e l l i p s e ; s h i f t o c c u r s i t h r e l a t i v e n u l l - p o i n t , a n w r e t u r n t t h e l l i p s er o u t i n e i l i n e 1 5 0 , w i t h t h u p p e r h a l f o e l l i p s e d r a w na d o t t e d l i n e ( l i n e 2 1 0 ) . T h r e m a i n d e r o t h c y l i n d e ri d r a w i l n e s 3 2 0 - 3 7 0 .

T h p r o c e d u r e f o p l o t t i n g c o n e i s o m e w h a t e a s i e r , s i n c eo n l y o n e l l i p s e i n e e d e d t g i v e u o u p e r s p e c t i v ed r a w i n g .

1 0 R E M = = = = 1 5 2 0 S E T U P = = = = = = = = = = =1 1 O P E N 1 , 6 , 11 2 O P E N 5 , 6 , 51 3 P R I N T # l , " M " ; 2 4 0 ; 01 4 P R I N T # l , " I t f1 5 R E M = = = = D R A W E L L I P S E = = = = = = = = =1 6 F O R X = - 3 . 2 T O 3 . 2 S T E P . 0 41 7 Y = 1 2 0 * C O S ( X )1 8 Z = 3 0 * S I N ( X )1 9 I F X = - 3 . 2 T H E N P R I N T # 1 , " R " , Y , Z2 0 V = V + 12 1 I F V = 8 0 T H E N P R I N T # 5 , 52 2 P R I N T # l , " J t f ; Y ; Z2 3 N E X T2 4 R E M = = = = D R A W2 5 P R I N T # 1 , M J "2 6 P R I N T # 1 , " J "2 7 P R I N T # 5 , 02 8 P R I N T # 1 , " J "2 9 P R I N T # 1 , " R "3 0 P R I N T # 1 , " J "3 2 P R I N T # 1 , " M "3 3 C L O S E 13 4 C L O S E 5R E A D Y .

C O N E = = =0 ; 0 ; 2 0 0

- 1 2 0 ; 01 2 0 ; 00 ; 2 0 0

3 1 R E M = = = = E N D = = = = = = = = = = = = = = = = = = = = = = = = =0 ; - 1 0 0

2 9

Page 300: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 300/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

T h e l l i p s e s u b r o u t i n e ( l i n e s 1 6 0 - 2 2 0 ) n e e d s n e x p l a n a t i o nh e r e , s i n c e i t ' s n e a r l y i d e n t i c a l t t h c y l i n d e r r o u t i n e .N o o n l y t h a t , t h h e i g h t a n s i d e s o t h c o n e i t s e l f a r q u i t e s i m i l a r t t h t r i a n g l e r o u t i n e s s e e n e a r l i e r .

8 . 3 . 6 T r i a n g l e

T c o n c l u d e t h i s s e c t i o n o g e o m e t r i c f i g u r e s , w e s h o u l dg i v e y o u s o m e m a t e r i a l s f o p l o t t i n g t h r i g h t t r i a n g l e w i t hd i f f e r e n t s i d e l e n g t h s . W r e a l l y c o u l d n ' t g i v e y o t h i sb e f o r e n o w , b e c a u s e s o m e k n o w l e d g e o c i r c l e c o n s t r u c t i o n i n e e d e d t p r o d u c e t h i s l a s t f i g u r e .

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

t

A l g o r i t h m

1 S t a r t i n g p o i n t d e f i n e d2 H a l f - c i r c l e d r a w n , a n s t a r t i n g p o i n t o t r i a n g l e d r a w n3 h a l f - c i r c l e e n d e d4 b a s e d r a w n

2 9

Page 301: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 301/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

1 0 R E M = = = = 1 5 2 0 S E T U P = = = = = = = = = = = = = = = = = =1 1 O P E N 1 , 6 , 11 2 O P E N 5 , 6 , 51 3 P R I N T # l , " M " ; 2 4 0 ; 01 4 P R I N T # l , " I l f : E = 5 01 5 R E M = = = = D R A W S E M I C I R C L E = = = = = = = = = = = = =1 6 F O R X = 0 T O 3 . 2 S T E P . 0 41 7 Y = 1 2 0 * C O S ( X )1 8 Z = 1 2 0 * S I N ( X )1 9 I F X = O T H E N P R I N T # 1 , " R " , Y , Z2 0 V = V + 12 1 I F V = E T H E N P R I N T # l , M J " ; 1 2 0 ; 02 2 I F E T H E N P R I N T # l , l f R f f ; Y - . O 4 ; Z - . O 42 3 I F V = E T H E N P R I N T # 1 , " J " ; - 1 2 0 ; 02 4 P R I N T # 1 , " J " ; Y ; Z2 5 N E X T2 6 R E M = = = = B A S E = = = = = = = = = = = = = = = = = = = = = = = =2 7 P R I N T # 1 , " R " ; 1 2 0 ; 02 8 P R I N T # l , " J f l ; - 1 2 0 ; 02 9 R E M = = = = E N D = = = = = = = = = = = = = = = = = = = = = = = = =3 0 P R I N T # l , " M " ; 0 ; - 1 0 03 1 C L 0 S E 13 2 C L O S E 5R E A D Y .

L i n e 1 4 d e f i n e s t h s t a r t i n g p o i n t o t h h a l f - c i r c l e ( l i n e1 4 0 ; E = 5 0 ) ; t h e t r i a n g l e s t a r t i a l s o t a k e n f r o m h e r e . T h a r i s c r i b e d i 8 s m a l l s e c t i o n s ( 3 . 2 / 0 . 0 4 = 8 0 ) . L i n e 2 0 i n c r e m e n t s v a r i a b l e b o n e , s t h a t w i l l e q u a l 5 w h e nt i m e c o m e s t d r a w t h e t r i a n g l e . O n c e t h e j u m p p o i n t i r e a c h e d ( l i n e s 2 1 0 - 2 3 0 ) , t h c o r n e r o b a s e A i s e t - u p a n

r i g h t a n g l e p l a c e d i p o i n t C

T h b a s e i d r a w n , a n t h r o u t i n e e n d s . T r a n v a l u eb e t w e e n a n 8 9 a n w a t c h w h a t t y p e s o t r i a n g l e s y o g e t .

T h a b o v e m e n t i o n e d g e o m e t r i c f i g u r e s a r e j u s t e x a m p l e s o w h a t c a b d o n e i t e r m s o p r o g r a m d e s i g n a n p r o b l e m -s o l v i n g . I t h e r e ' s f i g u r e y o w i s h t s e p l o t t e d , w e ' v e

2 9

Page 302: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 302/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

g i v e n y o t h f u n d a m e n t a l s i t ' s u p t y o t l o o k u p t h m a t h e m a t i c a l f a c t o r s i n v o l v e d , a n d d e s i g n y o u r o w p l o t t e rr o u t i n e . H e r e a r e f e s u g g e s t i o n s :

a p r i s m sb p y r a m i d s t r u n c a t e d c o n e sc b a l l o s p h e r e i p e r s p e c t i v ed e l l i p s o i d

A l y o u n e e d t d e s i g n o n o t h e s e f i g u r e s i c o n t a i n e d i t h e l a s t f e w p a g e s : I m a b h a r d w o r k i t h d e s i g ns t a g e s , b u t h p l o t t e r C A d r a w t h e s e a n m o r e .

2 9

Page 303: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 303/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

8 . R e p r e s e n t a t i o n s o F u n c t i o n s

T h t e r m " f u n c t i o n g r a p h " i n o r m a l l y a s s o c i a t e d w i t h t h S I N E , C O S I N E a n X - f u n c t i o n s . W e ' v e a l r e a d y d e s c r i b e d t h l a t t e r t s o m e e x t e n t ( s e e t h e d i s c u s s i o n o c u r v e s i t h p r e v i o u s s e c t i o n ) . O n e r a n g e o i n t e r e s t h e r e i t h r a n g eo t X o f t e n f o u n d i m a t h p r o b l e m s .

O t t h o p e r a t i o n o f u n c t i o n s . G r a p h s a r n o r m a l l y d r a w ni s y s t e m o c o o r d i n a t e s , i t h i s c a s e , t h X a n Y - a x e s .T h e s e a x e s a r e o f t e n d i v i d e d i n t o f o u r q u a d r a n t s ( p a r t i a lr a n g e s ) , w h i c h a r n u m b e r e d c l o c k w i s e h e r e , b e g i n n i n g w i t ht h n e g a t i v e X - a x i s .

Q U A D R A N T

Q U A D R A N T 4

Q U A D R A N T

Q U A D R A N T

A l r e f e r e n c e s i t h i s s e c t i o n w i l l u s e t h i s i l l u s t r a t i o n a g u i d e . N o w , t h e r e a r d i f f e r e n t t y p e s o c o o r d i n a t e

s y s t e m s t c h o o s e f r o m i p l o t t i n g g r a p h s ; t h e d i v i d i n gc r o s s h e r e i n o a l w a y s n e c e s s a r y . F o e x a m p l e , i y o w e r e d r a w i n g p a r a b o l a , t h X - r e g i s t e r w o u l d n o h a v e m u c hi m p o r t a n c e - - a t l e a s t , n o t s m u c h i m p o r t a n c e a t h p o s i t i v e Y - a x i s i t h i s f i g u r e .

2 9

Page 304: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 304/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

s i n e o c o s i n e a l m o s t a l w a y s m o v e s i t h p o s i t i v e X - a x i s ,a n b o t h s i d e s o f t h e Y - a x i s .

T h i s f u n c t i o n w o u l d g i v e y o u h o r i z o n t a l l i n e , w i t hs e c o n d l i n e i n t e r s e c t i n g t h n u l l p o i n t , r e s u l t i n g i 4 5 d e g r e e a n g l e . Y = w o u l d p u t h h o r i z o n t a l l i n e i Q u a d r a n t2 a n t h i n t e r s e c t i n g l i n e i Q u a d r a n t 4 T h i s p r o g r a mc a b a l t e r e d a n t h a n g l e s t u r n e d t y o u r o w n t a s t e s :

1 0 R E M = = = = 1 5 2 0 S E T U P = = = = = = = = = = = = = = =1 1 O P E N 4 , 61 2 O P E N 1 , 6 , 11 3 O P E N 2 , 6 , 21 4 R E M = = = = C O O R D I N A T E S Y S T E M = = = = = = = =1 5 F O R A = 1 T O 61 6 R E A D X $ , Y , Z1 7 P R I N T # 1 , X $ ; Y ; Z1 8 N E X T1 9 D A T A M , 0 , 0 , D , 4 8 0 , 0 , M , 2 4 0 , 2 4 02 0 D A T A D , 2 4 0 , - 2 4 0 , M , 2 4 0 , 0 , 1 , 0 , 02 1 R E M = = = = D E F I N I T I O N O F U N C T I O N = = =2 2 D E F F N A ( X ) = X2 3 R E M = = = = D R A W = = = = = = = = = = = = = = = = = = = = =2 4 F O R A = 2 0 0 T O - 2 0 0 S T E P - 12 5 I F A = 2 0 0 T H E N P R I N T # l , " R " ; A ; F N A ( A )2 6 P R I N T # 1 , " J M ; A ; F N A ( A )2 7 N E X T2 8 P R I N T # l , f t M t f ; 0 ; 02 9 R E M = = = = E N D = = = = = = = = = = = = = = = = = = = = = =3 0 C L O S E 13 1 C L O S E 23 2 C L 0 S E 4R E A D Y .

H e r e ' s a a n a l y s i s o t h i s r o u t i n e , s h o w i n g y o t h e X n -f u n c t i o n .

2 9

Page 305: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 305/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h C O M M O D O R E 6

1 5 0 - 1 8 0 D a t a f o r t h e c o o r d i n a t e d i v i s i o n i r e a d i a n d r a w n .

1 9 0 - 2 0 0 D a t a f o r t h e c o o r d i n a t e s y s t e m2 2 T h C - 6 4 h a s t h e a b i l i t y t d e f i n e f u n c t i o n s

( D E F ) w i t h i n p r o g r a m s . Y o c a d e f i n e f u n c t i o n si l a t e r d e v e l o p m e n t s o f t h i s p r o g r a m b a d d i n gP R I N T F N ( n u m b e r ) , e t c . , w i t h ( n u m b e r ) r e f e r r i n gt t h p r e v i o u s l y - d e f i n e d f u n c t i o n . I y o u d o n ' td e f i n e t h f u n c t i o n , y o m u s t k e e p s p e c i f y i n g t h f u n c t i o n t h r o u g h o u t t h p r o g r a m .

2 4 T h i s l i n e s p e c i f i e s l i m i t t o u r a n g e o m o v e m e n t f o r t h e f u n c t i o n . T h e 1 5 2 0 ' s m a x i m u mf o r t h e X - a x i s i 4 8 0 , s o w g a v e t h p r o g r a m a 2 0 - b y - + 2 0 0 r a n g e f o b o t h X a n Y - r e g i s t e r s ,a n s t i l l h a v e s o m e " r o o m " r e m a i n i n g .

2 6 T h v a l u e c a l c u l a t e d b t h Y - v a l u e i d r a w nh e r e , i c o n j u n t c i o n w i t h t h X - v a l u e ( Y = X ) .

N o w , l e t ' s e x p e r i m e n t w i t h t h i s p r o g r a m , a n d m a k e s o m ec h a n g e s . T r y t h i s : C h a n g e l i n e 2 4 f r o m " 2 0 0 T O - 2 0 0 " t " 1 0 0 T O - 1 0 0 " ; c h a n g e l i n e 2 5 0 t " F O R A = 1 G O . . . " t m a t c h ;m u l t i p l y ( l i n e s 2 5 0 / 2 6 0 ) b 2 F i n a l l y , c h a n g e l i n e 2 6 t r e a d 2 6 P R I N T # 1 , " J " ; 2 - A ; F N A ( A ) . C h a n g e l i n e 2 5 t m a t c h .

W h e n y o s t a r t t h i s v e r s i o n o t h p r o g r a m , y o u ' l l n o t e t h a tt h a n g l e i d e c r e a s e d c o n s i d e r a b l y . Y o u c a e x e r c i s e l o m o r e c o n t r o l b y a d d i n g t h e q u a t i o n Y = m x + b . m r e p r e s e n t st h e a n g l e , i t h n u l l p o i n t m a r k e r ( 0 / 0 ) a c r o s s t h Y a x i s .

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

2 9

Page 306: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 306/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

p r o g r a m . T h m o s t e l e g a n t m e t h o d i t m u l t i p l y F N ( A b c o n s t a n t , d i m i n i s h i n g t h r a i s e d e x p o n e n t o t h f u n c t i o n ,

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

T h e r e i a n o t h e r i t e m t h a t w s h o u l d c o n s i d e r : T h c o m p a r i s o n o f u n c t i o n s f r o m x x Y o c a n s e ei m m e d i a t e l y t h p r i n c i p l e b e h i n d t h e s e . I w h a v e t h f u n c t i o n Y = X , a n d h a v e X = 1 0 0 , t h r e s u l t w i l l b 1 0 0 . W u s e d t h i s w h e n c o n s i d e r i n g t h s t a r t i n g p o i n t . I f i t h a b o v e f u n c t i o n , w e r e a c h e d t h m a x i m u m o 1 0 0 , t h p l o t t e rw o u l d o n l y d r a w u t 1 0 0 , a n r e m a i n t h e r e h o w e v e r m a n ys t e p s a b o v e 1 0 t h c o u n t e r g o e s . A n a n s w e r t t h i s p r o b l e ml i e s i t h a b i l i t y t c h a n g e n u l l p o i n t s i t h X - r e g i s t e r( 0 - 4 8 0 ) . H o w e v e r , w w o u l d r a i s e t h f u n c t i o n i e x p o n e n t so o n e , g i v i n g u t h f u n c t i o n Y = X 2 . I w r e a c h 1 0 0 , t h r e s u l t f o w i l l a l r e a d y b 1 0 0 2 1 0 , 0 0 0 ; s o t h r e s u l to o u i n c r e a s e i t h e r e f o r e 1 0 t i m e s g r e a t e r .

T h i s i c o n f i r m e d i t h f u n c t i o n s Y = X 3 a n Y = X 4 .

T h p r o p o r t i o n a l i t y f a c t o r i e a s i e r t f i n d f o n o n - i n t e g e re x p o n e n t s , u s i n g c o m m o n f o r m u l a . T h e r e i o n f a c t o r t h a ts h o u l d r e m a i n c o n s t a n t ; t h e x p o n e n t i a t i o n o a n s h o u l db i d e n t i c a l ( e x p o n e n t i a t i o n i u s e d f o v a l u e r a n g e s l a r g e rt h a n 1 0 0 ) , u s i n g F N A ( A ) a r e f e r e n c e . W h e n w o r k i n g w i t hp a r a b o l a s , t h n o t a t i o n X s h o u l d b a c c o m p a n i e d b m u l t i p l i e d b . 0 1 . I n t h i s c a s e , w i t h v a l u e g r e a t e r t h a n1 0 0 , 1 0 1 0 0 . 0 1 g i v e s t h p r o p e r r e s u l t . X g i v e sp r o p o r t i o n a l i t y f a c t o r o . 0 0 0 1 .

N o w , y o u ' l l n e e d t h f o r m u l a f o c o m p u t i n g t h c o n s t a n t C X n = Y , w i t h e q u a l l i n g a n y n u m b e r .

3 0

Page 307: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 307/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

Y o a r n o l i m i t e d t n a t u r a l n u m b e r s i y o u r a p p l i c a t i o n sr a t i o n a l n u m b e r s , e t c . , a r p o s s i b l e . W h e n t r y i n g t

d e c i d e u p o n a e x p o n e n t f o F N ( A ) , u s e t h i s e x p r e s s i o n :

C = l / 1 0 0 ( n " 1 )

E x a m p l e : Y o w a n t t g r a p h i c a l l y d e p i c t t h f u n c t i o n X 6 S e t t i n g i n t o n y o g e

C = l / 1 0 0 ( 6 " 1 )

a n t h r e s u l t i 1 O " 1 0 .

T h i s v a l u e o i p u i n t o t h f u n c t i o n Y = X 6 , w i t he q u a l l i n g 1 0 0 .

T h n e x t t h r e e r o u t i n e s t u r n t h e s e t h e o r i e s i n t o p r a c t i c e ,u s i n g X 2 , X 3 , a n X 4

T h l i s t i n g s a r f a i r l y s h o r t t h e l p g i v e y o u s o l i du n d e r s t a n d i n g o f t h e e q u a t i o n s , f o l l o w e d b t h d o c u m e n t a t i o n .

1 0 R E M = = = = 1 5 2 0 S E T U P = = = = = = = = = = = = = = = = = =1 1 O P E N 1 , 6 , 11 2 R E M = = = = C O O R D I N A T E S Y S T E M = = = = = = = = = = =1 3 F O R A = 1 T O 61 4 R E A D X $ , Y , Z1 5 P R I N T # 1 , X $ ; Y ; Z1 6 N E X T1 7 D A T A M , 0 , 0 , D , 4 8 0 , 0 , M , 2 4 0 , 2 4 01 8 D A T A D , 2 4 0 , - 2 0 , M , 2 4 0 , 0 , I , 0 , 01 9 R E M = = = = D E F I N I T I O N O F U N C T I O N = = = = = =2 0 D E F F N A ( X ) = X " 22 1 C = . O 22 2 R E M = = = = D R A W = = = = = = = = = = = = = = = = = = = = = = = =2 3 F O R A = 1 0 Q T O - 1 0 0 S T E P - 12 4 I F A = 1 0 0 T H E N P R I N T # l , " R " ; A ; C * F N A ( A )2 5 P R I N T # 1 , " J " ; A ; C * F N A ( A )

3 0

Page 308: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 308/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

2 6 N E X T2 7 P R I N T # l , " M M j O ; O2 8 R E M = = = = E N D = = = = = = = = = = = = = = = = = = = = = = = = =2 9 C L O S E 1

1 0 R E M = = = = 1 5 2 0 S E T U P = = = = = = = = = = = = = = = = = =1 1 O P E N 1 , 6 , 11 2 R E M = = = = C O O R D I N A T E S Y S T E M = = = = = = = = = = =1 3 F O R A = 1 T O 61 4 R E A D X $ , Y , Z1 5 P R I N T # 1 , X $ ; Y ; Z1 6 N E X T1 7 D A T A M , 0 , 0 , D , 4 8 0 , 0 , M , 2 4 0 , 2 4 01 8 D A T A D , 2 4 0 , - 2 4 0 , M , 2 4 0 , 0 , 1 , 0 , 01 9 R E M = = = = D E F I N I T I O N O F U N C T I O N = = = = = =2 0 D E F F N A ( X ) = X ~ 32 1 C = . 0 0 0 22 2 R B M = = = = D R A W = = = = = = = = = = = = = = = = = = = = = = = =2 3 F O R A = 1 0 0 T O - 1 0 0 S T E P - 12 4 I F A = 1 0 0 T H E N P R I N T # l , " R " ; A ; C * F N A ( A )2 5 P R I N T # l , n J " ; A ; C * F N A ( A )2 6 N E X T2 7 P R I N T # l , f l M t f ; 0 ; 02 8 R E M = = = = E N D = = = = = = = = = = = = = = = = = = = = = = = = =2 9 C L 0 S E 1

1 0 R E M = = = = 1 5 2 0 S E T U P = = = = = = = = = = = = = = = = = =1 1 O P E N 1 , 6 , 11 2 R E M = = = = C O O R D I N A T E S Y S T E M = = = = = = = = = = =1 3 F O R A = 1 T O 61 4 R E A D X $ , Y , Z1 5 P R I N T # 1 , X $ ; Y ; Z1 6 N E X T1 7 D A T A M , 0 , 0 , D , 4 8 0 , 0 , M , 2 4 0 , 2 4 01 8 D A T A D , 2 4 0 , - 2 0 , M , 2 4 0 , 0 , 1 , 0 , 01 9 R E M = = = = D E F I N I T I O N O F U N C T I O N = = = = = =

3 0

Page 309: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 309/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

2 0 D E F F N A ( X ) = X ~ 42 1 C = . 0 0 0 0 0 22 2 R E M = = = = D R A W = = = = = = = = = = = = = = = = = = = = = = = =2 3 F O R A = 1 0 0 T O - 1 0 0 S T E P - 12 4 I F A = 1 0 0 T H E N P R I N T # l , f f R M A C * F N A ( A )2 5 P R I N T # 1 , " J " ; A ; C * F N A ( A )2 6 N E X T2 7 P R I N T # l , " M " ; 0 ; 02 8 R E M = = = = E N D = = = = = = = = = = = = = = = = = = = = = = = = =2 9 C L 0 S E 1

A y o c a p l a i n l y s e e , t h e s e t h r e e p r o g r a m s a r a l m o s ti d e n t i c a l , w i t h t h e x c e p t i o n o t h r e e l i n e s . L i n e 1 8 0 :T h i s l i n e c o n t a i n s t h D A T A f o t h c o o r d i n a t e s y s t e m . T h X f u n c t i o n w o n l y n e e d f o r t h e u p p e r s e c t i o n o f t h ec o o r d i n a t e c r o s s .

T h s e c o n d p r o g r a m b r i n g s X i n t o p l a y , g i v i n g u u n e v e nq u a d r a n t s a b o v e a n b e l o w t h X - a x i s , w h i l e X a f f e c t sq u a d r a n t s a n 2 T h X f u n c t i o n i l i n e 1 8 c h a n g e s l i n e1 8 t

1 8 D A T A D , 2 4 0 , - 2 4 0

( N O T E : T h n e g a t i v e n u m b e r i t h D A T A l i n e g i v e s t h l e n g t ho t h n e g a t i v e - Y - a x i s ) .

L i n e 2 0 0 : T h i s l i n e d e f i n e s t h r e s p e c t i v e f u n c t i o n t b p e r f o r m e d , a n l i n e 2 1 0 f i x e s t h p r o p o r t i o n a l i t y f a c t o r t b u s e d i t h f o r m u l a , m u l t i p l i e d b t h v a l u e r a n g e .

F u n c t i o n F a c t o r

x 0 . 0 2x 0 . 0 0 0 2x 0 . 0 0 0 0 0 2

3 0

Page 310: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 310/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

I o r d e r t a p p l y t h f o r m u l a f o i t h p r o g r a m , h o w e v e r ,h e r e i s h o r t r o u t i n e w h i c h u t i l i z e s t h n a t u r a l n u m b e r sf r o m 0 - 1 1 , w h i c h y o i n s e r t a e x p o n e n t s i t h f o r m u l aa n t h f u n c t i o n . O n c e t h c o o r d i n a t e c r o s s i d r a w n , t h ee x p o n e n t w i l l b e p r o m p t e d , c a l c u l a t e d , a n d t h e g r a p hp r i n t e d o u t .

1 0 R E M = = = = 1 5 2 0 S E T U P = = = = = = = = = = = = = = = = = =1 1 0 P E N 1 , 6 , 11 2 R E N = = = = C O O R D I N A T E S Y S T E M = = = = = = = = = = =1 3 F O R A = 1 T O 61 4 R E A D X * , Y , Z1 5 P R I N T s l , X $ ; Y ; Z1 6 N E X T1 7 D A T A N , 0 , 0 , 0 , 4 8 0 , 0 , ( 1 , 2 4 0 , 2 4 01 3 D A T A D , 2 4 0 , - 2 4 0 , I I , 2 4 0 , 0 , 1 , 0 , 01 9 R E M = = = = D E F I N I T I O N O F U N C T I O N = = = = = =2 0 I N P U T " s _ T O W H A T P O W E R C X t ? 3 " ; N $2 1 N = U A L C N $ 3 : N = A B S C N 32 2 I F N M 1 T H E N 2 0 02 3 F O R P = N T O 0 S T E P - 12 4 I F P = 0 T H E N 2 7 02 5 0 N E X T2 6 G O T O 2 0 02 7 D E F F N A C X 3 = X t N2 8 C = 2 / 1 0 0 t C N - l 32 9 R E M = = = = D R A U = = = = = = = = = = = = = = = = = = = = = = = =3 0 F O R A = 1 0 0 T O - 1 0 0 S T E P - 13 1 I F 1 0 0 T H E N P R I N T * 1 ' R . : A C x F N A C A3 2 0 P R I N T # 1 , 1 ' J " ; A ; C x F N A C A 33 3 N E X T3 4 P R I N T t f l , " I 1 ' . : 0 ; 03 5 R E M = = = = E N D = = = = = = = = = = = = = = = = = = = = = = = = =3 6 C L 0 S E 1R E A D Y .

T h e i n p u t r o u t i n e c a b f o u n d i l i n e s 2 0 0 - 2 5 0 . L i n e 2 2 t e s t s i n p u t f o o v e r f l o w , t a v o i d O V E R F L O W E R R O R m e s s a g e s .L i n e s 2 3 0 - 2 5 0 l i m i t t h n u m e r i c a l r a n g e a t N o . a w e l l , w i t hz e r o i n c l u d e d i t h a l l o w a b l e i n p u t r a n g e .

3 0

Page 311: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 311/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

I y o u ' v e t y p e d i c o r r e c t i n p u t , x d e f i n e s t h f u n c t i o n i l i n e 2 7 0 . T h f o r m u l a t f i g u r e t h i s c o n s t a n t i u s e d i

l i n e 2 8 0 , w i t h l i n e 3 0 i n s u r i n g t h a t t h r a n g e s t a y s w i t h i n- 1 0 0 t + 1 0 0 . I t h t w i t e m s i l i n e 2 8 0 i o n e , t h f u n c t i o n w i l l b f a i r l y l o a n d w i d e . T h e d r a w r o u t i n e sc a n b e a l t e r e d a m u c h a y o u w i s h .

B e f o r e w g o n t o s i n e a n d c o s i n e c u r v e s , t h e f o l k s w h o a r h a v i n g p r o b l e m s f o l l o w i n g w h a t h a p r e c e d e d a r b e s t a d v i s e dt r e r e a d t h s e c t i o n o a r c s . M o s t o w h a t f o l l o w s h a a l r e a d y b e e n c o v e r e d t h e r e . T h p r o g r a m t d r a w c o m p l e t es i n e - c o s i n e c u r v e s e w o u l d b i m p o s s i b l e t i n c l u d e i t h i sb o o k , s i n c e i t a k e s u 6 b l o c k s o m e m o r y ( r o u g h l y 1 5 K ) .H o w e v e r , w e c a n t a k e t h e m o r e i m p o r t a n t f a c t o r s i t h p r o g r a m ( z e r o p o i n t , m i n i m u m , m a x i m u m , a n t u r n i n g p o i n t ) a n g i v e y o s k e l e t o n v e r s i o n f o y o u r e x p e r i m e n t a t i o n .

T h i s p r o g r a m u s e s f u n c t i o n s w i t h w h o l e e x p o n e n t s d r a w n f r o mY = X 5 .

q u i c k r e v i e w o d e r i v a t i o n :

T h v a r i a b l e w i t h t h s p e c i f i c e x p o n e n t ( e . g . , X 4 w i l ld e v i a t e f r o m t h v a r i a b l e m u l t i p l i e d b t h e x p o n e n t , a n t h o l e x p o n e n t d e c r e m e n t e d b ( 4 * X 3 ) .

I o t h e r w o r d s , X i d e r i v e d f r o m

T h e n t i r e p r o c e d u r e i r e c i p r o c a l i y o u h a v e t h f u n c t i o nd e s c r i p t i o n , b u n o t h e t r u n k f u n c t i o n . F o e x a m p l e , l e t ' ss a t h f i r s t e q u a t i o n i 3 * X 2 . Y o c a a s c e r t a i n t h s e c o n d e q u a t i o n , b u y o u ' r e s t i l l m i s s i n g t h b a s i cf u n c t i o n .

3 0

Page 312: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 312/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

3 * X 2 i w h a t w e h a v e o h a n d . N o w , w c a r a i s e t h e x p o n e n t b y o

3 * X < 2 + 1 >

a n m u l t i p l y t h a t b t h r e c i p r o c a l o t h e x p o n e n t

w h i c h g i v e s u X 3 w h i c h i t h m a i n f u n c t i o n i c o n c e r tw i t h 3 * X 2 .

1 0 R E M = = = = I N P U T = = = = = = = = = = = = = = = 1 1 I N P U T & E N T E R F U N C T I O N " ; X $1 2 R E M = = = = F U N C T I O N S E T U P = = = = = = = = = = = = = =1 3 F O R X = 1 T O L E N C X $ D1 4 Y $ = M I D $ C X * , X , 1 D1 5 Y = U A L C Y $ 31 6 I F Y $ = " " T H E N N E X T1 7 I F Y $ " X " 1 T H E N E = E + 11 8 I F Y * = ' > " T H E N N E X T1 9 I F E = 1 A N D Y > 0 T H E N A = Y2 0 I F E < 1 A N D Y > 0 T H E N B = Y2 1 I F Y $ " - 1 ' T H E N 1 1 02 2 N E X T2 3 R E H = = = = D E R I U E = = = = = = = = = = = = = = = = = = = = = =2 4 P R I N T Q J S T D R I U A T I U E " ; * x B ; " ' x X f " ; A - 2 5 C = A x B * C A - l 32 6 P R I N T Q 2 N D D E R I U A T I U E 1 1 ; C ' x X t " ; f \ - 2

R E A D Y .

T h i s p r o g r a m s e r v e s t g i v e y o g o o d e x a m p l e o w h a t w e ' v eb e e n t a l k i n g a b o u t . Y o c a o n l y t r s m a l l f u n c t i o n s ,t h o u g h , s u c h a 9 * X 7 , e t c . , b u t h f i r s t a n s e c o n dd e v i a t i o n s a r p r i n t e d o u t .

N o f o t h m a t e r i a l p r o m i s e d a b o v e ; t h s i n e a n d c o s i n ef u n c t i o n s . T h e s e f u n c t i o n s a r i C - 6 4 B A S I C , s s h o r tr o u t i n e i a l w n e e d f o r t h e f u n d a m e n t a l m a t e r i a l s .

3 0

Page 313: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 313/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

1 0 R E M = = = = 1 5 2 0 S E T U P = = = = = = = = = = = = = = = = = =1 1 O P E N 1 , 6 , 11 2 O P E N 2 , 6 , 21 3 P R I N T # 2 , 01 4 R E M = = = = C O O R D I N A T E S Y S T E M = = = = = = = = = = =1 5 P R I N T # l , " D f f ; 4 0 0 ; 01 6 P R I N T # l , t f M f l ; 1 0 ; 1 0 01 7 P R I N T # l , " D " ; 1 0 ; - 1 0 01 8 P R I N T # l , " M " ; 1 0 ; 01 9 P R I N T # l , t f I t f2 0 R E M = = = = F U N C T I O N = = = = = = = = = = = = = = = = = = = =2 1 D E F F N A ( X ) = S I N ( X )2 2 R E M = = = = C A L C U L A T E / P L O T = = = = = = = = = = = = = =2 3 F O R X = 0 T O 3 2 02 4 P R I N T # l , " J " ; X ; F N A ( X / 5 1 ) * 9 02 5 N E X T2 6 R E M = = = = E N D = = = = = = = = = = = = = = = = = = = = = = = = =2 7 P R I N T # l , " R " ; 0 ; 02 8 C L O S E 12 9 C L O S E 2

L i n e 2 1 d e f i n e s t h s i n e f u n c t i o n ; y o c a i n s e r t t h c o s i n e w i t h o u t t o m u c h t r o u b l e . A a d d e d s i z e f a c t o r ( l i n e2 4 0 ) l e t s y o s t r e t c h t h e h e i g h t . O n c e y o u ' v e a d d e d t h c o s i n e r o u t i n e a n r u t h p r o g r a m , t h r e s u l t s h o u l d b e

3 0

Page 314: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 314/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

T h s i n e i d r a w n f r o m t h p o i n t o o r i g i n , w i t h t h c o s i n ep h a s i n g a 9 d e g r e e s . T h c o m p l e t e r o u t i n e l o o k s l i k et h i s :

1 0 R E M = = = = 1 5 2 0 S E T U P = = = = = = = = = = = = = = = = = =1 1 O P E N 1 , 6 , 11 2 O P E N 2 , 6 , 21 3 P R I N T # 2 , 01 4 R E M = = = = C O O R D I N A T E S Y S T E M = = = = = = = = = = =1 5 P R I N T # l , " D " ; 4 0 0 ; 01 6 P R I N T # l , " M f f ; 1 0 ; 1 0 01 7 P R I N T # l , w D M ; 1 0 ; - 1 0 01 8 P R I N T # l , t f M f t ; 1 0 ; 01 9 P R I N T # l f " I "2 0 R E M = = = = F U N C T I O N = = = = = = = = = = = = = = = = = = = =2 1 D E F F N A ( X ) = S I N ( X )2 2 D E F F N B ( X ) = C O S ( X )2 3 R E M = = = = C A L C U L A T E / P L O T = = = = = = = = = = = = = =2 4 F O R X = 0 T O 3 2 0 S T E P2 5 P R I N T # l , M J " ; X ; F N A ( X / 5 1 ) * 9 02 6 P R I N T # l , " J f t ; X ; F N B ( X / 5 1 ) * 9 02 7 N E X T2 8 R E M = = = = E N D = = = = = = = = = = = = = = = = = = = = = = = = =2 9 P R I N T # l , " R " ; 0 ; 03 0 C L O S E 13 1 C L O S E 2R E A D Y .

L i n e s 2 1 a n 2 2 d e f i n e t h e s i n e a n d c o s i n e f u n c t i o n s . I y o u o n l y w a n t c r o s s h a t c h i n g , a d S T E P f a c t o r t l i n e 2 4 ( e . g . , F O R X = 0 T O 3 2 0 S T E P 4 ) .

T h e n t h e c o m p u t e d p o i n t s w i l l b e p l a c e d f a r t h e r a p a r t .T h e r e a r e o t h e r u s e s f o f u n c t i o n s , b u e l e c t r o n i c f u n c t i o n sa l o n e w o u l d f i l l a e n t i r e b o o k i t h e m s e l v e s .

3 0

Page 315: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 315/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

8 . P e c u l i a r i t i e s o t h 1 5 2 0

W e ' l l b g o i n g o t s t a t i s t i c a l f u n c t i o n s s h o r t l y . F o n o w , h o w e v e r , w e a r g o i n g t t a k e l o o k a f e c h a r a c t e r i s t i c s b u i l t i n t o t h e 1 5 2 0 p l o t t e r . A w k n o wf r o m e a r l i e r c h a p t e r s , P R I N T U S I N G i n o f e a t u r e o B A S I C2 . 0 o r m o s t C o m m o d o r e p r i n t e r s . T h 1 5 2 0 i n e x c e p t i o n ,b u P R I N T U S I N G c a b s i m u l a t e d , i . e . , p r o p e r f o r m a t t i n g o t e x t a n d / o r n u m b e r s i n c o l u m n .

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

1 0 R E M = = = = 1 5 2 0 S E T U P = = = = = = = = = = = = = = = = =1 1 O P E N 4 , 61 2 P R I N T # 41 3 R E M = = = = L E N G T H O N U M B E R A L L O W E D = = =1 4 G Z = 41 5 D Z = 31 6 A = 1 7 R E M = = = = I N P U T / S E T U P = = = = = = = = = = = = = = = =1 8 I N P U T M N U M B E R t f ; N R1 9 A = A + 12 0 N R $ = S T R $ ( N R )2 1 N N = L E N ( N R $ ) : W = 02 2 F O R X = 1 T O N N2 3 I F M I D $ ( N R $ , X , l ) = " . " T H E N 2 5 02 4 W = W + 1 : N E X T2 5 R E M = = = = P R I N T T H N U M B E R = = = = = = = = = = =2 6 P R I N T # 4 , T A B ( G Z + 1 - W ) ; N R ; :2 7 P R I N T # 4 , T A B ( ( D Z + G Z ) - ( G Z - W + N N ) + 1 ) ;2 8 I F A < 2 T H E N 1 8 02 9 P R I N T # 43 0 0 A = 03 1 G O T O 1 8 0R E A D Y .

3 0

Page 316: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 316/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

1 4 V a r i a b l e G s e t s t h e n u m b e r o w h o l e d i g i t s .1 5 S e t s t h n u m b e r o d e c i m a l p l a c e s a l l o w e d ( D Z ) . P l e a s e

r e m e m b e r t l i m i t y o u r s e l f t t h e s e t w v a r i a b l e s w h e ng i v i n g i n p u t .

2 0 0 - 2 4 0 A c t i v a t e s t h p r i n t r o u t i n e a n d l i n e s t h n u m b e r su a c c o r d i n g l y .

2 6 P r i n t s t h n u m b e r ; l i n e 2 7 0 w i l l p r e c e d e t h n e x tn u m b e r w i t h n u m b e r o s p a c e s ( T A B ) .

W h e n t h n o v e l t y o f t h i s p r o g r a m w e a r s o f f , y o c a h a l t i u s i n g R U N / S T O P - R E S T O R E o t h e r w i s e , t h p r o g r a m w i l l s i m p l yc o n t i n u e b y a s k i n g f o a n o t h e r n u m b e r . T h e n , p r e s s t h p a p e r - f e e d k e t r e t u r n t h d r u m t i t s t a r t i n g - p o i n t .T h P R I N T U S I N G p r o g r a m c a b u s e d f o r a n y n u m b e r o t h i n g s ; f o r e x a m p l e , y o c a n l i s t i t e m s i t e x t s t r i n g s ,f o l l o w e d b y p r i c e s ( l i m i t t e x t l e n g t h t o 2 5 c h a r a c t e r s ) .

T h i n p u t f o r m f o r t h i s w o u l d r e a d

P R I N T # 4 , " T E X T " ; ( d e f i n e d t e x t l e n g t h p r a c t i c a l t e x t l e n g t h )

T h P R I N T U S I N Q f u n c t i o n i n b i d e a l o t h 1 5 2 0 b e c a u s eo t h n a r r o w p a p e r u s e d ( s e e C h a p t e r 5 . 1 . 2 f o p r o g r a mf o f o r m a t t i n g o " b i g " p r i n t e r ) . T h s a m e g o e s f o r t h ep r o g r a m b e l o w , w h i c h a l l o w s y o u t u s y o u r p l o t t e r a t y p e w r i t e r o f s o r t s :

1 0 R E M = = = = 1 5 2 0 S E T U P ^ = = = = = = = = = = = = = = = = =1 1 0 P E N 4 , 61 2 R E M = = = = R E A D K E Y S = = = = = = = = = = = = = = = = = = =1 3 0 P R N ' ■ § _ : 'i 4 P O K E 1 9 3 , 01 5 W A I T 1 9 8 . 11 6 G E T X $ : P R I N T * * ; ' :1 7 I F X * " g . M T H E N 2 2 0

3 1

Page 317: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 317/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

1 8 R E M = = = = P R I N T C H A R = = = = = = = = = = = = = = = = = =1 9 P R I N T * 4 , X $ ; :2 0 G O T O 1 4 02 1 R E M = = = = E N D = = = = = = = = = = = = = = = = = = = = = = = = =2 2 C L 0 S E 4R E A D Y .

T h i n p u t g o e s t t h k e y b o a r d b u f f e r , a n i p l a c e d i $ 0 0 C 6 ( 1 9 8 d e c i m a l ) .

1 4 C l e a r s a n b u f f e r c o n t e n t s , w r i t i n g t t h m e m o r yc e l l .

1 5 K e e p s t h p r o g r a m a s t a n d s t i l l u n t i l c h a r a c t e r i f e i n t o l o c a t i o n 1 9 8 . T h W A I T 1 9 8 , 3 m e a n s t h a t t h es y s t e m w i l l w a i t u n t i l t h r e e c h a r a c t e r s r e a c h t h b u f f e r b e f o r e g o i n g o n T h c o r r e s p o n d i n g c h a r a c t e r i r e a d b G E a n p r i n t e d o u i l i n e 1 9 0 .

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

D i r e c t m o d e i n e c e s s a r y e v i l t s t a t i s t i c s o t h e 1 5 2 0( e . g . , f o d r a w i n g b a g r a p h ) . F o r t h e m o m e n t , t h o u g h ,l e t ' s h a v e l i t t l e f u w i t h p r o g r a m c a l l e d " J O Y D R A W E R " .

W e c a n r e a d t h j o y s t i c k b y m e a n s o t h a d d r e s s e s 5 6 3 2 0 o 5 6 3 2 1 ( d e p e n d e n t o w h i c h p o r t y o u w i s h t u s e ) , a n dd e t e r m i n e t h d i r e c t i o n t h s t i c k i p o i n t i n g . s u b r o u t i n eo t h i s t y p e l o o k s l i k e :

3 1

Page 318: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 318/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

1 0 R E M = = = = R E A D J O Y S T I C K = = = = = = = = = = = = = = =1 1 X = P E E K ( 5 6 3 2 0 )1 2 I F ( X A N D 1 ) = O T H E N G O T O * L I N E N U M B E R *1 3 I F ( X A N D 2 ) = 0 T H E N G O T O * L I N E N U M B E R *1 4 I F ( X A N D 4 ) = 0 T H E N G O T O * L I N E N U M B E R *1 5 I F ( X A N D 8 ) = 0 T H E N G O T O * L I N E N U M B E R *1 6 I F ( X A N D 1 6 ) = 0 T H E N G O T O * L I N E N U M B E R *1 7 G O T O 1 1 0

O n c e t h d i r e c t i o n s h a v e b e e n l a i d o u t , t h e * L I N E N U M B E R *d e s i g n a t i o n s c a b u s e d t o r d e r u c e r t a i n c o m m a n d s .

T h i s i s n ' t t h m a i n r e a s o n w e ' r e p l a y i n g w i t h t h i s r o u t i n e ,t h o u g h j o y s t i c k t e s t s t h e m s e l v e s a r e n ' t m u c h f u n . A s y o k n o w , m o s t j o y s t i c k s a r m a d e u o t w m e m b r a n e k e y s o s o r t o n e f o r t h f i r e b u t t o n a n o n f o r t h e s t i c kd i r e c t i o n . P u s h i n g t h s t i c k i d i a g o n a l d i r e c t i o n c l i c k si t w s w i t c h e s s i m u l t a n e o u s l y ( o n e h o r i z o n t a l , o n v e r t i c a l ) . T h a b o v e r o u t i n e w i l l n o r e a d t w d i r e c t i o n sa t h s a m e t i m e , s o w e ' l l h a v e t o d o s o m e i m p r o v i n g t t h p r o g r a m , o w e ' l l o n l y b e a b l e t d r a w u p d o w n , l e f t a n r i g h t n d i a g o n a l s .

W c a g e a r o u n d t h i s b c r e a t i n g r o u t i n e t h a t r e a d s t w ok e y s s i m u l t a n e o u s l y ( o r , i w i l l s e e m t h a t w a t y o i w i l l a l t e r n a t e l y r e a d t h e t w o p o s i t i o n s m a n y t i m e s p e s e c o n d ) . H e r e i o n s o l u t i o n :

1 0 R E M = = = = 1 5 2 0 S E T U P = = = = =1 1 S W = 3 : C = 21 2 O P E N 4 , 61 3 O P E N 1 , 6 , 11 4 O P E N 2 , 6 , 2 : P R I N T # 2 , C1 5 R E M = = = = R E A D J O Y S T I C K = =1 6 J = P E E K ( 5 6 3 2 0 )1 7 I F ( J A N D 1 ) = O T H E N Y = Y + S W1 8 I F ( J A N D 2 ) = 0 T H E N Y = Y - S W1 9 I F ( J A N D 4 ) = 0 T H E N X = X - S W2 0 I F ( J A N D 8 ) = 0 T H E N X = X + S W

3 1

Page 319: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 319/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

2 1 I F ( J A N D 1 6 ) = 0 A N D K K = 0 T H E N K K = l : G O T O 2 4 02 2 I F ( J A N D 1 6 ) = O A N D K K = 1 T H E N K K = O2 3 R E M = = = = T E S T F O O V E R F L O W = = = = = = = = = = =2 4 I F X < 0 T H E N X = 0 : G O T O 1 6 02 5 I F Y < - 4 8 0 T H E N Y = - 4 8 0 : G O T O 1 6 02 6 I F X > 4 8 0 T H E N X = 4 8 0 : G O T O 1 6 02 7 I F Y > 4 8 0 T H E N Y = 4 8 0 : G O T O 1 6 02 8 R E M = = = = D R A W = = = = = = = = = = = = = = = = = = = = = = = =2 9 I F K K = l T H E N K $ t f D f l3 0 I F K K = O T H E N K $ = " M "3 1 P R I N T # 1 , K $ ; X ; Y3 2 G O T O 1 6 0R E A D Y .

1 1 T w v a r i a b l e s ( S W = s t e p w i d t h , C = c o l o r ) c a c h o o s er e s o l u t i o n ( a n d c o n s e q u e n t l y , d r a w i n g s p e e d ) a n t h p e c o l o r . S t e p w i d t h c o r r e s p o n d s t t h h i g h e s tr e s o l u t i o n .

1 6 0 - 2 0 0 T h f o u r m a i n d i r e c t i o n s o t h j o y s t i c k a r r e a dh e r e , a n v a r i a b l e s a n d e t e r m i n e t h d i r e c t i o n s i b e t w e e n .

2 1 0 T h e f i r e b u t t o n i r e a d h e r e , a n h a v a l u e o o 1 T h i s i i m p o r t a n t , s i n c e t h f i r e b u t t o n s e t s t h p e t p a p e r . I t h v a r i a b l e ( K R ) e q u a l s 1 l i n e 2 2 t a k e se f f e c t , f o l l o w e d b d i r e c t j u m p t t h d r a w r o u t i n e .

2 2 I t h f i r e b u t t o n i p r e s s e d s e c o n d t i m e , t h p r o g r a mr e t u r n s t l i n e 2 1 0 , c h n a g i n g K t 0

2 4 0 - 2 7 0 T p r e v e n t t h d r u m f r o m p a s s i n g t h b o r d e r ,v a r i a b l e s a n t e s t f o o v e r f l o w .

2 9 0 - 3 0 0 T h d r a w a n m o v e c o m m a n d s ( D / M ) a r s t o r e d i n K $ .3 1 T h d r a w r o u t i n e i e x e c u t e d , a n t h r o u t i n e r u n s

a g a i n .

3 1

Page 320: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 320/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

R U N n i n g t h p r o g r a m w i l l i m m e d i a t e l y s h o w y o u t h a d v a n t a g e sa n d i s a d v a n t a g e s o f t h i s r o u t i n e . T h d r a w - s p e e d i s l o w ,a n d t h e d i a g o n a l s l o o k v a g u e l y l i k e l i t t l e s t a i r s .

f e w o r d s o o p e r a t i n g t h i s p r o g r a m :

W h e n t h f i r e b u t t o n i p r e s s e d , t h p e n d r u m d o e s n o t h i n g .O n c e t h l e v e r i m o v e d , t h e p e n i s w i t c h e d o n t o t h p a p e r .T h i s h a s t h e a d v a n t a g e t h a t y o c a p r e s s t h f i r e b u t t o n a t h s a m e t i m e a t h e p e n i m o v i n g a n m a k e d a s h e d l i n e s i y o w i s h . T h j o y s t i c k , b t h e w a y , s h o u l d b p l u g g e d i n t oP o r t 2

T h o s e r e a d e r s w i t h o u t j o y s t i c k s c a n s t i l l u s e t h p r o g r a m .C h a n g e t h a d d r e s s i l i n e 1 6 f r o m 5 6 3 2 0 t 5 6 3 2 1 , w h i c hw i l l n o w a l l o w y o u t r e a d t h k e y b o a r d . H e r e a r t h k e y si n v o l v e d :

K E

C T R L

S P A C E

F U N C T I O N

r i g h tl e f tu d o w nf i r e b u t t o n

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

3 1

Page 321: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 321/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

1 0 R E M = = = = R E A D D A T A = = = = = = = = = = = = = = = = = = =1 1 P R I N T S1 2 F O R F = 0 T O 31 3 R E A D B * C F D1 4 N E X T1 5 R E f 1 = = 1 5 2 0 S E T U P = = = = = = = = = = = = = = = = = =1 6 S W = 3 : C = 01 7 0 P E N 4 , 61 8 O P E N 1 , 6 , 11 9 0 P E N 2 , 6 , 22 0 P R I N T # 2 , C2 1 R E M = = = = R E A D J O Y S T I C K = = = = = = = = = = = = = = =2 2 G E T A $ : J = P E E K C 5 6 3 2 0 D2 3 I F C J A N D 1 3 = 0 T H E N Y = Y + S U2 4 I F C J A N D 2 3 = 0 T H E N Y = Y - S U2 5 I F C J A N D 4 3 = 0 T H E N X = X - S U2 6 I A N D 8 - - 0 T H E N X = X + S U I2 7 I F f . J A N D 1 6 3 = 0 A N D K K = 0 T H E N K K l : G O T O 3 5 02 8 I F C J A N D 1 6 3 = 0 A N D K K = 1 T H E N K K = 02 9 I F A * = C H R * C 1 3 3 3 T H E N C L O S E 1 : C L 0 S E 2 : E N 3 0 I F A $ = C H R $ C 1 3 4 3 T H E N S W = S W + 13 1 I F A i = C H R $ C 1 3 8 3 A N D S U I > 1 T H E N S U = S U - 13 2 0 I F F l $ = C H R $ C 1 3 5 D T H E N C = C + l3 3 I F C = 4 T H E N C = 03 4 R E I 1 = = T E S T F O O U E R F L O U I = = = = 3 5 I F X < 0 T H E N X = 0 = G O T O 2 0 03 6 I F Y < - 4 8 0 T H E N Y = - 4 8 0 : G O T O 2 0 03 7 I F X > 4 8 0 T H E N X = 4 8 0 : G O T O 2 0 03 8 I F Y > 4 8 0 T H E N Y = 4 8 0 : G O T O 2 0 03 9 R E f 1 = D R A N = = = = = = = = ^ 0 0 I F K K 1 T H E N K $ " D > 14 1 I F K K = 0 T H E N K $ = " n M4 2 P R I N T # 1 , K $ ; X ; V4 3 P R I N T " S T E P I 1 ; S W f B * C C 3 M4 4 P R I N r ' a S L "4 5 I F S W < 1 0 T H E N P O K E 1 0 7 0 , 3 24 6 G O T O 2 0 04 7 D A T A B L A C K , B L U E , G R E E N , R E D

K E F U N C T I O N

F e n p r o g r a mF r a i s e s t e p - w i d t h b F d e c r e m e n t s t e p - w i d t h b F t u r n s t h p e d r u m o n e - q u a r t e r t u r n

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

3 1

Page 322: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 322/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

8 . S t a t i s t i c s o t h 1 5 2 0 P l o t t e r

O f t e n t h t i m e c o m e s w h e n n o n - s t a t i s t i c i a n h a t v i s u a l l y d e p i c t f e n u m b e r s i g r a p h f o r m . T h i s m a i n v o l v e m o n e t a r y s u m s , o p e r c e n t a g e s . W e ' l l t r t s h o wy o u h o w t d s u c h g r a p h s o y o u r 1 5 2 0 P l o t t e r , u s i n g t w t y p i c a l e x a m p l e s t h b a c h a r t , a n d t h e p i e c h a r t ( n a m e df o o b v i o u s r e a s o n s ) . B o t h p r o g r a m s u s p e r c e n t a g e s . W e ' l lb e g i n w i t h t h b a c h a r t :

i 0 R E M = = = = 1 5 2 0 S E T U P = = = = = = = = = = = = = = = = = =1 1 O P E N 4 , 61 2 O P E N 1 , 6 , 11 3 0 P E N 2 , 6 , 21 4 R E M = = = = I N P U T = = = = = = = = = = = = = = = = = = = = = = =1 5 I N P U T ^ J H O W M A N Y I T E M S C M A X . 7 D 1 ; A 1 6 A = U A L C A * 31 7 I F L E N C A * 3 > 1 O R A < 1 O R A > 7 T H E N 1 5 01 8 F O R S = 1 T O A1 9 P R I N T2 0 P R I N T S ; 1 1 . I T E M C I N ' I N P U T B C S2 1 I F B C S 3 M 0 0 T H E N 1 5 02 2 N E X T2 3 R E M = = = = C O O R D I N A T E S = = = = = = = = = = = = = = = = =2 4 P R I N T t t l , " D " ; 4 5 0 ; 02 5 P R I N T t t 4 , " X 1 12 6 P R I N T t t l , " M " ; 2 0 ; - 2 02 7 P R I N T # 1 , " D " ; 2 0 ; 5 2 02 8 P R I N T t t 4 , ' V2 9 P R I N T t t l , " M " ; 2 0 ; - 4 8 03 0 P R I N T # 1 , " I -3 1 R E M = = = = S C A L E = = = = = = = = = = = = = = = = = = = = = = =3 2 F O R E = 0 T O 5 0 0 S T E P 5 03 3 P R I N T t t l , ' R " ; 0 ; E3 4 P R I N T * t l , ' 1 J - ; - 1 0 ; E3 5 N E X T3 6 P R I N T # 1 , " H "3 7 R E = = C O L U M N S = = = = = = = = = = =3 8 F O R S = 1 T O A3 9 P R I N T # 1 " • R > i ; 5 0 ; 0 i P R I N T * l I 4 0 Y C S 3 = B C S D X 54 1 P R I N T t t l , " J " ; 0 ; y c s d4 2 P R I N T t t l , " J ' ; 4 0 ; V C S D4 3 P R I N T # 1 , " J - ; 4 0 ; 04 4 N E X T

3 1

Page 323: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 323/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

4 5 P R I N T * l f " R i l ; - A x 5 0 ; 04 6 P R I N T t t l / ' I "4 7 P R I N T # 1 , " R " ; 5 0 ; - 2 04 8 P R I N T # 1 , " 1 "4 9 R E M = = = = C A P T I O N = = = = = = = = = = = =5 0 P O K E 1 9 8 , 0 : W A I T 1 9 8 , 15 1 G E T X $ : I F X $ O ' 1 e _ ' < T H E N P R I N T t t 45 2 0 I F X $ O " G _ f t T H E N 5 0 05 3 R E M = = = = E N D = = = = = = = = = = = = = = = =5 4 C L O S E 15 5 C L 0 S E 25 6 C L 0 S E 4R E A D Y .

Y o c a d r a w s e v e n c o l u m n s w i t h t h i s p r o g r a m , w i t h 1 c 1 0 % T h e r e w i l l b m a r k s o t h Y - a x i s a 1 - c e n t i m e t e ri n t e r v a l s ( 1 0 * ) . O n c e t h p r o g r a m h a s e n d e d , i w i l l s h i f ti n t o d i r e c t " t y p e w r i t e r " m o d e , a l l o w i n g y o u t p u t e x t ,n u m b e r s , e t c . u n d e r n e a t h t h e c o l u m n s . H e r e i d e s c r i p t i o no t h p r o g r a m l o g i c :

1 5 p r o m p t s f o t h n u m b e r o c o l u m n s t h a t y o u w a n tp r i n t e d .

1 7 c h e c k s t h a t t h e i n p u t i w i t h i n t h a l l o w a b l e r a n g e .1 8 0 - 2 2 0 m a k e s u p t h e r e s t o t h I N P U T r o u t i n e . R e m e m b e r

t h a t t h i s s e c t i o n a c c e p t s n u m e r i c i n p u t O N L Y , a n w i l lg i v e y o u a e r r o r m e s s a g e i y o g i v e i a n y t h i n ge l s e . T h v a l u e s g i v e n a r e s t o r e d i o n e -d i m e n s i o n a l a r r a y , a n a r t e s t e d a t w h e t h e r t h e ya r l e s s t h a n o e q u a l t 1 0 0 * ( l i n e 2 1 0 ) . I f a l l i w e l l , t h p r o g r a m g o e s o n

2 4 0 - 3 0 0 d e s i g n s c o o r d i n a t e s y s t e m a n d d r a w s t h e X a n Y - a x e s .

3 1

Page 324: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 324/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

3 2 0 - 3 5 0 m a r k s t h 1 - c e n t i m e t e r s t e p s o t h Y - a x i s ( s e ea b o v e ) , w i t h 1 c e q u a l l i n g 1 0 0 % ( l i n e 3 2 c o n t a i n sS T E P 5 0 , w i t h s t e p e q u a l t 0 . m m s o 5 0 * 0 . 0 2 m = c m ) . T h i s r o u t i n e i c a l l e d u p o n t e t i m e s t g i v e u t h t e m a r k i n g s .

3 8 0 - 4 4 0 t a k e s t h p a r a m e t e r s g i v e n a n p r i n t s t h c o l u m n sp r o p e r .

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

3 8 T h d r a w - l o o p c o u n t s u t h n u m b e r o c o l u m n s i n p u t ,f r o m t A

3 9 n e w r e l a t i v e n u l l - p o i n t i d e f i n e d a e a c h c o l u m n i p l o t t e d ( r u n n i n g f r o m l e f t t r i g h t ) . B a c h c o l u m n i d r a w n u s i n g t h s a m e r o u t i n e , w i t h o n l y t h s i z e o t h c o l u m n s c h a n g e d a s p e c i f i e d .

4 0 P e r c e n t a g e s a r i n p u t i n t o ( S ) , t a k e n b y t h c o m p u t e r , a n t r a n s l a t e d i n t o c e n t i m e t e r s f o r t h ep l o t t e r ( 5 0 0 s t e p s 1 c 1 0 0 % ) .

4 1 0 - 4 4 0 C o l u m n s a r e p u t o n t o p a p e r , e a c h w i d t h o 4 s t e p s a n h e i g h t o ( S ) , a s p e c i f i e d b t h u s e r .

4 5 0 - 4 8 0 T h p l o t t e r s h i f t s i n t o d i r e c t m o d e ; t h e p e d r u mp o s i t i o n s i t s e l f b e n e a t h t h f i r s t c o l u m n ; a n n e r e l a t i v e n u l l - p o i n t i s e t .

5 0 0 - 5 2 0 T h i s s e c t i o n w a i t s f o k e t b p r e s s e d t h c h a r a c t e r p r e s s e d w i l l b p r i n t e d o p a p e r ( t y p e w r i t e rm o d e ) . W h e n d o n e t y p i n g , p r e s s F t e n t h p r o g r a m .

F o r e v i e w p u r p o s e s , h a v e l o o k a l i n e 5 0 0 : T h k e y b o a r db u f f e r ( l o c a t i o n 1 9 8 ) i c l e a r e d u s i n g P O K E 1 9 8 , 0 . W A I T

3 1

Page 325: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 325/343

Page 326: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 326/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

i 0 R E N = = = = 1 5 2 0 S E T U P = = = = = = = = = = = = = = = = = =1 1 O P E N 1 , 6 , 11 2 0 P E N 4 , 61 3 P R I N T # 1 , " P T ; 2 4 0 51 4 P R I N T * ! , " I "1 5 R E M = = = = I N P U T = = = = = = = = = = = = = = = = = = = = = = =1 6 D I I 1 U C 3 0 D1 7 I N P U T s Q Q H O U l M A N Y S E C T I O N < = 3 0 B " ; M $1 8 M = U A L C M * D : M = A B S C N D1 9 F O R N = l T O n2 0 P R I N T " S I D E M ; N ; s2 1 I N P U T U C N 32 2 N E X T2 3 R E N = = = = T E S T F O O U E R F L O U 1 = = = = = = = 2 4 F O R N = 1 T O N2 5 P = P + U C N D2 6 I F P > 1 0 0 T H E N C L R s G O T O 1 7 02 7 P R I N T " S C H E C K S U M t l ; T A B C 2 0 D P ;2 8 N E X T ^ N = 02 9 R E f 1 = = = S U B D I U I S I O N = = 3 0 0 N = N + 13 1 K = 1 2 8 x U C N D / 1 0 03 2 F O R L = 0 T O 6 . 4 S T E P . 0 5 : 2 = 2 + 13 3 X = 2 0 0 * S I N C L D3 4 Y = 2 0 0 ^ C O S C L D3 5 I F 2 - K < 1 A N D 2 - K > = 0 T H E N 4 0 03 6 I F L = 0 T H E N P R I N T # l f " J ' i ; X ; V3 7 P R I N T t t l F f i R " ; X ; v3 8 N E X T J G O T O 4 7 03 9 R E N = = = = N E X T U A L U E = = = = = = = = = = = = = = = = = =4 0 Z = 4 1 P R I N T # 1 ' J ' ; 0 ; 04 2 P R I N T t t l , R ' T X j v4 3 0 N = N + 14 4 K = 1 2 8 X U C N D / 1 0 04 5 G O T O 3 7 04 6 R E M = = = = D R A W C U R U E = = = = = = = = = = = = = = = = = =4 7 F O R L = 0 T O 6 . 4 S T E P . 0 54 8 X = 2 0 0 X S I N C L 34 9 Y = 2 0 0 x C O S C L D5 0 I F L = 0 T H E N P R I N T * 1 f " R " ; X ; V5 1 P R I N T # 1 , ' J " ; X ; v5 2 0 N E X T5 3 R E M = = = = C A P T I O N = = = = = = = = = = = = = = = = = = = = =5 4 0 P R I N T # 1 / 1 R " ; 0 ; 2 0 05 5 P O K E 1 9 8 , 0 i W f = l I T 1 9 8 , l5 6 G E T A i i F A " § _ : ■ T H E N 6 0 05 7 P R I N T # 4 , f H ,5 8 G O T O 5 5 05 9 R E M = = = = E N D = = = = = = = = = = = = = = = = = = = = = = = = =6 0 C L O S E 16 1 C L 0 S E 46 2 P 0 K E 2 1 4 , 1 26 3 P R I N T

3 2

Page 327: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 327/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

1 6 T h p e r c e n t a g e s g i v e n b y t h u s e r a r s t o r e d i o n e -d i m e n s i o n a l a r r a y . N o r m a l a r r a y s w i l l t a k e u t 1 i n p u t s b e f o r e t h c o m p u t e r g i v e s B A S U B S C R I P Te r r o r . O u a r r a y a l l o w s f o u t t h i r t y i n p u t s( D I M V ( 3 0 ) ) .

1 7 0 - 2 2 0 T h u s e r i p r o m p t e d h e r e f o i n p u t f o r t h e a r r a ym e n t i o n e d a b o v e . T h p r o m p t t e l l s y o t l i m i t y o u ri n p u t s t 3 o l e s s , a l t h o u g h i a c t u a l l y a c c e p t s 3 i n p u t s ( i n c l u d n g 0 w h i c h i r e s e r v e , n o t h i n g m o r e ) .

2 4 0 - 2 8 0 T h c o n t e n t s o t h a r r a y a r s u m m e d u p h e r e , a n c h e c k e d f o o v e r f l o w ( i . e . , i n s u r i n g t h a t t h e s u m< = 1 0 0 S ) .

3 1 0 - 3 5 0 T h v a l u e d e t e r m i n e s t h s i z e o t h e r a d i u s .T h c i r c l e i t s e l f i d r a w n u s i n g F O R L = 0 T O 6 . 4 S T E P . 0 5 .

w h i c h g i v e s t o t a l o 1 2 i n d i v i d u a l s t e p s .V a r i a b l e ( l i n e 3 2 0 ) c o u n t s e a c h s t e p , a n i n c r e m e n t si u n t i l 1 2 i r e a c h e d .

L i n e s 3 3 0 - 3 5 0 w i l l l o o k f a m i l i a r t t h r e a d e r ( s e e C h a p t e r8 . 3 . 5 ) .

4 0 0 - 4 5 0 T h n e x t i n p u t i r e a d i n a n t h d r a w i n g r o u t i n er e s t a r t s .

4 7 0 - 5 2 0 n e e d n e x p l a n a t i o n : c e n t e r - p o i n t i s h o w n .5 4 0 - 5 8 0 T h s y s t e m r e t u r n s t t y p e w r i t e r m o d e p r e s s F

t e n d t h e p r o g r a m .

T h e r e ; y o n o w h a v e t h b a s i c m a t e r i a l s f o c r e a t i n g y o u ro w s t a t i s t i c a l c h a r t s w i t h t h e 1 5 2 0 p l o t t e r . G o o d l u c k !

3 2

Page 328: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 328/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

3 2

Page 329: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 329/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

8 . P L O T T E R U T I L I T Y P R O G R A M

T h f o l l o w i n g B A S I C u t i l i t y p r o g r a m i l o n g o n e , a n d w i l lt a k e p l e n t y o t y p i n g t i m e ; b u i w i l l b w e l l w o r t h y o u rt r o u b l e . T h p r o g r a m s p l i t s u p t h e s e c o n d a r y a d d r e s s e s o t h 1 5 2 0 , a n e v e n g i v e s y o u r o u t i n e s s u c h a t h l i n e s a n dc i r c l e s d r a w n e a r l i e r . E s s e n t i a l l y , i m a k e s p l o t t e rs o f t w a r e d e v e l o p m e n t b i e a s i e r f o t h n o v i c e . ( N O T E : A w i t h s m a n y o t h e s e p r o g r a m s , t h e x e c u t i o n s p e e d i n o v e r y f a s t ) . T h p a g e s f o l l o w i n g t h p r o g r a m g i v e d e t a i l s o c o m m a n d s a n p r o g r a m l o g i c . I y o g e i m p a t i e n t f o c o m m a n d s , h e r e ' s s h o r t g u i d e :

C I R C L E , M x , M y , R x , R y , L d r a w s c i r c l e , g i v i n g y o o p t i o n s o m i d p o i n t , r a d i i ( X a n Y - r e g i s t e r s ) a n t y p e o l i n e .

L I N E , X 1 , X 2 , Y 1 , Y 2 , L d r a w s l i n e f r o m o n p o i n t t a n o t h e r( a g a i n , c h o i c e o l i n e t y p e ) .

P A P E R U P / D O W N , N m o v e s t h p a p e r s t e p s u o r d o w n .

T U R N / T E X T t u r n s a n y t e x t 9 d e g r e e s e i t h e r t t h X o r Y -a x i s .

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

3 2

Page 330: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 330/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

1 O P E N 1 , 6 , 12 0 P E N 2 , 6 , 23 0 P E N 3 , 6 , 34 0 P E N 4 , 6 , 45 0 P E N 5 , 6 , 56 0 P E N 6 , 6 , 67 0 P E N 7 , 6 , 78 0 P E N 8 , 6 P R I N T S ' : D I M E N $ C 1 0 0 D D I M M C 1 0 D R E S T O R E9 6 O S U B 9 0 0 0 : P O K E 5 3 2 8 0 , 0 : P 0 K E 5 3 2 8 1 , 2 : P R In t - e :1 0 R E M = = = = I N P U T = = = = = = = = = = = = = = = = = = = = = = =1 1 E " « - " : P O = 5 6 3 2 01 2 P R I N T " < " ; 1 3 G E T A * : I F A * " " T H E N 1 3 01 4 I F A $ " ! T O R A * " g J ' O R A $ l f i : ' O R A $ " ^ ' O R A $= C H R $ 3 D O R A $ = § _ ! ' O A = S I T H E N 1 3 1 5 I A = C H R $ C 1 D T H E N P R I N T P N g _ Z = : S = S + l : G O T O 2 4 01 6 I F A $ = C H R $ C 2 0 3 T H E N Z = Z - l : I F Z < 0 T H E N Z = 0 :G O T O 1 3 01 7 I F A * = C H R K 2 0 3 T H E N 1 9 01 8 0 Z = Z + 1 : I F Z > 7 0 T H E N A * = C H R $ C 1 D : G O T O 1 5 01 9 P R I N T T A B C 3 D m a ! ' A $ + E $ ;2 0 I F A * = " x " T H E N 3 3 02 1 T $ = T $ + A $2 2 G O T O 1 3 02 3 I F A $ = C H R $ C 2 0 D T H E N T T $ = L E F T $ C T T $ , L E N C T2 4 Y = L E N C T $ ] : E = E + 12 5 F O R X = 1 T O Y2 6 S $ = M I D $ C T $ , X , 1 32 7 I F S $ t l 0 R S $ M t 2 8 E N $ C E D = E N $ C E D + S $2 9 0 I F S $ < > " " A N D S $ < > < l t " A N D S $ < > " ' e - " T H E N N E X3 0 T $ = M " : A $ = " " : S $ = " "3 1 G O T O 1 2 03 2 R E M = = = = W O R K O U T = = = = = = = = = = = = = = = = = = = =3 3 E = 3 5 R E M = = = = R E A D C O M M E N T = = = = = = = = = = = = = = = =3 6 F O R X = 1 T O L E N C E N $ C E D D3 7 B F * = M I D * C E N i C E D , X , l D3 8 I F B F t O " " ' T H E N B 1 $ = B 1 $ + B F $ : N E X T3 9 R E M = = = = R E A D N U M B E R S = = = = = = = = = = = = = = = =4 0 F 0 R X = L E N C B l $ D + 2 T 0 L E N C E N $ C E D D4 1 Z l $ = M I D $ C E N i C E ] , X , l D4 2 0 I F Z l t < > " , 1 < T H E N N l $ = N l $ + Z l $ : N E X T4 3 R E N = = = = R E A D N U M B E R S = = = = = = = = = = = = = = = =4 4 F O R X = L E N C N 1 $ D + 2 + L E N C B 1 * D + 1 T O L E N C E N $ CE D

3 2

Page 331: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 331/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O N N O D O R B 6

4 5 Z 2 $ = M I D * C E N $ C E 3 , X , 1 34 6 I F Z 2 $ < > " , " T H E N N 2 $ = N 2 $ + Z 2 * : N E X T4 7 R E M = = = = R E A D N U M B E R S = = = = = = = = = = = = = = = =4 8 F O R X = L E N C N 1 $ 3 + 1 + L E N C B 1 $ 3 + 1 + L E N C N 2 $ 3 +2 T O L E N C E N * C E 34 9 Z 3 $ = M I D $ C E N $ C E 3 , X , 1 35 0 I F Z 3 $ < > " , " T H E N N 3 $ = N 3 $ + Z 3 $ : N E X T5 1 R E f 1 = R E A D N U I 1 B E R S = = = = 5 2 F O R X = L E N C N 1 $ 3 + 1 + L E N C B 1 $ 3 + 1 + L E N C N 2 $ 3 +1 + L E N C N 3 * 3 + 2 T O L E N C E N $ C E 3 5 3 Z 4 $ = M I D $ C E N i C E 3 , X , l 35 4 I F Z 4 * < > " , " T H E N N 4 $ = N 4 $ + Z 4 $ : N E X T5 5 R E M = = = = R E A D N U M B E R S = = = = = = = = = = = = = = = =5 7 F O R X = L E N C N 1 $ D + 1 + L E N C B 1 $ D + 1 + L E N C N 2 $ D 1 + L E N C N 3 $ D + 1 + L E N C N 4 $ D + 2 T 0 L E N C E N $ C E5 8 Z 5 $ = P 1 I D $ C E N $ C E D , X , 15 9 I F Z 5 $ < > " M T H E N N 5 $ = N 5 $ + Z 5 $ : N E X T6 0 R E M = = = = S T R I N G S I N U M B E R S = = = = = = = = = =6 1 N 1 = U A L C N 1 $ 3 . " N 1 = A B S C N 16 2 N 2 = U A L C N 2 $ 3 . " N 2 = A B S C N 26 3 N 3 = U A L C N 3 $ 3 : N 3 = A B S C N 36 4 N 4 = U A L C N 4 $ 3 : N 4 = A B S C N 46 5 N 5 = U A L C N 5 $ 3 : N 5 = A B S C N 56 6 R E P 1 = E X E C U T E = = = = = = 6 7 R E = C 0 n r i A N D S = = = = = = = 6 8 I F B 1 $ O " C O L O R " T H E N G O T O 7 1 06 9 I F N 1 > 2 5 5 T H E N P R I N T # 1 , 0 : G O T O 7 1 07 0 P R I N T * 2 , N 17 1 I F B 1 $ O " P E N " T H E N 7 4 07 2 I F N 1 > 2 5 5 T H E N N 1 = 07 3 P R I N T # 2 , N 1 : P R I N T « 1 " f i " 4 8 , 7 4 I F B 1 $ O " L I N E " T H E N 7 8 07 5 I F N 1 > 4 8 0 O R N 2 > 9 9 9 O R N 3 > 4 8 0 O R N 4 > 9 9 9 O R N 5M 5 T H E N 7 8 07 6 P R I N T # 5 , N 57 7 0 P R I N T # 1 , " ! r ' ; N l ; N 2 : P R I N T * * l , " D M ; N 3 ; N 47 8 I F B 1 $ < > M S I 6 N " T H E N 6 O T O 8 1 07 9 0 I F N 1 > 2 5 5 T H E N N 1 = 18 0 P R I N T # 3 , N 13 1 I F B ^ O ' T E S T ' T H E N S S e8 2 P R I N T # 8 , " T E T 8 3 I F B 1 $ O " P A P E R U P ' T H E N 8 7 08 4 I F N 1 > 9 9 9 T H E N N 1 = 9 9 88 5 P R I N T S , " M " ; 0 ; N 13 6 P R I N T # 88 7 I F B 1 $ O " P A P E R D O W N " T H E N 9 1 08 8 I F N 1 > 9 9 9 T H E N N 1 = 9 9 83 9 P R I N T t t l , " r r ; 0 ; - N 9 0 P R I N T # 89 1 I F B 1 $ O " H O M E " T H E N 9 3 09 2 P R I N T # 1 , ' H "

3 2

Page 332: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 332/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

9 3 I F B 1 * < > " C I R C L E " T H E N G O T O 1 0 1 09 4 I F N 1 + N 3 > 4 8 0 O R N 2 + N 4 > 9 9 9 O R N 5 > 1 5 O R N 1 - N 3< 0 T H E N P R I N T " O U T O B O U N D S "9 5 0 P R I N T * 1 , " I I " N l N 2 P R I N T # 1 , I " P R I N T *5 , N 59 6 F O R X = - 3 . 2 T O 3 . 2 S T E P . 0 49 7 Y = N 3 x C O S C X 3 : Z = N 4 * S I N C X D9 8 I F X = - 3 . 2 T H E N P R I N T * 1 , " R " ; Y ; Z9 9 P R I N T # 1 , " J " ; Y ; Z : N E X T1 0 0 0 P R I N T * 1 , " r r ; 0 ; 0 : P R I N T * l , " I "1 0 1 0 I F B 1 $ O " B A S I C " T H E N 1 0 3 01 0 2 0 S Y S 6 4 7 3 81 0 3 0 I F L E F T $ C B 1 $ , 5 X > " T U R N - " T H E N 1 0 9 01 0 4 0 F O R X = L E N C B 1 $ 3 T O 6 S T E P - 1 : P R I N T * 4 , 11 0 5 0 Y * = M I D * C B 1 $ , X , 1 3 :1 0 6 0 P R I N T t t l , " M " , N 1 * C L E N C B 1 $ 3 - X 31 0 7 0 P R I N T * 8 f Y * ; : N E X T : P R I N T * 4 , 01 0 8 0 P R I N T S1 0 9 0 I F L E F T * C B 1 $ , 5 D < > " T U R N / " T H E N 1 1 3 01 1 0 0 P R I N T t t 4 , l : F 0 R X = 6 T 0 L E N C B l $ D1 1 1 0 Y $ = M I D * C B 1 * , X , 1 31 1 2 0 P R I N T * 8 , Y $ : N E X T : P R I N T # 8 : P R I N T * 4 , 01 1 3 0 I F B 1 $ O " S C R E E N " T H E N 1 1 6 01 1 4 0 I F N 1 > 1 5 O R N 2 > 1 5 T H E N N 1 = 0 : N 2 = 21 1 5 0 P O K E 5 3 2 8 0 , N l : P O K E 5 3 2 8 1 , N 21 1 6 0 I F B 1 $ O " 0 - S E T " T H E N 1 1 9 01 1 7 0 P R I N T * 2 , 0 : P R I N T * 3 , 1 : P R I N T * 4 , 0 : P R I N T* 5 , 0 : P R I N T * 6 , 01 1 8 0 P O K E 5 3 2 8 0 , 0 P 0 K E 5 3 2 8 1 , 2 P R I N T ' ' ^ '1 1 9 0 I F B 1 $ O " D I R E C T 1 ' T H E N 1 2 5 01 2 0 0 I F N 1 > 2 5 5 O R N 2 > 2 5 5 T H E N 1 2 3 01 2 1 0 P R I N T * 6 , N l : P R I N T * * 3 , N 21 2 3 0 P O K E 1 9 8 , 0 : U 1 A I T 1 9 8 , 11 2 4 0 G E T A * : I F A $ < > " e J ' T H E N P R I N T A $ ; : P R I N T « 8, A $ ; : G O T O 1 2 3 01 2 5 0 I F B l i O " P O R T " T H E N 1 2 9 01 2 6 0 I F N 1 > 2 O R N K 1 T H E N P O = 5 6 3 2 01 2 7 0 I F N 1 = 1 T H E N P O = 5 6 3 2 11 2 8 0 I F N 1 = 2 T H E N P O = 5 6 3 2 01 2 9 0 I F B 1 * O " J O Y " T H E N 1 6 8 01 3 2 0 P R I N T : R E S T O R E : F O R F = 0 T O 31 3 3 0 R E A D B $ C F 31 3 4 0 N E X T1 3 5 0 R E N = = = = 1 5 2 0 S E T U P = = = = = = = = = = = = = = = = =1 3 6 0 S U = 3 : C = 01 4 0 0 P R I N T * 2 , C1 4 1 0 R E M = = = = R E A D Q S T I C K = = = = = = = = = = = = = =1 4 2 0 G E T A $ : J = P E E K C P O D1 4 3 0 I F C J A N D 1 D = 0 T H E N Y = Y + S U I1 4 4 0 I F C J A N D 2 D = 0 T H E N Y = Y - S W

3 2

Page 333: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 333/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

1 4 5 0 I F C J A N D 4 D = 0 T H E N X = X - S U I1 4 6 0 I F C J A N D 8 3 = 0 T H E N X = X + S W1 4 7 0 I F C J A N D 1 6 3 = 0 A N D K K = 0 T H E N K K = l : G O T O 1 5 5

1 4 8 0 I F C J A N D 1 6 D = 0 A N D K K = 1 T H E N K K = 01 4 9 0 I F A $ = C H R i C 1 3 3 D T H E N 8 0 0 01 5 0 0 I F A $ = C H R $ C 1 3 4 D T H E N S W = S W + 11 5 1 0 I F A $ = C H R $ C 1 3 8 D A N D S W > 1 T H E N S W = S U I - 11 5 2 0 I F A $ = C H R $ C 1 3 5 D T H E N C = C + 11 5 3 0 I F C = 4 T H E N C = 01 5 4 0 R E N = = = = X F O O U E R F L O U I = = = = = 1 5 5 0 I F X < 0 T H E N X = 0 : G O T O 1 4 0 01 5 6 0 I F Y < - 4 8 0 T H E N Y = - 4 8 0 : G O T O 1 4 0 01 5 7 0 I F X > 4 8 0 T H E N X = 4 8 0 : G O T O 1 4 0 01 5 8 0 I F Y > 4 8 0 T H E N Y = 4 8 0 : G O T O 1 4 0 01 5 9 0 R E M = = = =1 6 0 0 I F K K = 1 T H E N K * = M D M1 6 1 0 I F K K = 0 T H E N K * = M M "1 6 2 0 P R I N T » l f K * ; X ; Y1 6 3 0 P R I N T " S T E P I I J S W , B $ C C D "1 6 4 0 P R I N T " o a J '1 6 5 0 I F S U I < 1 0 T H E N P O K E 1 0 7 0 , 3 21 6 6 0 G O T O 1 4 0 01 6 7 0 D A T A B L A C K , B L U E , G R E E N , R E D1 6 8 0 I F B 1 $ O " P A U S E 1 T H E N 8 0 0 01 6 9 0 U I A I T 2 0 3 , 6 38 0 0 0 R E M = = = = 0 = = = = = = = = = = = = = = = = = = = = = =8 0 1 0 N l $ = " " : N 2 $ = " " : N 3 $ = " " : N 4 $ = " " : N 5 $ = " "3 0 2 0 X $ = " " : Y $ = " " : N l = 0 : N 2 = 0 : N 3 = 0 : N 4 = 0 : N 5 =8 0 3 0 E = E + l : I F B l i O " " T H E N B l $ t l " : G O T O 3 5 08 0 4 0 C L R : R U N9 0 0 0 R E M = = = = S T A T U S = = = = = = = = = = = = = = = =9 0 1 0 P R I N T ' s l E . > k x x 1 5 2 0 P L O T T E R U T I L I T Y

P R O G R A M x x x "9 0 2 0 R E T U R NR E A D Y .

3 2

Page 334: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 334/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

N o t h a t y o u ' v e t y p e d t h l i s t i n g i n h e r e a r f e f u n d a m e n t a l s a b o u t t h p r o g r a m . L i n e s 1 0 - 6 5 0 c o n t a i n t h i n i t i a l i z a t i o n a n i n p u t r o u t i n e s , f o l l o w e d b t h c o m m a n ds e m e n t i o n e d a b o v e ( l i n e s 6 6 0 - 1 6 9 0 ) . L i n e s 8 0 0 0 - 8 0 4 0 r e s e tv a r i a b l e s ; l i n e s 9 0 0 0 - f o r m t h s t a t u s l i n e . A l l o t h e s es u b p r o g r a m s a r e x e c u t e d i c o n c e r t w i t h n u m e r o u s s t r i n go p e r a t i o n s .

T h p r o g r a m w a d e s i g n e d t m a k e c e r t a i n i t e m s i p l o t t i n ga v a i l a b l e t t h u s e r a " s i n g l e - w o r d " c o m m a n d s , a n d t l e t h u s e r a d d h i s o h e o w n . T h i s i t h r e a s o n f o t h h u g e g a b e t w e e n l i n e 1 7 0 0 a n l i n e 7 9 9 0 ; o n c e y o u ' v e w o r k e dw i t h t h p r o g r a m f o w h i l e , y o m a y w a n t t e x t e n d i t a b i l i t i e s t s u i t y o u r o w n e e d s .

C o m m a n d s a r e i n p u t a c o m m a n d w o r d , f o l l o w e d b s e r i e so f u p t f i v e n u m b e r s . E a c h c o m m a n d a n n u m b e r s e q u e n c em u s t b s e p a r a t e d b y c o m m a s ( e . g . , C I R C L E , 1 0 0 , 1 0 0 , 9 0 , 8 0 , 0 ) .

L I S T O C O M M A N D W O R D S :

C O L O R , X X = 0 = b l a c kX = l = b l u eX = 2 = g r e e nX = 3 = r e d

P E N , X m o v e s t h d r u m w i t h t h s p e c i f i e d p e c o l o r t t h c h a n g e p o s i t i o n a t h r i g h t e n o f t h e r o l l e r ( r e p r e s e n t sp e c o l o r [ s e e a b o v e ] ) .

L I N E , X 1 , X 2 , Y 1 , Y 2 , L d r a w s l i n e f r o m X I , Y 2 t X 2 , Y 2 ; l i n et y p e ( L c a n b e f r o m t 1 5

3 2

Page 335: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 335/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

S I G N , X d e s i g n a t e s t h c h a r a c t e r s i z e : V a l u e s b e t w e e n( s m a l l p r i n t ) a n ( l a r g e p r i n t ) w o r k b e s t .

T E S T p r i n t s t h w o r d T E S T o p a p e r .

P A P E R U P , X m o v e s t h p a p e r u p l o t t e r s t e p s ( o n e s t e p0 . m m ) .

P A P E R D O W N , X m o v e s t h p a p e r d o w n s t e p s .

H O M E m o v e s t h d r u m t h o m e p o s i t i o n , i n d i c a t i n g t h a b s o l u t e o r e l a t i v e n u l l - p o i n t .

C I R C L E , M x , M y , R x , R y , L d r a w s c i r c l e o e l l i p s e :M m i d d l e - p o i n t c o o r d i n a t e f o X - a x i sM m i d d l e - p o i n t c o o r d i n a t e f o Y - a x i sR X - r e g i s t e r r a d i u s i p l o t t e r s t e p sR Y - r e g i s t e r r a d i u s i p l o t t e r s t e p s

l i n e t y p e ( 0 - 1 5 )

B A S I C f o r c e s s y s t e m r e s e t , w h i c h e n d s a n c l e a r s t h p r o g r a m .

T U R N - T E X T , X t u r n s t h w o r d T E X T o a n y o t h e r i n p u t 9 d e g r e e s t o w a r d t h a x i s , p r i n t e d a p l o t t e r s t e p s .

T U R N / T E X T t u r n s t h w o r d o o t h e r i n p u t 9 d e g r e e s t t h Y a x i s .

3 2

Page 336: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 336/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

S C R E E N , R , B c h a n g e s s c r e e n a n b o r d e r c o l o r ( n u m b e r s f r o m 0 1 5 ) . s t a n d s f o b o r d e r o R i m , f o s c r e e n p r o p e r o B a c k g r o u n d ; T h c o l o r s m a t c h t h f o l l o w i n g n u m b e r s :

b l a c kw h i t er e c y a np u r p l eg r e e nb l u ey e l l o w

1 1 1 1 1 1

o r a n g eb r o w nl i g h t r e dg r a yg r a yl i g h t g r e e nl i g h t b l u eg r a y

0 - S E T w i l l r e s e t a l v a l u e s t d e f a u l t v a l u e .

D I R E C T , X , Y a l l o w s u s t o u s e t h e p l o t t e r i t y p e w r i t e r m o d e :u p p e r - c a s e , w i t h S H I F T e d l o w e r - c a s el o w e r - c a s e , w i t h S H I F T e d u p p e r - c a s e

c o n t r o l s c h a r a c t e r s i z e ( b e t w e e n a n 3 )

P O R T , X a l l o w s u s e o f t h e j o y s t i c k p o r t s ( X = l o r 2 ) D e f a u l ti P o r t 2

J O Y s w i t c h e s j o y s t i c k r e a d i n g o a n o f f , a l s o d e f i n i n g t h f u n c t i o n k e y s a f o l l o w s :

F c o n t i n u e p r o g r a mF r a i s e p l o t t e r s t e p - w i d t h b F d e c r e a s e s t e p - w i d t h b F c h a n g e c o l o r

P A U S E s t o p s t h p r o g r a m u n t i l k e i p r e s s e d .

3 3

Page 337: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 337/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o t h C O M M O D O R E 6

T y p e i c o m m a n d , t h e n t h < R E T U R N > k e y . T e x e c u t e t h c o m m a n d , p r e s s t h p l o t t e r w i l l e x e c u t e , a n d w a i t f o t h n e x t c o m m a n d . I i s n ' t p r e s s e d , t h p r o g r a m a w a i t st h n e x t c o m m a n d ( s ) a t t a c h e d t t h f i r s t . I t ' s p o s s i b l e t u s u t o 1 0 0 c o m m a n d s l i n e t h i s w a y .

O t t h p r o g r a m i t s e l f :

L i n e s 1 0 - 9 0 o p e n t h e n e c e s s a r y p l o t t e r f i l e s a n d d i m e n s i o nt h a r r a y s . T h e G O S U B t 9 0 0 0 s e t s u t h s t a t u s l i n e , a n p l a c e s i o n s c r e e n .

T h i n p u t r o u t i n e f r o m l i n e 1 0 i s t r i n g o p e r a t i o n t h a tr e a d s i n d i v i d u a l c h a r a c t e r s u s i n g G E s t a t e m e n t . L i n e 1 4 b l o c k s o f a n a c k n o w l e d g e m e n t o c u r s o r k e y s o s c r e e no p e r a t i o n s ( s u c h a C L R ) . L i n e 2 1 p l a c e s a l i n p u t s i n t oT $ I c o m m a n d c h a i n s e x c e e d 7 c h a r a c t e r s , < R E T U R N > i f o r c e d a u t o m a t i c a l l y . L i n e 2 0 c h e c k s w h e t h e r t h c o m m a n dt e x e c u t e i g i v e n . I s o j u m p i m a d e t 3 3 0 ; i f n o t ,t h s y s t e m w a i t s f o r t h e n e x t c o m m a n d .

E v e r y < R E T U R N > s e n d s t h p r o g r a m f r o m l i n e 1 5 t 2 4 0 , w h e r et h c o m m a n d i s t o r e d i E N $ ( E ) . L i n e 2 7 c h e c k s f o s p a c e s , u p - a r r o w o l e f t - a r r o w , a n c o m p r e s s e s t h c o m m a n da c c o r d i n g l y . F o e x a m p l e , i y o u r t y p e d C I R C L E a I L E t h p r o g r a m w o u l d r e m o v e a l b l a n k s p a c e s . A l l o u ri n p u t f l o w s a o n e l o n g s t r i n g i n t o E N $ ( E ) .

I f a l l c o m m a n d s a r e n d e d w i t h a a s t e r i s k ( * ) , t h r e a dr o u t i n e p r o c e e d s ( l i n e 3 3 0 ) . T h i s h a s t h e j o b o f s e p a r a t i n ga n s t o r i n g c o m m a n d a n n u m b e r s e q u e n c e . T h i s i w h t h c o m m a s a r u s e d f o s e p a r a t i o n .

3 3

Page 338: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 338/343

A B A C U S S o f t w a r e P R I N T E R B O O K f o r t h e C O M M O D O R E 6

L i n e s 3 5 0 - 3 8 0 w i l l r e a d t h c o m m a n d w o r d , a n s t o r e i i B l $ . L i n e 3 8 w i l l r e a d t h f i r s t n u m b e r a f t e r t h f i r s tc o m m a , a n d s t o r e i t i n N l $ ; t h s e c o n d i N 2 $ , a n s o n u pt N 5 $ .

L i n e s 6 0 0 - 6 5 0 o n l y h a n d l e n u m e r i c a l v a r i a b l e s ( N 1 - N 5 ) .

N o t h i n p u t r o u t i n e h a e n d e d . I n d i v i d u a l c o m m a n d s a r w o r k e d o u f r o m l i n e 6 6 0 . I y o u w i s h t i m p r o v e t h i sp r o g r a m , h e r e i a e x a m p l e . L e t ' s t a k e C U B E , a n s h o w y o uw h i c h m a t e r i a l g o e s i n t o w h i c h v a r i a b l e :

C U B Es i d e - l e n g t hs t a r t i n g p t c o l o rt u r ne n p o s i t i o n

= B 1 $= N

N = N

N = N

A n v a r i a b l e c a b u s e d ; a n b a i n p u t w i l l s i m p l y s t a r tt h i n p u t r o u t i n e a g a i n .

L i n e s 8 0 0 0 - r e s e t a l v a r i a b l e s t s t a r t i n g v a l u e , t o g e tt h a r r a y s r e a d y f o t h n e x t c o m m a n d .

Y o u ' l l f i n d t h e s e c o m m a n d s g r e a t h e l p i y o u r p r o g r a m m i n ge f f o r t s . W e h o p e t h a t y o u ' v e f o u n d o u j u s t h o w u s e f u l y o u r1 5 2 0 p l o t t e r c a b l i m i t e d o n l y b y y o u r o w c r e a t i v i t y .

3 3

Page 339: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 339/343

P r i n t e r B o o kO p t i o n a l D i s k e t t e

F o y o u r c o n v e n i e n c e , t h p r o g r a m s t h a t a r l i s t e d i t h i s b o o k a r e a v a i l a b l e o 1 5 4 1 f o r m a t t e d d i s k e t t e .

I y o w a n t t u s t h p r o g r a m s , w i t h o u t t y p i n g t h e mi f r o m t h l i s t i n g s i t h b o o k , y o m a w a n t t o r d e r

t h i s d i s k e t t e .

A l p r o g r a m s o t h d i s k e t t e h a v e b e e n f u l l y t e s t e d .T h d i s k e t t e i a v a i l a b l e f o r $ 1 4 . 9 5 $ 2 . 0 0

( $ 5 . 0 0 f o r e i g n ) f o r p o s t a g e a n h a n d l i n g c h a r g e s .W h e n o r d e r i n g , P l e a s e s p e c i f y t h t i t l e o t h d i s k e t t e ,y o u r n a m e a n s h i p p i n g a d d r e s s a n e n c l o s e c h e c k ,

m o n e y o r d e r o c r e d i t c a r d i n f o r m a t i o n . M a i l y o u ro r d e r t o

A B A C U S S o f t w a r eP . O . B o 7 2 1 1

G r a n d R a p i d s , M 4 9 5 1 0C a l l t o d a y f o r t h e n a m e o y o u r n e a r e s t l o c a l d e a l e r

P h o n e ( 6 1 6 ) 2 4 1 - 5 5 1 0

Page 340: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 340/343

R e q u i r e d R e a d i n g f o y o u r j C O M M O D O R E 6

T R I C K S . & T I P S F O Y O U R C - 6 4t r e a s u r e c h e s t o e a s y - t o - u s e p r o g r a m m i n g t e c h n iq u e s . A d v a n c e d g r a p h i c s , e a s y d a t a i n p u t , e n h a n c e dB A S I C . C P / M , c h a r a c t e r s e t s , t r a n s f e r r i n g d a t a b e tw e e n c o m p u t e r s , m o r e .I S B N * 0 . 9 1 6 4 3 9 . 0 3 - 8 2 7 p a g e s $ 1 9 . 9 5G R A P H I C S B O O K F O C 6 f r o mf u n d a m e n t a l s t a d v a n c e d t o p i c s t h i s i m o s t c o p l e t e r e f e r e n c e a v a i l a b l e . S p r i t e a n i m a t i o n , H i r e s ,M u l t i c o l o r , l i g h t p e n , I R Q . 3 g r a p h i c s , p r o j e c t i o n s .D o z e n s o s a m p l e s .I 8 B N # 0 - 9 1 6 4 3 9 - 0 5 - 4 3 5 0 p a g e s $ 1 9 . 9 5S C I E N C E E N G I N E E R I N G O T H C - 6 4 - s t a r t s b d i s c u s s i n g v a r i a b l e t y p e s ,c o m p u t a t i o n a l a c c u r a c y , s o r t a l g o r i t h m s , m o r e .T o p i c s f r o m c h e m i s t r y , p h y s i c s , b i o l o g y ,a s t r o n o m y , e l e c t r o n i c s . M a n y p r o g r a m s .I 8 B N I 0 - 9 1 6 4 3 9 - 0 9 - 7 2 5 p a g e s $ 1 9 . 9 5

A N A T O M Y O 1 5 4 1 D I S K D R I V Eb e s t s e l l i n g h a n d b o o k a v a i l a b l e o u s i n g t h e f l o p p yd i s k . C l e a r l y e x p l a i n s d i s k f i l e s w i t h m a n y e x a m p l e sa n u t i l i t i e s . I n c l u d e s c o m p l e t e c o m m e n t e d 1 5 4 1R O l i s t i n g s .I S B N 0 0 - 9 1 6 4 3 9 - 0 1 - 1 3 2 0 p a g e s $ 1 9 . 9 5A N A T O M Y O C O M M O D O R E 6 i n s i d e r ' s g u i d e t t h e ' 6 4 i n t e r n a l s . D e s c r i b e sg r a p h i c s , s o u n d s y n t h e s i s , I / O , k e r n a l r o u t i n e s ,m o r e . I n c l u d e s c o m p l e t e c o m m e n t e d R O l i s t i n g s .F o u r t h p r i n t i n g .I S B N / / 0 - 9 1 6 4 3 9 - 0 0 3 3 0 p a g e s $ 1 9 . 9 5

I D E A S F O R U S E O N Y O U R C - 6 4W o n d e r w h a t t d w i t h y o u r ' 6 4 ? D o z e n s o f u s e f u li d e a s i n c l u d i n g c o m p l e t e l i s t i n g s f o a u t o e x p e n s e s ,e l e c t r o n i c c a l c u l a t o r , s t o r e w i n d o w a d v e r t i s i n g ,r e c i p e f i l e , m o r e .I S B N * 0 - 9 1 6 4 3 9 - 0 7 - 0 2 0 0 p a g e s $ 1 2 . 9 5

P E E K S P O K E S F O T H C - 6 4p r o g r a m m i n g q u i c k i e s t h a t w i l l s i m p l y a m a z e y o u .T h i s g u i d e i p a c k e d f u l l o t e c h n i q u e s f o t h B A S I Cp r o u r a m m e r .I S B N * 0 - 9 1 6 4 3 9 - 1 3 - 5 1 8 0 p a g e s $ 1 4 . 9 5

A D V A N C E D M A C H I N E L A N G U A G EF O C - 6 4 c o v e r s t o p i c s s u c h a v i d e o c o t r o l l e r , t i m e r a n r e a l t i m e c l o c k , s e r i a l a n p a r a l l e lI / O , e x t e n d i n g B A S I C c o m m a n d s , i n t e r r u p t s . D o z e n so s a m p l e l i s t i n g s .I S B N * 0 - 9 1 6 4 3 9 - 0 6 - 2 2 1 0 p a g e s $ 1 4 . 9 5

A D V E N T U R E Q A M E W R I T E R ' SH A N D B O O K • i a s t e p - b y - s t e p g u i d e t d e s i g n i n g a n w r i t i n g y o u r o w a d v e n t u r e g a m e s .I n c l u d e s l i s t i n g f o a a u t o m a t e d a d v e n t u r e g a m eg e n e r a t o r .I S B N * 0 4 1 5 4 3 9 - 1 4 - 3 2 0 0 p a g e s $ 1 4 . 9 5

C a l l t o d a y f o t h n a m e o y o u r n e a r e s t l o c a l d e a l e r P h o n e : ( 6 1 6 ) 2 4 1 - 5 5 1 0^ + . . . * . « • ■ • P n r u t c t a n o a n h a n H t i n n i n ^ l n ^ a < t v l A r / C C A A l A # A i M n \ H A . . ^ j a . f c j ^ * _ B H T — i r . ^ n i ^ M i

o c d e a l e r P h o n e : ( 6 1 6 )F o P ° s t a 9 e a n h a n d l i n g i n c l u d e $ 4 . 0 0 ( $ 6 . 0 0 f o r e i g n ) p e o r d e r . M o n e y o r d e ra n C h e c k s i U d o l l a r s o n l y M a s t e r c a r d - V I S A a n A m e r i c a n E x p r e s s a c c e p t e d . ' i r HM i c h i g a n r e s i d e n t s i n c l u d e 4 s a l e s t a x . C A N A D A : B o o k C e n t e r , M o n t r e a l P h o n e : ( 5 1 4 ) 3 3 2 - 4 1 5 4

Y o C a C o u n t O A b a c u s S o f t w a r eP . O . B o 7 2 1 1 G r a n d R a p i d s , M 4 9 5 1 0 T e l e x 7 0 9 - 1 0 1 P h o n e 6 1 6 / 2 4 1 - 5 5 1 0

Page 341: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 341/343

V I D E O B A S I C - 6 4 A D 5 0 g r a p h i c a n s o u n d c o m m a n d s t y o u r p r o g r a m s w i t h t h i s s u p e rd e v e l o p m e n t p a c k a g e . Y o c a d i s t r i b u t e f r e e R U T I M E v e r s i o n w i t h o u t p a y i n g r o y a l t i e s !I S B N * 0 - 9 1 6 4 3 9 - 2 6 - 7 $ 5 9 . 9 5

B A S I C C O M P I L E R 6 c o m p i l e s t h c o m p l e t e B A S I C l a n g u a g e i n t o e i t h e r f a s t 6 5 1 0m a c h i n e l a n g u a g e a n d / o r c o m p a c t s p e e d c o d e . G e y o u r p r o g r a m s i n t o h i g h g e a r a n p r o t e c t t h e m b c o m p i l i n g .I S B N * 0 - 9 1 6 4 3 9 - 1 7 - 8 $ 3 9 . 9 5

M A S T E R - 6 4 p r o f e s s i o n a l d e v e l o p m e n tp a c k a g e f o s e r i o u s a p p l i c a t i o n s . I n d e x e d f i l es y s t e m , f u l l s c r e e n m a n a g e m e n t , p r o g r a m m e r ' sa i d . B A S I C e x t e n s i o n s . 1 0 c o m m a n d s .I S B N * 0 - 9 1 6 4 3 9 - 2 1 - 6 $ 3 9 . 9 5

P A S C A L - 6 4 f u l l P a s c a l w i t h e x t e n s i o n s f o g r a p h i c s , s p r i t e s , f i l e m a n a g e m e n t , m o r e . C o m p i l e st 6 5 1 0 m a c h i n e c o d e a n d c a l i n k t A s s e m b l e r / M o n i t o r r o u t i n e s .I S B N * 0 - 9 1 6 4 3 9 - 1 0 0 $ 3 9 . 9 5

A D T R A I N I N G C O U R S E t e a c h e sy o t h l a n g u a g e o t h f u t u r e . C o m p r e h e n s i v es u b s e t o t h l a n g u a g e , e d i t o r , s y n t a xc h e c k e r / c o m p i l e r , a s s e m b l e r , d i s a s s e m b l e r . 1 2 0 +p a g e g u i d e .I S B N * 0 - 9 1 6 4 3 9 - 1 5 - 1

F O R T H - 6 4 l o a d e d w i t h h i r e s g r a p h i c s , c o p l e t e s y n t h e s i z e r c o n t r o l , f u l l s c r e e n e d i t o r , p r g r a m m i n g t o o l s , a s s e m b l e r .I S B N 0 - 9 1 6 4 3 9 - 3 2 - 1 $ 3 9 . 9 5

L A N G U A G E C O M P I L E R f u l ll a n g u a g e c o m p i l e r . C o n f o r m s t t h K e r n i g h a nR i t c h i e s t a n d a r d , b u w i t h o u t b i t f i e l d s . P a c k a g e i c l u d e s e d i t o r , c o m p i l e r a n l i n k e r .I S B N * 0 - 9 1 6 4 3 9 - 2 8 - 3 $ 7 9 . 9 5A S S E M B L E R M O N I T O R - 6 4m a c r o a s s e m b l e r a n e x t e n d e d m o n i t o r p a c k a g e .A s s e m b l e r s u p p o r t s f l o a t i n g p o i n t c o n s t a n t s .M o n i t o r s u p p o r t s b a n k s w i t c h i n g , q u i c k t r a c e , s i n g l es t e p . m o r e .I S B N * 0 - 9 1 6 4 3 9 - 1 1 - 9 $ 3 9 . 9 5

X R E F - 6 4 i n d i s p e n s i b l e t o o l f o r B A S I C p r g r a m m e r c r o s s - r e f e r e n c e s a l r e f e r e n c e s t o v a r i a b l ea n l i n e n u m b e r s .I S B N * 0 - 9 1 6 4 3 9 - 2 7 - 5 $ 1 7 . 9 5O T H E R T I T L E S A L S O A V A I LA B L E W R I T E O C A L L F O F R E E C O M P L E T E C A T A L O GC a l l t o d a y f o t h n a m e a n a d d r e s s o y o u r n e a r e s t l o c a l d e a l e r .P H O N E : ( 6 1 6 ) 2 4 1 - 5 5 1 0F o p o s t a g e a n h a n d l i n g i n c l u d e $ 4 . 0 0( $ 8 . 0 0 f o r e i g n ) p e o r d e r . M o n e y o r d e r a n c h e c k s i U . S . d o l l a r s o n l y . M a s t e r c a r d ,V I S A a n d A m e r i c a n E x p r e s s a c c e p t e d .M i c h i g a n r e s i d e n t s [ i n c l 4 s a l e s t a x . H

F R E E P E E K S P O K E S W A L LP O S T E R I N C L U D E D W I T HE V E R Y S O F T W A R E P U R C H A S E

Y o C a C o u n t O A b a c u s S o f t w a r eP . O . B o x 7 2 1 1 G r a n d R a p i d s , M l 4 9 5 1 0 T e l e x 7 0 9 - 1 0 1 P h o n e 6 1 6 / 2 4 1 - 5 5 1 0

Page 342: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 342/343

M a k e y o u r / 6 4w o r k f u l l t i m eS A L C S . C O O T . T O T A L C X S N E T P R O M T

M A K E Y O U R O W C H A R T S . . .C H A R T P A K - 6 4p r o d u c e s p r o f e s s i o n a lq u a l i t y c h a r t s a n g r a p h s i n s t a n t l y f r o my o u r d a t a . c h a r t f o r -m a t s . H a r d c o p y i t w s i z e s t p o p u l a r d o m a t r i x p r i n t e r s . $ 3 9 . 9 5 - s e aI S B t W 0 - 9 1 6 4 3 9 - 1 9 - 4

A l s o A v a i l a b l e C H A R T P L O T - 6 4 f o u n s u r p a s s e d q u a l i t y c h a r t s o p l o t t e r s . I S B N r V 0 - 9 1 6 4 3 9 - 2 0 - 8 $ 8 4 . 9 5

D E T A I L Y O U R D E S I G N S . . .C A D P A K - 6 4s u p e r b l i g h t p e n d e s i g nt o o l , e x a c t p l a c e m e n t o o b j e c t u s i n g o u r A c c u -P o i n t p o s i t i o n i n g . H a t w o c o m p l e t e s c r e e n s .D r a w L I N E S , B O X e s ,C I R C L E S . E L L I P S E S ;p a t t e r n F I L L i n g ; f r e e h a n dD R A W ; C O P Y s e c t i o n so s c r e e n ; Z O O M i a n d d e t a i l w o r k . H a r d c o p y i t w s i z e st p o p u l a r d o t m a t r i x p r i n t e r s . I S B N 0 0 - 9 1 6 4 3 9 - 1 8 - 6 $ 4 9 . 9 5

C R E A T E S P R E A D S H E E T S G R A P H S . . .P O W E R P L A N - 6 4n o o n l y p o w e r f u ls p r e a d s h e e t p a c k a g e sa v a i l a b l e , b u w i t h b u i l t i ng r a p h i c s t o o . T h 2 7 p a g e m a n u a l h a s t u t o r i a ls e c t i o n a n H E L P s c r e e n sa r a l w a y s a v a i l a b l e .F e a t u r e s f i e l d p r o t e c t i o n ;t e x t f o r m a t t i n g , w i n d o w i n g ;r o a n c o l u m n c o p y ,s o r t ; d u p l i c a t e a n d e l e t e .I S B N * 0 4 1 6 4 3 9 - 2 2 - 4

l

i

f t

D i s t r i b u t o r *B l t t l l l MH i l l D r d t r

E l p t f l M IR t t t m l sM l i c tS n i p p i n gM m t i t i o gP t r r o l l

P r o f i t

i 4 7 . 22 7 . 91 8 . 5

9 3 . 6

8 . 2 . 4 .

1 2 . 91 0 . 5

3 8 . 0

5 5 . 4

F t 3 4 . 21 3 . 42 J

1 1 3 .

2 3

1 3 1 0

4 1

7

F R E E P E E K S P O K E S P O S T E R W I T H S O F T W A R EF o n a m e a d d r e s s o y o u r n e a r e s t d e a l e r c a l l ( 6 1 6 ) 2 4 1 - 5 5 1 0

C H A R T Y O U R O W S T O C K S . . .T A S - 6 4s o p h i s t i c a t e d t e c h n i c a la n a l y s i s c h a r t i n gp a c k a g e f o t h e s e r i o u ss t o c k m a r k e t i n v e s t o r .C a p t u r e d a t a f r o mD J N / R S o W a r n e r s e v i c e s o e n t e r a n e d i td a t a a k e y b o a r d . m o i n a v e r a g e s , o s c i l l a t o r s , t r a d i n g b a n d s , l e a s t s q u a r e s , 5 v o u m i n d i c a t o r s , r e l a t i v e c h a r t s , m u c h m o r e . H a r d c o p y i t w s i z e s , m o s t p r i n t e r s . I S B N * 0 - 9 1 6 4 3 9 - 2 4 - 0 $ 8 4 . 9 5

D Y O U R O W W O R D P R O C E S S I N GT E X T O M A T - 4 8 4f l e x i b l e w o r p r o c e s s i n gp a c k a g e s u p p o r t i n g 4 o 8 0 c o l u m n s w i t h h o r i z o nt a s c r o l l i n g . C o m m a n d sa r c l e a r l y d i s p l a y e d o t h s c r e e n a w a i t i n g y o u rc h o i c e . Q u i c k l y m o v e f r o me d i t i n g t f o r m a t t i n g t

L J r

e a m n g t r o r m a n i n g t m e r g i n g t u t i l i t i e s . W i l l - * h « H | * » w o r k w i t h v i r t u a l l y a n p r i nt e r . I S B N * 0 4 1 6 4 3 9 - 1 2 - 7 $ 3 9 . 9 6

O R G A N I Z E Y O U R D A T A . . .D A T A M A T - 6 4p o w e r f u l , y e e a s y - t o -u s d a t a m a n a g e m e n tp a c k a g e . F r e e f o r md e s i g n o s c r e e n u s i n gu t 5 f i e l d s p e r e c o r d . M a x i m u m o 2 0 0 0 r e c o r d s p e rd i s k e t t e . C o m p l e t e a n df l e x i b l e r e p o r t i n g . S o r t - 1i n o m u l t i p l e f i e l d s i a n c o m b i n a t i o n . S e l e c t r e c o r d s f o r p r i nt i n g i d e s i r e d f o r m a t . I S B N * 0 - 9 1 6 4 3 9 - 1 6 - X $ 3 9 . 9 5

O t h e r t i t l e s a v a i l a b l e . F o F R E E C A T A L O G e n n a m e o n e a r e s t d e a l e r , w r i t e o r c a l l ( 8 1 6 )2 4 1 - 5 5 1 0 . F o p o s t a g e a n h a n d l i n g , i n c l u d e $ 4 . 0 0 ( $ 6 . 0 0 f o r e i g n ) p e r o r d e r . M o n e y O r d e ra n d c h e c k s i U . S . d o l l a r s o n l y . M a s t e r c a r d . V I S A a n d A m e r i c a n E x p r e s s a c c e p t e d M i c h i o a nr e s i d e n t s i n c l u d e 4 s a l e s t a x . p ^ M — i ^ _ C A N A D A : B o o k C e n t e r . M o n t r e a l ( 5 1 4 ) 3 3 2 4 1 5 4 ' ~ * f l ^

I N V E N T O R Yt a r n N u m t o o r _ _

O n h a n dL o c a t i o nR B o r d . P t C o » t

F I L ED e o c r i p t i O BP l e

R e o r d . Q t v a

J Y o u C a n C o u n t O A b a c u s S o f t w a r eP . O . B o 7 2 1 1 G r a n d R a p i d s , M l 4 9 5 1 0 T e l e x 7 0 9 - 1 0 1 P h o n e 6 1 6 / 2 4 1 - 5 5 1 0

Page 343: Printer Book for the Commodore 64 and VIC-20

8/6/2019 Printer Book for the Commodore 64 and VIC-20

http://slidepdf.com/reader/full/printer-book-for-the-commodore-64-and-vic-20 343/343

P R I N T E R B O O Kf o t h C o m m o d o r e 6

( a n d V i c - 2 0 )B y R B r u c k m a n n

K G e r i t sT W i e n s

D A T A B E C K E R B O O K

P u b l i s h e d b y » • » C « n C o u n t O | B W » I I l 5 | { f . A b a c u s t o ™ ] S o f t w a r e