
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:
15 BORDER 6,9
R U N
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:
120 GOTO 50
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
15 BORDER 2
R U N
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
30
and 40. When you LIST the program, it should then look like:
1 0 R E M D R A W S I N E WAVE
15 BORDER 2
20 MODE 2
3 0 I N K 1,2
4 0 INK 0,20
50 CLS
6 0 DEG
70 ORIGIN 0,200
80 FOR n=0 TO 720
9 0 y=SIN(n)
1 0 0 P L O T n * 6 4 0 / 7 2 0 , 1 9 8 * y , l
110 NEXT
120 GOT0 50
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.
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: ......