New - AMSTRAD CPC464 User Manual

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

Advertisement

NEW

We have now started to use the keyword new before typing in the program itself.
This tells the computer to fully clear the memory in a similar way to reset ([CTRL] [SHIFT] [SHIFT]
and [ESC] keys). However, it differs in that the screen is not cleared; only the memory. This is useful
if you want to keep the old program on the screen for reference when writing a new program.
Plotting the points of a circle.
In the previous program we plotted points with respect to the bottom left corner of the screen. If we
now wanted to position a circle in the centre of the screen we would have to plot the centre of the
circle at co-ordinates 320,200, then position all points of the circle relative to the centre position, by
adding on the centre position co-ordinates.
A program to draw a circle would then be like this. Type in:
new
5 cls
1 0 f o r a = 1 t o 3 6 0
15 deg
2 0 p l o t 3 2 0 , 2 0 0
3 0 p l o t 3 2 0 + 1 9 0 * c o s ( a ) , 2 0 0 + 1 9 0 * s i n ( a )
40 next
run
The radius of the circle can be reduced by lowering the 190 figure (190 refers to pixels).
To see the effect of the circle being plotted differently (in radians), delete line 15 from the program by
typing in:
15
To see a solid circle drawn by lines from the centre, edit line 30, replacing the word plot with the
word draw . Line 30 will then be:
d r a w 3 2 0 + 1 9 0 * c o s ( a ) , 2 0 0 + 1 9 0 * s i n ( a )
Try this with and without line 15 again.
You will note that line 40 of this program is next instead of next a
It is permissable to simply type in next in programs. The computer will work out which for
expression the next is to be associated with. In programs where there are numerous for and next
loops you may wish to add the appropriate name after the word next in order to identify the next
statement when studying the program.

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents