program. You can change the size and position of the engine by changing the
values of scale'%, xstart% and ystart%.
Information can be passed to a procedure from the main program:
10 MODE 130
20 PR0CcircLe(400,300,200)
30 PR0CcircLe(600,600,100)
40 PR0Ccircloe(690,750,50)
50 END
60 DEFPROCcircle(xcentre%,ycentre%,radius%)
70 MOVE xcentre%,ycentre%
80 PLOT 157,xcentre%+radius%,ycentre%
90 ENDPROC
The values in brackets at line 20 are called parameters. The computer takes
the parameters and stores them in the variables xcentre%, ycentre%, and
radius% in line 60 when it obeys the procedure call. It uses these variables in
the rest of the procedure to draw a circle with its centre at 400,300 and a radius
of 200.
Lines 30 and 40 demonstrate how this same procedure can be used whenever a
circle is drawn. Only the parameters need to be changed.
A procedure like PROCcircle is very useful because:
-- it can be used many times in the same program with different parameters to
give. different results;
-- it can be used even if you do not know or remember how the procedure
works;
-- it can be used in other programs.
You might use xcentre% and ycentre% to hold the coordinates of the screen
centre in a program. It seems as if these values will be lost if PROCcircle is used
in the same program, because this also has variables called xcentre% and
ycentre%:
16 MODE 130
15 xcentre%=640:ycentre%=512
20 PR0Ccircle(400,300,200)
30 PR0Ccircle(600,600,100)
40 PR0Ccircle(690,750,50)
45 PRINT''xcentre% remains " ;xcentre%
46 PRINT"ycentre% remains ";ycentre%
50 END
60 DEFPR0Ccircle(xcentre% ,ycentre%,radius%)
C 33