Home » CEEFAX disks » telesoftware16.adl » 08-07-89/Mandel1
08-07-89/Mandel1
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 » CEEFAX disks » telesoftware16.adl |
Filename: | 08-07-89/Mandel1 |
Read OK: | ✔ |
File size: | 0667 bytes |
Load address: | 0000 |
Exec address: | 0000 |
Duplicates
There are 2 duplicate copies of this file in the archive:
- AEW website » au » au_5_25_discs_Acorn_User_87_05_D-AU8705.ssd » o.MANDEL1
- AEW website » au » au_tapes_Acorn_User_87_05_AU58-May87_E.uef » MANDEL1
- CEEFAX disks » telesoftware16.adl » 08-07-89/Mandel1
File contents
{$D-,R-,U-} {Mandelbrot curve - 16 colours - needs GXR} program mandel (input,output); const smax=255; res=1024; maxm=256; maxcol=15; type array1=array[1..smax] of integer; var j,k: real; s,i,side,v: real; n,m: integer; colour,d,e: integer; x,y,ix,jx,kx: integer; c: array1; function steps(cx,cy:real): integer; var n:integer; x,x2,y,y2:real; begin n:=-1;x:=0.0;y:=0.0; repeat y2:=y*y; x2:=x*x; y:=2*x*y+cy; x:=x2-y2+cx; n:=n+1; until (n=smax) or (x2+y2>=4); steps:=n; {steps=1 to smax} end; procedure palette(logical, actual: integer); begin vdu(19,logical,actual,0,0,0) end; procedure gcol(plotmode, col: integer); begin vdu(18,plotmode,col) end; {main program} begin mode(2); vdu(28,16,31,19,0); palette(1,5); palette(2,4); palette(3,6); palette(4,2); palette(5,3); palette(6,1); write('x,y:'); read(j,k); write(' s:'); read(side); v:=maxcol/ln(smax); for n:=1 to smax do c[n] := maxcol-trunc(ln(n)*v); {main loop} m:=1; settime(0); repeat i:=side/m; ix:= res div m; for jx:=0 to m-1 do for kx:=0 to m-1 do if (kx mod 2 = 1) or (jx mod 2 = 1) then begin colour:=c[steps(j+i*jx, k+i*kx)]; d:=colour div 2; e:=(d+colour mod 2) mod 8; vdu(23,12,e,d,d,e,e,d,d,e); gcol(16,0); x:=ix*jx; y:=ix*kx; plot(4,x,y); plot(&65,x+ix-1,y+ix-1); end; m:=m*2; write(m); until m=maxm; write(time); end.
00000000 7b 24 44 2d 2c 52 2d 2c 55 2d 7d 20 20 20 20 20 |{$D-,R-,U-} | 00000010 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0d 7b | .{| 00000020 4d 61 6e 64 65 6c 62 72 6f 74 20 63 75 72 76 65 |Mandelbrot curve| 00000030 20 2d 20 31 36 20 63 6f 6c 6f 75 72 73 0d 20 20 | - 16 colours. | 00000040 2d 20 6e 65 65 64 73 20 47 58 52 7d 0d 0d 70 72 |- needs GXR}..pr| 00000050 6f 67 72 61 6d 20 6d 61 6e 64 65 6c 20 28 69 6e |ogram mandel (in| 00000060 70 75 74 2c 6f 75 74 70 75 74 29 3b 0d 0d 63 6f |put,output);..co| 00000070 6e 73 74 0d 20 20 73 6d 61 78 3d 32 35 35 3b 0d |nst. smax=255;.| 00000080 20 20 72 65 73 3d 31 30 32 34 3b 0d 20 20 6d 61 | res=1024;. ma| 00000090 78 6d 3d 32 35 36 3b 0d 20 20 6d 61 78 63 6f 6c |xm=256;. maxcol| 000000a0 3d 31 35 3b 0d 0d 74 79 70 65 0d 20 20 61 72 72 |=15;..type. arr| 000000b0 61 79 31 3d 61 72 72 61 79 5b 31 2e 2e 73 6d 61 |ay1=array[1..sma| 000000c0 78 5d 20 6f 66 20 69 6e 74 65 67 65 72 3b 0d 0d |x] of integer;..| 000000d0 76 61 72 0d 20 20 6a 2c 6b 3a 20 72 65 61 6c 3b |var. j,k: real;| 000000e0 0d 20 20 73 2c 69 2c 73 69 64 65 2c 76 3a 20 72 |. s,i,side,v: r| 000000f0 65 61 6c 3b 0d 20 20 6e 2c 6d 3a 20 69 6e 74 65 |eal;. n,m: inte| 00000100 67 65 72 3b 0d 20 20 63 6f 6c 6f 75 72 2c 64 2c |ger;. colour,d,| 00000110 65 3a 20 69 6e 74 65 67 65 72 3b 20 20 20 20 20 |e: integer; | 00000120 20 20 20 20 20 20 20 20 20 20 0d 20 20 78 2c 79 | . x,y| 00000130 2c 69 78 2c 6a 78 2c 6b 78 3a 20 69 6e 74 65 67 |,ix,jx,kx: integ| 00000140 65 72 3b 0d 20 20 63 3a 20 61 72 72 61 79 31 3b |er;. c: array1;| 00000150 0d 20 20 20 0d 66 75 6e 63 74 69 6f 6e 20 73 74 |. .function st| 00000160 65 70 73 28 63 78 2c 63 79 3a 72 65 61 6c 29 3a |eps(cx,cy:real):| 00000170 20 69 6e 74 65 67 65 72 3b 0d 76 61 72 0d 20 20 | integer;.var. | 00000180 6e 3a 69 6e 74 65 67 65 72 3b 0d 20 20 78 2c 78 |n:integer;. x,x| 00000190 32 2c 79 2c 79 32 3a 72 65 61 6c 3b 0d 62 65 67 |2,y,y2:real;.beg| 000001a0 69 6e 0d 20 20 6e 3a 3d 2d 31 3b 78 3a 3d 30 2e |in. n:=-1;x:=0.| 000001b0 30 3b 79 3a 3d 30 2e 30 3b 0d 20 20 72 65 70 65 |0;y:=0.0;. repe| 000001c0 61 74 0d 20 20 20 20 79 32 3a 3d 79 2a 79 3b 20 |at. y2:=y*y; | 000001d0 78 32 3a 3d 78 2a 78 3b 0d 20 20 20 20 79 3a 3d |x2:=x*x;. y:=| 000001e0 32 2a 78 2a 79 2b 63 79 3b 20 78 3a 3d 78 32 2d |2*x*y+cy; x:=x2-| 000001f0 79 32 2b 63 78 3b 0d 20 20 20 20 6e 3a 3d 6e 2b |y2+cx;. n:=n+| 00000200 31 3b 20 0d 20 20 75 6e 74 69 6c 20 28 6e 3d 73 |1; . until (n=s| 00000210 6d 61 78 29 20 6f 72 20 28 78 32 2b 79 32 3e 3d |max) or (x2+y2>=| 00000220 34 29 3b 0d 20 20 73 74 65 70 73 3a 3d 6e 3b 20 |4);. steps:=n; | 00000230 7b 73 74 65 70 73 3d 31 20 74 6f 20 73 6d 61 78 |{steps=1 to smax| 00000240 7d 0d 65 6e 64 3b 0d 20 20 20 0d 70 72 6f 63 65 |}.end;. .proce| 00000250 64 75 72 65 20 70 61 6c 65 74 74 65 28 6c 6f 67 |dure palette(log| 00000260 69 63 61 6c 2c 0d 20 20 61 63 74 75 61 6c 3a 20 |ical,. actual: | 00000270 69 6e 74 65 67 65 72 29 3b 0d 62 65 67 69 6e 0d |integer);.begin.| 00000280 20 20 76 64 75 28 31 39 2c 6c 6f 67 69 63 61 6c | vdu(19,logical| 00000290 2c 61 63 74 75 61 6c 2c 30 2c 30 2c 30 29 0d 65 |,actual,0,0,0).e| 000002a0 6e 64 3b 0d 0d 70 72 6f 63 65 64 75 72 65 20 67 |nd;..procedure g| 000002b0 63 6f 6c 28 70 6c 6f 74 6d 6f 64 65 2c 20 63 6f |col(plotmode, co| 000002c0 6c 3a 20 69 6e 74 65 67 65 72 29 3b 0d 62 65 67 |l: integer);.beg| 000002d0 69 6e 0d 20 20 76 64 75 28 31 38 2c 70 6c 6f 74 |in. vdu(18,plot| 000002e0 6d 6f 64 65 2c 63 6f 6c 29 0d 65 6e 64 3b 0d 0d |mode,col).end;..| 000002f0 7b 6d 61 69 6e 20 70 72 6f 67 72 61 6d 7d 0d 0d |{main program}..| 00000300 62 65 67 69 6e 0d 20 20 6d 6f 64 65 28 32 29 3b |begin. mode(2);| 00000310 0d 20 20 76 64 75 28 32 38 2c 31 36 2c 33 31 2c |. vdu(28,16,31,| 00000320 31 39 2c 30 29 3b 0d 20 20 70 61 6c 65 74 74 65 |19,0);. palette| 00000330 28 31 2c 35 29 3b 20 70 61 6c 65 74 74 65 28 32 |(1,5); palette(2| 00000340 2c 34 29 3b 0d 20 20 70 61 6c 65 74 74 65 28 33 |,4);. palette(3| 00000350 2c 36 29 3b 20 70 61 6c 65 74 74 65 28 34 2c 32 |,6); palette(4,2| 00000360 29 3b 0d 20 20 70 61 6c 65 74 74 65 28 35 2c 33 |);. palette(5,3| 00000370 29 3b 20 70 61 6c 65 74 74 65 28 36 2c 31 29 3b |); palette(6,1);| 00000380 0d 20 20 77 72 69 74 65 28 27 78 2c 79 3a 27 29 |. write('x,y:')| 00000390 3b 20 72 65 61 64 28 6a 2c 6b 29 3b 0d 20 20 77 |; read(j,k);. w| 000003a0 72 69 74 65 28 27 20 20 73 3a 27 29 3b 20 72 65 |rite(' s:'); re| 000003b0 61 64 28 73 69 64 65 29 3b 0d 20 20 76 3a 3d 6d |ad(side);. v:=m| 000003c0 61 78 63 6f 6c 2f 6c 6e 28 73 6d 61 78 29 3b 0d |axcol/ln(smax);.| 000003d0 20 20 66 6f 72 20 6e 3a 3d 31 20 74 6f 20 73 6d | for n:=1 to sm| 000003e0 61 78 20 64 6f 0d 20 20 20 20 63 5b 6e 5d 20 3a |ax do. c[n] :| 000003f0 3d 20 6d 61 78 63 6f 6c 2d 74 72 75 6e 63 28 6c |= maxcol-trunc(l| 00000400 6e 28 6e 29 2a 76 29 3b 0d 0d 7b 6d 61 69 6e 20 |n(n)*v);..{main | 00000410 6c 6f 6f 70 7d 0d 0d 20 20 6d 3a 3d 31 3b 20 20 |loop}.. m:=1; | 00000420 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000430 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0d 20 | . | 00000440 20 73 65 74 74 69 6d 65 28 30 29 3b 0d 20 20 72 | settime(0);. r| 00000450 65 70 65 61 74 0d 20 20 20 20 69 3a 3d 73 69 64 |epeat. i:=sid| 00000460 65 2f 6d 3b 20 69 78 3a 3d 20 72 65 73 20 64 69 |e/m; ix:= res di| 00000470 76 20 6d 3b 0d 20 20 20 20 66 6f 72 20 6a 78 3a |v m;. for jx:| 00000480 3d 30 20 74 6f 20 6d 2d 31 20 64 6f 0d 20 20 20 |=0 to m-1 do. | 00000490 20 20 20 66 6f 72 20 6b 78 3a 3d 30 20 74 6f 20 | for kx:=0 to | 000004a0 6d 2d 31 20 64 6f 0d 20 20 20 20 20 20 20 20 69 |m-1 do. i| 000004b0 66 20 28 6b 78 20 6d 6f 64 20 32 20 3d 20 31 29 |f (kx mod 2 = 1)| 000004c0 20 6f 72 0d 20 20 20 20 20 20 20 20 20 20 28 6a | or. (j| 000004d0 78 20 6d 6f 64 20 32 20 3d 20 31 29 20 74 68 65 |x mod 2 = 1) the| 000004e0 6e 0d 20 20 20 20 20 20 20 20 20 20 62 65 67 69 |n. begi| 000004f0 6e 0d 20 20 20 20 20 20 20 20 20 20 20 20 63 6f |n. co| 00000500 6c 6f 75 72 3a 3d 63 5b 73 74 65 70 73 28 6a 2b |lour:=c[steps(j+| 00000510 69 2a 6a 78 2c 0d 20 20 20 20 20 20 20 20 20 20 |i*jx,. | 00000520 20 20 20 20 6b 2b 69 2a 6b 78 29 5d 3b 0d 20 20 | k+i*kx)];. | 00000530 20 20 20 20 20 20 20 20 20 20 64 3a 3d 63 6f 6c | d:=col| 00000540 6f 75 72 20 64 69 76 20 32 3b 0d 20 20 20 20 20 |our div 2;. | 00000550 20 20 20 20 20 20 20 65 3a 3d 28 64 2b 63 6f 6c | e:=(d+col| 00000560 6f 75 72 20 6d 6f 64 20 32 29 0d 20 20 20 20 20 |our mod 2). | 00000570 20 20 20 20 20 20 20 20 20 6d 6f 64 20 38 3b 0d | mod 8;.| 00000580 20 20 20 20 20 20 20 20 20 20 20 20 76 64 75 28 | vdu(| 00000590 32 33 2c 31 32 2c 65 2c 64 2c 64 2c 65 2c 65 2c |23,12,e,d,d,e,e,| 000005a0 64 2c 64 2c 65 29 3b 0d 20 20 20 20 20 20 20 20 |d,d,e);. | 000005b0 20 20 20 20 67 63 6f 6c 28 31 36 2c 30 29 3b 0d | gcol(16,0);.| 000005c0 20 20 20 20 20 20 20 20 20 20 20 20 78 3a 3d 69 | x:=i| 000005d0 78 2a 6a 78 3b 20 79 3a 3d 69 78 2a 6b 78 3b 0d |x*jx; y:=ix*kx;.| 000005e0 20 20 20 20 20 20 20 20 20 20 20 20 70 6c 6f 74 | plot| 000005f0 28 34 2c 78 2c 79 29 3b 0d 20 20 20 20 20 20 20 |(4,x,y);. | 00000600 20 20 20 20 20 70 6c 6f 74 28 26 36 35 2c 78 2b | plot(&65,x+| 00000610 69 78 2d 31 2c 79 2b 69 78 2d 31 29 3b 0d 20 20 |ix-1,y+ix-1);. | 00000620 20 20 65 6e 64 3b 0d 20 20 20 20 6d 3a 3d 6d 2a | end;. m:=m*| 00000630 32 3b 0d 20 20 20 20 77 72 69 74 65 28 6d 29 3b |2;. write(m);| 00000640 0d 20 20 20 20 75 6e 74 69 6c 20 6d 3d 6d 61 78 |. until m=max| 00000650 6d 3b 0d 20 20 77 72 69 74 65 28 74 69 6d 65 29 |m;. write(time)| 00000660 3b 0d 65 6e 64 2e 0d |;.end..| 00000667