AMSTRAD CPC464 User Manual page 110

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

Advertisement

The PLOT statement in line 100 is the part of the program that draws the line. It produces one dot
(pixel) on the screen for each calculation it makes in the FOR NEXT loop (lines 80-l 10) - and the
result is displayed on your screen.
The CPC464 has many simple and powerful commands - you can add to the effect of the above
progam by simply adding:
1 5 B O R D E R 6 , 9
RUN again. The border is now alternating between the colour numbers 6 and 9. The flashing rate is
set by the ' default' values. To make the program loop continuously until you press [ESC]ape (twice to
break out of the program, once to suspend operation), add:
1 2 0 G O T O 5 0
See that the flashing border did not stop when the program did - this is because the border is
controlled indepedently of the rest of the program. To stop the flashing and set the border to bright
blue, press [ESC] twice, then change line 15 to
1 5 B O R D E R 2
RUN the program, and the flashing stops.
To change the colour of the curve and the background, you must change the colour of the INK in
lines
and 40. When you LIST the program, it should then look like:
30
1 0 R E M D R A W S I N E WAVE
1 5 B O R D E R 2
2 0 M O D E 2
3 0 I N K 1,2
4 0 I N K 0 , 2 0
50 CLS
6 0 DEG
7 0 O R I G I N 0 , 2 0 0
8 0 F O R n = 0 T O 7 2 0
9 0 y = S I N ( n )
1 0 0 P L O T n * 6 4 0 / 7 2 0 , 1 9 8 * y , l
110 NEXT
1 2 0 G O T 0 5 0
The number 1 at the end of the PLOT statement in line 100 tells the computer to plot the curve in
the colour specified by the INK 1 command in line 30. Check the definition of the PLOT statement in
the keyword listing of Chapter 8 and you will see exactly how the various parts of this statement
work.
If you look closely at the curve being plotted on the screen, you will see that it is not a continuous
line, but is broken in many fine segments. The smallest individual segment is an example of a ' pixel'
described earlier.

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents