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:
10 INK 0,0:I N K 1 , 2 6 : I N K 2 , 6 : I N K 3 , 1 8 :BORDER 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
30 mode l:DEG
40 PRINT "3,4 or 6 sided pattern ? ";
50 LINE INPUT 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
80 IF p$="6" THEN sa=150:GOTO 100
90 GOT0 50
1 0 0 P R I N T : P R I N T “Calculating”;
1 0 5 I F p$="3" THEN ORIGIN 0,-50,0,640,0,400
E L S E O R I G I N 0 , 0 , 0 , 6 4 0 , 0 , 4 0 0
1 1 0 DIM cx(5),cy(5),r(5),lc(5)
1 2 0 DIM np(5)
1 3 0 D I M p x % ( 5 , 8 1 ) , p y % ( 5 , 8 1 )
1 4 0 s t = l
150 cx(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
180 NEXT st
190 FOR st=l TO 5
2 0 0 lc(st)=0:np(st)=0
2 1 0 np(st)=np(st)+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 )
245 IF (lc(st) MOD 60)= 0 T H E N PRINT ".";
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 CLS:ink 1,2
270 st=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 GOT0 330
3 4 0 R E M d r a w c i r c l e plus 3,4 or 6 others
around it
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 MOVE cx%,cy%
/more
Summary of Contents for CPC464
Page 1: ......
Page 102: ...PRINT 10 AND 12 Results in 8 PRINT 10 AND 1000 Results in 8 again ...
Page 118: ...TO DO DRAW THIS PAGE ...
Page 219: ...actual value may be made to vary during the execution of a program ...
Page 240: ...Text and WINDOW planner Mode 2 80 Columns ...
Page 241: ......