From c7ade29c69e972046cb146e90d4841af270213a0 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Sun, 9 May 2021 23:18:10 -0700 Subject: [PATCH] . Keep the html version of mandelbrot-fixed at the correct monochrome still image for now. (commit 4bfc80ce) --- html/mandelbrot-fixed.mu.html | 58 +++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/html/mandelbrot-fixed.mu.html b/html/mandelbrot-fixed.mu.html index aa464470..3b786876 100644 --- a/html/mandelbrot-fixed.mu.html +++ b/html/mandelbrot-fixed.mu.html @@ -171,20 +171,20 @@ if ('onhashchange' in window) { 112 var a/eax: int <- copy 0 113 var b/ecx: int <- copy 0 114 a, b <- screen-size screen -115 var width-f/esi: int <- copy a -116 width-f <- shift-left 0xb/log2-font-width-and-fixed-precision # 3 + 8 = 11 -117 var height-f/edi: int <- copy b -118 height-f <- shift-left 0xc/log2-font-height-and-fixed-precision # 4 + 8 = 12 +115 var width/esi: int <- copy a +116 width <- shift-left 3/log2-font-width +117 var height/edi: int <- copy b +118 height <- shift-left 4/log2-font-height 119 var y/ecx: int <- copy 0 120 { -121 compare y, height-f +121 compare y, height 122 break-if->= -123 var imaginary-f/ebx: int <- viewport-to-imaginary-f y, width-f, height-f +123 var imaginary-f/ebx: int <- viewport-to-imaginary-f y, width, height 124 var x/eax: int <- copy 0 125 { -126 compare x, width-f +126 compare x, width 127 break-if->= -128 var real-f/edx: int <- viewport-to-real-f x, width-f +128 var real-f/edx: int <- viewport-to-real-f x, width 129 var iterations/esi: int <- mandelbrot-iterations-for-point real-f, imaginary-f, 0x400/max 130 compare iterations, 0x400/max 131 { @@ -261,26 +261,32 @@ if ('onhashchange' in window) { 202 # ranges from -2 to +2. Viewport height just follows the viewport's aspect 203 # ratio. 204 -205 fn viewport-to-real-f x: int, width-f: int -> _/edx: int { +205 fn viewport-to-real-f x: int, width: int -> _/edx: int { 206 # (x - width/2)*4/width 207 var result-f/eax: int <- int-to-fixed x -208 var half-width-f/ecx: int <- copy width-f -209 half-width-f <- shift-right-signed 1/log2 -210 result-f <- subtract half-width-f -211 result-f <- shift-left 2/log4 -212 result-f <- divide-fixed result-f, width-f -213 return result-f -214 } -215 -216 fn viewport-to-imaginary-f y: int, width-f: int, height-f: int -> _/ebx: int { -217 # (y - height/2)*4/width -218 var result-f/eax: int <- int-to-fixed y -219 shift-right-signed height-f, 1/log2 -220 result-f <- subtract height-f -221 result-f <- shift-left 2/log4 -222 result-f <- divide-fixed result-f, width-f -223 return result-f -224 } +208 var width-f/ecx: int <- copy width +209 width-f <- shift-left 8/fixed-precision +210 var half-width-f/edx: int <- copy width-f +211 half-width-f <- shift-right-signed 1/log2 +212 result-f <- subtract half-width-f +213 result-f <- shift-left 2/log4 +214 result-f <- divide-fixed result-f, width-f +215 return result-f +216 } +217 +218 fn viewport-to-imaginary-f y: int, width: int, height: int -> _/ebx: int { +219 # (y - height/2)*4/width +220 var result-f/eax: int <- int-to-fixed y +221 var half-height-f/ecx: int <- copy height +222 half-height-f <- shift-left 8/fixed-precision +223 half-height-f <- shift-right-signed 1/log2 +224 result-f <- subtract half-height-f +225 result-f <- shift-left 2/log4 +226 var width-f/ecx: int <- copy width +227 width-f <- shift-left 8/fixed-precision +228 result-f <- divide-fixed result-f, width-f +229 return result-f +230 }