Origin; Gosub Return - AMSTRAD CPC464 User Manual

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

Advertisement

ORIGIN

In the previous program we used the plot command to plot the centre of a circle, then added the x,y
co-ordinates to this centre position. Instead of adding these centre co-ordinates to the point plotted,
we can use the origin command. This will position the centre of the circle, then position the x,y co-
ordinates of all the points on the circumference (in 1 degree steps) from the origin. To see this type
in:
new
5 cls
1 0 f o r a = 1 t o 3 6 0
15 deg
2 0 o r i g i n 3 2 0 , 2 0 0
3 0 p l o t 1 9 0 * c o s ( a ) , 1 9 0 * s i n ( a )
40 next
run
Again, you can alter lines
or
to remove deg or draw the solid circle from the centre.
15
30
To plot four smaller circles on the screen, type in the following program:
new
5 cls
1 0 f o r a = 1 t o 3 6 0
15 deg
2 0 o r i g i n 1 9 6 , 2 8 2
3 0 p l o t 5 0 * c o s ( a ) , 5 0 * s i n ( a )
4 0 o r i g i n 4 4 2 , 2 8 2
5 0 p l o t 5 0 * c o s ( a ) , 5 0 * s i n ( a )
6 0 o r i g i n 1 9 6 , 1 1 6
7 0 p l o t 5 0 * c o s ( a ) , 5 0 * s i n ( a )
8 0 o r i g i n 4 4 2 , 1 1 6
9 0 p l o t 5 0 * c o s ( a ) , 5 0 * s i n ( a )
1 0 0 n e x t
run
Once again, you can remove line 15 and modify lines 30,50,70 and 90 to use
DRAW command.
the

GOSUB RETURN

If there are a set of instructions within a program which are to be carried out a number of times,
these instructions can be typed as a sub-routine, and can be called into action by the command gosub
followed by the line number.
The end of a gosub routine is marked by typing in the instruction return.
At this point, the computer will return to the line that followed the gosub command which it had just
obeyed.

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents