Home » Archimedes archive » Micro User » MU 1991-09.adf » PD-Stuff » FracTrace/FTS-Files/MandelPot
FracTrace/FTS-Files/MandelPot
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » Archimedes archive » Micro User » MU 1991-09.adf » PD-Stuff |
Filename: | FracTrace/FTS-Files/MandelPot |
Read OK: | ✔ |
File size: | 01C8 bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
\ MandelPot \ Calculates the M-potential of a complex number \ stored in creal,cimag var creal, cimag, zreal, zimag, ztemp var iter, potential creal=0; cimag=1.01 zreal=0; zimag=0; iter=0 repeat ztemp=zreal zreal=zreal*zreal-zimag*zimag+creal zimag=2*ztemp*zimag+cimag iter=iter+1 until zreal*zreal+zimag*zimag>4 OR iter>127 if iter<=127 potential=0.5*LOG(zreal*zreal+zimag*zimag)/(2^iter) else potential=0 endif show potential
00000000 5c 20 4d 61 6e 64 65 6c 50 6f 74 0a 5c 20 43 61 |\ MandelPot.\ Ca| 00000010 6c 63 75 6c 61 74 65 73 20 74 68 65 20 4d 2d 70 |lculates the M-p| 00000020 6f 74 65 6e 74 69 61 6c 20 6f 66 20 61 20 63 6f |otential of a co| 00000030 6d 70 6c 65 78 20 6e 75 6d 62 65 72 0a 5c 20 73 |mplex number.\ s| 00000040 74 6f 72 65 64 20 69 6e 20 63 72 65 61 6c 2c 63 |tored in creal,c| 00000050 69 6d 61 67 0a 20 20 20 20 20 20 20 20 20 20 20 |imag. | 00000060 20 20 20 0a 76 61 72 20 63 72 65 61 6c 2c 20 63 | .var creal, c| 00000070 69 6d 61 67 2c 20 7a 72 65 61 6c 2c 20 7a 69 6d |imag, zreal, zim| 00000080 61 67 2c 20 7a 74 65 6d 70 0a 76 61 72 20 69 74 |ag, ztemp.var it| 00000090 65 72 2c 20 70 6f 74 65 6e 74 69 61 6c 0a 0a 63 |er, potential..c| 000000a0 72 65 61 6c 3d 30 3b 20 63 69 6d 61 67 3d 31 2e |real=0; cimag=1.| 000000b0 30 31 0a 7a 72 65 61 6c 3d 30 3b 20 7a 69 6d 61 |01.zreal=0; zima| 000000c0 67 3d 30 3b 20 69 74 65 72 3d 30 0a 0a 72 65 70 |g=0; iter=0..rep| 000000d0 65 61 74 20 20 20 0a 20 7a 74 65 6d 70 3d 7a 72 |eat . ztemp=zr| 000000e0 65 61 6c 0a 20 7a 72 65 61 6c 3d 7a 72 65 61 6c |eal. zreal=zreal| 000000f0 2a 7a 72 65 61 6c 2d 7a 69 6d 61 67 2a 7a 69 6d |*zreal-zimag*zim| 00000100 61 67 2b 63 72 65 61 6c 0a 20 7a 69 6d 61 67 3d |ag+creal. zimag=| 00000110 32 2a 7a 74 65 6d 70 2a 7a 69 6d 61 67 2b 63 69 |2*ztemp*zimag+ci| 00000120 6d 61 67 0a 20 69 74 65 72 3d 69 74 65 72 2b 31 |mag. iter=iter+1| 00000130 0a 75 6e 74 69 6c 20 7a 72 65 61 6c 2a 7a 72 65 |.until zreal*zre| 00000140 61 6c 2b 7a 69 6d 61 67 2a 7a 69 6d 61 67 3e 34 |al+zimag*zimag>4| 00000150 20 4f 52 20 69 74 65 72 3e 31 32 37 0a 0a 69 66 | OR iter>127..if| 00000160 20 69 74 65 72 3c 3d 31 32 37 0a 20 70 6f 74 65 | iter<=127. pote| 00000170 6e 74 69 61 6c 3d 30 2e 35 2a 4c 4f 47 28 7a 72 |ntial=0.5*LOG(zr| 00000180 65 61 6c 2a 7a 72 65 61 6c 2b 7a 69 6d 61 67 2a |eal*zreal+zimag*| 00000190 7a 69 6d 61 67 29 2f 28 32 5e 69 74 65 72 29 0a |zimag)/(2^iter).| 000001a0 65 6c 73 65 0a 20 70 6f 74 65 6e 74 69 61 6c 3d |else. potential=| 000001b0 30 0a 65 6e 64 69 66 0a 0a 73 68 6f 77 20 70 6f |0.endif..show po| 000001c0 74 65 6e 74 69 61 6c 0a |tential.| 000001c8