mandelbrot: add some garish color

This commit is contained in:
Kartik K. Agaram 2021-05-09 22:14:42 -07:00
parent cf8ccb0a09
commit 208dab2256
2 changed files with 12 additions and 19 deletions

View File

@ -143,16 +143,14 @@ fn mandelbrot screen: (addr screen), scene-cx-f: int, scene-cy-f: int, scene-wid
break-if->= break-if->=
var real-f/edx: int <- viewport-to-real-f x, width, scene-cx-f, scene-width-f var real-f/edx: int <- viewport-to-real-f x, width, scene-cx-f, scene-width-f
var iterations/esi: int <- mandelbrot-iterations-for-point real-f, imaginary-f, 0x400/max var iterations/esi: int <- mandelbrot-iterations-for-point real-f, imaginary-f, 0x400/max
compare iterations, 0x400/max iterations <- shift-right 3
var color/edx: int <- copy 0
{ {
break-if->= var dummy/eax: int <- copy 0
pixel screen, x, y, 0xf/white dummy, color <- integer-divide iterations, 0x18/24/size-of-cycle-0
} color <- add 0x20/cycle-0
compare iterations, 0x400/max
{
break-if-<
pixel screen, x, y, 0/black
} }
pixel screen, x, y, color
x <- increment x <- increment
loop loop
} }

View File

@ -51,22 +51,17 @@ fn mandelbrot screen: (addr screen), scene-cx: float, scene-cy: float, scene-wid
compare y, height compare y, height
break-if->= break-if->=
var imaginary/xmm1: float <- viewport-to-imaginary y, width, height, scene-cy, scene-width 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 compare x, width
break-if->= break-if->=
var real/xmm0: float <- viewport-to-real x, width, scene-cx, scene-width 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 var iterations/eax: int <- mandelbrot-iterations-for-point real, imaginary, 0x400/max
compare iterations, 0x400/max iterations <- shift-right 3
{ var color/edx: int <- copy 0
break-if->= iterations, color <- integer-divide iterations, 0x18/24/size-of-cycle-0
pixel screen, x, y, 0xf/white color <- add 0x20/cycle-0
} pixel screen, x, y, color
compare iterations, 0x400/max
{
break-if-<
pixel screen, x, y, 0/black
}
x <- increment x <- increment
loop loop
} }