AMSTRAD CPC464 User Manual page 112

Cpc464 colour personal computer 64k
Hide thumbs Also See for CPC464:
Table of Contents

Advertisement

Here' s an example of a program that uses all the items mentioned so far, and introduces a couple
more useful concepts. See how the first line (10) sets up the colour and ink conditions to make sure
that whatever was in the memory of the CPC464 at the time is reset to produce the expected results:
1 0 I N K 0 , 0 :I N K 1 , 2 6 : I N K 2 , 6 : I N K 3 , 1 8 : B O R D E R 0
2 0 R E M t h i s p r o g r a m s d r a w s p a t t e r n s
3 0 m o d e l : D E G
4 0 P R I N T " 3 ,4 o r 6 s i d e d p a t t e rn ? ";
5 0 L I N E I N P U T p $
6 0 I F p $ = " 3 " T H E N s a = 1 2 0 : G O T O 100
7 0 I F p $ = " 4 " T H E N s a = 1 3 5 : G O T O 100
8 0 I F p $ = " 6 " T H E N s a = 1 5 0 : G O T O 1 0 0
9 0 G O T 0 5 0
1 0 0 P R I N T : P R I N T " C a l c u l a t i n g " ;
1 0 5 I F p $ = " 3 " T H E N O R I G I N 0 ,-5 0 , 0 , 6 4 0 , 0 , 4 0 0
E L S E O R I G I N 0 , 0 , 0 , 6 4 0 , 0 , 4 0 0
1 1 0 D I M c x ( 5 ) , cy(5),r( 5 ) , l c ( 5 )
1 2 0 D I M n p ( 5 )
1 3 0 D I M p x % ( 5 , 8 1 ) , p y % ( 5 , 8 1 )
1 4 0 s t = l
1 5 0 c x ( l )= 3 2 0 : c y ( l ) = 2 0 0 : r ( l ) = 8 0
1 6 0 F O R s t = l T O 4
1 7 0 r ( s t + l ) = r ( s t ) / 2
1 8 0 N E X T s t
1 9 0 F O R s t = l T O 5
2 0 0
l c ( s t ) = 0 : n p ( s t ) = 0
2 1 0
n p ( s t ) = n p ( s t ) + l
2 2 0
p x % ( s t , n p ( s t ) ) = r ( s t ) * S I N ( l c ( s t ) )
230
p y % ( s t , n p ( s t ) ) = r ( s t ) * C O S ( L c ( s t ) )
2 4 0
l c ( s t ) = l c ( s t ) + 3 6 0 / r ( s t )
2 4 5
I F ( l c ( s t ) M O D 6 0 ) = 0 T H E N P R I N T " . " ;
2 5 0
I F l c ( s t ) < 3 6 0 T H E N 2 1 0
252
p x % ( s t , n p ( s t ) + l ) = p x % ( st,l)
2 5 4
py%( s t , n p ( s t > + l ) = p y % ( s t , l )
2 6 0 N E X T s t
2 6 5 C L S : i n k 1,2
2 7 0 s t = l
2 8 0 G O S U B 340
29 0 L O C A T E 1,1
3 0 0 E V E R Y 2 5 , l G O S U B 510
3 1 0 E V E R Y 1 5 , 2 G O S U B 550
3 2 0 E V E R Y 5 , 3 G O S U B 590
5 3 0 G O T 0 3 3 0
3 4 0 R E M d r a w c i r c l e p l u s 3 , 4 or 6 o t h e r s
a r o u n d i t
3 5 0 c x % = c x ( s t ) : c y % = c y ( s t ) : l c ( s t )=0
3 6 0 F O R x % = 1 T O np(st)
3 7 0
M O V E c x % , c y %
/more

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents