diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-05-09 22:14:42 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-05-09 22:14:42 -0700 |
commit | 208dab22566cf8c49df7548b645f860446ce08d0 (patch) | |
tree | 1d777dd898b010da5fe2f55edcfcf8b836bac422 /mandelbrot.mu | |
parent | cf8ccb0a090c76abc6afe6d10ae7b0f36b374800 (diff) | |
download | mu-208dab22566cf8c49df7548b645f860446ce08d0.tar.gz |
mandelbrot: add some garish color
Diffstat (limited to 'mandelbrot.mu')
-rw-r--r-- | mandelbrot.mu | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/mandelbrot.mu b/mandelbrot.mu index ac37901b..278fafc2 100644 --- a/mandelbrot.mu +++ b/mandelbrot.mu @@ -51,22 +51,17 @@ fn mandelbrot screen: (addr screen), scene-cx: float, scene-cy: float, scene-wid compare y, height break-if->= var imaginary/xmm1: float <- viewport-to-imaginary y, width, height, scene-cy, scene-width - var x/edx: int <- copy 0 + var x/ebx: int <- copy 0 { compare x, width break-if->= var real/xmm0: float <- viewport-to-real x, width, scene-cx, scene-width var iterations/eax: int <- mandelbrot-iterations-for-point real, imaginary, 0x400/max - compare iterations, 0x400/max - { - break-if->= - pixel screen, x, y, 0xf/white - } - compare iterations, 0x400/max - { - break-if-< - pixel screen, x, y, 0/black - } + iterations <- shift-right 3 + var color/edx: int <- copy 0 + iterations, color <- integer-divide iterations, 0x18/24/size-of-cycle-0 + color <- add 0x20/cycle-0 + pixel screen, x, y, color x <- increment loop } |