Article 931 of net.micro.amiga: ion: version B 2.10.2 9/17/84 chuqui version 1.9 3/12/85; site unisoft.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site caip.RUTGERS.EDU Path: unisoft!lll-lcc!lll-crg!gymble!umcp-cs!seismo!caip!DEC.BANKS From: DEC.BANKS@MARLBORO.DEC.COM Newsgroups: net.micro.amiga Subject: ABasiC MandelHack Message-ID: <653@caip.RUTGERS.EDU> Date: 8 Dec 85 12:04:41 GMT Date-Received: 8 Dec 85 15:50:23 GMT Sender: daemon@caip.RUTGERS.EDU Organization: Rutgers Univ., New Brunswick, N.J. Lines: 766 From: Dawn Banks Herein lies the ABasiC source for the Mandelbrot zoom program. This distribution consists of two ABasiC programs: MandelMung.bas, which contains the source for the assembly language subroutine, and Mandelbrot.bas, which is the actual zoom program. To bootstrap these programs, run ABasiC, and give the following commands: RUN MandelMung ' which should take about 1 minute RUN Mandelbrot ' which should take about 15 minutes Running Mandelbrot the first time will cause it to compute the entire set (which is the part that takes 15 minutes), and write it to disk as MandelSet.320. This is a low resolution, 4 bit plane image in which each point is computed to 250 iterations. Any time Mandelbrot.bas is run after this, it will read either MandelSet.640 or MandelSet.320 and display it on the screen. Once done, it waits for the left mouse button to be pressed. When pressed, it prompts for a command. A complete list of available commands may be obtained by typing the "HELP" command. When typing commands, always type the command name, followed by a carraige return. Mandelbrot.bas will then prompt for all subsequent arguments needed to complete the command. Some of the more interesting commands are: SET which prompts for the X and Y coordinates, the DeltaX (difference between the X value at the right and left of the screen - not the difference between single points on the screen), screen resolution (0 or 1 as given to the basic SCREEN statement), bit plane count and iteration count. When prompting for each of these values, the default value will be given in parenthesis. MOUSE Use the mouse to set the coordinates. Move the pointer to the lower left of the desired coordinate "box", press the left mouse button, then move the pointer to the upper right of the box and press the mouse button again. Note that due to several bugs, this command will not work properly if issued after a set command, nor will the set command work properly if issued after a MOUSE command. SHOW Show the current coordinate settings GO Compute the set as given by the coordinates set by the SET or MOUSE commands. READ Read and display an existing set SAVE Save the current set (may not be done after a SET or MOUSE command, unless the set has been computed via the GO command). This will also save the coordinate data with the actual picture. EXIT Exit to ABasiC. Program notes: In order to speed computation of the set, an assembly language subroutine which does the actual per point iteration. Code readers will notice that it does not use the normal floating point representation. Since virtually all the points being computed have an absolute value in the range of .01 to 1.99, a floating binary representation isn't absolutely necessary. As a result, a 32 bit fixed point representation has been chosen in which the high order bit is the sign, the next higher bit is considered to be "before" the decimal point, and the remaining 30 bits are considered fraction. This yields an exclusive range of 0 to 2, and in many cases produces a couple more bits of precision than the normal 32 bit floating point, as well as reducing execution time. This results in low resolution screen computation time of between 15 - 45 minutes for most regions. As is well documented in the USENET Net.Micro.Amiga mailing list, high resolution screens of more than 2 bit planes will steal compute cycles from the 68000 processor. It is suggested that when computing high resolution sets, the screen should be "hidden" under a screen of fewer bit planes. Fortunately, the workbench screen fits this. Typing some combination of {Amiga key} N or M will bury the ABasiC screen without affecting the run, except to speed it up. Two last points: you're going to need at least 512K bytes of memory, and using 5 bit plane low resolution screens aren't going to do much for you, as the program doesn't set the last 16 color registers, which are by default mapped to the same colors as the first 16 registers. It wouldn't take much work to modify the program to do this, but we didn't. Happy hacking!