Home » Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_29.ADF » P/MBGEN

P/MBGEN

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 » Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_29.ADF
Filename: P/MBGEN
Read OK:
File size: 0627 bytes
Load address: FFFF0E00
Exec address: FFFF802B
Duplicates

There are 2 duplicate copies of this file in the archive:

File contents
   10*K.10O.|MG.30|M
   20CALL!-4
   30*DIR $
   40REM 4-colour mandelbrot generator
   50REM Should work on DFS and ADFS
   60REM and on all machines
   70MODE1
   80:
   90HIMEM=&3000
  100VDU23;8202;0;0;0;
  110:
  120REM Leave blank lines to make program
  130REM lines the same for both programs
  140:
  150:
  160CLG
  170MI%=600:REM Maximum number of iterations.  600 takes ages, so try 30 when you start experimenting!
  180XN%=4:YN%=4:REM Change XN% for modes 0 or 2
  190xstep%=1
  200ystep%=1
  210XL=-1:XR=-0.5:REM Coordinates
  220YLO=0:YUP=0.5
  230MNC%=0:MXC%=255:MNR%=0:MXR%=255
  240OFSET=FNoffset(XL,XR,1+MXC%)
  250XL=XL-OFSET:XR=XR-OFSET
  260OFSET=FNoffset(YLO,YUP,1+MXR%)
  270YLO=YLO-OFSET:YUP=YUP-OFSET
  280DIMXCOORD(MXC%),YCOORD(MXR%)
  290CGAP=(XR-XL)/(1+MXC%):TEMP=XL-CGAP
  300FORI%=MNC%TOMXC%
  310TEMP=TEMP+CGAP
  320XCOORD(I%)=TEMP
  330NEXTI%
  340RGAP=(YUP-YLO)/(MXR%+1):TEMP=YLO-RGAP
  350FORI%=MNR%TOMXR%
  360TEMP=TEMP+RGAP
  370YCOORD(I%)=TEMP
  380NEXTI%
  390FORI%=MNC%TOMXC%STEPxstep%
  400FORJ%=MNR%TOMXR%STEPystep%
  410col=FNout(XCOORD(I%),YCOORD(J%),MI%)
  420:
  430GCOL0,col
  440PLOT69,XN%*I%,YN%*J%
  450:
  460:
  470:
  480NEXTJ%
  490NEXTI%
  500:
  510*SAVE PICTURE 3000 8000
  520:
  530:
  540:
  550END
  560:
  570:
  580:
  590REM Mandelbrot iterative algorithm
  600DEFFNout(X,Y,M%)
  610IFX+Y<=-0.75 THEN =0:REM these 2 lines remove some of
  620IF2*X-Y>=-1.5 THEN =0:REM the infinite area for speed
  630LOCALI%,TEMP,X1,Y1,HLT
  640I%=0:X1=0:Y1=0
  650REPEAT
  660I%=I%+1
  670TEMP=(X1-Y1)*(X1+Y1)+X
  680Y1=2*X1*Y1+Y
  690X1=TEMP
  700HLT=((X1^2+Y1^2)>16)
  710UNTIL(I%=M%) OR HLT
  720IF HLT THEN I%=((I% MOD3)+1) ELSEI%=0
  730=I%
  740:
  750REM Calculate pixel offset
  760DEFFNoffset(MIN,MAX,GD%)
  770LOCAL TEMP
  780TEMP=GD%*MIN/(MIN-MAX)
  790IF (MIN>0) OR (MAX<0) THEN=0 ELSE=TEMP-INT(TEMP)

*K.10O.|MG.30|M
�!-4

*DIR $
(#� 4-colour mandelbrot generator
2!� Should work on DFS and ADFS
<� and on all machines
F�1
P:
Z�=&3000
d�23;8202;0;0;0;
n:
x'� Leave blank lines to make program
�&� lines the same for both programs
�:
�:
��
�dMI%=600:� Maximum number of iterations.  600 takes ages, so try 30 when you start experimenting!
�-XN%=4:YN%=4:� Change XN% for modes 0 or 2
�xstep%=1
�ystep%=1
�XL=-1:XR=-0.5:� Coordinates
�YLO=0:YUP=0.5
�#MNC%=0:MXC%=255:MNR%=0:MXR%=255
�OFSET=�offset(XL,XR,1+MXC%)
�XL=XL-OFSET:XR=XR-OFSET
!OFSET=�offset(YLO,YUP,1+MXR%)
YLO=YLO-OFSET:YUP=YUP-OFSET
�XCOORD(MXC%),YCOORD(MXR%)
"&CGAP=(XR-XL)/(1+MXC%):TEMP=XL-CGAP
,�I%=MNC%�MXC%
6TEMP=TEMP+CGAP
@XCOORD(I%)=TEMP
J�I%
T)RGAP=(YUP-YLO)/(MXR%+1):TEMP=YLO-RGAP
^�I%=MNR%�MXR%
hTEMP=TEMP+RGAP
rYCOORD(I%)=TEMP
|�I%
��I%=MNC%�MXC%�xstep%
��J%=MNR%�MXR%�ystep%
�'col=�out(XCOORD(I%),YCOORD(J%),MI%)
�:
�
�0,col
��69,XN%*I%,YN%*J%
�:
�:
�:
��J%
��I%
�:
�*SAVE PICTURE 3000 8000
:
:
:
&�
0:
::
D:
N$� Mandelbrot iterative algorithm
Xݤout(X,Y,M%)
b3�X+Y<=-0.75 � =0:� these 2 lines remove some of
l3�2*X-Y>=-1.5 � =0:� the infinite area for speed
v�I%,TEMP,X1,Y1,HLT
�I%=0:X1=0:Y1=0
��
�I%=I%+1
�TEMP=(X1-Y1)*(X1+Y1)+X
�Y1=2*X1*Y1+Y
�X1=TEMP
�HLT=((X1^2+Y1^2)>16)
��(I%=M%) � HLT
� � HLT � I%=((I% �3)+1) �I%=0
�=I%
�:
�� Calculate pixel offset
�ݤoffset(MIN,MAX,GD%)

� TEMP
TEMP=GD%*MIN/(MIN-MAX)
*� (MIN>0) � (MAX<0) �=0 �=TEMP-�(TEMP)
�
00000000  0d 00 0a 13 2a 4b 2e 31  30 4f 2e 7c 4d 47 2e 33  |....*K.10O.|MG.3|
00000010  30 7c 4d 0d 00 14 08 d6  21 2d 34 0d 00 1e 0a 2a  |0|M.....!-4....*|
00000020  44 49 52 20 24 0d 00 28  23 f4 20 34 2d 63 6f 6c  |DIR $..(#. 4-col|
00000030  6f 75 72 20 6d 61 6e 64  65 6c 62 72 6f 74 20 67  |our mandelbrot g|
00000040  65 6e 65 72 61 74 6f 72  0d 00 32 21 f4 20 53 68  |enerator..2!. Sh|
00000050  6f 75 6c 64 20 77 6f 72  6b 20 6f 6e 20 44 46 53  |ould work on DFS|
00000060  20 61 6e 64 20 41 44 46  53 0d 00 3c 19 f4 20 61  | and ADFS..<.. a|
00000070  6e 64 20 6f 6e 20 61 6c  6c 20 6d 61 63 68 69 6e  |nd on all machin|
00000080  65 73 0d 00 46 06 eb 31  0d 00 50 05 3a 0d 00 5a  |es..F..1..P.:..Z|
00000090  0b d3 3d 26 33 30 30 30  0d 00 64 13 ef 32 33 3b  |..=&3000..d..23;|
000000a0  38 32 30 32 3b 30 3b 30  3b 30 3b 0d 00 6e 05 3a  |8202;0;0;0;..n.:|
000000b0  0d 00 78 27 f4 20 4c 65  61 76 65 20 62 6c 61 6e  |..x'. Leave blan|
000000c0  6b 20 6c 69 6e 65 73 20  74 6f 20 6d 61 6b 65 20  |k lines to make |
000000d0  70 72 6f 67 72 61 6d 0d  00 82 26 f4 20 6c 69 6e  |program...&. lin|
000000e0  65 73 20 74 68 65 20 73  61 6d 65 20 66 6f 72 20  |es the same for |
000000f0  62 6f 74 68 20 70 72 6f  67 72 61 6d 73 0d 00 8c  |both programs...|
00000100  05 3a 0d 00 96 05 3a 0d  00 a0 05 da 0d 00 aa 64  |.:....:........d|
00000110  4d 49 25 3d 36 30 30 3a  f4 20 4d 61 78 69 6d 75  |MI%=600:. Maximu|
00000120  6d 20 6e 75 6d 62 65 72  20 6f 66 20 69 74 65 72  |m number of iter|
00000130  61 74 69 6f 6e 73 2e 20  20 36 30 30 20 74 61 6b  |ations.  600 tak|
00000140  65 73 20 61 67 65 73 2c  20 73 6f 20 74 72 79 20  |es ages, so try |
00000150  33 30 20 77 68 65 6e 20  79 6f 75 20 73 74 61 72  |30 when you star|
00000160  74 20 65 78 70 65 72 69  6d 65 6e 74 69 6e 67 21  |t experimenting!|
00000170  0d 00 b4 2d 58 4e 25 3d  34 3a 59 4e 25 3d 34 3a  |...-XN%=4:YN%=4:|
00000180  f4 20 43 68 61 6e 67 65  20 58 4e 25 20 66 6f 72  |. Change XN% for|
00000190  20 6d 6f 64 65 73 20 30  20 6f 72 20 32 0d 00 be  | modes 0 or 2...|
000001a0  0c 78 73 74 65 70 25 3d  31 0d 00 c8 0c 79 73 74  |.xstep%=1....yst|
000001b0  65 70 25 3d 31 0d 00 d2  1f 58 4c 3d 2d 31 3a 58  |ep%=1....XL=-1:X|
000001c0  52 3d 2d 30 2e 35 3a f4  20 43 6f 6f 72 64 69 6e  |R=-0.5:. Coordin|
000001d0  61 74 65 73 0d 00 dc 11  59 4c 4f 3d 30 3a 59 55  |ates....YLO=0:YU|
000001e0  50 3d 30 2e 35 0d 00 e6  23 4d 4e 43 25 3d 30 3a  |P=0.5...#MNC%=0:|
000001f0  4d 58 43 25 3d 32 35 35  3a 4d 4e 52 25 3d 30 3a  |MXC%=255:MNR%=0:|
00000200  4d 58 52 25 3d 32 35 35  0d 00 f0 1f 4f 46 53 45  |MXR%=255....OFSE|
00000210  54 3d a4 6f 66 66 73 65  74 28 58 4c 2c 58 52 2c  |T=.offset(XL,XR,|
00000220  31 2b 4d 58 43 25 29 0d  00 fa 1b 58 4c 3d 58 4c  |1+MXC%)....XL=XL|
00000230  2d 4f 46 53 45 54 3a 58  52 3d 58 52 2d 4f 46 53  |-OFSET:XR=XR-OFS|
00000240  45 54 0d 01 04 21 4f 46  53 45 54 3d a4 6f 66 66  |ET...!OFSET=.off|
00000250  73 65 74 28 59 4c 4f 2c  59 55 50 2c 31 2b 4d 58  |set(YLO,YUP,1+MX|
00000260  52 25 29 0d 01 0e 1f 59  4c 4f 3d 59 4c 4f 2d 4f  |R%)....YLO=YLO-O|
00000270  46 53 45 54 3a 59 55 50  3d 59 55 50 2d 4f 46 53  |FSET:YUP=YUP-OFS|
00000280  45 54 0d 01 18 1e de 58  43 4f 4f 52 44 28 4d 58  |ET.....XCOORD(MX|
00000290  43 25 29 2c 59 43 4f 4f  52 44 28 4d 58 52 25 29  |C%),YCOORD(MXR%)|
000002a0  0d 01 22 26 43 47 41 50  3d 28 58 52 2d 58 4c 29  |.."&CGAP=(XR-XL)|
000002b0  2f 28 31 2b 4d 58 43 25  29 3a 54 45 4d 50 3d 58  |/(1+MXC%):TEMP=X|
000002c0  4c 2d 43 47 41 50 0d 01  2c 11 e3 49 25 3d 4d 4e  |L-CGAP..,..I%=MN|
000002d0  43 25 b8 4d 58 43 25 0d  01 36 12 54 45 4d 50 3d  |C%.MXC%..6.TEMP=|
000002e0  54 45 4d 50 2b 43 47 41  50 0d 01 40 13 58 43 4f  |TEMP+CGAP..@.XCO|
000002f0  4f 52 44 28 49 25 29 3d  54 45 4d 50 0d 01 4a 07  |ORD(I%)=TEMP..J.|
00000300  ed 49 25 0d 01 54 29 52  47 41 50 3d 28 59 55 50  |.I%..T)RGAP=(YUP|
00000310  2d 59 4c 4f 29 2f 28 4d  58 52 25 2b 31 29 3a 54  |-YLO)/(MXR%+1):T|
00000320  45 4d 50 3d 59 4c 4f 2d  52 47 41 50 0d 01 5e 11  |EMP=YLO-RGAP..^.|
00000330  e3 49 25 3d 4d 4e 52 25  b8 4d 58 52 25 0d 01 68  |.I%=MNR%.MXR%..h|
00000340  12 54 45 4d 50 3d 54 45  4d 50 2b 52 47 41 50 0d  |.TEMP=TEMP+RGAP.|
00000350  01 72 13 59 43 4f 4f 52  44 28 49 25 29 3d 54 45  |.r.YCOORD(I%)=TE|
00000360  4d 50 0d 01 7c 07 ed 49  25 0d 01 86 18 e3 49 25  |MP..|..I%.....I%|
00000370  3d 4d 4e 43 25 b8 4d 58  43 25 88 78 73 74 65 70  |=MNC%.MXC%.xstep|
00000380  25 0d 01 90 18 e3 4a 25  3d 4d 4e 52 25 b8 4d 58  |%.....J%=MNR%.MX|
00000390  52 25 88 79 73 74 65 70  25 0d 01 9a 27 63 6f 6c  |R%.ystep%...'col|
000003a0  3d a4 6f 75 74 28 58 43  4f 4f 52 44 28 49 25 29  |=.out(XCOORD(I%)|
000003b0  2c 59 43 4f 4f 52 44 28  4a 25 29 2c 4d 49 25 29  |,YCOORD(J%),MI%)|
000003c0  0d 01 a4 05 3a 0d 01 ae  0a e6 30 2c 63 6f 6c 0d  |....:.....0,col.|
000003d0  01 b8 15 f0 36 39 2c 58  4e 25 2a 49 25 2c 59 4e  |....69,XN%*I%,YN|
000003e0  25 2a 4a 25 0d 01 c2 05  3a 0d 01 cc 05 3a 0d 01  |%*J%....:....:..|
000003f0  d6 05 3a 0d 01 e0 07 ed  4a 25 0d 01 ea 07 ed 49  |..:.....J%.....I|
00000400  25 0d 01 f4 05 3a 0d 01  fe 1b 2a 53 41 56 45 20  |%....:....*SAVE |
00000410  50 49 43 54 55 52 45 20  33 30 30 30 20 38 30 30  |PICTURE 3000 800|
00000420  30 0d 02 08 05 3a 0d 02  12 05 3a 0d 02 1c 05 3a  |0....:....:....:|
00000430  0d 02 26 05 e0 0d 02 30  05 3a 0d 02 3a 05 3a 0d  |..&....0.:..:.:.|
00000440  02 44 05 3a 0d 02 4e 24  f4 20 4d 61 6e 64 65 6c  |.D.:..N$. Mandel|
00000450  62 72 6f 74 20 69 74 65  72 61 74 69 76 65 20 61  |brot iterative a|
00000460  6c 67 6f 72 69 74 68 6d  0d 02 58 11 dd a4 6f 75  |lgorithm..X...ou|
00000470  74 28 58 2c 59 2c 4d 25  29 0d 02 62 33 e7 58 2b  |t(X,Y,M%)..b3.X+|
00000480  59 3c 3d 2d 30 2e 37 35  20 8c 20 3d 30 3a f4 20  |Y<=-0.75 . =0:. |
00000490  74 68 65 73 65 20 32 20  6c 69 6e 65 73 20 72 65  |these 2 lines re|
000004a0  6d 6f 76 65 20 73 6f 6d  65 20 6f 66 0d 02 6c 33  |move some of..l3|
000004b0  e7 32 2a 58 2d 59 3e 3d  2d 31 2e 35 20 8c 20 3d  |.2*X-Y>=-1.5 . =|
000004c0  30 3a f4 20 74 68 65 20  69 6e 66 69 6e 69 74 65  |0:. the infinite|
000004d0  20 61 72 65 61 20 66 6f  72 20 73 70 65 65 64 0d  | area for speed.|
000004e0  02 76 16 ea 49 25 2c 54  45 4d 50 2c 58 31 2c 59  |.v..I%,TEMP,X1,Y|
000004f0  31 2c 48 4c 54 0d 02 80  12 49 25 3d 30 3a 58 31  |1,HLT....I%=0:X1|
00000500  3d 30 3a 59 31 3d 30 0d  02 8a 05 f5 0d 02 94 0b  |=0:Y1=0.........|
00000510  49 25 3d 49 25 2b 31 0d  02 9e 1a 54 45 4d 50 3d  |I%=I%+1....TEMP=|
00000520  28 58 31 2d 59 31 29 2a  28 58 31 2b 59 31 29 2b  |(X1-Y1)*(X1+Y1)+|
00000530  58 0d 02 a8 10 59 31 3d  32 2a 58 31 2a 59 31 2b  |X....Y1=2*X1*Y1+|
00000540  59 0d 02 b2 0b 58 31 3d  54 45 4d 50 0d 02 bc 18  |Y....X1=TEMP....|
00000550  48 4c 54 3d 28 28 58 31  5e 32 2b 59 31 5e 32 29  |HLT=((X1^2+Y1^2)|
00000560  3e 31 36 29 0d 02 c6 12  fd 28 49 25 3d 4d 25 29  |>16).....(I%=M%)|
00000570  20 84 20 48 4c 54 0d 02  d0 20 e7 20 48 4c 54 20  | . HLT... . HLT |
00000580  8c 20 49 25 3d 28 28 49  25 20 83 33 29 2b 31 29  |. I%=((I% .3)+1)|
00000590  20 8b 49 25 3d 30 0d 02  da 07 3d 49 25 0d 02 e4  | .I%=0....=I%...|
000005a0  05 3a 0d 02 ee 1c f4 20  43 61 6c 63 75 6c 61 74  |.:..... Calculat|
000005b0  65 20 70 69 78 65 6c 20  6f 66 66 73 65 74 0d 02  |e pixel offset..|
000005c0  f8 19 dd a4 6f 66 66 73  65 74 28 4d 49 4e 2c 4d  |....offset(MIN,M|
000005d0  41 58 2c 47 44 25 29 0d  03 02 0a ea 20 54 45 4d  |AX,GD%)..... TEM|
000005e0  50 0d 03 0c 1a 54 45 4d  50 3d 47 44 25 2a 4d 49  |P....TEMP=GD%*MI|
000005f0  4e 2f 28 4d 49 4e 2d 4d  41 58 29 0d 03 16 2a e7  |N/(MIN-MAX)...*.|
00000600  20 28 4d 49 4e 3e 30 29  20 84 20 28 4d 41 58 3c  | (MIN>0) . (MAX<|
00000610  30 29 20 8c 3d 30 20 8b  3d 54 45 4d 50 2d a8 28  |0) .=0 .=TEMP-.(|
00000620  54 45 4d 50 29 0d ff                              |TEMP)..|
00000627
P/MBGEN.m0
P/MBGEN.m1
P/MBGEN.m2
P/MBGEN.m4
P/MBGEN.m5