1 rem ***  mandelbrot  ***
2 rem  a speed demo for basic64
3 rem
4 rem  fills the whole framebuffer with a
5 rem  true-colour mandelbrot set: birchnight
6 rem  midnight-blue in the far night, warming to
7 rem  gorse fire-yellow at the burning edge of a
8 rem  black, still heart.
9 rem
10 rem  raise mx (line 40) for more detail.
11 rem  on this machine it stays fast.
12 rem
15 cls
20 gw = gramaxx : gh = gramaxy
30 cx = -.75 : vw = 3.5
40 mx = 200
50 dx = vw / gw
60 x0 = cx - vw / 2
70 y0 = -(dx * gh) / 2
80 t=timer
100 for py = 0 to gh
110 ci = y0 + py * dx
120 for px = 0 to gw
130 cr = x0 + px * dx
140 zr = 0 : zi = 0 : it = 0
150 zr2 = zr * zr : zi2 = zi * zi
160 if zr2 + zi2 > 4 then goto 220
170 zi = 2 * zr * zi + ci
180 zr = zr2 - zi2 + cr
190 it = it + 1
200 if it < mx then goto 150
210 rem  fell through: point is inside the set
220 if it >= mx then rr = 0 : gg = 0 : bb = 0 : goto 270
230 tt = it / mx
240 rr = int(25 + 230 * tt)
250 gg = int(25 + 165 * tt)
260 bb = int(70 - 40 * tt)
270 line (px, py)-(px, py), rr, gg, bb
280 next px
290 next py
300 print "Time needed:"timer-t"seconds."
