14k # set precision # Registers: # x - X0 # y - Y0 # u - dX # v - dY # s - #x # t - #y 1.5 sx _1.2001sy _.05 su .1 sv 78 ss 24 st # q - maxiter # r - current iter (counts down) 50 sq # a - current pixel real part ("c" in mandelbrot equation) # b - current pixel imaginary part # c - accumulator real part ("z" in mandelbrot equation) # d - accumulator imaginary part # j - pixels left in current row # k - rows left in picture # Arrays: # z - characters to draw (mod 5) [ ] 0 :z [.] 1 :z [o] 2 :z [O] 3 :z [*] 4 :z # quit macro [ #[quit #] n q] sQ # quit macro [ #[escape #] n q] sX # , - iteration program - do one iteration [ # [iterating ] n # lr n [ ] n # la n [ ] n # lb n [ ] n # lc n [ ] n # ld n [ ] n [ # ] n # compute new real part # z'r = zr * zr - zi * zi + cr # z'i = 2 * zr * zi + ci lc d * ld d * - la + # leave new real part on stack lc ld 2 * * lb + # store new value sd sc 4 lc d * ld d * + >X # exit if escape lr 1 - sr # count down lr 0 =Q # last iteration? exit l, x # and recurse ] s, # . - pixel program - calculate one pixel [ lx lj lu * + d sa sc # Set C, Z real, imag ly lk lv * + d sb sd lq sr # set iterations l, x # run the iteration program K 0 k lr 5 % ;z n k ] s. # _ - row program - calculate one row [ l. x # [row program j= ] n lj n [ #] n # exit if last pixel lj 0 =Q # otherwise subtract pixel and recurse lj 1 - sj l_ x ] s_ # | - screen program - calculate whole screen [ ls sj # reset number of pixels in row l_ x # and do a row [ ] n # exit if last row lk 0 =Q lk 1 - sk l| x ] s| [ lt sk # reset number of rows on screen l| x # and do the screen ] s*