include "sdl.inc"

SetDisplay 620,480,1
SetCaption "PLANETARIUM MANDELBROT"

single a,x,y,dy,cx,cy,i,b,it,yy,y0,x0,x1,y1

ClsColor 105,168,100
For dy=0 To 2
   For x=0 To 620 
      a = (x*.06)-12
      cx = -2 * a / 25
      For y=0 To 255  
         yy = y + dy
         b = yy * .121 + 21
         cy = 2-b / 25
         x0 = 0
         y0 = 0
         it = 0
         For i=1 To 255
            x1 = x0 * x0 - y0 * y0 + cx
            y1 = 2 * x0 * y0 + cy
            iF x1 * x1 + y1 * y1 >4 
               it = 1
               Exit For
            End iF
            x0 = x1
            y0 = y1
         Next               
         iF it
            SetPixel x, yy, y,i*.8,i*.8
            SetPixel x, 480-yy, y,i*.8,i*.8
         End iF     
      Next
   Next
Next
While Key(27)=0
Flip
Wend
Ends