Classic Computer Magazine Archive PROGRAM LISTING: 88-11/LSPEEDC.TXT


LIGHTSPEED C FRACTAL GRAPHICS

BY MATT RATCLIFF

   Here's everything you need to grow
your own Julia fractal curves using
Ralph Walden's Lightspeed C and your
Atari 8-bit computer:

   You'll need MANDEL.COM,
MANVIEW.COM and RUNTIME.OBJ from this
month's disk.  RUNTIME.OBJ is from
the LIGHTSPEED C support library.  It
is automatically loaded whenever you
run MANDEL.COM or MANVIEW.COM.
(MANDEL.COM generates the fractal
pictures and MANVIEW.COM displays
them.)

   Although the Lightspeed C compiler
is fast, MANDEL.COM isn't.  Each
image will take at least four hours,
and maybe more than 24, depending on
the colors and number of iterations
chosen, but the results are worth the
wait.

GETTING STARTED
   From the DOS menu, choose option
'L' to Load D:MANDEL.COM.  When the
program begins, you'll be asked
whether you want to make two-color or
four-color fractal patterns.  The
two-color pictures are done in
GRAPHICS 8 and the four-color
pictures use GRAPHICS 7.5 (XL and XE
only).  The two-color pictures take
longer to generate, since twice as
many points are calculated and
displayed.

ALARM MODE
Next, the program will ask if you
want to use its "alarm" mode.  Since
the fractal images take so long to
grow, you are not likely to sit in
front of the monitor until it is
finished. The alarm mode makes it
easy to disconnect your disk drive
from your spare Atari (that's growing
your fractal curves) and attach it to
your primary computer.  Once the
fractal curves have been drawn, an
alarm will sound.  Now, reconnect the
disk drive and press the joystick
button to shut off the alarm.
Finally, follow the menu prompts to
save the image to disk.    IMPORTANT:
Be sure your disk drive is turned OFF
whenever you connect and disconnect
it from your Atari!

   Next, the program will prompt you
for a value for "pmax", the maximum
real number axis value.  This should
be between -2.05 and 0.55.  You are
then prompted for "pmin," which
should be less than pmax, of course.
The following prompt is for "qmax",
the maximum imaginary value to plot
along the vertical axis.  (Values
above 1.25 are not very interesting.)
The qmin is automatically caculated,
so the height of the plot is the same
as the width.

   Once the plot limits have been
entered, you are asked for the
maximum number of iterations.  Values
between 30 and 50 result in the best
displays, in the shortest time.  Due
to the way the program is written,
the iteration count should always be
a multiple of the total number of
colors (an even number for two color
plots, for example), otherwise the
resulting colors might not be what
you expect.

   Next, you are prompted for a disk
filename for your fractal image.
Just type the name; the default drive
number and extender will be taken
care of.  (You can enter a different
drive number if you want, however.)
Finally, all your data is redisplayed
and you are given the opportunity to
press [ESCAPE] to abort or [RETURN]
to begin the plot.

   The graphics display is enabled
and filled with white or blue,
(depending on the number of colors
selected), and the screen will
suddenly go blank. MANDEL.COM uses
Lightspeed's "Fast" command, which
turns off the ANTIC chip, thereby
turning off your screen.  This speeds
up the calculations by 2% to 15%.

   If you are curious to see your
image-in-progress, just press the
joystick button to see the display.
When the button is released, the
screen is blanked again.

   If you chose a plot area that is
pretty much a dead zone -- all black
-- then you can press [CONTROL] [A]
to abort the plot.  The program saves
the file anyway, just in case. Since
black points take longer to calculate
than colored ones, MANDEL.COM fills
the screen before plotting, making it
easier to see the program's progress.

MANVIEW
   Load MANVIEW.COM from DOS to take
a look at your creations.  You are
first asked whether you'll view two-
or four-color pictures, and then
you're prompted for a file
specification for a directory of
picture files.  If you just press
[RETURN], a default of D1:*.PI2 or
D1:*.PI4 will be used.

   Next, type in the filename of the
picture and MANVIEW will display it.
Press [ESCAPE] to return to DOS, or
[RETURN] to view another picture.
Should you return to the main menu,
the parameters used for the previous
plot are displayed.

   Pmax and pmin values should be
chosen from the horizontal axis,
labeled along the bottom of the
graphic.  Qmax can be selected from
the vertical axis, labeled to the
left of the page.

Back to previous page