Star Micronics Radix User Manual page 163

Table of Contents

Advertisement

Printing
With
Dot Graphics
149
600 '
610 1 Subroutine to plot a circle
620 '
630 RAD = 4
640 Xl = 19
: Yl = 10
658 FOR ANGX = 0 TO 360 STEP 10
660 RANG = ANG%*6.28/360
670 X2
= RAD*COS(RANG)+lfJ : Y2 = RAD*SIN(RANG)+l@
680 GOSUB 270
690
NEXT ANG%
700
RETURN
How the program
works
In the program
above,
we've
created
an array called
BIT%,
which
is dimensioned
in line
50. You'll
note
that
instead
of
I
i
.
._-'- ----I.
_
!
,/
Y.
1"
'x.
I
/
/
_
I
'I
i
j
'.
':,,,,...
,;Jf
1
,..'
'.._
----
-...
f
-_a-
using numeric
constants
to dimension
the array, we used the vari-
ables MAXCOL%
and MAXROW%.
This way, if your computer
has enough
memory
and you want to plot a larger image,
all you
need to change
are the values
in line 40. The array MASK%
con-
tains the values of the dots. (In order to make this program
run on
the most computers,
we're using only six pins for graphics.
With
many computers,
you can use all eight available
pins.) In lines 90
and 100 we've defined
some other variables
you'll be interested
in:
LX, LXFAC,
LY, and LYFAC are used as scaling
factors.
By chang-
ing these values, you can change
the size of your printed
image or
even distort
it (you can, for example,
make our circle
print as an
ellipse).
Experiment
a little bit!
The main calculations
for plotting
the image are done in the
subroutine
starting
at program
line 600. This is where you put the
formulas
that you want to plot. By changing
just the lines after 600
(with some
creative
mathematics!)
you can plot any function-
limited
only by your imagination.
Some
examples
are shown
at
the end of this section.

Advertisement

Table of Contents
loading

Table of Contents