AMSTRAD CPC464 User Manual page 113

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

Advertisement

3 8 0
D R A W c x % + p x % ( s t, x % ) , c y % + p y % ( s t , x % ) ,
l + ( s t M O D 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 + ( s t M O D 3 )
4 0 0 N E X T x %
4 1 0 I F s t = 5 T H E N R E T U R N
4 2 0 l c ( s t ) = 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 ) )
4 5 0 s t = s t + l s t = s t + l
46 0 G O S U B 3 4 0
4 7 0 s t = s t-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
5 0 0 R E T U R N
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
5 3 0 I N K 1 , i k ( 1 )
5 4 0 R E T U R N
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 E N 550
5 7 0 I N K 2 , i k ( 2 )
5 8 0 R E T U R N
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
6 1 0 I N K 3 , i k ( 3 )
6 2 0 R E T U R N
When you RUN this program, it will ask you a question (line
results. The program will then display the message Calculating , and display a dot . every few
seconds (line
to indicate that it is still ' thinking' to itself and confirm that the program is still
245)
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
discarded until space is made by allowing those in the queue to work their way through.
- answer 3 for the speediest
40)
EVERY
command gets

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents