P L O T F R A C . C By Ronald F. Merts Copyright (c) 1987, 1988 Oklahoma Digital Systems This software is provided as a freeware service to the public. You may distribute, use and modify the program freely; although, I do request that you distribute this short documentation file only with the original files. The ARChive file PLOTFRAC.ARC should contain the following files: GRAFIX.H The include file for using the GRAFIX functions. GRAFIX.C Source code for the GRAFIX functions. PLOTFRAC.EXE Fractal Graphics Program (CGA & EGA support) PLOTFRAC.C Source code for the above program. README.TXT This file. The program can plot functions in as little as 2 hours; or some take as long as 8 hours. These times should be substantially reduced with the installation of an 8087 or 80287 math co-processor. When I changed from a 8088-2 to an NEC V20-8 I achieved a 30% time savings. One thing to remember is that the closer you get to the Mendlebrot set, the longer the iterations take; and as you zoom in closer to the boundary, your plots can begin to take quite a long time. The programs are compiled with the 8087/8087-emulator routines in them; so if you don't have an 8087 installed the emulation routines will be used; and if you do have an 8087 installed, it will be used. The program's inputs should be fairly straight forward; but there are a few I will discuss. The parameter M is used as a boundary check. If X*X + Y*Y is greater than M and you haven't made K (I'll get to parameter K in a minute) passes; you can plot a color -- or white if you're in 640 X 200 CGA mode. Choose M carefully; I suggest no more than 100; or you may be getting a LARGE black region. The parameter K is how many colors you have available. I suggest lying and saying you have 200 or so (I have had it down to 80 and changed the M to be 40 and produced satisfactory results). Why? Well if you tell it you have 4 colors; then you will be allowing it to only make 4 passes through the function; and your results will be far less than satisfactory. Page 2 The program is not very smart about it's file access; so I don't suggest trying anything tricky with the filenames. I usually name them something like MAP_1.PIC and let it go to work. A word of warning; the 320 X 200 plots take up 64038 bytes of disk space, the 640 X 200 plots require 128038 bytes of disk space, and the 640 X 350 plots take up 224038 bytes of disk space. You can reduce this by up to 95% or so by using the program ARC or something similar. You can't read them while they are in the archive; but you can store 8-12 of them in one archive that takes up as much or less space than one 320 X 200 plot. But it is your disk-space... I have also included several extra features not documented in the program. These; although not sophisticated, do help. After a plot is completed, it is automatically saved. After being saved, or after loading an old picture; you may do several things to it. Here is a list of the commands. All you do is press the key, do NOT press return unless you want to exit the picture. Note: means press the, return or "enter" key; means press the "Esc" or "Escape" key. Key (Lower,Upper) Description ----------------------------------------------- p,P Changes the Color Palette. b,B Changes the background color between any of the 16 colors. d,D Dump picture to Epson or IBM com- patable dot-matrix printer. c,C Chop picture (*) , Return to main menu. (*) See below. Page 3 The P command allows you to change between the IBM CGA's 2 color palettes (Red, green, Yellow and the background color or, white, Cyan, Magenta and the background color). The B command allows you to change the background color to any of the 16 supported background colors of the IBM CGA. This command and the P command are only available with the 320 X 200 mode plot. The D command allows you to print the Black region on any Epson compatable printer...including the IBM dot matrix printer, Seikosha SP-1000, Epson MX-80 with Graftrax, RX and FX. If your picture has no black; then nothing will be printed...sorry I haven't had time with college to figure out shading yet...(note...yet!) The C command (this is bizarre) allows you to remove every-other vertical column starting in column 1. Why? Well, I was wanting to zoom in on a region; and rather than count those dots I decided to just thrash the picture since it could be reloaded easily. If you are wanting to find a new starting value it can be helpful; then all you have to do is calculate a starting value based on the column num- ber of the screen. There is also an H command; but it does not work properly. Remember that the screen location 0,0 is the upper left of the screen; while it is preferable to have it in the lower left. The GRAFIX routine observes the screen locations (0,0 is upper left, 319,199 is lower right in 320 X 200 mode). It is up to the "plotfrac()" function to handle the conversion. If you have any comments, I can be reached via 300/1200 baud modem (8 bits, 1 stop, no parity) at (405) 799-2638 -- The Revelstone BBS. I am User #2. Page 4 ACKNOWLEDGEMENTS I want to thank Dr. A. L. Merts of the Los Alamos National Laboratory (my father) for providing me the inspiration for these programs and pictures; and for giving me the chance to enhance my education my attending college....Thank you father and mother. H.-O. Peitgen and P. H. Richter for the book THE BEAUTY OF FRACTALS, "Images of Complex Dynamical Systems". Page 5 PROGRAMMING NOTES These notes are for those who are interested in digging into the programs and tinkering. These all were written in Microsoft 'C' 4.00 with IBM PC-DOS 3.10. Because of the large amount of arrays and other storage I chose to compile these as Large Models (allow multiple 64K data segment, and multiple 64K program segments). These were linked with the Microsoft Overlay Linker V3.51 with the /NOIGNORECASE option ( /NOI -- The function plotfrac uses K and k as variables; and the GRAFIX routines use upper and lower case variables as well). The GRAFIX functions utilize the ROM BIOS Int 10h functions to draw graphics directly to the 320 X 200 4-color or b/w, or the 640 X 200 monochrome graphics pages of the IBM CGA (Color Graphics Adapter), as well as to the 640 X 350 16-color page of the EGA via the BIOS Interrupt. In the save_pic() function you will see some manipulating of the byte values on the screen just before saving; this is to prevent any 00's being written; which really seemed to irritate the Microsoft 'C' disk write routines. They are automatically adjusted by the load_pic() function before they are redrawn. With Version 3.00, I stopped using the BIOS extension windowing routines which were previously used by this program. For this reason, I am no longer able to supply all of the source code. The new windowing routines are from Vitamin-C, a commercially available library. With a little bit of studying, one should be able to figure out the routines used an either work around them, or replace them with their own. I am working on at least one more revision to the program which will allow me to directly write to the EGA video, without using the BIOS. This should further speed up the program as the EGA's BIOS is not especially fast. The GRAFIX routines are fully supportive of the majority of the CGA and EGA Graphics Modes. They may be used to do just about anything involving graphics. They are not fancy, and they could definitely stand some sort of "clean-up"; but they do work reliably.