380 DRAW cx%+px%(st, x % ) , c y % + p y % ( s t , x % ) ,
l+(st MOD 3)
3 9 0 D R A W c x % + p x % ( s t , x % + l ) , c y % + p y % ( s t ,
x%+l),l+(st MOD 3)
400 NEXT x%
4 1 0 I F s t = 5 T H E N R E T U R N
420 lc(st)=0
4 3 0 c x ( s t + l ) = c x ( s t ) + l . 5 * r ( s t ) * S I N ( s a + l c ( s t ) )
4 4 0 c y ( s t + l ) = c y ( s t ) + l . 5 * r ( s t ) * C O S ( s a + l c ( s t ) )
450 st=st+l st=st+l
460 GOSUB 340
470 st=st-1
4 8 0 l c ( s t ) = l c ( s t ) + 2 * s a
4 9 0 I F ( l c ( s t ) M O D 3 6 0 ) < > 0 T H E N 4 3 0
500 RETURN
5 1 0 i k ( l ) = l + R N D * 2 5
5 2 0 I F i k ( l ) = i k ( 2 ) O R i k ( l > = i k ( 3 ) T H E N 5 1 0
530 INK 1,ik(1)
540 RETURN
5 5 0 i k ( 2 ) = 1 + R N D * 2 5 i k ( 2 ) = 1 + R N D * 2 5
5 6 0 I F i k ( 2 ) = i k ( l ) O R i k ( 2 ) = i k ( 3 ) T H
EN 550
570 INK 2,ik(2)
580 RETURN
5 9 0 i k ( 3 ) = 1 + R N D * 2 5 i k ( 3 ) = 1 + R N D * 2 5
6 0 0 I F i k ( 3 ) = i k ( l ) O R i k ( 3 ) = i k ( 2 ) T H E N 5 9 0
610 INK 3,ik(3)
620 RETURN
When you RUN this program, it will ask you a question (line
40)
-
answer 3 for the speediest
results. The program will then display the message
C a l c u l a t i n g
,
and display a dot
.
every few
seconds (line
245)
to indicate that it is still ‘thinking’ to itself and confirm that the program is still
running.
The subroutines called by lines 300-320 flash the different coloured inks at the rates determined by
the E V E R Y command. If you want to slow down the flashing, E D I T lines 300-320 to read:
3 0 0 E V E R Y 2 5 0 , l G O S U B 5 1 0
3 1 0 E V E R Y 1 5 0 , 2 G O S U B 5 5 0
3 2 0 E V E R Y 5 0 , 3 G O S U B 5 9 0
To see what you have done, look up the E V E R Y command in Chapter 8, it’s one of the most useful
features in AMSTRAD BASIC. One interesting effect of the E V E R Y command is the way it stacks
up requests to do something if the program is interrupted by pressing the
[ESC]
key - only ONCE.
Pause the operation of the program for a few seconds by doing this, then restart by pressing ‘any
key’. The display will flash frantically as the ‘queued’ timing instructions rush through to catch up.
There’s only a finite amount of space in the queue, so after a while, the new
EVERY
command gets
discarded until space is made by allowing those in the queue to work their way through.
Содержание CPC464
Страница 1: ......
Страница 32: ...or you can type 3e1 1e1 ENTER 300 2 3000x1000 Type 3e3 1e3 ENTER 3000000 3 3000x0 001 Type 3e3 1e 3 ENTER 3 ...
Страница 102: ...PRINT 10 AND 12 Results in 8 PRINT 10 AND 1000 Results in 8 again ...
Страница 118: ...TO DO DRAW THIS PAGE ...
Страница 219: ...actual value may be made to vary during the execution of a program ...
Страница 240: ...Text and WINDOW planner Mode 2 80 Columns ...
Страница 241: ......
Страница 245: ...Sound envelope Music planner sheet ...