From dd60a1d73c8017fd3d80ccf91e4549fc47a90760 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Mon, 16 Nov 2020 20:44:02 -0800 Subject: 7252 --- html/apps/browse/main.mu.html | 106 ++-- html/apps/raytracing/1.mu.html | 2 +- html/apps/raytracing/2.mu.html | 14 +- html/apps/raytracing/3.mu.html | 172 +++--- html/apps/raytracing/color.mu.html | 6 +- html/apps/raytracing/ray.mu.html | 10 +- html/apps/raytracing/vec.mu.html | 52 +- html/apps/tile/data.mu.html | 68 +-- html/apps/tile/environment.mu.html | 966 +++++++++++++++++----------------- html/apps/tile/gap-buffer.mu.html | 152 +++--- html/apps/tile/grapheme-stack.mu.html | 8 +- html/apps/tile/main.mu.html | 68 +-- html/apps/tile/rpn.mu.html | 420 +++++++-------- html/apps/tile/surface.mu.html | 58 +- html/apps/tile/table.mu.html | 118 ++--- html/apps/tile/value-stack.mu.html | 80 +-- html/apps/tile/value.mu.html | 108 ++-- html/apps/tile/word.mu.html | 480 ++++++++--------- 18 files changed, 1444 insertions(+), 1444 deletions(-) (limited to 'html') diff --git a/html/apps/browse/main.mu.html b/html/apps/browse/main.mu.html index 7bc920d5..0949562c 100644 --- a/html/apps/browse/main.mu.html +++ b/html/apps/browse/main.mu.html @@ -101,13 +101,13 @@ if ('onhashchange' in window) { 42 enable-screen-grid-mode 43 enable-keyboard-immediate-mode 44 # initialize screen state - 45 var paginated-screen-storage: paginated-screen - 46 var paginated-screen/eax: (addr paginated-screen) <- address paginated-screen-storage - 47 initialize-paginated-screen paginated-screen, 0x40, 2, 5 - 48 normal-text paginated-screen + 45 var paginated-screen-storage: paginated-screen + 46 var paginated-screen/eax: (addr paginated-screen) <- address paginated-screen-storage + 47 initialize-paginated-screen paginated-screen, 0x40, 2, 5 + 48 normal-text paginated-screen 49 # 50 { - 51 render paginated-screen, fs + 51 render paginated-screen, fs 52 var key/eax: grapheme <- read-key-from-real-keyboard 53 compare key, 0x71 # 'q' 54 loop-if-!= @@ -116,8 +116,8 @@ if ('onhashchange' in window) { 57 enable-screen-type-mode 58 } 59 - 60 fn render screen: (addr paginated-screen), fs: (addr buffered-file) { - 61 start-drawing screen + 60 fn render screen: (addr paginated-screen), fs: (addr buffered-file) { + 61 start-drawing screen 62 render-normal screen, fs 63 } 64 @@ -128,9 +128,9 @@ if ('onhashchange' in window) { 69 populate-buffered-file-containing "abcdefgh", input-ah 70 var in/eax: (addr buffered-file) <- lookup input-storage 71 # output screen - 72 var pg: paginated-screen - 73 var pg-addr/ecx: (addr paginated-screen) <- address pg - 74 initialize-fake-paginated-screen pg-addr, 3, 6, 2, 1, 1 # 3 rows, 6 columns, 2 pages * 2 columns each + 72 var pg: paginated-screen + 73 var pg-addr/ecx: (addr paginated-screen) <- address pg + 74 initialize-fake-paginated-screen pg-addr, 3, 6, 2, 1, 1 # 3 rows, 6 columns, 2 pages * 2 columns each 75 # 76 render pg-addr, in 77 var screen-ah/eax: (addr handle screen) <- get pg, screen @@ -147,9 +147,9 @@ if ('onhashchange' in window) { 88 populate-buffered-file-containing "# abc\n\ndef", input-ah 89 var in/eax: (addr buffered-file) <- lookup input-storage 90 # output screen - 91 var pg: paginated-screen - 92 var pg-addr/ecx: (addr paginated-screen) <- address pg - 93 initialize-fake-paginated-screen pg-addr, 8, 6, 5, 1, 1 # 6 columns, single page + 91 var pg: paginated-screen + 92 var pg-addr/ecx: (addr paginated-screen) <- address pg + 93 initialize-fake-paginated-screen pg-addr, 8, 6, 5, 1, 1 # 6 columns, single page 94 # 95 render pg-addr, in 96 var screen-ah/eax: (addr handle screen) <- get pg, screen @@ -167,9 +167,9 @@ if ('onhashchange' in window) { 108 populate-buffered-file-containing "a *b* c", input-ah 109 var in/eax: (addr buffered-file) <- lookup input-storage 110 # output screen -111 var pg: paginated-screen -112 var pg-addr/ecx: (addr paginated-screen) <- address pg -113 initialize-fake-paginated-screen pg-addr, 8, 6, 5, 1, 1 # 6 columns, single page +111 var pg: paginated-screen +112 var pg-addr/ecx: (addr paginated-screen) <- address pg +113 initialize-fake-paginated-screen pg-addr, 8, 6, 5, 1, 1 # 6 columns, single page 114 # 115 render pg-addr, in 116 var screen-ah/eax: (addr handle screen) <- get pg, screen @@ -187,9 +187,9 @@ if ('onhashchange' in window) { 128 populate-buffered-file-containing "a _b_ c", input-ah 129 var in/eax: (addr buffered-file) <- lookup input-storage 130 # output screen -131 var pg: paginated-screen -132 var pg-addr/ecx: (addr paginated-screen) <- address pg -133 initialize-fake-paginated-screen pg-addr, 8, 6, 5, 1, 1 # 6 columns, single page +131 var pg: paginated-screen +132 var pg-addr/ecx: (addr paginated-screen) <- address pg +133 initialize-fake-paginated-screen pg-addr, 8, 6, 5, 1, 1 # 6 columns, single page 134 # 135 render pg-addr, in 136 var screen-ah/eax: (addr handle screen) <- get pg, screen @@ -205,9 +205,9 @@ if ('onhashchange' in window) { 146 populate-buffered-file-containing "a*b*c", input-ah 147 var in/eax: (addr buffered-file) <- lookup input-storage 148 # output screen -149 var pg: paginated-screen -150 var pg-addr/ecx: (addr paginated-screen) <- address pg -151 initialize-fake-paginated-screen pg-addr, 8, 6, 5, 1, 1 # 6 columns, single page +149 var pg: paginated-screen +150 var pg-addr/ecx: (addr paginated-screen) <- address pg +151 initialize-fake-paginated-screen pg-addr, 8, 6, 5, 1, 1 # 6 columns, single page 152 # 153 render pg-addr, in 154 var screen-ah/eax: (addr handle screen) <- get pg, screen @@ -216,13 +216,13 @@ if ('onhashchange' in window) { 157 check-screen-row-in-bold screen, 2, " ", "F - test-render-bold-text/bold" 158 } 159 -160 fn render-normal screen: (addr paginated-screen), fs: (addr buffered-file) { +160 fn render-normal screen: (addr paginated-screen), fs: (addr buffered-file) { 161 var newline-seen?/esi: boolean <- copy 0 # false 162 var start-of-paragraph?/edi: boolean <- copy 1 # true 163 var previous-grapheme/ebx: grapheme <- copy 0 164 $render-normal:loop: { 165 # if done-drawing?(screen) break -166 var done?/eax: boolean <- done-drawing? screen +166 var done?/eax: boolean <- done-drawing? screen 167 compare done?, 0 # false 168 break-if-!= 169 var c/eax: grapheme <- read-grapheme-buffered fs @@ -245,8 +245,8 @@ if ('onhashchange' in window) { 186 # otherwise render two newlines 187 { 188 break-if-= -189 add-grapheme screen, 0xa # newline -190 add-grapheme screen, 0xa # newline +189 add-grapheme screen, 0xa # newline +190 add-grapheme screen, 0xa # newline 191 newline-seen? <- copy 0 # false 192 start-of-paragraph? <- copy 1 # true 193 break $render-normal:loop-body @@ -280,10 +280,10 @@ if ('onhashchange' in window) { 221 { 222 compare c, 0x20 223 break-if-!= -224 add-grapheme screen, 0xa # newline +224 add-grapheme screen, 0xa # newline 225 break $render-normal:flush-buffered-newline 226 } -227 add-grapheme screen, 0x20 # space +227 add-grapheme screen, 0x20 # space 228 # fall through to print c 229 } 230 ## end soft newline support @@ -301,8 +301,8 @@ if ('onhashchange' in window) { 242 compare c, 0x2a # '*' 243 { 244 break-if-!= -245 start-color-on-paginated-screen screen, 0xec, 7 # 236 = darkish gray -246 start-bold-on-paginated-screen screen +245 start-color-on-paginated-screen screen, 0xec, 7 # 236 = darkish gray +246 start-bold-on-paginated-screen screen 247 render-until-asterisk screen, fs 248 normal-text screen 249 break $render-normal:loop-body @@ -311,22 +311,22 @@ if ('onhashchange' in window) { 252 compare c, 0x5f # '_' 253 { 254 break-if-!= -255 start-color-on-paginated-screen screen, 0xec, 7 # 236 = darkish gray -256 start-bold-on-paginated-screen screen +255 start-color-on-paginated-screen screen, 0xec, 7 # 236 = darkish gray +256 start-bold-on-paginated-screen screen 257 render-until-underscore screen, fs 258 normal-text screen 259 break $render-normal:loop-body 260 } 261 } 262 # -263 add-grapheme screen, c +263 add-grapheme screen, c 264 } # $render-normal:loop-body 265 previous-grapheme <- copy c 266 loop 267 } # $render-normal:loop 268 } 269 -270 fn render-header-line screen: (addr paginated-screen), fs: (addr buffered-file) { +270 fn render-header-line screen: (addr paginated-screen), fs: (addr buffered-file) { 271 $render-header-line:body: { 272 # compute color based on number of '#'s 273 var header-level/esi: int <- copy 1 # caller already grabbed one @@ -334,7 +334,7 @@ if ('onhashchange' in window) { 275 { 276 # if done-drawing?(screen) return 277 { -278 var done?/eax: boolean <- done-drawing? screen +278 var done?/eax: boolean <- done-drawing? screen 279 compare done?, 0 # false 280 break-if-!= $render-header-line:body 281 } @@ -352,7 +352,7 @@ if ('onhashchange' in window) { 293 { 294 # if done-drawing?(screen) break 295 { -296 var done?/eax: boolean <- done-drawing? screen +296 var done?/eax: boolean <- done-drawing? screen 297 compare done?, 0 # false 298 break-if-!= 299 } @@ -365,7 +365,7 @@ if ('onhashchange' in window) { 306 compare c, 0xa # newline 307 break-if-= 308 # -309 add-grapheme screen, c +309 add-grapheme screen, c 310 # 311 loop 312 } @@ -374,41 +374,41 @@ if ('onhashchange' in window) { 315 } 316 317 # colors for a light background, going from bright to dark (meeting up with bold-text) -318 fn start-heading screen: (addr paginated-screen), header-level: int { +318 fn start-heading screen: (addr paginated-screen), header-level: int { 319 $start-heading:body: { -320 start-bold-on-paginated-screen screen +320 start-bold-on-paginated-screen screen 321 compare header-level, 1 322 { 323 break-if-!= -324 start-color-on-paginated-screen screen, 0xa0, 7 +324 start-color-on-paginated-screen screen, 0xa0, 7 325 break $start-heading:body 326 } 327 compare header-level, 2 328 { 329 break-if-!= -330 start-color-on-paginated-screen screen, 0x7c, 7 +330 start-color-on-paginated-screen screen, 0x7c, 7 331 break $start-heading:body 332 } 333 compare header-level, 3 334 { 335 break-if-!= -336 start-color-on-paginated-screen screen, 0x58, 7 +336 start-color-on-paginated-screen screen, 0x58, 7 337 break $start-heading:body 338 } 339 compare header-level, 4 340 { 341 break-if-!= -342 start-color-on-paginated-screen screen, 0x34, 7 +342 start-color-on-paginated-screen screen, 0x34, 7 343 break $start-heading:body 344 } -345 start-color-on-paginated-screen screen, 0xe8, 7 +345 start-color-on-paginated-screen screen, 0xe8, 7 346 } 347 } 348 -349 fn render-until-asterisk screen: (addr paginated-screen), fs: (addr buffered-file) { +349 fn render-until-asterisk screen: (addr paginated-screen), fs: (addr buffered-file) { 350 { 351 # if done-drawing?(screen) break -352 var done?/eax: boolean <- done-drawing? screen +352 var done?/eax: boolean <- done-drawing? screen 353 compare done?, 0 # false 354 break-if-!= 355 # @@ -420,16 +420,16 @@ if ('onhashchange' in window) { 361 compare c, 0x2a # '*' 362 break-if-= 363 # -364 add-grapheme screen, c +364 add-grapheme screen, c 365 # 366 loop 367 } 368 } 369 -370 fn render-until-underscore screen: (addr paginated-screen), fs: (addr buffered-file) { +370 fn render-until-underscore screen: (addr paginated-screen), fs: (addr buffered-file) { 371 { 372 # if done-drawing?(screen) break -373 var done?/eax: boolean <- done-drawing? screen +373 var done?/eax: boolean <- done-drawing? screen 374 compare done?, 0 # false 375 break-if-!= 376 # @@ -441,15 +441,15 @@ if ('onhashchange' in window) { 382 compare c, 0x5f # '_' 383 break-if-= 384 # -385 add-grapheme screen, c +385 add-grapheme screen, c 386 # 387 loop 388 } 389 } 390 -391 fn normal-text screen: (addr paginated-screen) { -392 reset-formatting-on-paginated-screen screen -393 start-color-on-paginated-screen screen, 0xec, 7 # 236 = darkish gray +391 fn normal-text screen: (addr paginated-screen) { +392 reset-formatting-on-paginated-screen screen +393 start-color-on-paginated-screen screen, 0xec, 7 # 236 = darkish gray 394 } diff --git a/html/apps/raytracing/1.mu.html b/html/apps/raytracing/1.mu.html index bc5ab657..b72418ad 100644 --- a/html/apps/raytracing/1.mu.html +++ b/html/apps/raytracing/1.mu.html @@ -65,7 +65,7 @@ if ('onhashchange' in window) { 7 # $ ./translate_mu apps/raytracing/1.mu 8 # $ ./a.elf > 1.ppm 9 -10 fn main -> _/ebx: int { +10 fn main -> _/ebx: int { 11 print-string 0, "P3\n256 256\n255\n" 12 var j/ecx: int <- copy 0xff 13 { diff --git a/html/apps/raytracing/2.mu.html b/html/apps/raytracing/2.mu.html index 8e068b01..56563080 100644 --- a/html/apps/raytracing/2.mu.html +++ b/html/apps/raytracing/2.mu.html @@ -65,7 +65,7 @@ if ('onhashchange' in window) { 6 # $ ./translate_mu apps/raytracing/2.mu 7 # $ ./a.elf > 2.ppm 8 - 9 fn main -> _/ebx: int { + 9 fn main -> _/ebx: int { 10 print-string 0, "P3\n256 256\n255\n" 11 var _four/edx: int <- copy 4 12 var four/xmm1: float <- convert _four @@ -80,7 +80,7 @@ if ('onhashchange' in window) { 21 { 22 compare i, 0xff 23 break-if-> -24 var c: rgb +24 var c: rgb 25 # compute r 26 var tmp/xmm0: float <- convert i 27 tmp <- divide image-size @@ -98,8 +98,8 @@ if ('onhashchange' in window) { 39 var b-addr/edx: (addr float) <- get c, b 40 copy-to *b-addr, one-fourth 41 # emit -42 var c-addr/edx: (addr rgb) <- address c -43 print-rgb 0, c-addr +42 var c-addr/edx: (addr rgb) <- address c +43 print-rgb 0, c-addr 44 i <- increment 45 loop 46 } @@ -109,7 +109,7 @@ if ('onhashchange' in window) { 50 return 0 51 } 52 -53 type rgb { +53 type rgb { 54 # components normalized to within [0.0, 1.0] 55 r: float 56 g: float @@ -117,8 +117,8 @@ if ('onhashchange' in window) { 58 } 59 60 # print translating to [0, 256) -61 fn print-rgb screen: (addr screen), _c: (addr rgb) { -62 var c/esi: (addr rgb) <- copy _c +61 fn print-rgb screen: (addr screen), _c: (addr rgb) { +62 var c/esi: (addr rgb) <- copy _c 63 var n/ecx: int <- copy 0xff # turns out 255 works just as well as 255.999, which is lucky because we don't have floating-point literals 64 var xn/xmm1: float <- convert n 65 # print 255 * c->r diff --git a/html/apps/raytracing/3.mu.html b/html/apps/raytracing/3.mu.html index 9819e2ba..0e6820b4 100644 --- a/html/apps/raytracing/3.mu.html +++ b/html/apps/raytracing/3.mu.html @@ -67,16 +67,16 @@ if ('onhashchange' in window) { 6 # $ ./translate_mu apps/raytracing/3.mu 7 # $ ./a.elf > 3.ppm 8 - 9 fn ray-color _in: (addr ray), _out: (addr rgb) { - 10 var in/esi: (addr ray) <- copy _in - 11 var out/edi: (addr rgb) <- copy _out - 12 var dir/eax: (addr vec3) <- get in, dir + 9 fn ray-color _in: (addr ray), _out: (addr rgb) { + 10 var in/esi: (addr ray) <- copy _in + 11 var out/edi: (addr rgb) <- copy _out + 12 var dir/eax: (addr vec3) <- get in, dir 13 #? print-string 0, "r.dir: " 14 #? print-vec3 0, dir 15 #? print-string 0, "\n" - 16 var unit-storage: vec3 - 17 var unit/ecx: (addr vec3) <- address unit-storage - 18 vec3-unit dir, unit + 16 var unit-storage: vec3 + 17 var unit/ecx: (addr vec3) <- address unit-storage + 18 vec3-unit dir, unit 19 #? print-string 0, "r.dir normalized: " 20 #? print-vec3 0, unit 21 #? print-string 0, "\n" @@ -93,8 +93,8 @@ if ('onhashchange' in window) { 32 #? print-float 0, t 33 #? print-string 0, "\n" 34 # whitening = (1.0 - t) * white - 35 var whitening-storage: rgb - 36 var whitening/ecx: (addr rgb) <- address whitening-storage + 35 var whitening-storage: rgb + 36 var whitening/ecx: (addr rgb) <- address whitening-storage 37 rgb-white whitening 38 var one-minus-t/xmm3: float <- copy one-f 39 one-minus-t <- subtract t @@ -120,7 +120,7 @@ if ('onhashchange' in window) { 59 #? print-string 0, "\n" 60 } 61 - 62 fn main -> _/ebx: int { + 62 fn main -> _/ebx: int { 63 64 # image 65 # width = 400 @@ -171,33 +171,33 @@ if ('onhashchange' in window) { 110 var focal-length/xmm5: float <- convert tmp 111 112 # origin = point3(0, 0, 0) -113 var origin-storage: vec3 -114 var origin/edi: (addr vec3) <- address origin-storage +113 var origin-storage: vec3 +114 var origin/edi: (addr vec3) <- address origin-storage 115 # horizontal = vec3(viewport-width, 0, 0) -116 var horizontal-storage: vec3 +116 var horizontal-storage: vec3 117 var dest/eax: (addr float) <- get horizontal-storage, x 118 copy-to *dest, viewport-width -119 var horizontal/ebx: (addr vec3) <- address horizontal-storage +119 var horizontal/ebx: (addr vec3) <- address horizontal-storage 120 # vertical = vec3(0, viewport-height, 0) -121 var vertical-storage: vec3 +121 var vertical-storage: vec3 122 dest <- get vertical-storage, y 123 copy-to *dest, viewport-height -124 var vertical/edx: (addr vec3) <- address vertical-storage +124 var vertical/edx: (addr vec3) <- address vertical-storage 125 # lower-left-corner = origin - horizontal/2 - vertical/2 - vec3(0, 0, focal-length) 126 # . lower-left-corner = origin -127 var lower-left-corner-storage: vec3 -128 var lower-left-corner/esi: (addr vec3) <- address lower-left-corner-storage +127 var lower-left-corner-storage: vec3 +128 var lower-left-corner/esi: (addr vec3) <- address lower-left-corner-storage 129 copy-object origin, lower-left-corner 130 # . lower-left-corner -= horizontal/2 -131 var tmp2: vec3 -132 var tmp2-addr/eax: (addr vec3) <- address tmp2 +131 var tmp2: vec3 +132 var tmp2-addr/eax: (addr vec3) <- address tmp2 133 copy-object horizontal, tmp2-addr -134 vec3-scale-down tmp2-addr, two-f -135 vec3-subtract-from lower-left-corner, tmp2-addr +134 vec3-scale-down tmp2-addr, two-f +135 vec3-subtract-from lower-left-corner, tmp2-addr 136 # . lower-left-corner -= vertical/2 137 copy-object vertical, tmp2-addr -138 vec3-scale-down tmp2-addr, two-f -139 vec3-subtract-from lower-left-corner, tmp2-addr +138 vec3-scale-down tmp2-addr, two-f +139 vec3-subtract-from lower-left-corner, tmp2-addr 140 # . lower-left-corner -= vec3(0, 0, focal-length) 141 var dest2/ecx: (addr float) <- get lower-left-corner, z 142 var tmp3/xmm0: float <- copy *dest2 @@ -237,42 +237,42 @@ if ('onhashchange' in window) { 176 var v/xmm1: float <- convert j 177 v <- divide image-height-1 178 # r = ray(origin, lower-left-corner + u*horizontal + v*vertical - origin) -179 var r-storage: ray +179 var r-storage: ray 180 # . . we're running out of int registers now, 181 # . . but luckily we don't need i and j in the rest of this loop iteration, 182 # . . so we'll just spill them in a block 183 { 184 # . r.orig = origin -185 var r/eax: (addr ray) <- address r-storage -186 var dest/ecx: (addr vec3) <- get r, orig +185 var r/eax: (addr ray) <- address r-storage +186 var dest/ecx: (addr vec3) <- get r, orig 187 copy-object origin, dest 188 # . r.dir = lower-left-corner 189 dest <- get r, dir 190 copy-object lower-left-corner, dest 191 # . r.dir += horizontal*u -192 var tmp-vec3: vec3 -193 var tmp/eax: (addr vec3) <- address tmp-vec3 +192 var tmp-vec3: vec3 +193 var tmp/eax: (addr vec3) <- address tmp-vec3 194 copy-object horizontal, tmp -195 vec3-scale-up tmp, u -196 vec3-add-to dest, tmp +195 vec3-scale-up tmp, u +196 vec3-add-to dest, tmp 197 # . r.dir += vertical*v 198 copy-object vertical, tmp -199 vec3-scale-up tmp, v -200 vec3-add-to dest, tmp +199 vec3-scale-up tmp, v +200 vec3-add-to dest, tmp 201 # . r.dir -= origin -202 vec3-subtract-from dest, origin +202 vec3-subtract-from dest, origin 203 #? print-string 0, "ray direction: " 204 #? print-vec3 0, dest 205 #? print-string 0, "\n" 206 } 207 # pixel-color = ray-color(r) -208 var c-storage: rgb -209 var c/ecx: (addr rgb) <- address c-storage +208 var c-storage: rgb +209 var c/ecx: (addr rgb) <- address c-storage 210 { -211 var r/eax: (addr ray) <- address r-storage +211 var r/eax: (addr ray) <- address r-storage 212 ray-color r, c 213 # write color -214 print-rgb 0, c +214 print-rgb 0, c 215 #? print-rgb-raw 0, c 216 #? print-string 0, "\n" 217 } @@ -285,32 +285,32 @@ if ('onhashchange' in window) { 224 return 0 225 } 226 -227 type ray { -228 orig: vec3 # point -229 dir: vec3 +227 type ray { +228 orig: vec3 # point +229 dir: vec3 230 } 231 232 # A little different from the constructor at https://raytracing.github.io/books/RayTracingInOneWeekend.html 233 # We immediately normalize the direction vector so we don't have to keep doing 234 # so. -235 fn initialize-ray _self: (addr ray), o: (addr vec3), d: (addr vec3) { -236 var self/esi: (addr ray) <- copy _self -237 var dest/eax: (addr vec3) <- get self, orig +235 fn initialize-ray _self: (addr ray), o: (addr vec3), d: (addr vec3) { +236 var self/esi: (addr ray) <- copy _self +237 var dest/eax: (addr vec3) <- get self, orig 238 copy-object o, dest 239 dest <- get self, dir -240 vec3-unit d, dest +240 vec3-unit d, dest 241 } 242 -243 fn ray-at _self: (addr ray), t: float, out: (addr vec3) { -244 var self/esi: (addr ray) <- copy _self -245 var src/eax: (addr vec3) <- get self, dir +243 fn ray-at _self: (addr ray), t: float, out: (addr vec3) { +244 var self/esi: (addr ray) <- copy _self +245 var src/eax: (addr vec3) <- get self, dir 246 copy-object src, out -247 vec3-scale-up out, t +247 vec3-scale-up out, t 248 src <- get self, orig -249 vec3-add-to out, src +249 vec3-add-to out, src 250 } 251 -252 type rgb { +252 type rgb { 253 # components normalized to within [0.0, 1.0] 254 r: float 255 g: float @@ -318,8 +318,8 @@ if ('onhashchange' in window) { 257 } 258 259 # print translating to [0, 256) -260 fn print-rgb screen: (addr screen), _c: (addr rgb) { -261 var c/esi: (addr rgb) <- copy _c +260 fn print-rgb screen: (addr screen), _c: (addr rgb) { +261 var c/esi: (addr rgb) <- copy _c 262 var xn: float 263 var xn-addr/ecx: (addr float) <- address xn 264 fill-in-rational xn-addr, 0x3e7ff, 0x3e8 # 255999 / 1000 @@ -346,8 +346,8 @@ if ('onhashchange' in window) { 285 print-string screen, "\n" 286 } 287 -288 fn print-rgb-raw screen: (addr screen), _v: (addr rgb) { -289 var v/esi: (addr rgb) <- copy _v +288 fn print-rgb-raw screen: (addr screen), _v: (addr rgb) { +289 var v/esi: (addr rgb) <- copy _v 290 print-string screen, "(" 291 var tmp/eax: (addr float) <- get v, r 292 print-float screen, *tmp @@ -360,8 +360,8 @@ if ('onhashchange' in window) { 299 print-string screen, ")" 300 } 301 -302 fn rgb-white _c: (addr rgb) { -303 var c/esi: (addr rgb) <- copy _c +302 fn rgb-white _c: (addr rgb) { +303 var c/esi: (addr rgb) <- copy _c 304 var one/eax: int <- copy 1 305 var one-f/xmm0: float <- convert one 306 var dest/edi: (addr float) <- get c, r @@ -372,9 +372,9 @@ if ('onhashchange' in window) { 311 copy-to *dest, one-f 312 } 313 -314 fn rgb-add-to _c1: (addr rgb), _c2: (addr rgb) { -315 var c1/edi: (addr rgb) <- copy _c1 -316 var c2/esi: (addr rgb) <- copy _c2 +314 fn rgb-add-to _c1: (addr rgb), _c2: (addr rgb) { +315 var c1/edi: (addr rgb) <- copy _c1 +316 var c2/esi: (addr rgb) <- copy _c2 317 # c1.r += c2.r 318 var arg1/eax: (addr float) <- get c1, r 319 var arg2/ecx: (addr float) <- get c2, r @@ -395,8 +395,8 @@ if ('onhashchange' in window) { 334 copy-to *arg1, result 335 } 336 -337 fn rgb-scale-up _c1: (addr rgb), f: float { -338 var c1/edi: (addr rgb) <- copy _c1 +337 fn rgb-scale-up _c1: (addr rgb), f: float { +338 var c1/edi: (addr rgb) <- copy _c1 339 # c1.r *= f 340 var dest/eax: (addr float) <- get c1, r 341 var result/xmm0: float <- copy *dest @@ -414,14 +414,14 @@ if ('onhashchange' in window) { 353 copy-to *dest, result 354 } 355 -356 type vec3 { +356 type vec3 { 357 x: float 358 y: float 359 z: float 360 } 361 -362 fn print-vec3 screen: (addr screen), _v: (addr vec3) { -363 var v/esi: (addr vec3) <- copy _v +362 fn print-vec3 screen: (addr screen), _v: (addr vec3) { +363 var v/esi: (addr vec3) <- copy _v 364 print-string screen, "(" 365 var tmp/eax: (addr float) <- get v, x 366 print-float screen, *tmp @@ -434,9 +434,9 @@ if ('onhashchange' in window) { 373 print-string screen, ")" 374 } 375 -376 fn vec3-add-to _v1: (addr vec3), _v2: (addr vec3) { -377 var v1/edi: (addr vec3) <- copy _v1 -378 var v2/esi: (addr vec3) <- copy _v2 +376 fn vec3-add-to _v1: (addr vec3), _v2: (addr vec3) { +377 var v1/edi: (addr vec3) <- copy _v1 +378 var v2/esi: (addr vec3) <- copy _v2 379 # v1.x += v2.x 380 var arg1/eax: (addr float) <- get v1, x 381 var arg2/ecx: (addr float) <- get v2, x @@ -457,22 +457,22 @@ if ('onhashchange' in window) { 396 copy-to *arg1, result 397 } 398 -399 fn vec3-subtract-from v1: (addr vec3), v2: (addr vec3) { -400 var tmp-storage: vec3 -401 var tmp/eax: (addr vec3) <- address tmp-storage +399 fn vec3-subtract-from v1: (addr vec3), v2: (addr vec3) { +400 var tmp-storage: vec3 +401 var tmp/eax: (addr vec3) <- address tmp-storage 402 copy-object v2, tmp -403 vec3-negate tmp -404 vec3-add-to v1, tmp +403 vec3-negate tmp +404 vec3-add-to v1, tmp 405 } 406 -407 fn vec3-negate v: (addr vec3) { +407 fn vec3-negate v: (addr vec3) { 408 var negative-one/eax: int <- copy -1 409 var negative-one-f/xmm0: float <- convert negative-one -410 vec3-scale-up v, negative-one-f +410 vec3-scale-up v, negative-one-f 411 } 412 -413 fn vec3-scale-up _v: (addr vec3), f: float { -414 var v/edi: (addr vec3) <- copy _v +413 fn vec3-scale-up _v: (addr vec3), f: float { +414 var v/edi: (addr vec3) <- copy _v 415 # v.x *= f 416 var dest/eax: (addr float) <- get v, x 417 var result/xmm0: float <- copy *dest @@ -490,8 +490,8 @@ if ('onhashchange' in window) { 429 copy-to *dest, result 430 } 431 -432 fn vec3-scale-down _v: (addr vec3), f: float { -433 var v/edi: (addr vec3) <- copy _v +432 fn vec3-scale-down _v: (addr vec3), f: float { +433 var v/edi: (addr vec3) <- copy _v 434 # v.x /= f 435 var dest/eax: (addr float) <- get v, x 436 var result/xmm0: float <- copy *dest @@ -509,23 +509,23 @@ if ('onhashchange' in window) { 448 copy-to *dest, result 449 } 450 -451 fn vec3-unit in: (addr vec3), out: (addr vec3) { -452 var len/xmm0: float <- vec3-length in +451 fn vec3-unit in: (addr vec3), out: (addr vec3) { +452 var len/xmm0: float <- vec3-length in 453 #? print-string 0, "len: " 454 #? print-float 0, len 455 #? print-string 0, "\n" 456 copy-object in, out -457 vec3-scale-down out, len +457 vec3-scale-down out, len 458 } 459 -460 fn vec3-length v: (addr vec3) -> _/xmm0: float { -461 var result/xmm0: float <- vec3-length-squared v +460 fn vec3-length v: (addr vec3) -> _/xmm0: float { +461 var result/xmm0: float <- vec3-length-squared v 462 result <- square-root result 463 return result 464 } 465 -466 fn vec3-length-squared _v: (addr vec3) -> _/xmm0: float { -467 var v/esi: (addr vec3) <- copy _v +466 fn vec3-length-squared _v: (addr vec3) -> _/xmm0: float { +467 var v/esi: (addr vec3) <- copy _v 468 # result = v.x * v.x 469 var src/eax: (addr float) <- get v, x 470 var tmp/xmm1: float <- copy *src diff --git a/html/apps/raytracing/color.mu.html b/html/apps/raytracing/color.mu.html index 8313b7ec..3daaa25b 100644 --- a/html/apps/raytracing/color.mu.html +++ b/html/apps/raytracing/color.mu.html @@ -56,7 +56,7 @@ if ('onhashchange' in window) { https://github.com/akkartik/mu/blob/master/apps/raytracing/color.mu
- 1 type rgb {
+ 1 type rgb {
  2   # components normalized to within [0.0, 1.0]
  3   r: float
  4   g: float
@@ -64,8 +64,8 @@ if ('onhashchange' in window) {
  6 }
  7 
  8 # print translating to [0, 256)
- 9 fn print-rgb screen: (addr screen), _c: (addr rgb) {
-10   var c/esi: (addr rgb) <- copy _c
+ 9 fn print-rgb screen: (addr screen), _c: (addr rgb) {
+10   var c/esi: (addr rgb) <- copy _c
 11   var xn: float
 12   var xn-addr/ecx: (addr float) <- address xn
 13   fill-in-rational xn-addr, 0x3e7ff, 0x3e8  # 255999 / 1000
diff --git a/html/apps/raytracing/ray.mu.html b/html/apps/raytracing/ray.mu.html
index b3fe9789..dbe00587 100644
--- a/html/apps/raytracing/ray.mu.html
+++ b/html/apps/raytracing/ray.mu.html
@@ -56,7 +56,7 @@ if ('onhashchange' in window) {
 
 https://github.com/akkartik/mu/blob/master/apps/raytracing/ray.mu
 
- 1 type ray {
+ 1 type ray {
  2   orig: vec3  # point
  3   dir: vec3
  4 }
@@ -64,16 +64,16 @@ if ('onhashchange' in window) {
  6 # A little different from the constructor at https://raytracing.github.io/books/RayTracingInOneWeekend.html
  7 # We immediately normalize the direction vector so we don't have to keep doing
  8 # so.
- 9 fn initialize-ray _self: (addr ray), o: (addr vec3), d: (addr vec3) {
-10   var self/esi: (addr ray) <- copy _self
+ 9 fn initialize-ray _self: (addr ray), o: (addr vec3), d: (addr vec3) {
+10   var self/esi: (addr ray) <- copy _self
 11   var dest/eax: (addr vec3) <- get self, orig
 12   copy-object o, dest
 13   dest <- get self, dir
 14   vec3-unit d, dest
 15 }
 16 
-17 fn ray-at _self: (addr ray), t: float, out: (addr vec3) {
-18   var self/esi: (addr ray) <- copy _self
+17 fn ray-at _self: (addr ray), t: float, out: (addr vec3) {
+18   var self/esi: (addr ray) <- copy _self
 19   var src/eax: (addr vec3) <- get self, dir
 20   copy-object src, out
 21   vec3-scale-up out, t
diff --git a/html/apps/raytracing/vec.mu.html b/html/apps/raytracing/vec.mu.html
index b3aeb5f0..9b8961c2 100644
--- a/html/apps/raytracing/vec.mu.html
+++ b/html/apps/raytracing/vec.mu.html
@@ -57,14 +57,14 @@ if ('onhashchange' in window) {
 
 https://github.com/akkartik/mu/blob/master/apps/raytracing/vec.mu
 
-  1 type vec3 {
+  1 type vec3 {
   2   x: float
   3   y: float
   4   z: float
   5 }
   6 
-  7 fn print-vec3 screen: (addr screen), _v: (addr vec3) {
-  8   var v/esi: (addr vec3) <- copy _v
+  7 fn print-vec3 screen: (addr screen), _v: (addr vec3) {
+  8   var v/esi: (addr vec3) <- copy _v
   9   print-string screen, "("
  10   var tmp/eax: (addr float) <- get v, x
  11   print-float screen, *tmp
@@ -77,9 +77,9 @@ if ('onhashchange' in window) {
  18   print-string screen, ")"
  19 }
  20 
- 21 fn vec3-add-to _v1: (addr vec3), _v2: (addr vec3) {
- 22   var v1/edi: (addr vec3) <- copy _v1
- 23   var v2/esi: (addr vec3) <- copy _v2
+ 21 fn vec3-add-to _v1: (addr vec3), _v2: (addr vec3) {
+ 22   var v1/edi: (addr vec3) <- copy _v1
+ 23   var v2/esi: (addr vec3) <- copy _v2
  24   # v1.x += v2.x
  25   var arg1/eax: (addr float) <- get v1, x
  26   var arg2/ecx: (addr float) <- get v2, x
@@ -100,22 +100,22 @@ if ('onhashchange' in window) {
  41   copy-to *arg1, result
  42 }
  43 
- 44 fn vec3-subtract-from v1: (addr vec3), v2: (addr vec3) {
- 45   var tmp-storage: vec3
- 46   var tmp/eax: (addr vec3) <- address tmp-storage
+ 44 fn vec3-subtract-from v1: (addr vec3), v2: (addr vec3) {
+ 45   var tmp-storage: vec3
+ 46   var tmp/eax: (addr vec3) <- address tmp-storage
  47   copy-object v2, tmp
- 48   vec3-negate tmp
- 49   vec3-add-to v1, tmp
+ 48   vec3-negate tmp
+ 49   vec3-add-to v1, tmp
  50 }
  51 
- 52 fn vec3-negate v: (addr vec3) {
+ 52 fn vec3-negate v: (addr vec3) {
  53   var negative-one/eax: int <- copy -1
  54   var negative-one-f/xmm0: float <- convert negative-one
- 55   vec3-scale-up v, negative-one-f
+ 55   vec3-scale-up v, negative-one-f
  56 }
  57 
- 58 fn vec3-scale-up _v: (addr vec3), f: float {
- 59   var v/edi: (addr vec3) <- copy _v
+ 58 fn vec3-scale-up _v: (addr vec3), f: float {
+ 59   var v/edi: (addr vec3) <- copy _v
  60   # v.x *= f
  61   var dest/eax: (addr float) <- get v, x
  62   var result/xmm0: float <- copy *dest
@@ -133,8 +133,8 @@ if ('onhashchange' in window) {
  74   copy-to *dest, result
  75 }
  76 
- 77 fn vec3-scale-down _v: (addr vec3), f: float {
- 78   var v/edi: (addr vec3) <- copy _v
+ 77 fn vec3-scale-down _v: (addr vec3), f: float {
+ 78   var v/edi: (addr vec3) <- copy _v
  79   # v.x /= f
  80   var dest/eax: (addr float) <- get v, x
  81   var result/xmm0: float <- copy *dest
@@ -152,23 +152,23 @@ if ('onhashchange' in window) {
  93   copy-to *dest, result
  94 }
  95 
- 96 fn vec3-unit in: (addr vec3), out: (addr vec3) {
- 97   var len/xmm0: float <- vec3-length in
+ 96 fn vec3-unit in: (addr vec3), out: (addr vec3) {
+ 97   var len/xmm0: float <- vec3-length in
  98 #?   print-string 0, "len: "
  99 #?   print-float 0, len
 100 #?   print-string 0, "\n"
 101   copy-object in, out
-102   vec3-scale-down out, len
+102   vec3-scale-down out, len
 103 }
 104 
-105 fn vec3-length v: (addr vec3) -> _/xmm0: float {
-106   var result/xmm0: float <- vec3-length-squared v
+105 fn vec3-length v: (addr vec3) -> _/xmm0: float {
+106   var result/xmm0: float <- vec3-length-squared v
 107   result <- square-root result
 108   return result
 109 }
 110 
-111 fn vec3-length-squared _v: (addr vec3) -> _/xmm0: float {
-112   var v/esi: (addr vec3) <- copy _v
+111 fn vec3-length-squared _v: (addr vec3) -> _/xmm0: float {
+112   var v/esi: (addr vec3) <- copy _v
 113   # result = v.x * v.x
 114   var src/eax: (addr float) <- get v, x
 115   var tmp/xmm1: float <- copy *src
@@ -187,10 +187,10 @@ if ('onhashchange' in window) {
 128   return result
 129 }
 130 
-131 fn vec3-dot _v1: (addr vec3), _v2: (addr vec3) -> _/xmm0: float {
+131 fn vec3-dot _v1: (addr vec3), _v2: (addr vec3) -> _/xmm0: float {
 132 }
 133 
-134 fn vec3-cross _v1: (addr vec3), _v2: (addr vec3), out: (addr vec3) {
+134 fn vec3-cross _v1: (addr vec3), _v2: (addr vec3), out: (addr vec3) {
 135 }
 
diff --git a/html/apps/tile/data.mu.html b/html/apps/tile/data.mu.html index 9cfd5f38..6ab72085 100644 --- a/html/apps/tile/data.mu.html +++ b/html/apps/tile/data.mu.html @@ -87,7 +87,7 @@ if ('onhashchange' in window) { 28 } 29 30 type word { - 31 scalar-data: (handle gap-buffer) + 31 scalar-data: (handle gap-buffer) 32 next: (handle word) 33 prev: (handle word) 34 } @@ -127,7 +127,7 @@ if ('onhashchange' in window) { 68 } 69 70 type result { - 71 data: value-stack + 71 data: value-stack 72 error: (handle array byte) # single error message for now 73 } 74 @@ -151,7 +151,7 @@ if ('onhashchange' in window) { 92 var word-ah/eax: (addr handle word) <- get line, data 93 allocate word-ah 94 var word/eax: (addr word) <- lookup *word-ah - 95 initialize-word word + 95 initialize-word word 96 } 97 98 fn create-primitive-functions _self: (addr handle function) { @@ -165,7 +165,7 @@ if ('onhashchange' in window) { 106 var args-ah/eax: (addr handle word) <- get f, args 107 allocate args-ah 108 var args/eax: (addr word) <- lookup *args-ah -109 initialize-word-with args, "x" +109 initialize-word-with args, "x" 110 var body-ah/eax: (addr handle line) <- get f, body 111 allocate body-ah 112 var body/eax: (addr line) <- lookup *body-ah @@ -175,12 +175,12 @@ if ('onhashchange' in window) { 116 allocate curr-word-ah 117 var tmp/eax: (addr word) <- lookup *curr-word-ah 118 var curr-word/edx: (addr word) <- copy tmp -119 initialize-word-with curr-word, "x" +119 initialize-word-with curr-word, "x" 120 # *curr-word->next = "2" 121 var next-word-ah/ebx: (addr handle word) <- get curr-word, next 122 allocate next-word-ah 123 tmp <- lookup *next-word-ah -124 initialize-word-with tmp, "2" +124 initialize-word-with tmp, "2" 125 # *curr-word->next->prev = curr-word 126 var prev-word-ah/edi: (addr handle word) <- get tmp, prev 127 copy-object curr-word-ah, prev-word-ah @@ -191,7 +191,7 @@ if ('onhashchange' in window) { 132 next-word-ah <- get curr-word, next 133 allocate next-word-ah 134 tmp <- lookup *next-word-ah -135 initialize-word-with tmp, "*" +135 initialize-word-with tmp, "*" 136 # *curr-word->next->prev = curr-word 137 prev-word-ah <- get tmp, prev 138 copy-object curr-word-ah, prev-word-ah @@ -206,7 +206,7 @@ if ('onhashchange' in window) { 147 var args-ah/eax: (addr handle word) <- get f, args 148 allocate args-ah 149 var args/eax: (addr word) <- lookup *args-ah -150 initialize-word-with args, "x" +150 initialize-word-with args, "x" 151 var body-ah/eax: (addr handle line) <- get f, body 152 allocate body-ah 153 var body/eax: (addr line) <- lookup *body-ah @@ -216,12 +216,12 @@ if ('onhashchange' in window) { 157 allocate curr-word-ah 158 var tmp/eax: (addr word) <- lookup *curr-word-ah 159 curr-word <- copy tmp -160 initialize-word-with curr-word, "x" +160 initialize-word-with curr-word, "x" 161 # *curr-word->next = "1" 162 next-word-ah <- get curr-word, next 163 allocate next-word-ah 164 tmp <- lookup *next-word-ah -165 initialize-word-with tmp, "1" +165 initialize-word-with tmp, "1" 166 # *curr-word->next->prev = curr-word 167 prev-word-ah <- get tmp, prev 168 copy-object curr-word-ah, prev-word-ah @@ -232,7 +232,7 @@ if ('onhashchange' in window) { 173 next-word-ah <- get curr-word, next 174 allocate next-word-ah 175 tmp <- lookup *next-word-ah -176 initialize-word-with tmp, "+" +176 initialize-word-with tmp, "+" 177 # *curr-word->next->prev = curr-word 178 prev-word-ah <- get tmp, prev 179 copy-object curr-word-ah, prev-word-ah @@ -247,7 +247,7 @@ if ('onhashchange' in window) { 188 var args-ah/eax: (addr handle word) <- get f, args 189 allocate args-ah 190 var args/eax: (addr word) <- lookup *args-ah -191 initialize-word-with args, "x" +191 initialize-word-with args, "x" 192 var body-ah/eax: (addr handle line) <- get f, body 193 allocate body-ah 194 var body/eax: (addr line) <- lookup *body-ah @@ -257,12 +257,12 @@ if ('onhashchange' in window) { 198 allocate curr-word-ah 199 var tmp/eax: (addr word) <- lookup *curr-word-ah 200 curr-word <- copy tmp -201 initialize-word-with curr-word, "x" +201 initialize-word-with curr-word, "x" 202 # *curr-word->next = "1+" 203 next-word-ah <- get curr-word, next 204 allocate next-word-ah 205 tmp <- lookup *next-word-ah -206 initialize-word-with tmp, "1+" +206 initialize-word-with tmp, "1+" 207 # *curr-word->next->prev = curr-word 208 prev-word-ah <- get tmp, prev 209 copy-object curr-word-ah, prev-word-ah @@ -273,7 +273,7 @@ if ('onhashchange' in window) { 214 next-word-ah <- get curr-word, next 215 allocate next-word-ah 216 tmp <- lookup *next-word-ah -217 initialize-word-with tmp, "1+" +217 initialize-word-with tmp, "1+" 218 # *curr-word->next->prev = curr-word 219 prev-word-ah <- get tmp, prev 220 copy-object curr-word-ah, prev-word-ah @@ -288,7 +288,7 @@ if ('onhashchange' in window) { 229 var args-ah/eax: (addr handle word) <- get f, args 230 allocate args-ah 231 var args/eax: (addr word) <- lookup *args-ah -232 initialize-word-with args, "x" +232 initialize-word-with args, "x" 233 var body-ah/eax: (addr handle line) <- get f, body 234 allocate body-ah 235 var body/eax: (addr line) <- lookup *body-ah @@ -298,12 +298,12 @@ if ('onhashchange' in window) { 239 allocate curr-word-ah 240 var tmp/eax: (addr word) <- lookup *curr-word-ah 241 var curr-word/edx: (addr word) <- copy tmp -242 initialize-word-with curr-word, "x" +242 initialize-word-with curr-word, "x" 243 # *curr-word->next = "x" 244 var next-word-ah/ebx: (addr handle word) <- get curr-word, next 245 allocate next-word-ah 246 tmp <- lookup *next-word-ah -247 initialize-word-with tmp, "x" +247 initialize-word-with tmp, "x" 248 # *curr-word->next->prev = curr-word 249 var prev-word-ah/edi: (addr handle word) <- get tmp, prev 250 copy-object curr-word-ah, prev-word-ah @@ -314,7 +314,7 @@ if ('onhashchange' in window) { 255 next-word-ah <- get curr-word, next 256 allocate next-word-ah 257 tmp <- lookup *next-word-ah -258 initialize-word-with tmp, "*" +258 initialize-word-with tmp, "*" 259 # *curr-word->next->prev = curr-word 260 prev-word-ah <- get tmp, prev 261 copy-object curr-word-ah, prev-word-ah @@ -329,7 +329,7 @@ if ('onhashchange' in window) { 270 var args-ah/eax: (addr handle word) <- get f, args 271 allocate args-ah 272 var args/eax: (addr word) <- lookup *args-ah -273 initialize-word-with args, "x" +273 initialize-word-with args, "x" 274 var body-ah/eax: (addr handle line) <- get f, body 275 allocate body-ah 276 var body/eax: (addr line) <- lookup *body-ah @@ -339,12 +339,12 @@ if ('onhashchange' in window) { 280 allocate curr-word-ah 281 var tmp/eax: (addr word) <- lookup *curr-word-ah 282 curr-word <- copy tmp -283 initialize-word-with curr-word, "x" +283 initialize-word-with curr-word, "x" 284 # *curr-word->next = "1" 285 next-word-ah <- get curr-word, next 286 allocate next-word-ah 287 tmp <- lookup *next-word-ah -288 initialize-word-with tmp, "1" +288 initialize-word-with tmp, "1" 289 # *curr-word->next->prev = curr-word 290 prev-word-ah <- get tmp, prev 291 copy-object curr-word-ah, prev-word-ah @@ -355,7 +355,7 @@ if ('onhashchange' in window) { 296 next-word-ah <- get curr-word, next 297 allocate next-word-ah 298 tmp <- lookup *next-word-ah -299 initialize-word-with tmp, "-" +299 initialize-word-with tmp, "-" 300 # *curr-word->next->prev = curr-word 301 prev-word-ah <- get tmp, prev 302 copy-object curr-word-ah, prev-word-ah @@ -371,11 +371,11 @@ if ('onhashchange' in window) { 312 var args-ah/eax: (addr handle word) <- get f, args 313 allocate args-ah 314 var args/eax: (addr word) <- lookup *args-ah -315 initialize-word-with args, "y" +315 initialize-word-with args, "y" 316 var next-arg-ah/eax: (addr handle word) <- get args, next 317 allocate next-arg-ah 318 var next-arg/eax: (addr word) <- lookup *next-arg-ah -319 initialize-word-with next-arg, "x" +319 initialize-word-with next-arg, "x" 320 var body-ah/eax: (addr handle line) <- get f, body 321 allocate body-ah 322 var body/eax: (addr line) <- lookup *body-ah @@ -385,12 +385,12 @@ if ('onhashchange' in window) { 326 allocate curr-word-ah 327 var tmp/eax: (addr word) <- lookup *curr-word-ah 328 curr-word <- copy tmp -329 initialize-word-with curr-word, "x" +329 initialize-word-with curr-word, "x" 330 # *curr-word->next = "y" 331 next-word-ah <- get curr-word, next 332 allocate next-word-ah 333 tmp <- lookup *next-word-ah -334 initialize-word-with tmp, "y" +334 initialize-word-with tmp, "y" 335 # *curr-word->next->prev = curr-word 336 prev-word-ah <- get tmp, prev 337 copy-object curr-word-ah, prev-word-ah @@ -401,7 +401,7 @@ if ('onhashchange' in window) { 342 next-word-ah <- get curr-word, next 343 allocate next-word-ah 344 tmp <- lookup *next-word-ah -345 initialize-word-with tmp, "-" +345 initialize-word-with tmp, "-" 346 # *curr-word->next->prev = curr-word 347 prev-word-ah <- get tmp, prev 348 copy-object curr-word-ah, prev-word-ah @@ -413,9 +413,9 @@ if ('onhashchange' in window) { 354 var function-name-ah/ecx: (addr handle array byte) <- address function-name-storage 355 var word-ah/esi: (addr handle word) <- copy _word 356 var word/eax: (addr word) <- lookup *word-ah -357 var gap-ah/eax: (addr handle gap-buffer) <- get word, scalar-data -358 var gap/eax: (addr gap-buffer) <- lookup *gap-ah -359 gap-buffer-to-string gap, function-name-ah +357 var gap-ah/eax: (addr handle gap-buffer) <- get word, scalar-data +358 var gap/eax: (addr gap-buffer) <- lookup *gap-ah +359 gap-buffer-to-string gap, function-name-ah 360 var _function-name/eax: (addr array byte) <- lookup *function-name-ah 361 var function-name/esi: (addr array byte) <- copy _function-name 362 var curr-ah/ecx: (addr handle function) <- copy functions @@ -730,7 +730,7 @@ if ('onhashchange' in window) { 671 var x/esi: (addr call-path-element) <- copy _x 672 var word-ah/eax: (addr handle word) <- get x, word 673 var word/eax: (addr word) <- lookup *word-ah -674 print-word screen, word +674 print-word screen, word 675 var next-ah/ecx: (addr handle call-path-element) <- get x, next 676 var next/eax: (addr call-path-element) <- lookup *next-ah 677 compare next, 0 @@ -762,7 +762,7 @@ if ('onhashchange' in window) { 703 fn function-width _self: (addr function) -> _/eax: int { 704 var self/esi: (addr function) <- copy _self 705 var args/ecx: (addr handle word) <- get self, args -706 var arg-width/eax: int <- word-list-length args +706 var arg-width/eax: int <- word-list-length args 707 var result/edi: int <- copy arg-width 708 result <- add 4 # function-header-indent + body-indent 709 var body-ah/eax: (addr handle line) <- get self, body @@ -786,7 +786,7 @@ if ('onhashchange' in window) { 727 break-if-= 728 { 729 var words/ecx: (addr handle word) <- get curr, data -730 var curr-len/eax: int <- word-list-length words +730 var curr-len/eax: int <- word-list-length words 731 compare curr-len, result 732 break-if-<= 733 result <- copy curr-len diff --git a/html/apps/tile/environment.mu.html b/html/apps/tile/environment.mu.html index 3fedae36..944f0019 100644 --- a/html/apps/tile/environment.mu.html +++ b/html/apps/tile/environment.mu.html @@ -60,8 +60,8 @@ if ('onhashchange' in window) {
    1 type environment {
    2   screen: (handle screen)
-   3   functions: (handle function)
-   4   sandboxes: (handle sandbox)
+   3   functions: (handle function)
+   4   sandboxes: (handle sandbox)
    5   nrows: int
    6   ncols: int
    7   code-separator-col: int
@@ -70,13 +70,13 @@ if ('onhashchange' in window) {
   10 fn initialize-environment _env: (addr environment) {
   11   var env/esi: (addr environment) <- copy _env
   12   # initialize some predefined function definitions
-  13   var functions/eax: (addr handle function) <- get env, functions
-  14   create-primitive-functions functions
+  13   var functions/eax: (addr handle function) <- get env, functions
+  14   create-primitive-functions functions
   15   # initialize first sandbox
-  16   var sandbox-ah/eax: (addr handle sandbox) <- get env, sandboxes
+  16   var sandbox-ah/eax: (addr handle sandbox) <- get env, sandboxes
   17   allocate sandbox-ah
-  18   var sandbox/eax: (addr sandbox) <- lookup *sandbox-ah
-  19   initialize-sandbox sandbox
+  18   var sandbox/eax: (addr sandbox) <- lookup *sandbox-ah
+  19   initialize-sandbox sandbox
   20   # initialize screen
   21   var screen-ah/eax: (addr handle screen) <- get env, screen
   22   var _screen/eax: (addr screen) <- lookup *screen-ah
@@ -122,115 +122,115 @@ if ('onhashchange' in window) {
   62 fn process _self: (addr environment), key: grapheme {
   63 $process:body: {
   64   var self/esi: (addr environment) <- copy _self
-  65   var sandbox-ah/eax: (addr handle sandbox) <- get self, sandboxes
-  66   var _sandbox/eax: (addr sandbox) <- lookup *sandbox-ah
-  67   var sandbox/edi: (addr sandbox) <- copy _sandbox
-  68   var rename-word-mode-ah?/ecx: (addr handle word) <- get sandbox, partial-name-for-cursor-word
-  69   var rename-word-mode?/eax: (addr word) <- lookup *rename-word-mode-ah?
+  65   var sandbox-ah/eax: (addr handle sandbox) <- get self, sandboxes
+  66   var _sandbox/eax: (addr sandbox) <- lookup *sandbox-ah
+  67   var sandbox/edi: (addr sandbox) <- copy _sandbox
+  68   var rename-word-mode-ah?/ecx: (addr handle word) <- get sandbox, partial-name-for-cursor-word
+  69   var rename-word-mode?/eax: (addr word) <- lookup *rename-word-mode-ah?
   70   compare rename-word-mode?, 0
   71   {
   72     break-if-=
   73 #?     print-string 0, "processing sandbox rename\n"
-  74     process-sandbox-rename sandbox, key
+  74     process-sandbox-rename sandbox, key
   75     break $process:body
   76   }
-  77   var define-function-mode-ah?/ecx: (addr handle word) <- get sandbox, partial-name-for-function
-  78   var define-function-mode?/eax: (addr word) <- lookup *define-function-mode-ah?
+  77   var define-function-mode-ah?/ecx: (addr handle word) <- get sandbox, partial-name-for-function
+  78   var define-function-mode?/eax: (addr word) <- lookup *define-function-mode-ah?
   79   compare define-function-mode?, 0
   80   {
   81     break-if-=
   82 #?     print-string 0, "processing function definition\n"
-  83     var functions/ecx: (addr handle function) <- get self, functions
-  84     process-sandbox-define sandbox, functions, key
+  83     var functions/ecx: (addr handle function) <- get self, functions
+  84     process-sandbox-define sandbox, functions, key
   85     break $process:body
   86   }
   87 #?   print-string 0, "processing sandbox\n"
-  88   process-sandbox self, sandbox, key
+  88   process-sandbox self, sandbox, key
   89 }
   90 }
   91 
-  92 fn process-sandbox _self: (addr environment), _sandbox: (addr sandbox), key: grapheme {
+  92 fn process-sandbox _self: (addr environment), _sandbox: (addr sandbox), key: grapheme {
   93 $process-sandbox:body: {
   94   var self/esi: (addr environment) <- copy _self
-  95   var sandbox/edi: (addr sandbox) <- copy _sandbox
-  96   var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
-  97   var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah
-  98   var cursor-word-ah/ebx: (addr handle word) <- get cursor-call-path, word
-  99   var _cursor-word/eax: (addr word) <- lookup *cursor-word-ah
- 100   var cursor-word/ecx: (addr word) <- copy _cursor-word
+  95   var sandbox/edi: (addr sandbox) <- copy _sandbox
+  96   var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
+  97   var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah
+  98   var cursor-word-ah/ebx: (addr handle word) <- get cursor-call-path, word
+  99   var _cursor-word/eax: (addr word) <- lookup *cursor-word-ah
+ 100   var cursor-word/ecx: (addr word) <- copy _cursor-word
  101   compare key, 0x445b1b  # left-arrow
  102   $process-sandbox:key-left-arrow: {
  103     break-if-!=
  104 #?     print-string 0, "left-arrow\n"
  105     # if not at start, move left within current word
- 106     var at-start?/eax: boolean <- cursor-at-start? cursor-word
+ 106     var at-start?/eax: boolean <- cursor-at-start? cursor-word
  107     compare at-start?, 0  # false
  108     {
  109       break-if-!=
  110 #?       print-string 0, "cursor left within word\n"
- 111       cursor-left cursor-word
+ 111       cursor-left cursor-word
  112       break $process-sandbox:body
  113     }
  114     # if current word is expanded, move to the rightmost word in its body
  115     {
- 116       var cursor-call-path/esi: (addr handle call-path-element) <- get sandbox, cursor-call-path
- 117       var expanded-words/edx: (addr handle call-path) <- get sandbox, expanded-words
- 118       var curr-word-is-expanded?/eax: boolean <- find-in-call-paths expanded-words, cursor-call-path
+ 116       var cursor-call-path/esi: (addr handle call-path-element) <- get sandbox, cursor-call-path
+ 117       var expanded-words/edx: (addr handle call-path) <- get sandbox, expanded-words
+ 118       var curr-word-is-expanded?/eax: boolean <- find-in-call-paths expanded-words, cursor-call-path
  119       compare curr-word-is-expanded?, 0  # false
  120       break-if-=
  121       # update cursor-call-path
  122 #?       print-string 0, "curr word is expanded\n"
  123       var self/ecx: (addr environment) <- copy _self
- 124       var functions/ecx: (addr handle function) <- get self, functions
- 125       var body: (handle line)
- 126       var body-ah/eax: (addr handle line) <- address body
- 127       function-body functions, cursor-word-ah, body-ah
- 128       var body-addr/eax: (addr line) <- lookup *body-ah
- 129       var first-word-ah/edx: (addr handle word) <- get body-addr, data
- 130       var final-word-h: (handle word)
- 131       var final-word-ah/eax: (addr handle word) <- address final-word-h
- 132       final-word first-word-ah, final-word-ah
- 133       push-to-call-path-element cursor-call-path, final-word-ah
+ 124       var functions/ecx: (addr handle function) <- get self, functions
+ 125       var body: (handle line)
+ 126       var body-ah/eax: (addr handle line) <- address body
+ 127       function-body functions, cursor-word-ah, body-ah
+ 128       var body-addr/eax: (addr line) <- lookup *body-ah
+ 129       var first-word-ah/edx: (addr handle word) <- get body-addr, data
+ 130       var final-word-h: (handle word)
+ 131       var final-word-ah/eax: (addr handle word) <- address final-word-h
+ 132       final-word first-word-ah, final-word-ah
+ 133       push-to-call-path-element cursor-call-path, final-word-ah
  134       # move cursor to end of word
- 135       var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
- 136       var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah
- 137       var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word
- 138       var cursor-word/eax: (addr word) <- lookup *cursor-word-ah
- 139       cursor-to-end cursor-word
+ 135       var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
+ 136       var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah
+ 137       var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word
+ 138       var cursor-word/eax: (addr word) <- lookup *cursor-word-ah
+ 139       cursor-to-end cursor-word
  140       break $process-sandbox:body
  141     }
  142     # if at first word, look for a caller to jump to
  143     $process-sandbox:key-left-arrow-first-word: {
- 144       var prev-word-ah/edx: (addr handle word) <- get cursor-word, prev
- 145       var prev-word/eax: (addr word) <- lookup *prev-word-ah
+ 144       var prev-word-ah/edx: (addr handle word) <- get cursor-word, prev
+ 145       var prev-word/eax: (addr word) <- lookup *prev-word-ah
  146       compare prev-word, 0
  147       break-if-!=
  148       $process-sandbox:key-left-arrow-first-word-and-caller: {
  149 #?         print-string 0, "return\n"
  150         {
- 151           var cursor-call-path-ah/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path
- 152           var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah
- 153           var next-cursor-element-ah/edx: (addr handle call-path-element) <- get cursor-call-path, next
- 154           var next-cursor-element/eax: (addr call-path-element) <- lookup *next-cursor-element-ah
+ 151           var cursor-call-path-ah/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path
+ 152           var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah
+ 153           var next-cursor-element-ah/edx: (addr handle call-path-element) <- get cursor-call-path, next
+ 154           var next-cursor-element/eax: (addr call-path-element) <- lookup *next-cursor-element-ah
  155           compare next-cursor-element, 0
  156           break-if-= $process-sandbox:key-left-arrow-first-word-and-caller
  157           copy-object next-cursor-element-ah, cursor-call-path-ah
  158         }
- 159         var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
- 160         var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah
- 161         var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word
- 162         var _cursor-word/eax: (addr word) <- lookup *cursor-word-ah
+ 159         var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
+ 160         var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah
+ 161         var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word
+ 162         var _cursor-word/eax: (addr word) <- lookup *cursor-word-ah
  163         cursor-word <- copy _cursor-word
  164       }
  165     }
  166     # then move to end of previous word
- 167     var prev-word-ah/edx: (addr handle word) <- get cursor-word, prev
- 168     var prev-word/eax: (addr word) <- lookup *prev-word-ah
+ 167     var prev-word-ah/edx: (addr handle word) <- get cursor-word, prev
+ 168     var prev-word/eax: (addr word) <- lookup *prev-word-ah
  169     {
  170       compare prev-word, 0
  171       break-if-=
  172 #?       print-string 0, "move to previous word\n"
- 173       cursor-to-end prev-word
+ 173       cursor-to-end prev-word
  174 #?       {
  175 #?         var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
  176 #?         var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah
@@ -241,8 +241,8 @@ if ('onhashchange' in window) {
  181 #?         print-word 0, cursor-word
  182 #?         print-string 0, "\n"
  183 #?       }
- 184       var cursor-call-path/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
- 185       decrement-final-element cursor-call-path
+ 184       var cursor-call-path/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
+ 185       decrement-final-element cursor-call-path
  186 #?       {
  187 #?         var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
  188 #?         var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah
@@ -260,65 +260,65 @@ if ('onhashchange' in window) {
  200   $process-sandbox:key-right-arrow: {
  201     break-if-!=
  202     # if not at end, move right within current word
- 203     var at-end?/eax: boolean <- cursor-at-end? cursor-word
+ 203     var at-end?/eax: boolean <- cursor-at-end? cursor-word
  204     compare at-end?, 0  # false
  205     {
  206       break-if-!=
  207 #?       print-string 0, "a\n"
- 208       cursor-right cursor-word
+ 208       cursor-right cursor-word
  209       break $process-sandbox:body
  210     }
  211     # if at final word, look for a caller to jump to
  212     {
- 213       var next-word-ah/edx: (addr handle word) <- get cursor-word, next
- 214       var next-word/eax: (addr word) <- lookup *next-word-ah
+ 213       var next-word-ah/edx: (addr handle word) <- get cursor-word, next
+ 214       var next-word/eax: (addr word) <- lookup *next-word-ah
  215       compare next-word, 0
  216       break-if-!=
- 217       var cursor-call-path-ah/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path
- 218       var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah
- 219       var next-cursor-element-ah/ecx: (addr handle call-path-element) <- get cursor-call-path, next
- 220       var next-cursor-element/eax: (addr call-path-element) <- lookup *next-cursor-element-ah
+ 217       var cursor-call-path-ah/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path
+ 218       var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah
+ 219       var next-cursor-element-ah/ecx: (addr handle call-path-element) <- get cursor-call-path, next
+ 220       var next-cursor-element/eax: (addr call-path-element) <- lookup *next-cursor-element-ah
  221       compare next-cursor-element, 0
  222       break-if-=
  223       copy-object next-cursor-element-ah, cursor-call-path-ah
  224       break $process-sandbox:body
  225     }
  226     # otherwise, move to the next word
- 227     var next-word-ah/edx: (addr handle word) <- get cursor-word, next
- 228     var next-word/eax: (addr word) <- lookup *next-word-ah
+ 227     var next-word-ah/edx: (addr handle word) <- get cursor-word, next
+ 228     var next-word/eax: (addr word) <- lookup *next-word-ah
  229     {
  230       compare next-word, 0
  231       break-if-=
  232 #?       print-string 0, "b\n"
- 233       cursor-to-start next-word
+ 233       cursor-to-start next-word
  234       # . . cursor-word now out of date
- 235       var cursor-call-path/ecx: (addr handle call-path-element) <- get sandbox, cursor-call-path
- 236       increment-final-element cursor-call-path
+ 235       var cursor-call-path/ecx: (addr handle call-path-element) <- get sandbox, cursor-call-path
+ 236       increment-final-element cursor-call-path
  237       # Is the new cursor word expanded? If so, it's a function call. Add a
  238       # new level to the cursor-call-path for the call's body.
  239       $process-sandbox:key-right-arrow-next-word-is-call-expanded: {
  240 #?         print-string 0, "c\n"
  241         {
- 242           var expanded-words/eax: (addr handle call-path) <- get sandbox, expanded-words
- 243           var curr-word-is-expanded?/eax: boolean <- find-in-call-paths expanded-words, cursor-call-path
+ 242           var expanded-words/eax: (addr handle call-path) <- get sandbox, expanded-words
+ 243           var curr-word-is-expanded?/eax: boolean <- find-in-call-paths expanded-words, cursor-call-path
  244           compare curr-word-is-expanded?, 0  # false
  245           break-if-= $process-sandbox:key-right-arrow-next-word-is-call-expanded
  246         }
- 247         var callee-h: (handle function)
- 248         var callee-ah/edx: (addr handle function) <- address callee-h
- 249         var functions/ebx: (addr handle function) <- get self, functions
+ 247         var callee-h: (handle function)
+ 248         var callee-ah/edx: (addr handle function) <- address callee-h
+ 249         var functions/ebx: (addr handle function) <- get self, functions
  250         callee functions, next-word, callee-ah
- 251         var callee/eax: (addr function) <- lookup *callee-ah
- 252         var callee-body-ah/eax: (addr handle line) <- get callee, body
- 253         var callee-body/eax: (addr line) <- lookup *callee-body-ah
- 254         var callee-body-first-word/edx: (addr handle word) <- get callee-body, data
- 255         push-to-call-path-element cursor-call-path, callee-body-first-word
+ 251         var callee/eax: (addr function) <- lookup *callee-ah
+ 252         var callee-body-ah/eax: (addr handle line) <- get callee, body
+ 253         var callee-body/eax: (addr line) <- lookup *callee-body-ah
+ 254         var callee-body-first-word/edx: (addr handle word) <- get callee-body, data
+ 255         push-to-call-path-element cursor-call-path, callee-body-first-word
  256         # position cursor at left
- 257         var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
- 258         var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah
- 259         var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word
- 260         var cursor-word/eax: (addr word) <- lookup *cursor-word-ah
- 261         cursor-to-start cursor-word
+ 257         var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
+ 258         var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah
+ 259         var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word
+ 260         var cursor-word/eax: (addr word) <- lookup *cursor-word-ah
+ 261         cursor-to-start cursor-word
  262 #?         print-string 0, "d\n"
  263         break $process-sandbox:body
  264       }
@@ -329,14 +329,14 @@ if ('onhashchange' in window) {
  269   {
  270     break-if-!=
  271     # toggle display of subsidiary stack
- 272     toggle-cursor-word sandbox
+ 272     toggle-cursor-word sandbox
  273     break $process-sandbox:body
  274   }
  275   compare key, 0xc  # ctrl-l
  276   $process-sandbox:new-line: {
  277     break-if-!=
  278     # new line in sandbox
- 279     append-line sandbox
+ 279     append-line sandbox
  280     break $process-sandbox:body
  281   }
  282   # word-based motions
@@ -344,34 +344,34 @@ if ('onhashchange' in window) {
  284   $process-sandbox:prev-word: {
  285     break-if-!=
  286     # jump to previous word at same level
- 287     var prev-word-ah/edx: (addr handle word) <- get cursor-word, prev
- 288     var prev-word/eax: (addr word) <- lookup *prev-word-ah
+ 287     var prev-word-ah/edx: (addr handle word) <- get cursor-word, prev
+ 288     var prev-word/eax: (addr word) <- lookup *prev-word-ah
  289     {
  290       compare prev-word, 0
  291       break-if-=
- 292       cursor-to-end prev-word
- 293       var cursor-call-path/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
- 294       decrement-final-element cursor-call-path
+ 292       cursor-to-end prev-word
+ 293       var cursor-call-path/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
+ 294       decrement-final-element cursor-call-path
  295       break $process-sandbox:body
  296     }
  297     # if previous word doesn't exist, try to bump up one level
  298     {
- 299       var cursor-call-path-ah/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path
- 300       var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah
- 301       var caller-cursor-element-ah/ecx: (addr handle call-path-element) <- get cursor-call-path, next
- 302       var caller-cursor-element/eax: (addr call-path-element) <- lookup *caller-cursor-element-ah
+ 299       var cursor-call-path-ah/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path
+ 300       var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah
+ 301       var caller-cursor-element-ah/ecx: (addr handle call-path-element) <- get cursor-call-path, next
+ 302       var caller-cursor-element/eax: (addr call-path-element) <- lookup *caller-cursor-element-ah
  303       compare caller-cursor-element, 0
  304       break-if-=
  305       # check if previous word exists in caller
- 306       var caller-word-ah/eax: (addr handle word) <- get caller-cursor-element, word
- 307       var caller-word/eax: (addr word) <- lookup *caller-word-ah
- 308       var word-before-caller-ah/eax: (addr handle word) <- get caller-word, prev
- 309       var word-before-caller/eax: (addr word) <- lookup *word-before-caller-ah
+ 306       var caller-word-ah/eax: (addr handle word) <- get caller-cursor-element, word
+ 307       var caller-word/eax: (addr word) <- lookup *caller-word-ah
+ 308       var word-before-caller-ah/eax: (addr handle word) <- get caller-word, prev
+ 309       var word-before-caller/eax: (addr word) <- lookup *word-before-caller-ah
  310       compare word-before-caller, 0
  311       break-if-=
  312       # if so jump to it
- 313       drop-from-call-path-element cursor-call-path-ah
- 314       decrement-final-element cursor-call-path-ah
+ 313       drop-from-call-path-element cursor-call-path-ah
+ 314       decrement-final-element cursor-call-path-ah
  315       break $process-sandbox:body
  316     }
  317   }
@@ -380,23 +380,23 @@ if ('onhashchange' in window) {
  320     break-if-!=
  321 #?     print-string 0, "AA\n"
  322     # jump to previous word at same level
- 323     var next-word-ah/edx: (addr handle word) <- get cursor-word, next
- 324     var next-word/eax: (addr word) <- lookup *next-word-ah
+ 323     var next-word-ah/edx: (addr handle word) <- get cursor-word, next
+ 324     var next-word/eax: (addr word) <- lookup *next-word-ah
  325     {
  326       compare next-word, 0
  327       break-if-=
  328 #?       print-string 0, "BB\n"
- 329       cursor-to-end next-word
- 330       var cursor-call-path/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
- 331       increment-final-element cursor-call-path
+ 329       cursor-to-end next-word
+ 330       var cursor-call-path/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
+ 331       increment-final-element cursor-call-path
  332       break $process-sandbox:body
  333     }
  334     # if next word doesn't exist, try to bump up one level
  335 #?     print-string 0, "CC\n"
- 336     var cursor-call-path-ah/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path
- 337     var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah
- 338     var caller-cursor-element-ah/ecx: (addr handle call-path-element) <- get cursor-call-path, next
- 339     var caller-cursor-element/eax: (addr call-path-element) <- lookup *caller-cursor-element-ah
+ 336     var cursor-call-path-ah/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path
+ 337     var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah
+ 338     var caller-cursor-element-ah/ecx: (addr handle call-path-element) <- get cursor-call-path, next
+ 339     var caller-cursor-element/eax: (addr call-path-element) <- lookup *caller-cursor-element-ah
  340     compare caller-cursor-element, 0
  341     break-if-=
  342 #?     print-string 0, "DD\n"
@@ -408,14 +408,14 @@ if ('onhashchange' in window) {
  348   $process-sandbox:start-of-line: {
  349     break-if-!=
  350     # move cursor up past all calls and to start of line
- 351     var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
- 352     drop-nested-calls cursor-call-path-ah
- 353     move-final-element-to-start-of-line cursor-call-path-ah
+ 351     var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
+ 352     drop-nested-calls cursor-call-path-ah
+ 353     move-final-element-to-start-of-line cursor-call-path-ah
  354     # move cursor to start of word
- 355     var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah
- 356     var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word
- 357     var cursor-word/eax: (addr word) <- lookup *cursor-word-ah
- 358     cursor-to-start cursor-word
+ 355     var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah
+ 356     var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word
+ 357     var cursor-word/eax: (addr word) <- lookup *cursor-word-ah
+ 358     cursor-to-start cursor-word
  359     # this works as long as the first word isn't expanded
  360     # but we don't expect to see zero-arg functions first-up
  361     break $process-sandbox:body
@@ -424,14 +424,14 @@ if ('onhashchange' in window) {
  364   $process-sandbox:end-of-line: {
  365     break-if-!=
  366     # move cursor up past all calls and to start of line
- 367     var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
- 368     drop-nested-calls cursor-call-path-ah
- 369     move-final-element-to-end-of-line cursor-call-path-ah
+ 367     var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
+ 368     drop-nested-calls cursor-call-path-ah
+ 369     move-final-element-to-end-of-line cursor-call-path-ah
  370     # move cursor to end of word
- 371     var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah
- 372     var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word
- 373     var cursor-word/eax: (addr word) <- lookup *cursor-word-ah
- 374     cursor-to-end cursor-word
+ 371     var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah
+ 372     var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word
+ 373     var cursor-word/eax: (addr word) <- lookup *cursor-word-ah
+ 374     cursor-to-end cursor-word
  375     # this works because expanded words lie to the right of their bodies
  376     # so the final word is always guaranteed to be at the top-level
  377     break $process-sandbox:body
@@ -440,14 +440,14 @@ if ('onhashchange' in window) {
  380   $process-sandbox:clear-line: {
  381     break-if-!=
  382     # clear line in sandbox
- 383     initialize-sandbox sandbox
+ 383     initialize-sandbox sandbox
  384     break $process-sandbox:body
  385   }
  386   # if cursor is within a call, disable editing hotkeys below
- 387   var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
- 388   var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah
- 389   var next-cursor-element-ah/eax: (addr handle call-path-element) <- get cursor-call-path, next
- 390   var next-cursor-element/eax: (addr call-path-element) <- lookup *next-cursor-element-ah
+ 387   var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
+ 388   var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah
+ 389   var next-cursor-element-ah/eax: (addr handle call-path-element) <- get cursor-call-path, next
+ 390   var next-cursor-element/eax: (addr call-path-element) <- lookup *next-cursor-element-ah
  391   compare next-cursor-element, 0
  392   break-if-!= $process-sandbox:body
  393   # - remaining keys only work at the top row outside any function calls
@@ -455,23 +455,23 @@ if ('onhashchange' in window) {
  395   $process-sandbox:backspace: {
  396     break-if-!=
  397     # if not at start of some word, delete grapheme before cursor within current word
- 398     var at-start?/eax: boolean <- cursor-at-start? cursor-word
+ 398     var at-start?/eax: boolean <- cursor-at-start? cursor-word
  399     compare at-start?, 0  # false
  400     {
  401       break-if-!=
- 402       delete-before-cursor cursor-word
+ 402       delete-before-cursor cursor-word
  403       break $process-sandbox:body
  404     }
  405     # otherwise delete current word and move to end of prev word
- 406     var prev-word-ah/eax: (addr handle word) <- get cursor-word, prev
- 407     var prev-word/eax: (addr word) <- lookup *prev-word-ah
+ 406     var prev-word-ah/eax: (addr handle word) <- get cursor-word, prev
+ 407     var prev-word/eax: (addr word) <- lookup *prev-word-ah
  408     {
  409       compare prev-word, 0
  410       break-if-=
- 411       cursor-to-end prev-word
- 412       delete-next prev-word
- 413       var cursor-call-path/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
- 414       decrement-final-element cursor-call-path
+ 411       cursor-to-end prev-word
+ 412       delete-next prev-word
+ 413       var cursor-call-path/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
+ 414       decrement-final-element cursor-call-path
  415     }
  416     break $process-sandbox:body
  417   }
@@ -481,22 +481,22 @@ if ('onhashchange' in window) {
  421 #?     print-string 0, "space\n"
  422     # if cursor is at start of word, insert word before
  423     {
- 424       var at-start?/eax: boolean <- cursor-at-start? cursor-word
+ 424       var at-start?/eax: boolean <- cursor-at-start? cursor-word
  425       compare at-start?, 0  # false
  426       break-if-=
- 427       var prev-word-ah/eax: (addr handle word) <- get cursor-word, prev
- 428       append-word prev-word-ah
- 429       var cursor-call-path/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
- 430       decrement-final-element cursor-call-path
+ 427       var prev-word-ah/eax: (addr handle word) <- get cursor-word, prev
+ 428       append-word prev-word-ah
+ 429       var cursor-call-path/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
+ 430       decrement-final-element cursor-call-path
  431       break $process-sandbox:body
  432     }
  433     # if start of word is quote and grapheme before cursor is not, just insert it as usual
  434     # TODO: support string escaping
  435     {
- 436       var first-grapheme/eax: grapheme <- first-grapheme cursor-word
- 437       compare first-grapheme, 0x22  # double quote
+ 436       var first-grapheme/eax: grapheme <- first-grapheme cursor-word
+ 437       compare first-grapheme, 0x22  # double quote
  438       break-if-!=
- 439       var final-grapheme/eax: grapheme <- grapheme-before-cursor cursor-word
+ 439       var final-grapheme/eax: grapheme <- grapheme-before-cursor cursor-word
  440       compare final-grapheme, 0x22  # double quote
  441       break-if-=
  442       break $process-sandbox:space
@@ -504,37 +504,37 @@ if ('onhashchange' in window) {
  444     # if start of word is '[' and grapheme before cursor is not ']', just insert it as usual
  445     # TODO: support nested arrays
  446     {
- 447       var first-grapheme/eax: grapheme <- first-grapheme cursor-word
- 448       compare first-grapheme, 0x5b  # '['
+ 447       var first-grapheme/eax: grapheme <- first-grapheme cursor-word
+ 448       compare first-grapheme, 0x5b  # '['
  449       break-if-!=
- 450       var final-grapheme/eax: grapheme <- grapheme-before-cursor cursor-word
+ 450       var final-grapheme/eax: grapheme <- grapheme-before-cursor cursor-word
  451       compare final-grapheme, 0x5d  # ']'
  452       break-if-=
  453       break $process-sandbox:space
  454     }
  455     # otherwise insert word after and move cursor to it for the next key
  456     # (but we'll continue to track the current cursor-word for the rest of this function)
- 457     append-word cursor-word-ah
- 458     var cursor-call-path/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
- 459     increment-final-element cursor-call-path
+ 457     append-word cursor-word-ah
+ 458     var cursor-call-path/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
+ 459     increment-final-element cursor-call-path
  460     # if cursor is at end of word, that's all
- 461     var at-end?/eax: boolean <- cursor-at-end? cursor-word
+ 461     var at-end?/eax: boolean <- cursor-at-end? cursor-word
  462     compare at-end?, 0  # false
  463     break-if-!= $process-sandbox:body
  464     # otherwise we're in the middle of a word
  465     # move everything after cursor to the (just created) next word
- 466     var next-word-ah/eax: (addr handle word) <- get cursor-word, next
- 467     var _next-word/eax: (addr word) <- lookup *next-word-ah
- 468     var next-word/ebx: (addr word) <- copy _next-word
+ 466     var next-word-ah/eax: (addr handle word) <- get cursor-word, next
+ 467     var _next-word/eax: (addr word) <- lookup *next-word-ah
+ 468     var next-word/ebx: (addr word) <- copy _next-word
  469     {
- 470       var at-end?/eax: boolean <- cursor-at-end? cursor-word
+ 470       var at-end?/eax: boolean <- cursor-at-end? cursor-word
  471       compare at-end?, 0  # false
  472       break-if-!=
- 473       var g/eax: grapheme <- pop-after-cursor cursor-word
- 474       add-grapheme-to-word next-word, g
+ 473       var g/eax: grapheme <- pop-after-cursor cursor-word
+ 474       add-grapheme-to-word next-word, g
  475       loop
  476     }
- 477     cursor-to-start next-word
+ 477     cursor-to-start next-word
  478     break $process-sandbox:body
  479   }
  480   compare key, 0xe  # ctrl-n
@@ -542,20 +542,20 @@ if ('onhashchange' in window) {
  482     break-if-!=
  483     # TODO: ensure current word is not a function
  484     # rename word at cursor
- 485     var new-name-ah/eax: (addr handle word) <- get sandbox, partial-name-for-cursor-word
+ 485     var new-name-ah/eax: (addr handle word) <- get sandbox, partial-name-for-cursor-word
  486     allocate new-name-ah
- 487     var new-name/eax: (addr word) <- lookup *new-name-ah
- 488     initialize-word new-name
+ 487     var new-name/eax: (addr word) <- lookup *new-name-ah
+ 488     initialize-word new-name
  489     break $process-sandbox:body
  490   }
  491   compare key, 4  # ctrl-d
  492   $process:define-function: {
  493     break-if-!=
  494     # define function out of line at cursor
- 495     var new-name-ah/eax: (addr handle word) <- get sandbox, partial-name-for-function
+ 495     var new-name-ah/eax: (addr handle word) <- get sandbox, partial-name-for-function
  496     allocate new-name-ah
- 497     var new-name/eax: (addr word) <- lookup *new-name-ah
- 498     initialize-word new-name
+ 497     var new-name/eax: (addr word) <- lookup *new-name-ah
+ 498     initialize-word new-name
  499     break $process-sandbox:body
  500   }
  501   # otherwise insert key within current word
@@ -564,7 +564,7 @@ if ('onhashchange' in window) {
  504   $process-sandbox:real-grapheme: {
  505     compare print?, 0  # false
  506     break-if-=
- 507     add-grapheme-to-word cursor-word, g
+ 507     add-grapheme-to-word cursor-word, g
  508     break $process-sandbox:body
  509   }
  510   # silently ignore other hotkeys
@@ -574,10 +574,10 @@ if ('onhashchange' in window) {
  514 # collect new name in partial-name-for-cursor-word, and then rename the word
  515 # at cursor to it
  516 # Precondition: cursor-call-path is a singleton (not within a call)
- 517 fn process-sandbox-rename _sandbox: (addr sandbox), key: grapheme {
+ 517 fn process-sandbox-rename _sandbox: (addr sandbox), key: grapheme {
  518 $process-sandbox-rename:body: {
- 519   var sandbox/esi: (addr sandbox) <- copy _sandbox
- 520   var new-name-ah/edi: (addr handle word) <- get sandbox, partial-name-for-cursor-word
+ 519   var sandbox/esi: (addr sandbox) <- copy _sandbox
+ 520   var new-name-ah/edi: (addr handle word) <- get sandbox, partial-name-for-cursor-word
  521   # if 'esc' pressed, cancel rename
  522   compare key, 0x1b  # esc
  523   $process-sandbox-rename:cancel: {
@@ -591,26 +591,26 @@ if ('onhashchange' in window) {
  531     break-if-!=
  532 #?     print-string 0, "rename\n"
  533     # new line
- 534     var new-line-h: (handle line)
- 535     var new-line-ah/eax: (addr handle line) <- address new-line-h
+ 534     var new-line-h: (handle line)
+ 535     var new-line-ah/eax: (addr handle line) <- address new-line-h
  536     allocate new-line-ah
- 537     var new-line/eax: (addr line) <- lookup *new-line-ah
- 538     initialize-line new-line
- 539     var new-line-word-ah/ecx: (addr handle word) <- get new-line, data
+ 537     var new-line/eax: (addr line) <- lookup *new-line-ah
+ 538     initialize-line new-line
+ 539     var new-line-word-ah/ecx: (addr handle word) <- get new-line, data
  540     {
  541       # move word at cursor to new line
- 542       var cursor-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
- 543       var cursor/eax: (addr call-path-element) <- lookup *cursor-ah
- 544       var word-at-cursor-ah/eax: (addr handle word) <- get cursor, word
+ 542       var cursor-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
+ 543       var cursor/eax: (addr call-path-element) <- lookup *cursor-ah
+ 544       var word-at-cursor-ah/eax: (addr handle word) <- get cursor, word
  545 #?       print-string 0, "cursor before at word "
  546 #?       {
  547 #?         var cursor-word/eax: (addr word) <- lookup *word-at-cursor-ah
  548 #?         print-word 0, cursor-word
  549 #?         print-string 0, "\n"
  550 #?       }
- 551       move-word-contents word-at-cursor-ah, new-line-word-ah
+ 551       move-word-contents word-at-cursor-ah, new-line-word-ah
  552       # copy name to word at cursor
- 553       copy-word-contents-before-cursor new-name-ah, word-at-cursor-ah
+ 553       copy-word-contents-before-cursor new-name-ah, word-at-cursor-ah
  554 #?       print-string 0, "cursor after at word "
  555 #?       {
  556 #?         var cursor-word/eax: (addr word) <- lookup *word-at-cursor-ah
@@ -632,15 +632,15 @@ if ('onhashchange' in window) {
  572     }
  573     # prepend '=' to name
  574     {
- 575       var new-name/eax: (addr word) <- lookup *new-name-ah
- 576       cursor-to-start new-name
- 577       add-grapheme-to-word new-name, 0x3d  # '='
+ 575       var new-name/eax: (addr word) <- lookup *new-name-ah
+ 576       cursor-to-start new-name
+ 577       add-grapheme-to-word new-name, 0x3d  # '='
  578     }
  579     # append name to new line
- 580     chain-words new-line-word-ah, new-name-ah
+ 580     chain-words new-line-word-ah, new-name-ah
  581     # new-line->next = sandbox->data
- 582     var new-line-next/ecx: (addr handle line) <- get new-line, next
- 583     var sandbox-slot/edx: (addr handle line) <- get sandbox, data
+ 582     var new-line-next/ecx: (addr handle line) <- get new-line, next
+ 583     var sandbox-slot/edx: (addr handle line) <- get sandbox, data
  584     copy-object sandbox-slot, new-line-next
  585     # sandbox->data = new-line
  586     copy-handle new-line-h, sandbox-slot
@@ -665,13 +665,13 @@ if ('onhashchange' in window) {
  605   $process-sandbox-rename:backspace: {
  606     break-if-!=
  607     # if not at start, delete grapheme before cursor
- 608     var new-name/eax: (addr word) <- lookup *new-name-ah
- 609     var at-start?/eax: boolean <- cursor-at-start? new-name
+ 608     var new-name/eax: (addr word) <- lookup *new-name-ah
+ 609     var at-start?/eax: boolean <- cursor-at-start? new-name
  610     compare at-start?, 0  # false
  611     {
  612       break-if-!=
- 613       var new-name/eax: (addr word) <- lookup *new-name-ah
- 614       delete-before-cursor new-name
+ 613       var new-name/eax: (addr word) <- lookup *new-name-ah
+ 614       delete-before-cursor new-name
  615     }
  616     break $process-sandbox-rename:body
  617   }
@@ -680,8 +680,8 @@ if ('onhashchange' in window) {
  620   $process-sandbox-rename:real-grapheme: {
  621     compare print?, 0  # false
  622     break-if-=
- 623     var new-name/eax: (addr word) <- lookup *new-name-ah
- 624     add-grapheme-to-word new-name, key
+ 623     var new-name/eax: (addr word) <- lookup *new-name-ah
+ 624     add-grapheme-to-word new-name, key
  625     break $process-sandbox-rename:body
  626   }
  627   # silently ignore other hotkeys
@@ -692,10 +692,10 @@ if ('onhashchange' in window) {
  632 # of the sandbox to be a new function with that name. Replace the last line
  633 # with a call to the appropriate function.
  634 # Precondition: cursor-call-path is a singleton (not within a call)
- 635 fn process-sandbox-define _sandbox: (addr sandbox), functions: (addr handle function), key: grapheme {
+ 635 fn process-sandbox-define _sandbox: (addr sandbox), functions: (addr handle function), key: grapheme {
  636 $process-sandbox-define:body: {
- 637   var sandbox/esi: (addr sandbox) <- copy _sandbox
- 638   var new-name-ah/edi: (addr handle word) <- get sandbox, partial-name-for-function
+ 637   var sandbox/esi: (addr sandbox) <- copy _sandbox
+ 638   var new-name-ah/edi: (addr handle word) <- get sandbox, partial-name-for-function
  639   # if 'esc' pressed, cancel define
  640   compare key, 0x1b  # esc
  641   $process-sandbox-define:cancel: {
@@ -709,43 +709,43 @@ if ('onhashchange' in window) {
  649     break-if-!=
  650 #?     print-string 0, "define\n"
  651     # create new function
- 652     var new-function: (handle function)
- 653     var new-function-ah/ecx: (addr handle function) <- address new-function
+ 652     var new-function: (handle function)
+ 653     var new-function-ah/ecx: (addr handle function) <- address new-function
  654     allocate new-function-ah
- 655     var _new-function/eax: (addr function) <- lookup *new-function-ah
- 656     var new-function/ebx: (addr function) <- copy _new-function
- 657     var dest/edx: (addr handle function) <- get new-function, next
+ 655     var _new-function/eax: (addr function) <- lookup *new-function-ah
+ 656     var new-function/ebx: (addr function) <- copy _new-function
+ 657     var dest/edx: (addr handle function) <- get new-function, next
  658     copy-object functions, dest
  659     copy-object new-function-ah, functions
  660     # set function name to new-name
- 661     var new-name/eax: (addr word) <- lookup *new-name-ah
+ 661     var new-name/eax: (addr word) <- lookup *new-name-ah
  662     var dest/edx: (addr handle array byte) <- get new-function, name
- 663     word-to-string new-name, dest
+ 663     word-to-string new-name, dest
  664     # move final line to body
- 665     var body-ah/eax: (addr handle line) <- get new-function, body
+ 665     var body-ah/eax: (addr handle line) <- get new-function, body
  666     allocate body-ah
- 667     var body/eax: (addr line) <- lookup *body-ah
- 668     var body-contents/ecx: (addr handle word) <- get body, data
- 669     var final-line-storage: (handle line)
- 670     var final-line-ah/eax: (addr handle line) <- address final-line-storage
- 671     final-line sandbox, final-line-ah
- 672     var final-line/eax: (addr line) <- lookup *final-line-ah
- 673     var final-line-contents/eax: (addr handle word) <- get final-line, data
+ 667     var body/eax: (addr line) <- lookup *body-ah
+ 668     var body-contents/ecx: (addr handle word) <- get body, data
+ 669     var final-line-storage: (handle line)
+ 670     var final-line-ah/eax: (addr handle line) <- address final-line-storage
+ 671     final-line sandbox, final-line-ah
+ 672     var final-line/eax: (addr line) <- lookup *final-line-ah
+ 673     var final-line-contents/eax: (addr handle word) <- get final-line, data
  674     copy-object final-line-contents, body-contents
  675     #
  676     copy-unbound-words-to-args functions
  677     #
- 678     var empty-word: (handle word)
+ 678     var empty-word: (handle word)
  679     copy-handle empty-word, final-line-contents
  680     construct-call functions, final-line-contents
  681     # clear partial-name-for-function
- 682     var empty-word: (handle word)
+ 682     var empty-word: (handle word)
  683     copy-handle empty-word, new-name-ah
  684     # update cursor
- 685     var final-line/eax: (addr line) <- lookup final-line-storage
- 686     var cursor-call-path-ah/ecx: (addr handle call-path-element) <- get sandbox, cursor-call-path
+ 685     var final-line/eax: (addr line) <- lookup final-line-storage
+ 686     var cursor-call-path-ah/ecx: (addr handle call-path-element) <- get sandbox, cursor-call-path
  687     allocate cursor-call-path-ah  # leak
- 688     initialize-path-from-line final-line, cursor-call-path-ah
+ 688     initialize-path-from-line final-line, cursor-call-path-ah
  689     break $process-sandbox-define:body
  690   }
  691   #
@@ -753,13 +753,13 @@ if ('onhashchange' in window) {
  693   $process-sandbox-define:backspace: {
  694     break-if-!=
  695     # if not at start, delete grapheme before cursor
- 696     var new-name/eax: (addr word) <- lookup *new-name-ah
- 697     var at-start?/eax: boolean <- cursor-at-start? new-name
+ 696     var new-name/eax: (addr word) <- lookup *new-name-ah
+ 697     var at-start?/eax: boolean <- cursor-at-start? new-name
  698     compare at-start?, 0  # false
  699     {
  700       break-if-!=
- 701       var new-name/eax: (addr word) <- lookup *new-name-ah
- 702       delete-before-cursor new-name
+ 701       var new-name/eax: (addr word) <- lookup *new-name-ah
+ 702       delete-before-cursor new-name
  703     }
  704     break $process-sandbox-define:body
  705   }
@@ -768,8 +768,8 @@ if ('onhashchange' in window) {
  708   $process-sandbox-define:real-grapheme: {
  709     compare print?, 0  # false
  710     break-if-=
- 711     var new-name/eax: (addr word) <- lookup *new-name-ah
- 712     add-grapheme-to-word new-name, key
+ 711     var new-name/eax: (addr word) <- lookup *new-name-ah
+ 712     add-grapheme-to-word new-name, key
  713     break $process-sandbox-define:body
  714   }
  715   # silently ignore other hotkeys
@@ -779,26 +779,26 @@ if ('onhashchange' in window) {
  719 # extract from the body of the first function in 'functions' all words that
  720 # aren't defined in the rest of 'functions'. Prepend them in reverse order.
  721 # Assumes function body is a single line for now.
- 722 fn copy-unbound-words-to-args _functions: (addr handle function) {
+ 722 fn copy-unbound-words-to-args _functions: (addr handle function) {
  723   # target
- 724   var target-ah/eax: (addr handle function) <- copy _functions
- 725   var _target/eax: (addr function) <- lookup *target-ah
- 726   var target/esi: (addr function) <- copy _target
- 727   var dest-ah/edi: (addr handle word) <- get target, args
+ 724   var target-ah/eax: (addr handle function) <- copy _functions
+ 725   var _target/eax: (addr function) <- lookup *target-ah
+ 726   var target/esi: (addr function) <- copy _target
+ 727   var dest-ah/edi: (addr handle word) <- get target, args
  728   # next
- 729   var functions-ah/edx: (addr handle function) <- get target, next
+ 729   var functions-ah/edx: (addr handle function) <- get target, next
  730   # src
- 731   var line-ah/eax: (addr handle line) <- get target, body
- 732   var line/eax: (addr line) <- lookup *line-ah
- 733   var curr-ah/eax: (addr handle word) <- get line, data
- 734   var curr/eax: (addr word) <- lookup *curr-ah
+ 731   var line-ah/eax: (addr handle line) <- get target, body
+ 732   var line/eax: (addr line) <- lookup *line-ah
+ 733   var curr-ah/eax: (addr handle word) <- get line, data
+ 734   var curr/eax: (addr word) <- lookup *curr-ah
  735   {
  736     compare curr, 0
  737     break-if-=
  738     $copy-unbound-words-to-args:loop-iter: {
  739       # is it a number?
  740       {
- 741         var is-int?/eax: boolean <- word-is-decimal-integer? curr
+ 741         var is-int?/eax: boolean <- word-is-decimal-integer? curr
  742         compare is-int?, 0  # false
  743         break-if-!= $copy-unbound-words-to-args:loop-iter
  744       }
@@ -811,128 +811,128 @@ if ('onhashchange' in window) {
  751       compare dup?, 0  # false
  752       break-if-!= $copy-unbound-words-to-args:loop-iter
  753       # push copy of curr before dest-ah
- 754       var rest-h: (handle word)
- 755       var rest-ah/ecx: (addr handle word) <- address rest-h
+ 754       var rest-h: (handle word)
+ 755       var rest-ah/ecx: (addr handle word) <- address rest-h
  756       copy-object dest-ah, rest-ah
- 757       copy-word curr, dest-ah
- 758       chain-words dest-ah, rest-ah
+ 757       copy-word curr, dest-ah
+ 758       chain-words dest-ah, rest-ah
  759     }
- 760     var next-ah/ecx: (addr handle word) <- get curr, next
+ 760     var next-ah/ecx: (addr handle word) <- get curr, next
  761     curr <- lookup *next-ah
  762     loop
  763   }
  764 }
  765 
- 766 fn bound-function? w: (addr word), functions-ah: (addr handle function) -> _/ebx: boolean {
- 767   var result/ebx: boolean <- copy 1  # true
+ 766 fn bound-function? w: (addr word), functions-ah: (addr handle function) -> _/ebx: boolean {
+ 767   var result/ebx: boolean <- copy 1  # true
  768   {
  769     ## numbers
  770     # if w == "+" return true
- 771     var subresult/eax: boolean <- word-equal? w, "+"
+ 771     var subresult/eax: boolean <- word-equal? w, "+"
  772     compare subresult, 0  # false
  773     break-if-!=
  774     # if w == "-" return true
- 775     subresult <- word-equal? w, "-"
+ 775     subresult <- word-equal? w, "-"
  776     compare subresult, 0  # false
  777     break-if-!=
  778     # if w == "*" return true
- 779     subresult <- word-equal? w, "*"
+ 779     subresult <- word-equal? w, "*"
  780     compare subresult, 0  # false
  781     break-if-!=
  782     ## strings/arrays
  783     # if w == "len" return true
- 784     subresult <- word-equal? w, "len"
+ 784     subresult <- word-equal? w, "len"
  785     compare subresult, 0  # false
  786     break-if-!=
  787     ## files
  788     # if w == "open" return true
- 789     subresult <- word-equal? w, "open"
+ 789     subresult <- word-equal? w, "open"
  790     compare subresult, 0  # false
  791     break-if-!=
  792     # if w == "read" return true
- 793     subresult <- word-equal? w, "read"
+ 793     subresult <- word-equal? w, "read"
  794     compare subresult, 0  # false
  795     break-if-!=
  796     # if w == "slurp" return true
- 797     subresult <- word-equal? w, "slurp"
+ 797     subresult <- word-equal? w, "slurp"
  798     compare subresult, 0  # false
  799     break-if-!=
  800     # if w == "lines" return true
- 801     subresult <- word-equal? w, "lines"
+ 801     subresult <- word-equal? w, "lines"
  802     compare subresult, 0  # false
  803     break-if-!=
  804     ## screens
  805     # if w == "fake-screen" return true
- 806     subresult <- word-equal? w, "fake-screen"
+ 806     subresult <- word-equal? w, "fake-screen"
  807     compare subresult, 0  # false
  808     break-if-!=
  809     # if w == "print" return true
- 810     subresult <- word-equal? w, "print"
+ 810     subresult <- word-equal? w, "print"
  811     compare subresult, 0  # false
  812     break-if-!=
  813     # if w == "move" return true
- 814     subresult <- word-equal? w, "move"
+ 814     subresult <- word-equal? w, "move"
  815     compare subresult, 0  # false
  816     break-if-!=
  817     # if w == "up" return true
- 818     subresult <- word-equal? w, "up"
+ 818     subresult <- word-equal? w, "up"
  819     compare subresult, 0  # false
  820     break-if-!=
  821     # if w == "down" return true
- 822     subresult <- word-equal? w, "down"
+ 822     subresult <- word-equal? w, "down"
  823     compare subresult, 0  # false
  824     break-if-!=
  825     # if w == "left" return true
- 826     subresult <- word-equal? w, "left"
+ 826     subresult <- word-equal? w, "left"
  827     compare subresult, 0  # false
  828     break-if-!=
  829     # if w == "right" return true
- 830     subresult <- word-equal? w, "right"
+ 830     subresult <- word-equal? w, "right"
  831     compare subresult, 0  # false
  832     break-if-!=
  833     ## hacks
  834     # if w == "dup" return true
- 835     subresult <- word-equal? w, "dup"
+ 835     subresult <- word-equal? w, "dup"
  836     compare subresult, 0  # false
  837     break-if-!=
  838     # if w == "swap" return true
- 839     subresult <- word-equal? w, "swap"
+ 839     subresult <- word-equal? w, "swap"
  840     compare subresult, 0  # false
  841     break-if-!=
  842     # return w in functions
- 843     var out-h: (handle function)
- 844     var out/eax: (addr handle function) <- address out-h
+ 843     var out-h: (handle function)
+ 844     var out/eax: (addr handle function) <- address out-h
  845     callee functions-ah, w, out
- 846     var found?/eax: (addr function) <- lookup *out
- 847     result <- copy found?
+ 846     var found?/eax: (addr function) <- lookup *out
+ 847     result <- copy found?
  848   }
- 849   return result
+ 849   return result
  850 }
  851 
- 852 fn arg-exists? _f-ah: (addr handle function), arg: (addr word) -> _/ebx: boolean {
- 853   var f-ah/eax: (addr handle function) <- copy _f-ah
- 854   var f/eax: (addr function) <- lookup *f-ah
- 855   var args-ah/eax: (addr handle word) <- get f, args
- 856   var result/ebx: boolean <- word-exists? args-ah, arg
- 857   return result
+ 852 fn arg-exists? _f-ah: (addr handle function), arg: (addr word) -> _/ebx: boolean {
+ 853   var f-ah/eax: (addr handle function) <- copy _f-ah
+ 854   var f/eax: (addr function) <- lookup *f-ah
+ 855   var args-ah/eax: (addr handle word) <- get f, args
+ 856   var result/ebx: boolean <- word-exists? args-ah, arg
+ 857   return result
  858 }
  859 
  860 # construct a call to `f` with copies of exactly its args
- 861 fn construct-call _f-ah: (addr handle function), _dest-ah: (addr handle word) {
- 862   var f-ah/eax: (addr handle function) <- copy _f-ah
- 863   var _f/eax: (addr function) <- lookup *f-ah
- 864   var f/esi: (addr function) <- copy _f
+ 861 fn construct-call _f-ah: (addr handle function), _dest-ah: (addr handle word) {
+ 862   var f-ah/eax: (addr handle function) <- copy _f-ah
+ 863   var _f/eax: (addr function) <- lookup *f-ah
+ 864   var f/esi: (addr function) <- copy _f
  865   # append args in reverse
- 866   var args-ah/eax: (addr handle word) <- get f, args
- 867   var dest-ah/edi: (addr handle word) <- copy _dest-ah
- 868   copy-words-in-reverse args-ah, dest-ah
+ 866   var args-ah/eax: (addr handle word) <- get f, args
+ 867   var dest-ah/edi: (addr handle word) <- copy _dest-ah
+ 868   copy-words-in-reverse args-ah, dest-ah
  869   # append name
  870   var name-ah/eax: (addr handle array byte) <- get f, name
  871   var name/eax: (addr array byte) <- lookup *name-ah
- 872   append-word-at-end-with dest-ah, name
+ 872   append-word-at-end-with dest-ah, name
  873 }
  874 
- 875 fn word-index _words: (addr handle word), _n: int, out: (addr handle word) {
+ 875 fn word-index _words: (addr handle word), _n: int, out: (addr handle word) {
  876 $word-index:body: {
  877   var n/ecx: int <- copy _n
  878   {
@@ -941,30 +941,30 @@ if ('onhashchange' in window) {
  881     copy-object _words, out
  882     break $word-index:body
  883   }
- 884   var words-ah/eax: (addr handle word) <- copy _words
- 885   var words/eax: (addr word) <- lookup *words-ah
- 886   var next/eax: (addr handle word) <- get words, next
+ 884   var words-ah/eax: (addr handle word) <- copy _words
+ 885   var words/eax: (addr word) <- lookup *words-ah
+ 886   var next/eax: (addr handle word) <- get words, next
  887   n <- decrement
  888   word-index next, n, out
  889 }
  890 }
  891 
- 892 fn toggle-cursor-word _sandbox: (addr sandbox) {
+ 892 fn toggle-cursor-word _sandbox: (addr sandbox) {
  893 $toggle-cursor-word:body: {
- 894   var sandbox/esi: (addr sandbox) <- copy _sandbox
- 895   var expanded-words/edi: (addr handle call-path) <- get sandbox, expanded-words
- 896   var cursor-call-path/ecx: (addr handle call-path-element) <- get sandbox, cursor-call-path
+ 894   var sandbox/esi: (addr sandbox) <- copy _sandbox
+ 895   var expanded-words/edi: (addr handle call-path) <- get sandbox, expanded-words
+ 896   var cursor-call-path/ecx: (addr handle call-path-element) <- get sandbox, cursor-call-path
  897 #?   print-string 0, "cursor call path: "
  898 #?   dump-call-path-element 0, cursor-call-path
  899 #?   print-string 0, "expanded words:\n"
  900 #?   dump-call-paths 0, expanded-words
- 901   var already-expanded?/eax: boolean <- find-in-call-paths expanded-words, cursor-call-path
+ 901   var already-expanded?/eax: boolean <- find-in-call-paths expanded-words, cursor-call-path
  902   compare already-expanded?, 0  # false
  903   {
  904     break-if-!=
  905 #?     print-string 0, "expand\n"
  906     # if not already-expanded, insert
- 907     insert-in-call-path expanded-words cursor-call-path
+ 907     insert-in-call-path expanded-words cursor-call-path
  908 #?     print-string 0, "expanded words now:\n"
  909 #?     dump-call-paths 0, expanded-words
  910     break $toggle-cursor-word:body
@@ -972,36 +972,36 @@ if ('onhashchange' in window) {
  912   {
  913     break-if-=
  914     # otherwise delete
- 915     delete-in-call-path expanded-words cursor-call-path
+ 915     delete-in-call-path expanded-words cursor-call-path
  916   }
  917 }
  918 }
  919 
- 920 fn append-line _sandbox: (addr sandbox) {
- 921   var sandbox/esi: (addr sandbox) <- copy _sandbox
- 922   var line-ah/ecx: (addr handle line) <- get sandbox, data
+ 920 fn append-line _sandbox: (addr sandbox) {
+ 921   var sandbox/esi: (addr sandbox) <- copy _sandbox
+ 922   var line-ah/ecx: (addr handle line) <- get sandbox, data
  923   {
- 924     var line/eax: (addr line) <- lookup *line-ah
- 925     var next-line-ah/edx: (addr handle line) <- get line, next
- 926     var next-line/eax: (addr line) <- lookup *next-line-ah
+ 924     var line/eax: (addr line) <- lookup *line-ah
+ 925     var next-line-ah/edx: (addr handle line) <- get line, next
+ 926     var next-line/eax: (addr line) <- lookup *next-line-ah
  927     compare next-line, 0
  928     break-if-=
  929     line-ah <- copy next-line-ah
  930     loop
  931   }
- 932   var line/eax: (addr line) <- lookup *line-ah
- 933   var final-line-ah/edx: (addr handle line) <- get line, next
+ 932   var line/eax: (addr line) <- lookup *line-ah
+ 933   var final-line-ah/edx: (addr handle line) <- get line, next
  934   allocate final-line-ah
- 935   var final-line/eax: (addr line) <- lookup *final-line-ah
- 936   initialize-line final-line
- 937   var final-prev/eax: (addr handle line) <- get final-line, prev
+ 935   var final-line/eax: (addr line) <- lookup *final-line-ah
+ 936   initialize-line final-line
+ 937   var final-prev/eax: (addr handle line) <- get final-line, prev
  938   copy-object line-ah, final-prev
  939   # clear cursor
- 940   var final-line/eax: (addr line) <- lookup *final-line-ah
- 941   var word-ah/ecx: (addr handle word) <- get final-line, data
- 942   var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
- 943   var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah
- 944   var dest/eax: (addr handle word) <- get cursor-call-path, word
+ 940   var final-line/eax: (addr line) <- lookup *final-line-ah
+ 941   var word-ah/ecx: (addr handle word) <- get final-line, data
+ 942   var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
+ 943   var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah
+ 944   var dest/eax: (addr handle word) <- get cursor-call-path, word
  945   copy-object word-ah, dest
  946 }
  947 
@@ -1009,17 +1009,17 @@ if ('onhashchange' in window) {
  949 # Visualize
  950 #############
  951 
- 952 fn evaluate-environment _env: (addr environment), stack: (addr value-stack) {
+ 952 fn evaluate-environment _env: (addr environment), stack: (addr value-stack) {
  953   var env/esi: (addr environment) <- copy _env
  954   # functions
- 955   var functions/edx: (addr handle function) <- get env, functions
+ 955   var functions/edx: (addr handle function) <- get env, functions
  956   # line
- 957   var sandbox-ah/esi: (addr handle sandbox) <- get env, sandboxes
- 958   var sandbox/eax: (addr sandbox) <- lookup *sandbox-ah
- 959   var line-ah/eax: (addr handle line) <- get sandbox, data
- 960   var _line/eax: (addr line) <- lookup *line-ah
- 961   var line/esi: (addr line) <- copy _line
- 962   evaluate functions, 0, line, 0, stack
+ 957   var sandbox-ah/esi: (addr handle sandbox) <- get env, sandboxes
+ 958   var sandbox/eax: (addr sandbox) <- lookup *sandbox-ah
+ 959   var line-ah/eax: (addr handle line) <- get sandbox, data
+ 960   var _line/eax: (addr line) <- lookup *line-ah
+ 961   var line/esi: (addr line) <- copy _line
+ 962   evaluate functions, 0, line, 0, stack
  963 }
  964 
  965 fn render _env: (addr environment) {
@@ -1035,25 +1035,25 @@ if ('onhashchange' in window) {
  975   var repl-col/ecx: int <- copy *_repl-col
  976   repl-col <- add 2  # repl-margin-left
  977   # functions
- 978   var functions/edx: (addr handle function) <- get env, functions
+ 978   var functions/edx: (addr handle function) <- get env, functions
  979   # sandbox
- 980   var sandbox-ah/eax: (addr handle sandbox) <- get env, sandboxes
- 981   var sandbox/eax: (addr sandbox) <- lookup *sandbox-ah
+ 980   var sandbox-ah/eax: (addr handle sandbox) <- get env, sandboxes
+ 981   var sandbox/eax: (addr sandbox) <- lookup *sandbox-ah
  982   # bindings
- 983   var bindings-storage: table
- 984   var bindings/ebx: (addr table) <- address bindings-storage
- 985   initialize-table bindings, 0x10
+ 983   var bindings-storage: table
+ 984   var bindings/ebx: (addr table) <- address bindings-storage
+ 985   initialize-table bindings, 0x10
  986 #?   print-string 0, "render-sandbox {\n"
- 987   render-sandbox screen, functions, bindings, sandbox, 3, repl-col
+ 987   render-sandbox screen, functions, bindings, sandbox, 3, repl-col
  988 #?   print-string 0, "render-sandbox }\n"
  989 }
  990 
- 991 fn render-sandbox screen: (addr screen), functions: (addr handle function), bindings: (addr table), _sandbox: (addr sandbox), top-row: int, left-col: int {
- 992   var sandbox/esi: (addr sandbox) <- copy _sandbox
+ 991 fn render-sandbox screen: (addr screen), functions: (addr handle function), bindings: (addr table), _sandbox: (addr sandbox), top-row: int, left-col: int {
+ 992   var sandbox/esi: (addr sandbox) <- copy _sandbox
  993   # line
- 994   var curr-line-ah/eax: (addr handle line) <- get sandbox, data
- 995   var _curr-line/eax: (addr line) <- lookup *curr-line-ah
- 996   var curr-line/ecx: (addr line) <- copy _curr-line
+ 994   var curr-line-ah/eax: (addr handle line) <- get sandbox, data
+ 995   var _curr-line/eax: (addr line) <- lookup *curr-line-ah
+ 996   var curr-line/ecx: (addr line) <- copy _curr-line
  997   #
  998   var curr-row/edx: int <- copy top-row
  999   # cursor row, col
@@ -1068,15 +1068,15 @@ if ('onhashchange' in window) {
 1008   # render all but final line without stack
 1009 #?   print-string 0, "render all but final line\n"
 1010   {
-1011     var next-line-ah/eax: (addr handle line) <- get curr-line, next
-1012     var next-line/eax: (addr line) <- lookup *next-line-ah
+1011     var next-line-ah/eax: (addr handle line) <- get curr-line, next
+1012     var next-line/eax: (addr line) <- lookup *next-line-ah
 1013     compare next-line, 0
 1014     break-if-=
 1015     {
-1016       var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
-1017       var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah
-1018       var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word
-1019       var cursor-word/eax: (addr word) <- lookup *cursor-word-ah
+1016       var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
+1017       var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah
+1018       var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word
+1019       var cursor-word/eax: (addr word) <- lookup *cursor-word-ah
 1020       # it's enough to pass in the first word of the path, because if the path isn't a singleton the word is guaranteed to be unique
 1021       render-line-without-stack screen, curr-line, curr-row, left-col, cursor-word, cursor-row-addr, cursor-col-addr
 1022     }
@@ -1085,57 +1085,57 @@ if ('onhashchange' in window) {
 1025     loop
 1026   }
 1027   #
-1028   render-final-line-with-stack screen, functions, bindings, sandbox, curr-row, left-col, cursor-row-addr, cursor-col-addr
+1028   render-final-line-with-stack screen, functions, bindings, sandbox, curr-row, left-col, cursor-row-addr, cursor-col-addr
 1029   # at most one of the following dialogs will be rendered
-1030   render-rename-dialog screen, sandbox, cursor-row, cursor-col
-1031   render-define-dialog screen, sandbox, cursor-row, cursor-col
+1030   render-rename-dialog screen, sandbox, cursor-row, cursor-col
+1031   render-define-dialog screen, sandbox, cursor-row, cursor-col
 1032   move-cursor screen, cursor-row, cursor-col
 1033 }
 1034 
-1035 fn render-final-line-with-stack screen: (addr screen), functions: (addr handle function), bindings: (addr table), _sandbox: (addr sandbox), top-row: int, left-col: int, cursor-row-addr: (addr int), cursor-col-addr: (addr int) {
-1036   var sandbox/esi: (addr sandbox) <- copy _sandbox
+1035 fn render-final-line-with-stack screen: (addr screen), functions: (addr handle function), bindings: (addr table), _sandbox: (addr sandbox), top-row: int, left-col: int, cursor-row-addr: (addr int), cursor-col-addr: (addr int) {
+1036   var sandbox/esi: (addr sandbox) <- copy _sandbox
 1037   # expanded-words
-1038   var expanded-words/edi: (addr handle call-path) <- get sandbox, expanded-words
+1038   var expanded-words/edi: (addr handle call-path) <- get sandbox, expanded-words
 1039   # cursor-word
-1040   var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
-1041   var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah
-1042   var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word
-1043   var _cursor-word/eax: (addr word) <- lookup *cursor-word-ah
-1044   var cursor-word/ebx: (addr word) <- copy _cursor-word
+1040   var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
+1041   var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah
+1042   var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word
+1043   var _cursor-word/eax: (addr word) <- lookup *cursor-word-ah
+1044   var cursor-word/ebx: (addr word) <- copy _cursor-word
 1045 #?   print-string 0, "word at cursor: "
 1046 #?   print-word 0, cursor-word
 1047 #?   print-string 0, "\n"
 1048   # cursor-call-path
-1049   var cursor-call-path: (addr handle call-path-element)
+1049   var cursor-call-path: (addr handle call-path-element)
 1050   {
-1051     var src/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
+1051     var src/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
 1052     copy-to cursor-call-path, src
 1053   }
 1054   # first line
-1055   var first-line-ah/eax: (addr handle line) <- get sandbox, data
-1056   var _first-line/eax: (addr line) <- lookup *first-line-ah
-1057   var first-line/edx: (addr line) <- copy _first-line
+1055   var first-line-ah/eax: (addr handle line) <- get sandbox, data
+1056   var _first-line/eax: (addr line) <- lookup *first-line-ah
+1057   var first-line/edx: (addr line) <- copy _first-line
 1058   # final line
-1059   var final-line-storage: (handle line)
-1060   var final-line-ah/eax: (addr handle line) <- address final-line-storage
-1061   final-line sandbox, final-line-ah
-1062   var final-line/eax: (addr line) <- lookup *final-line-ah
+1059   var final-line-storage: (handle line)
+1060   var final-line-ah/eax: (addr handle line) <- address final-line-storage
+1061   final-line sandbox, final-line-ah
+1062   var final-line/eax: (addr line) <- lookup *final-line-ah
 1063   # curr-path
-1064   var curr-path-storage: (handle call-path-element)
-1065   var curr-path/ecx: (addr handle call-path-element) <- address curr-path-storage
+1064   var curr-path-storage: (handle call-path-element)
+1065   var curr-path/ecx: (addr handle call-path-element) <- address curr-path-storage
 1066   allocate curr-path  # leak
-1067   initialize-path-from-line final-line, curr-path
+1067   initialize-path-from-line final-line, curr-path
 1068   #
 1069   var dummy/ecx: int <- render-line screen, functions, bindings, first-line, final-line, expanded-words, top-row, left-col, curr-path, cursor-word, cursor-call-path, cursor-row-addr, cursor-col-addr
 1070 }
 1071 
-1072 fn final-line _sandbox: (addr sandbox), out: (addr handle line) {
-1073   var sandbox/esi: (addr sandbox) <- copy _sandbox
-1074   var curr-line-ah/ecx: (addr handle line) <- get sandbox, data
+1072 fn final-line _sandbox: (addr sandbox), out: (addr handle line) {
+1073   var sandbox/esi: (addr sandbox) <- copy _sandbox
+1074   var curr-line-ah/ecx: (addr handle line) <- get sandbox, data
 1075   {
-1076     var curr-line/eax: (addr line) <- lookup *curr-line-ah
-1077     var next-line-ah/edx: (addr handle line) <- get curr-line, next
-1078     var next-line/eax: (addr line) <- lookup *next-line-ah
+1076     var curr-line/eax: (addr line) <- lookup *curr-line-ah
+1077     var next-line-ah/edx: (addr handle line) <- get curr-line, next
+1078     var next-line/eax: (addr line) <- lookup *next-line-ah
 1079     compare next-line, 0
 1080     break-if-=
 1081     curr-line-ah <- copy next-line-ah
@@ -1144,10 +1144,10 @@ if ('onhashchange' in window) {
 1084   copy-object curr-line-ah, out
 1085 }
 1086 
-1087 fn render-rename-dialog screen: (addr screen), _sandbox: (addr sandbox), cursor-row: int, cursor-col: int {
-1088   var sandbox/edi: (addr sandbox) <- copy _sandbox
-1089   var rename-word-mode-ah?/ecx: (addr handle word) <- get sandbox, partial-name-for-cursor-word
-1090   var rename-word-mode?/eax: (addr word) <- lookup *rename-word-mode-ah?
+1087 fn render-rename-dialog screen: (addr screen), _sandbox: (addr sandbox), cursor-row: int, cursor-col: int {
+1088   var sandbox/edi: (addr sandbox) <- copy _sandbox
+1089   var rename-word-mode-ah?/ecx: (addr handle word) <- get sandbox, partial-name-for-cursor-word
+1090   var rename-word-mode?/eax: (addr word) <- lookup *rename-word-mode-ah?
 1091   compare rename-word-mode?, 0
 1092   break-if-=
 1093   # clear a space for the dialog
@@ -1159,8 +1159,8 @@ if ('onhashchange' in window) {
 1099   left-col <- subtract 0x10
 1100   var right-col/ebx: int <- copy cursor-col
 1101   right-col <- add 0x10
-1102   clear-rect screen, top-row, left-col, bottom-row, right-col
-1103   draw-box screen, top-row, left-col, bottom-row, right-col
+1102   clear-rect screen, top-row, left-col, bottom-row, right-col
+1103   draw-box screen, top-row, left-col, bottom-row, right-col
 1104   # render a little menu for the dialog
 1105   var menu-row/ecx: int <- copy bottom-row
 1106   menu-row <- decrement
@@ -1177,19 +1177,19 @@ if ('onhashchange' in window) {
 1117   print-string screen, " rename  "
 1118   # draw the word, positioned appropriately around the cursor
 1119   var start-col/ecx: int <- copy cursor-col
-1120   var word-ah?/edx: (addr handle word) <- get sandbox, partial-name-for-cursor-word
-1121   var word/eax: (addr word) <- lookup *word-ah?
-1122   var cursor-index/eax: int <- cursor-index word
-1123   start-col <- subtract cursor-index
+1120   var word-ah?/edx: (addr handle word) <- get sandbox, partial-name-for-cursor-word
+1121   var word/eax: (addr word) <- lookup *word-ah?
+1122   var cursor-index/eax: int <- cursor-index word
+1123   start-col <- subtract cursor-index
 1124   move-cursor screen, cursor-row, start-col
-1125   var word/eax: (addr word) <- lookup *word-ah?
-1126   print-word screen, word
+1125   var word/eax: (addr word) <- lookup *word-ah?
+1126   print-word screen, word
 1127 }
 1128 
-1129 fn render-define-dialog screen: (addr screen), _sandbox: (addr sandbox), cursor-row: int, cursor-col: int {
-1130   var sandbox/edi: (addr sandbox) <- copy _sandbox
-1131   var define-function-mode-ah?/ecx: (addr handle word) <- get sandbox, partial-name-for-function
-1132   var define-function-mode?/eax: (addr word) <- lookup *define-function-mode-ah?
+1129 fn render-define-dialog screen: (addr screen), _sandbox: (addr sandbox), cursor-row: int, cursor-col: int {
+1130   var sandbox/edi: (addr sandbox) <- copy _sandbox
+1131   var define-function-mode-ah?/ecx: (addr handle word) <- get sandbox, partial-name-for-function
+1132   var define-function-mode?/eax: (addr word) <- lookup *define-function-mode-ah?
 1133   compare define-function-mode?, 0
 1134   break-if-=
 1135   # clear a space for the dialog
@@ -1201,8 +1201,8 @@ if ('onhashchange' in window) {
 1141   left-col <- subtract 0x10
 1142   var right-col/ebx: int <- copy cursor-col
 1143   right-col <- add 0x10
-1144   clear-rect screen, top-row, left-col, bottom-row, right-col
-1145   draw-box screen, top-row, left-col, bottom-row, right-col
+1144   clear-rect screen, top-row, left-col, bottom-row, right-col
+1145   draw-box screen, top-row, left-col, bottom-row, right-col
 1146   # render a little menu for the dialog
 1147   var menu-row/ecx: int <- copy bottom-row
 1148   menu-row <- decrement
@@ -1219,22 +1219,22 @@ if ('onhashchange' in window) {
 1159   print-string screen, " define  "
 1160   # draw the word, positioned appropriately around the cursor
 1161   var start-col/ecx: int <- copy cursor-col
-1162   var word-ah?/edx: (addr handle word) <- get sandbox, partial-name-for-function
-1163   var word/eax: (addr word) <- lookup *word-ah?
-1164   var cursor-index/eax: int <- cursor-index word
-1165   start-col <- subtract cursor-index
+1162   var word-ah?/edx: (addr handle word) <- get sandbox, partial-name-for-function
+1163   var word/eax: (addr word) <- lookup *word-ah?
+1164   var cursor-index/eax: int <- cursor-index word
+1165   start-col <- subtract cursor-index
 1166   move-cursor screen, cursor-row, start-col
-1167   var word/eax: (addr word) <- lookup *word-ah?
-1168   print-word screen, word
+1167   var word/eax: (addr word) <- lookup *word-ah?
+1168   print-word screen, word
 1169 }
 1170 
 1171 # Render just the words in 'line'.
-1172 fn render-line-without-stack screen: (addr screen), _line: (addr line), curr-row: int, left-col: int, cursor-word: (addr word), cursor-row-addr: (addr int), cursor-col-addr: (addr int) {
+1172 fn render-line-without-stack screen: (addr screen), _line: (addr line), curr-row: int, left-col: int, cursor-word: (addr word), cursor-row-addr: (addr int), cursor-col-addr: (addr int) {
 1173   # curr-word
-1174   var line/eax: (addr line) <- copy _line
-1175   var first-word-ah/eax: (addr handle word) <- get line, data
-1176   var _curr-word/eax: (addr word) <- lookup *first-word-ah
-1177   var curr-word/esi: (addr word) <- copy _curr-word
+1174   var line/eax: (addr line) <- copy _line
+1175   var first-word-ah/eax: (addr handle word) <- get line, data
+1176   var _curr-word/eax: (addr word) <- lookup *first-word-ah
+1177   var curr-word/esi: (addr word) <- copy _curr-word
 1178   #
 1179   # loop-carried dependency
 1180   var curr-col/ecx: int <- copy left-col
@@ -1251,9 +1251,9 @@ if ('onhashchange' in window) {
 1191     var old-col/edx: int <- copy curr-col
 1192     reset-formatting screen
 1193     move-cursor screen, curr-row, curr-col
-1194     print-word screen, curr-word
+1194     print-word screen, curr-word
 1195     {
-1196       var max-width/eax: int <- word-length curr-word
+1196       var max-width/eax: int <- word-length curr-word
 1197       curr-col <- add max-width
 1198       curr-col <- add 1  # margin-right
 1199     }
@@ -1279,50 +1279,50 @@ if ('onhashchange' in window) {
 1219       copy-to *dest, src
 1220       dest <- copy cursor-col-addr
 1221       copy-to *dest, old-col
-1222       var cursor-index-in-word/eax: int <- cursor-index curr-word
+1222       var cursor-index-in-word/eax: int <- cursor-index curr-word
 1223       add-to *dest, cursor-index-in-word
 1224     }
 1225     # loop update
-1226     var next-word-ah/edx: (addr handle word) <- get curr-word, next
-1227     var _curr-word/eax: (addr word) <- lookup *next-word-ah
+1226     var next-word-ah/edx: (addr handle word) <- get curr-word, next
+1227     var _curr-word/eax: (addr word) <- lookup *next-word-ah
 1228     curr-word <- copy _curr-word
 1229     loop
 1230   }
 1231 }
 1232 
-1233 fn call-depth-at-cursor _sandbox: (addr sandbox) -> _/eax: int {
-1234   var sandbox/esi: (addr sandbox) <- copy _sandbox
-1235   var cursor-call-path/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path
-1236   var result/eax: int <- call-path-element-length cursor-call-path
-1237   result <- add 2  # input-row - 1
-1238   return result
+1233 fn call-depth-at-cursor _sandbox: (addr sandbox) -> _/eax: int {
+1234   var sandbox/esi: (addr sandbox) <- copy _sandbox
+1235   var cursor-call-path/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path
+1236   var result/eax: int <- call-path-element-length cursor-call-path
+1237   result <- add 2  # input-row - 1
+1238   return result
 1239 }
 1240 
-1241 fn call-path-element-length _x: (addr handle call-path-element) -> _/eax: int {
-1242   var curr-ah/ecx: (addr handle call-path-element) <- copy _x
-1243   var result/edi: int <- copy 0
+1241 fn call-path-element-length _x: (addr handle call-path-element) -> _/eax: int {
+1242   var curr-ah/ecx: (addr handle call-path-element) <- copy _x
+1243   var result/edi: int <- copy 0
 1244   {
-1245     var curr/eax: (addr call-path-element) <- lookup *curr-ah
+1245     var curr/eax: (addr call-path-element) <- lookup *curr-ah
 1246     compare curr, 0
 1247     break-if-=
 1248     curr-ah <- get curr, next
-1249     result <- increment
+1249     result <- increment
 1250     loop
 1251   }
-1252   return result
+1252   return result
 1253 }
 1254 
 1255 # Render the line of words in line, along with the state of the stack under each word.
 1256 # Also render any expanded function calls using recursive calls.
 1257 #
 1258 # Along the way, compute the column the cursor should be positioned at (cursor-col-addr).
-1259 fn render-line screen: (addr screen), functions: (addr handle function), bindings: (addr table), first-line: (addr line), _line: (addr line), expanded-words: (addr handle call-path), top-row: int, left-col: int, curr-path: (addr handle call-path-element), cursor-word: (addr word), cursor-call-path: (addr handle call-path-element), cursor-row-addr: (addr int), cursor-col-addr: (addr int) -> _/ecx: int {
+1259 fn render-line screen: (addr screen), functions: (addr handle function), bindings: (addr table), first-line: (addr line), _line: (addr line), expanded-words: (addr handle call-path), top-row: int, left-col: int, curr-path: (addr handle call-path-element), cursor-word: (addr word), cursor-call-path: (addr handle call-path-element), cursor-row-addr: (addr int), cursor-col-addr: (addr int) -> _/ecx: int {
 1260 #?   print-string 0, "render-line\n"
 1261 #?   dump-table bindings
 1262   # curr-word
-1263   var line/esi: (addr line) <- copy _line
-1264   var first-word-ah/eax: (addr handle word) <- get line, data
-1265   var curr-word/eax: (addr word) <- lookup *first-word-ah
+1263   var line/esi: (addr line) <- copy _line
+1264   var first-word-ah/eax: (addr handle word) <- get line, data
+1265   var curr-word/eax: (addr word) <- lookup *first-word-ah
 1266   #
 1267   # loop-carried dependency
 1268   var curr-col/ecx: int <- copy left-col
@@ -1337,62 +1337,62 @@ if ('onhashchange' in window) {
 1277     $render-line:subsidiary: {
 1278       {
 1279 #?         print-string 0, "check sub\n"
-1280         var display-subsidiary-stack?/eax: boolean <- find-in-call-paths expanded-words, curr-path
+1280         var display-subsidiary-stack?/eax: boolean <- find-in-call-paths expanded-words, curr-path
 1281         compare display-subsidiary-stack?, 0  # false
 1282         break-if-= $render-line:subsidiary
 1283       }
 1284 #?       print-string 0, "render subsidiary stack\n"
 1285       # does function exist?
-1286       var callee/edi: (addr function) <- copy 0
+1286       var callee/edi: (addr function) <- copy 0
 1287       {
-1288         var callee-h: (handle function)
-1289         var callee-ah/ecx: (addr handle function) <- address callee-h
+1288         var callee-h: (handle function)
+1289         var callee-ah/ecx: (addr handle function) <- address callee-h
 1290         callee functions, curr-word, callee-ah
-1291         var _callee/eax: (addr function) <- lookup *callee-ah
+1291         var _callee/eax: (addr function) <- lookup *callee-ah
 1292         callee <- copy _callee
 1293         compare callee, 0
 1294         break-if-= $render-line:subsidiary
 1295       }
 1296       move-cursor screen, top-row, curr-col
 1297       start-color screen, 8, 7
-1298       print-word screen, curr-word
+1298       print-word screen, curr-word
 1299       {
-1300         var word-len/eax: int <- word-length curr-word
+1300         var word-len/eax: int <- word-length curr-word
 1301         curr-col <- add word-len
 1302         curr-col <- add 2
 1303         increment top-row
 1304       }
 1305       # obtain stack at call site
-1306       var stack-storage: value-stack
-1307       var stack/edx: (addr value-stack) <- address stack-storage
-1308       initialize-value-stack stack, 0x10
+1306       var stack-storage: value-stack
+1307       var stack/edx: (addr value-stack) <- address stack-storage
+1308       initialize-value-stack stack, 0x10
 1309       {
-1310         var prev-word-ah/eax: (addr handle word) <- get curr-word, prev
-1311         var prev-word/eax: (addr word) <- lookup *prev-word-ah
+1310         var prev-word-ah/eax: (addr handle word) <- get curr-word, prev
+1311         var prev-word/eax: (addr word) <- lookup *prev-word-ah
 1312         compare prev-word, 0
 1313         break-if-=
-1314         var bindings2-storage: table
-1315         var bindings2/ebx: (addr table) <- address bindings2-storage
-1316         deep-copy-table bindings, bindings2
-1317         evaluate functions, bindings2, first-line, prev-word, stack
+1314         var bindings2-storage: table
+1315         var bindings2/ebx: (addr table) <- address bindings2-storage
+1316         deep-copy-table bindings, bindings2
+1317         evaluate functions, bindings2, first-line, prev-word, stack
 1318       }
 1319       # construct new bindings
-1320       var callee-bindings-storage: table
-1321       var callee-bindings/esi: (addr table) <- address callee-bindings-storage
-1322       initialize-table callee-bindings, 0x10
-1323       bind-args callee, stack, callee-bindings
+1320       var callee-bindings-storage: table
+1321       var callee-bindings/esi: (addr table) <- address callee-bindings-storage
+1322       initialize-table callee-bindings, 0x10
+1323       bind-args callee, stack, callee-bindings
 1324       # obtain body
-1325       var callee-body-ah/eax: (addr handle line) <- get callee, body
-1326       var callee-body/eax: (addr line) <- lookup *callee-body-ah
-1327       var callee-body-first-word/edx: (addr handle word) <- get callee-body, data
+1325       var callee-body-ah/eax: (addr handle line) <- get callee, body
+1326       var callee-body/eax: (addr line) <- lookup *callee-body-ah
+1327       var callee-body-first-word/edx: (addr handle word) <- get callee-body, data
 1328       # - render subsidiary stack
-1329       push-to-call-path-element curr-path, callee-body-first-word  # leak
+1329       push-to-call-path-element curr-path, callee-body-first-word  # leak
 1330 #?       print-string 0, "subsidiary {\n"
 1331 #?       dump-table callee-bindings
 1332 #?       syscall_exit
 1333       curr-col <- render-line screen, functions, callee-bindings, callee-body, callee-body, expanded-words, top-row, curr-col, curr-path, cursor-word, cursor-call-path, cursor-row-addr, cursor-col-addr
 1334 #?       print-string 0, "}\n"
-1335       drop-from-call-path-element curr-path
+1335       drop-from-call-path-element curr-path
 1336       #
 1337       move-cursor screen, top-row, curr-col
 1338       print-code-point screen, 0x21d7  # ⇗
@@ -1402,18 +1402,18 @@ if ('onhashchange' in window) {
 1342     }
 1343     # render main column
 1344     var old-col/edx: int <- copy curr-col
-1345     var bindings2-storage: table
-1346     var bindings2/ebx: (addr table) <- address bindings2-storage
+1345     var bindings2-storage: table
+1346     var bindings2/ebx: (addr table) <- address bindings2-storage
 1347 #?     print-string 0, "deep-copy {\n"
-1348     deep-copy-table bindings, bindings2
+1348     deep-copy-table bindings, bindings2
 1349 #?     print-string 0, "}\n"
 1350 #?     print-string 0, "render column {\n"
-1351     curr-col <- render-column screen, functions, bindings2, first-line, line, curr-word, top-row, curr-col
+1351     curr-col <- render-column screen, functions, bindings2, first-line, line, curr-word, top-row, curr-col
 1352 #?     print-string 0, "}\n"
 1353     # cache cursor column if necessary
 1354     $render-line:cache-cursor-column: {
 1355       {
-1356         var found?/eax: boolean <- call-path-element-match? curr-path, cursor-call-path
+1356         var found?/eax: boolean <- call-path-element-match? curr-path, cursor-call-path
 1357         compare found?, 0  # false
 1358         break-if-= $render-line:cache-cursor-column
 1359       }
@@ -1424,29 +1424,29 @@ if ('onhashchange' in window) {
 1364       }
 1365       dest <- copy cursor-col-addr
 1366       copy-to *dest, old-col
-1367       var cursor-index-in-word/eax: int <- cursor-index curr-word
+1367       var cursor-index-in-word/eax: int <- cursor-index curr-word
 1368       add-to *dest, cursor-index-in-word
 1369     }
 1370     # loop update
 1371 #?     print-string 0, "next word\n"
-1372     var next-word-ah/edx: (addr handle word) <- get curr-word, next
+1372     var next-word-ah/edx: (addr handle word) <- get curr-word, next
 1373     curr-word <- lookup *next-word-ah
 1374 #?     {
 1375 #?       var foo/eax: int <- copy curr-word
 1376 #?       print-int32-hex 0, foo
 1377 #?       print-string 0, "\n"
 1378 #?     }
-1379     increment-final-element curr-path
+1379     increment-final-element curr-path
 1380     loop
 1381   }
 1382   return curr-col
 1383 }
 1384 
-1385 fn callee functions: (addr handle function), word: (addr word), out: (addr handle function) {
+1385 fn callee functions: (addr handle function), word: (addr word), out: (addr handle function) {
 1386   var stream-storage: (stream byte 0x10)
 1387   var stream/esi: (addr stream byte) <- address stream-storage
-1388   emit-word word, stream
-1389   find-function functions, stream, out
+1388   emit-word word, stream
+1389   find-function functions, stream, out
 1390 }
 1391 
 1392 # Render:
@@ -1454,42 +1454,42 @@ if ('onhashchange' in window) {
 1394 #   - starting somewhere below at left-col: the stack result from interpreting first-world to final-word (inclusive)
 1395 #
 1396 # Return the farthest column written.
-1397 fn render-column screen: (addr screen), functions: (addr handle function), bindings: (addr table), first-line: (addr line), line: (addr line), final-word: (addr word), top-row: int, left-col: int -> _/ecx: int {
+1397 fn render-column screen: (addr screen), functions: (addr handle function), bindings: (addr table), first-line: (addr line), line: (addr line), final-word: (addr word), top-row: int, left-col: int -> _/ecx: int {
 1398 #?   print-string 0, "render-column\n"
 1399 #?   dump-table bindings
 1400   var max-width/esi: int <- copy 0
 1401   {
 1402     # compute stack
-1403     var stack: value-stack
-1404     var stack-addr/edi: (addr value-stack) <- address stack
-1405     initialize-value-stack stack-addr, 0x10  # max-words
+1403     var stack: value-stack
+1404     var stack-addr/edi: (addr value-stack) <- address stack
+1405     initialize-value-stack stack-addr, 0x10  # max-words
 1406     # copy bindings
-1407     var bindings2-storage: table
-1408     var bindings2/ebx: (addr table) <- address bindings2-storage
+1407     var bindings2-storage: table
+1408     var bindings2/ebx: (addr table) <- address bindings2-storage
 1409 #?     print-string 0, "deep copy table {\n"
-1410     deep-copy-table bindings, bindings2
+1410     deep-copy-table bindings, bindings2
 1411 #?     print-string 0, "}\n"
-1412     evaluate functions, bindings2, first-line, final-word, stack-addr
+1412     evaluate functions, bindings2, first-line, final-word, stack-addr
 1413     # indent stack
 1414     var indented-col/ebx: int <- copy left-col
 1415     indented-col <- add 1  # margin-right
 1416     # render stack
 1417     var curr-row/edx: int <- copy top-row
 1418     curr-row <- add 2  # stack-margin-top
-1419     var _max-width/eax: int <- value-stack-max-width stack-addr
+1419     var _max-width/eax: int <- value-stack-max-width stack-addr
 1420     max-width <- copy _max-width
 1421     {
 1422       var top-addr/ecx: (addr int) <- get stack-addr, top
 1423       compare *top-addr, 0
 1424       break-if-<=
 1425       decrement *top-addr
-1426       var data-ah/eax: (addr handle array value) <- get stack-addr, data
-1427       var data/eax: (addr array value) <- lookup *data-ah
+1426       var data-ah/eax: (addr handle array value) <- get stack-addr, data
+1427       var data/eax: (addr array value) <- lookup *data-ah
 1428       var top/ecx: int <- copy *top-addr
-1429       var dest-offset/ecx: (offset value) <- compute-offset data, top
-1430       var val/eax: (addr value) <- index data, dest-offset
-1431       render-value-at screen, curr-row, indented-col, val, max-width
-1432       var height/eax: int <- value-height val
+1429       var dest-offset/ecx: (offset value) <- compute-offset data, top
+1430       var val/eax: (addr value) <- index data, dest-offset
+1431       render-value-at screen, curr-row, indented-col, val, max-width
+1432       var height/eax: int <- value-height val
 1433       curr-row <- add height
 1434       loop
 1435     }
@@ -1500,9 +1500,9 @@ if ('onhashchange' in window) {
 1440   # render word, initialize result
 1441   reset-formatting screen
 1442   move-cursor screen, top-row, left-col
-1443   print-word screen, final-word
+1443   print-word screen, final-word
 1444   {
-1445     var size/eax: int <- word-length final-word
+1445     var size/eax: int <- word-length final-word
 1446     compare size, max-width
 1447     break-if-<=
 1448     max-width <- copy size
@@ -1528,7 +1528,7 @@ if ('onhashchange' in window) {
 1468   var nrows/eax: (addr int) <- get env, nrows
 1469   var _repl-col/ecx: (addr int) <- get env, code-separator-col
 1470   var repl-col/ecx: int <- copy *_repl-col
-1471   draw-vertical-line screen, 1, *nrows, repl-col
+1471   draw-vertical-line screen, 1, *nrows, repl-col
 1472   # wordstar-style cheatsheet of shortcuts
 1473   move-cursor screen, *nrows, 0
 1474   start-reverse-video screen
@@ -1545,11 +1545,11 @@ if ('onhashchange' in window) {
 1485   start-reverse-video screen
 1486   print-string screen, " ctrl-b "
 1487   reset-formatting screen
-1488   print-string screen, " â—€ word  "
+1488   print-string screen, " â—€ word  "
 1489   start-reverse-video screen
 1490   print-string screen, " ctrl-f "
 1491   reset-formatting screen
-1492   print-string screen, " word â–¶  "
+1492   print-string screen, " word â–¶  "
 1493   start-reverse-video screen
 1494   print-string screen, " ctrl-e "
 1495   reset-formatting screen
@@ -1557,7 +1557,7 @@ if ('onhashchange' in window) {
 1497   start-reverse-video screen
 1498   print-string screen, " ctrl-l "
 1499   reset-formatting screen
-1500   print-string screen, " new line "
+1500   print-string screen, " new line "
 1501   start-reverse-video screen
 1502   print-string screen, " ctrl-u "
 1503   reset-formatting screen
@@ -1565,11 +1565,11 @@ if ('onhashchange' in window) {
 1505   start-reverse-video screen
 1506   print-string screen, " ctrl-n "
 1507   reset-formatting screen
-1508   print-string screen, " name value  "
+1508   print-string screen, " name value  "
 1509   start-reverse-video screen
 1510   print-string screen, " ctrl-d "
 1511   reset-formatting screen
-1512   print-string screen, " define function  "
+1512   print-string screen, " define function  "
 1513   # primitives
 1514   var dummy/eax: int <- render-primitives screen, *nrows, repl-col
 1515   # currently defined functions
@@ -1631,9 +1631,9 @@ if ('onhashchange' in window) {
 1571   var row/ecx: int <- copy 1
 1572   var dummy-col/edx: int <- copy right-col
 1573   var env/esi: (addr environment) <- copy _env
-1574   var functions/esi: (addr handle function) <- get env, functions
+1574   var functions/esi: (addr handle function) <- get env, functions
 1575   {
-1576     var curr/eax: (addr function) <- lookup *functions
+1576     var curr/eax: (addr function) <- lookup *functions
 1577     compare curr, 0
 1578     break-if-=
 1579     row, dummy-col <- render-function-right-aligned screen, row, right-col, curr
@@ -1645,19 +1645,19 @@ if ('onhashchange' in window) {
 1585 
 1586 # print function starting at row, right-aligned before right-col
 1587 # return row, col printed until
-1588 fn render-function-right-aligned screen: (addr screen), row: int, right-col: int, f: (addr function) -> _/ecx: int, _/edx: int {
+1588 fn render-function-right-aligned screen: (addr screen), row: int, right-col: int, f: (addr function) -> _/ecx: int, _/edx: int {
 1589   var col/edx: int <- copy right-col
 1590   col <- subtract 1  # function-right-margin
 1591   var col2/ebx: int <- copy col
-1592   var width/eax: int <- function-width f
+1592   var width/eax: int <- function-width f
 1593   col <- subtract width
 1594   var new-row/ecx: int <- copy row
-1595   var height/eax: int <- function-height f
+1595   var height/eax: int <- function-height f
 1596   new-row <- add height
 1597   new-row <- decrement
 1598   col <- subtract 1  # function-left-padding
 1599   start-color screen, 0, 0xf7
-1600   clear-rect screen, row, col, new-row, col2
+1600   clear-rect screen, row, col, new-row, col2
 1601   col <- add 1
 1602 #?   var dummy/eax: grapheme <- read-key-from-real-keyboard
 1603   render-function screen, row, col, f
@@ -1670,11 +1670,11 @@ if ('onhashchange' in window) {
 1610 
 1611 # render function starting at row, col
 1612 # only single-line functions supported for now
-1613 fn render-function screen: (addr screen), row: int, col: int, _f: (addr function) {
-1614   var f/esi: (addr function) <- copy _f
-1615   var args/ecx: (addr handle word) <- get f, args
+1613 fn render-function screen: (addr screen), row: int, col: int, _f: (addr function) {
+1614   var f/esi: (addr function) <- copy _f
+1615   var args/ecx: (addr handle word) <- get f, args
 1616   move-cursor screen, row, col
-1617   print-words-in-reverse screen, args
+1617   print-words-in-reverse screen, args
 1618   var name-ah/eax: (addr handle array byte) <- get f, name
 1619   var name/eax: (addr array byte) <- lookup *name-ah
 1620   start-bold screen
@@ -1685,10 +1685,10 @@ if ('onhashchange' in window) {
 1625   add-to col, 2
 1626   move-cursor screen, row, col
 1627   print-string screen, "≡ "
-1628   var body-ah/eax: (addr handle line) <- get f, body
-1629   var body/eax: (addr line) <- lookup *body-ah
-1630   var body-words-ah/eax: (addr handle word) <- get body, data
-1631   print-words screen, body-words-ah
+1628   var body-ah/eax: (addr handle line) <- get f, body
+1629   var body/eax: (addr line) <- lookup *body-ah
+1630   var body-words-ah/eax: (addr handle word) <- get body, data
+1631   print-words screen, body-words-ah
 1632 }
 1633 
 1634 fn real-grapheme? g: grapheme -> _/eax: boolean {
diff --git a/html/apps/tile/gap-buffer.mu.html b/html/apps/tile/gap-buffer.mu.html
index 873992ef..028667b1 100644
--- a/html/apps/tile/gap-buffer.mu.html
+++ b/html/apps/tile/gap-buffer.mu.html
@@ -58,16 +58,16 @@ if ('onhashchange' in window) {
 https://github.com/akkartik/mu/blob/master/apps/tile/gap-buffer.mu
 
   1 type gap-buffer {
-  2   left: grapheme-stack
-  3   right: grapheme-stack
+  2   left: grapheme-stack
+  3   right: grapheme-stack
   4 }
   5 
   6 fn initialize-gap-buffer _self: (addr gap-buffer) {
   7   var self/esi: (addr gap-buffer) <- copy _self
-  8   var left/eax: (addr grapheme-stack) <- get self, left
-  9   initialize-grapheme-stack left, 0x10  # max-word-size
- 10   var right/eax: (addr grapheme-stack) <- get self, right
- 11   initialize-grapheme-stack right, 0x10  # max-word-size
+  8   var left/eax: (addr grapheme-stack) <- get self, left
+  9   initialize-grapheme-stack left, 0x10  # max-word-size
+ 10   var right/eax: (addr grapheme-stack) <- get self, right
+ 11   initialize-grapheme-stack right, 0x10  # max-word-size
  12 }
  13 
  14 # just for tests
@@ -96,15 +96,15 @@ if ('onhashchange' in window) {
  37 fn emit-gap-buffer _self: (addr gap-buffer), out: (addr stream byte) {
  38   var self/esi: (addr gap-buffer) <- copy _self
  39   clear-stream out
- 40   var left/eax: (addr grapheme-stack) <- get self, left
+ 40   var left/eax: (addr grapheme-stack) <- get self, left
  41   emit-stack-from-bottom left, out
- 42   var right/eax: (addr grapheme-stack) <- get self, right
+ 42   var right/eax: (addr grapheme-stack) <- get self, right
  43   emit-stack-from-top right, out
  44 }
  45 
  46 # dump stack from bottom to top
- 47 fn emit-stack-from-bottom _self: (addr grapheme-stack), out: (addr stream byte) {
- 48   var self/esi: (addr grapheme-stack) <- copy _self
+ 47 fn emit-stack-from-bottom _self: (addr grapheme-stack), out: (addr stream byte) {
+ 48   var self/esi: (addr grapheme-stack) <- copy _self
  49   var data-ah/edi: (addr handle array grapheme) <- get self, data
  50   var _data/eax: (addr array grapheme) <- lookup *data-ah
  51   var data/edi: (addr array grapheme) <- copy _data
@@ -121,8 +121,8 @@ if ('onhashchange' in window) {
  62 }
  63 
  64 # dump stack from top to bottom
- 65 fn emit-stack-from-top _self: (addr grapheme-stack), out: (addr stream byte) {
- 66   var self/esi: (addr grapheme-stack) <- copy _self
+ 65 fn emit-stack-from-top _self: (addr grapheme-stack), out: (addr stream byte) {
+ 66   var self/esi: (addr grapheme-stack) <- copy _self
  67   var data-ah/edi: (addr handle array grapheme) <- get self, data
  68   var _data/eax: (addr array grapheme) <- lookup *data-ah
  69   var data/edi: (addr array grapheme) <- copy _data
@@ -141,28 +141,28 @@ if ('onhashchange' in window) {
  82 
  83 fn render-gap-buffer screen: (addr screen), _gap: (addr gap-buffer) {
  84   var gap/esi: (addr gap-buffer) <- copy _gap
- 85   var left/eax: (addr grapheme-stack) <- get gap, left
- 86   render-stack-from-bottom left, screen
- 87   var right/eax: (addr grapheme-stack) <- get gap, right
- 88   render-stack-from-top right, screen
+ 85   var left/eax: (addr grapheme-stack) <- get gap, left
+ 86   render-stack-from-bottom left, screen
+ 87   var right/eax: (addr grapheme-stack) <- get gap, right
+ 88   render-stack-from-top right, screen
  89 }
  90 
  91 fn gap-buffer-length _gap: (addr gap-buffer) -> _/eax: int {
  92   var gap/esi: (addr gap-buffer) <- copy _gap
- 93   var left/eax: (addr grapheme-stack) <- get gap, left
+ 93   var left/eax: (addr grapheme-stack) <- get gap, left
  94   var tmp/eax: (addr int) <- get left, top
  95   var left-length/ecx: int <- copy *tmp
- 96   var right/esi: (addr grapheme-stack) <- get gap, right
+ 96   var right/esi: (addr grapheme-stack) <- get gap, right
  97   tmp <- get right, top
- 98   var result/eax: int <- copy *tmp
- 99   result <- add left-length
-100   return result
+ 98   var result/eax: int <- copy *tmp
+ 99   result <- add left-length
+100   return result
 101 }
 102 
 103 fn add-grapheme-at-gap _self: (addr gap-buffer), g: grapheme {
 104   var self/esi: (addr gap-buffer) <- copy _self
-105   var left/eax: (addr grapheme-stack) <- get self, left
-106   push-grapheme-stack left, g
+105   var left/eax: (addr grapheme-stack) <- get self, left
+106   push-grapheme-stack left, g
 107 }
 108 
 109 fn gap-to-start self: (addr gap-buffer) {
@@ -183,28 +183,28 @@ if ('onhashchange' in window) {
 124 
 125 fn gap-at-start? _self: (addr gap-buffer) -> _/eax: boolean {
 126   var self/esi: (addr gap-buffer) <- copy _self
-127   var left/eax: (addr grapheme-stack) <- get self, left
-128   var result/eax: boolean <- grapheme-stack-empty? left
-129   return result
+127   var left/eax: (addr grapheme-stack) <- get self, left
+128   var result/eax: boolean <- grapheme-stack-empty? left
+129   return result
 130 }
 131 
 132 fn gap-at-end? _self: (addr gap-buffer) -> _/eax: boolean {
 133   var self/esi: (addr gap-buffer) <- copy _self
-134   var right/eax: (addr grapheme-stack) <- get self, right
-135   var result/eax: boolean <- grapheme-stack-empty? right
-136   return result
+134   var right/eax: (addr grapheme-stack) <- get self, right
+135   var result/eax: boolean <- grapheme-stack-empty? right
+136   return result
 137 }
 138 
 139 fn gap-right _self: (addr gap-buffer) -> _/eax: grapheme {
 140   var self/esi: (addr gap-buffer) <- copy _self
 141   var g/eax: grapheme <- copy 0
-142   var right/ecx: (addr grapheme-stack) <- get self, right
-143   g <- pop-grapheme-stack right
+142   var right/ecx: (addr grapheme-stack) <- get self, right
+143   g <- pop-grapheme-stack right
 144   compare g, -1
 145   {
 146     break-if-=
-147     var left/ecx: (addr grapheme-stack) <- get self, left
-148     push-grapheme-stack left, g
+147     var left/ecx: (addr grapheme-stack) <- get self, left
+148     push-grapheme-stack left, g
 149   }
 150   return g
 151 }
@@ -213,30 +213,30 @@ if ('onhashchange' in window) {
 154   var self/esi: (addr gap-buffer) <- copy _self
 155   var g/eax: grapheme <- copy 0
 156   {
-157     var left/ecx: (addr grapheme-stack) <- get self, left
-158     g <- pop-grapheme-stack left
+157     var left/ecx: (addr grapheme-stack) <- get self, left
+158     g <- pop-grapheme-stack left
 159   }
 160   compare g, -1
 161   {
 162     break-if-=
-163     var right/ecx: (addr grapheme-stack) <- get self, right
-164     push-grapheme-stack right, g
+163     var right/ecx: (addr grapheme-stack) <- get self, right
+164     push-grapheme-stack right, g
 165   }
 166   return g
 167 }
 168 
 169 fn gap-index _self: (addr gap-buffer) -> _/eax: int {
 170   var self/eax: (addr gap-buffer) <- copy _self
-171   var left/eax: (addr grapheme-stack) <- get self, left
+171   var left/eax: (addr grapheme-stack) <- get self, left
 172   var top-addr/eax: (addr int) <- get left, top
-173   var result/eax: int <- copy *top-addr
-174   return result
+173   var result/eax: int <- copy *top-addr
+174   return result
 175 }
 176 
 177 fn first-grapheme-in-gap-buffer _self: (addr gap-buffer) -> _/eax: grapheme {
 178   var self/esi: (addr gap-buffer) <- copy _self
 179   # try to read from left
-180   var left/eax: (addr grapheme-stack) <- get self, left
+180   var left/eax: (addr grapheme-stack) <- get self, left
 181   var top-addr/ecx: (addr int) <- get left, top
 182   compare *top-addr, 0
 183   {
@@ -247,7 +247,7 @@ if ('onhashchange' in window) {
 188     return *result-addr
 189   }
 190   # try to read from right
-191   var right/eax: (addr grapheme-stack) <- get self, right
+191   var right/eax: (addr grapheme-stack) <- get self, right
 192   top-addr <- get right, top
 193   compare *top-addr, 0
 194   {
@@ -266,14 +266,14 @@ if ('onhashchange' in window) {
 207 fn grapheme-before-cursor-in-gap-buffer _self: (addr gap-buffer) -> _/eax: grapheme {
 208   var self/esi: (addr gap-buffer) <- copy _self
 209   # try to read from left
-210   var left/ecx: (addr grapheme-stack) <- get self, left
+210   var left/ecx: (addr grapheme-stack) <- get self, left
 211   var top-addr/edx: (addr int) <- get left, top
 212   compare *top-addr, 0
 213   {
 214     break-if-<=
-215     var result/eax: grapheme <- pop-grapheme-stack left
-216     push-grapheme-stack left, result
-217     return result
+215     var result/eax: grapheme <- pop-grapheme-stack left
+216     push-grapheme-stack left, result
+217     return result
 218   }
 219   # give up
 220   return -1
@@ -281,15 +281,15 @@ if ('onhashchange' in window) {
 222 
 223 fn delete-before-gap _self: (addr gap-buffer) {
 224   var self/eax: (addr gap-buffer) <- copy _self
-225   var left/eax: (addr grapheme-stack) <- get self, left
-226   var dummy/eax: grapheme <- pop-grapheme-stack left
+225   var left/eax: (addr grapheme-stack) <- get self, left
+226   var dummy/eax: grapheme <- pop-grapheme-stack left
 227 }
 228 
 229 fn pop-after-gap _self: (addr gap-buffer) -> _/eax: grapheme {
 230   var self/eax: (addr gap-buffer) <- copy _self
-231   var right/eax: (addr grapheme-stack) <- get self, right
-232   var result/eax: grapheme <- pop-grapheme-stack right
-233   return result
+231   var right/eax: (addr grapheme-stack) <- get self, right
+232   var result/eax: grapheme <- pop-grapheme-stack right
+233   return result
 234 }
 235 
 236 fn gap-buffer-equal? _self: (addr gap-buffer), s: (addr array byte) -> _/eax: boolean {
@@ -301,24 +301,24 @@ if ('onhashchange' in window) {
 242   var expected-stream/ecx: (addr stream byte) <- address stream-storage
 243   write expected-stream, s
 244   # compare left
-245   var left/edx: (addr grapheme-stack) <- get self, left
-246   var result/eax: boolean <- prefix-match? left, expected-stream
-247   compare result, 0  # false
+245   var left/edx: (addr grapheme-stack) <- get self, left
+246   var result/eax: boolean <- prefix-match? left, expected-stream
+247   compare result, 0  # false
 248   {
 249     break-if-!=
-250     return result
+250     return result
 251   }
 252   # compare right
-253   var right/edx: (addr grapheme-stack) <- get self, right
-254   result <- suffix-match? right, expected-stream
-255   compare result, 0  # false
+253   var right/edx: (addr grapheme-stack) <- get self, right
+254   result <- suffix-match? right, expected-stream
+255   compare result, 0  # false
 256   {
 257     break-if-!=
-258     return result
+258     return result
 259   }
 260   # ensure there's nothing left over
-261   result <- stream-empty? expected-stream
-262   return result
+261   result <- stream-empty? expected-stream
+262   return result
 263 }
 264 
 265 fn test-gap-buffer-equal-from-end? {
@@ -332,8 +332,8 @@ if ('onhashchange' in window) {
 273   add-grapheme-at-gap g, c
 274   # gap is at end (right is empty)
 275   var _result/eax: boolean <- gap-buffer-equal? g, "aaa"
-276   var result/eax: int <- copy _result
-277   check-ints-equal result, 1, "F - test-gap-buffer-equal-from-end?"
+276   var result/eax: int <- copy _result
+277   check-ints-equal result, 1, "F - test-gap-buffer-equal-from-end?"
 278 }
 279 
 280 fn test-gap-buffer-equal-from-middle? {
@@ -348,8 +348,8 @@ if ('onhashchange' in window) {
 289   var dummy/eax: grapheme <- gap-left g
 290   # gap is in the middle
 291   var _result/eax: boolean <- gap-buffer-equal? g, "aaa"
-292   var result/eax: int <- copy _result
-293   check-ints-equal result, 1, "F - test-gap-buffer-equal-from-middle?"
+292   var result/eax: int <- copy _result
+293   check-ints-equal result, 1, "F - test-gap-buffer-equal-from-middle?"
 294 }
 295 
 296 fn test-gap-buffer-equal-from-start? {
@@ -366,8 +366,8 @@ if ('onhashchange' in window) {
 307   dummy <- gap-left g
 308   # gap is at the start
 309   var _result/eax: boolean <- gap-buffer-equal? g, "aaa"
-310   var result/eax: int <- copy _result
-311   check-ints-equal result, 1, "F - test-gap-buffer-equal-from-start?"
+310   var result/eax: int <- copy _result
+311   check-ints-equal result, 1, "F - test-gap-buffer-equal-from-start?"
 312 }
 313 
 314 fn copy-gap-buffer _src-ah: (addr handle gap-buffer), _dest-ah: (addr handle gap-buffer) {
@@ -379,26 +379,26 @@ if ('onhashchange' in window) {
 320   var _dest-a/eax: (addr gap-buffer) <- lookup *dest-ah
 321   var dest-a/edi: (addr gap-buffer) <- copy _dest-a
 322   # copy left grapheme-stack
-323   var src/ecx: (addr grapheme-stack) <- get src-a, left
-324   var dest/edx: (addr grapheme-stack) <- get dest-a, left
-325   copy-grapheme-stack src, dest
+323   var src/ecx: (addr grapheme-stack) <- get src-a, left
+324   var dest/edx: (addr grapheme-stack) <- get dest-a, left
+325   copy-grapheme-stack src, dest
 326   # copy right grapheme-stack
 327   src <- get src-a, right
 328   dest <- get dest-a, right
-329   copy-grapheme-stack src, dest
+329   copy-grapheme-stack src, dest
 330 }
 331 
 332 fn gap-buffer-is-decimal-integer? _self: (addr gap-buffer) -> _/eax: boolean {
 333   var self/esi: (addr gap-buffer) <- copy _self
-334   var curr/ecx: (addr grapheme-stack) <- get self, left
-335   var result/eax: boolean <- grapheme-stack-is-decimal-integer? curr
+334   var curr/ecx: (addr grapheme-stack) <- get self, left
+335   var result/eax: boolean <- grapheme-stack-is-decimal-integer? curr
 336   {
-337     compare result, 0  # false
+337     compare result, 0  # false
 338     break-if-=
 339     curr <- get self, right
-340     result <- grapheme-stack-is-decimal-integer? curr
+340     result <- grapheme-stack-is-decimal-integer? curr
 341   }
-342   return result
+342   return result
 343 }
 
diff --git a/html/apps/tile/grapheme-stack.mu.html b/html/apps/tile/grapheme-stack.mu.html index 6beded15..fea2d996 100644 --- a/html/apps/tile/grapheme-stack.mu.html +++ b/html/apps/tile/grapheme-stack.mu.html @@ -234,18 +234,18 @@ if ('onhashchange' in window) { 176 var data/edx: (addr array grapheme) <- copy _data 177 var top-addr/ecx: (addr int) <- get self, top 178 var i/ebx: int <- copy 0 -179 var result/eax: boolean <- copy 1 # true +179 var result/eax: boolean <- copy 1 # true 180 $grapheme-stack-is-integer?:loop: { 181 compare i, *top-addr 182 break-if->= 183 var g/edx: (addr grapheme) <- index data, i -184 result <- is-decimal-digit? *g -185 compare result, 0 # false +184 result <- is-decimal-digit? *g +185 compare result, 0 # false 186 break-if-= 187 i <- increment 188 loop 189 } -190 return result +190 return result 191 }
diff --git a/html/apps/tile/main.mu.html b/html/apps/tile/main.mu.html index 1629a012..bdb2d8c2 100644 --- a/html/apps/tile/main.mu.html +++ b/html/apps/tile/main.mu.html @@ -108,16 +108,16 @@ if ('onhashchange' in window) { 49 fn interactive { 50 enable-screen-grid-mode 51 enable-keyboard-immediate-mode - 52 var env-storage: environment - 53 var env/esi: (addr environment) <- address env-storage - 54 initialize-environment env - 55 draw-screen env + 52 var env-storage: environment + 53 var env/esi: (addr environment) <- address env-storage + 54 initialize-environment env + 55 draw-screen env 56 { 57 var key/eax: grapheme <- read-key-from-real-keyboard 58 compare key, 0x11 # 'ctrl-q' 59 break-if-= - 60 process env, key - 61 render env + 60 process env, key + 61 render env 62 loop 63 } 64 enable-keyboard-type-mode @@ -125,23 +125,23 @@ if ('onhashchange' in window) { 66 } 67 68 fn test { - 69 var env-storage: environment - 70 var env/esi: (addr environment) <- address env-storage - 71 initialize-environment-with-fake-screen env, 0x20, 0xa0 + 69 var env-storage: environment + 70 var env/esi: (addr environment) <- address env-storage + 71 initialize-environment-with-fake-screen env, 0x20, 0xa0 72 process-all env, "3 3 fake-screen =s" - 73 process env, 0xc # ctrl-l + 73 process env, 0xc # ctrl-l 74 process-all env, "s 1 down 1 right" - 75 process env, 4 # ctrl-d: start defining function + 75 process env, 4 # ctrl-d: start defining function 76 process-all env, "foo" - 77 process env, 0xa # newline: define function - 78 process env, 0x435b1b # right-arrow + 77 process env, 0xa # newline: define function + 78 process env, 0x435b1b # right-arrow 79 #? process env, 5 # ctrl-e: end of line 80 print-string 0, "==\n" - 81 process env, 0xa # newline: expand - 82 render env + 81 process env, 0xa # newline: expand + 82 render env 83 } 84 - 85 fn process-all env: (addr environment), cmds: (addr array byte) { + 85 fn process-all env: (addr environment), cmds: (addr array byte) { 86 var cmds-stream: (stream byte 0x100) 87 var cmds-stream-a/esi: (addr stream byte) <- address cmds-stream 88 write cmds-stream-a, cmds @@ -150,7 +150,7 @@ if ('onhashchange' in window) { 91 compare done?, 0 # false 92 break-if-!= 93 var g/eax: grapheme <- read-grapheme cmds-stream-a - 94 process env, g + 94 process env, g 95 loop 96 } 97 } @@ -161,36 +161,36 @@ if ('onhashchange' in window) { 102 print-string-to-real-screen "> " 103 # read 104 var line-storage: (stream byte 0x100) -105 var line/ecx: (addr stream byte) <- address line-storage -106 clear-stream line -107 read-line-from-real-keyboard line -108 var done?/eax: boolean <- stream-empty? line +105 var line/ecx: (addr stream byte) <- address line-storage +106 clear-stream line +107 read-line-from-real-keyboard line +108 var done?/eax: boolean <- stream-empty? line 109 compare done?, 0 # false 110 break-if-!= 111 # parse -112 var env-storage: environment -113 var env/esi: (addr environment) <- address env-storage -114 initialize-environment env +112 var env-storage: environment +113 var env/esi: (addr environment) <- address env-storage +114 initialize-environment env 115 { -116 var done?/eax: boolean <- stream-empty? line +116 var done?/eax: boolean <- stream-empty? line 117 compare done?, 0 # false 118 break-if-!= -119 var g/eax: grapheme <- read-grapheme line -120 process env, g +119 var g/eax: grapheme <- read-grapheme line +120 process env, g 121 loop 122 } 123 # eval -124 var stack-storage: value-stack -125 var stack/edi: (addr value-stack) <- address stack-storage -126 initialize-value-stack stack, 0x10 -127 evaluate-environment env, stack +124 var stack-storage: value-stack +125 var stack/edi: (addr value-stack) <- address stack-storage +126 initialize-value-stack stack, 0x10 +127 evaluate-environment env, stack 128 # print -129 var empty?/eax: boolean <- value-stack-empty? stack +129 var empty?/eax: boolean <- value-stack-empty? stack 130 { 131 compare empty?, 0 # false 132 break-if-!= -133 var result/eax: int <- pop-int-from-value-stack stack -134 print-int32-decimal-to-real-screen result +133 var result/eax: int <- pop-int-from-value-stack stack +134 print-int32-decimal-to-real-screen result 135 print-string-to-real-screen "\n" 136 } 137 # diff --git a/html/apps/tile/rpn.mu.html b/html/apps/tile/rpn.mu.html index dad0a274..0c5d6255 100644 --- a/html/apps/tile/rpn.mu.html +++ b/html/apps/tile/rpn.mu.html @@ -58,19 +58,19 @@ if ('onhashchange' in window) { https://github.com/akkartik/mu/blob/master/apps/tile/rpn.mu
-  1 fn evaluate functions: (addr handle function), bindings: (addr table), scratch: (addr line), end: (addr word), out: (addr value-stack) {
-  2   var line/eax: (addr line) <- copy scratch
-  3   var word-ah/eax: (addr handle word) <- get line, data
-  4   var curr/eax: (addr word) <- lookup *word-ah
+  1 fn evaluate functions: (addr handle function), bindings: (addr table), scratch: (addr line), end: (addr word), out: (addr value-stack) {
+  2   var line/eax: (addr line) <- copy scratch
+  3   var word-ah/eax: (addr handle word) <- get line, data
+  4   var curr/eax: (addr word) <- lookup *word-ah
   5   var curr-stream-storage: (stream byte 0x10)
   6   var curr-stream/edi: (addr stream byte) <- address curr-stream-storage
-  7   clear-value-stack out
+  7   clear-value-stack out
   8   $evaluate:loop: {
   9     # precondition (should never hit)
  10     compare curr, 0
  11     break-if-=
  12     # update curr-stream
- 13     emit-word curr, curr-stream
+ 13     emit-word curr, curr-stream
  14 #?     print-string-to-real-screen "eval: "
  15 #?     print-stream-to-real-screen curr-stream
  16 #?     print-string-to-real-screen "\n"
@@ -81,33 +81,33 @@ if ('onhashchange' in window) {
  21         var is-add?/eax: boolean <- stream-data-equal? curr-stream, "+"
  22         compare is-add?, 0
  23         break-if-=
- 24         var _b/eax: int <- pop-int-from-value-stack out
+ 24         var _b/eax: int <- pop-int-from-value-stack out
  25         var b/edx: int <- copy _b
- 26         var a/eax: int <- pop-int-from-value-stack out
+ 26         var a/eax: int <- pop-int-from-value-stack out
  27         a <- add b
- 28         push-int-to-value-stack out, a
+ 28         push-int-to-value-stack out, a
  29         break $evaluate:process-word
  30       }
  31       {
  32         var is-sub?/eax: boolean <- stream-data-equal? curr-stream, "-"
  33         compare is-sub?, 0
  34         break-if-=
- 35         var _b/eax: int <- pop-int-from-value-stack out
+ 35         var _b/eax: int <- pop-int-from-value-stack out
  36         var b/edx: int <- copy _b
- 37         var a/eax: int <- pop-int-from-value-stack out
+ 37         var a/eax: int <- pop-int-from-value-stack out
  38         a <- subtract b
- 39         push-int-to-value-stack out, a
+ 39         push-int-to-value-stack out, a
  40         break $evaluate:process-word
  41       }
  42       {
  43         var is-mul?/eax: boolean <- stream-data-equal? curr-stream, "*"
  44         compare is-mul?, 0
  45         break-if-=
- 46         var _b/eax: int <- pop-int-from-value-stack out
+ 46         var _b/eax: int <- pop-int-from-value-stack out
  47         var b/edx: int <- copy _b
- 48         var a/eax: int <- pop-int-from-value-stack out
+ 48         var a/eax: int <- pop-int-from-value-stack out
  49         a <- multiply b
- 50         push-int-to-value-stack out, a
+ 50         push-int-to-value-stack out, a
  51         break $evaluate:process-word
  52       }
  53       ## strings/arrays
@@ -117,17 +117,17 @@ if ('onhashchange' in window) {
  57         break-if-=
  58 #?         print-string 0, "is len\n"
  59         # pop target-val from out
- 60         var out2/esi: (addr value-stack) <- copy out
+ 60         var out2/esi: (addr value-stack) <- copy out
  61         var top-addr/ecx: (addr int) <- get out2, top
  62         compare *top-addr, 0
  63         break-if-<=
  64 #?         print-string 0, "stack has stuff\n"
- 65         var data-ah/eax: (addr handle array value) <- get out2, data
- 66         var data/eax: (addr array value) <- lookup *data-ah
+ 65         var data-ah/eax: (addr handle array value) <- get out2, data
+ 66         var data/eax: (addr array value) <- lookup *data-ah
  67         var top/edx: int <- copy *top-addr
  68         top <- decrement
- 69         var dest-offset/edx: (offset value) <- compute-offset data, top
- 70         var target-val/edx: (addr value) <- index data, dest-offset
+ 69         var dest-offset/edx: (offset value) <- compute-offset data, top
+ 70         var target-val/edx: (addr value) <- index data, dest-offset
  71         # check target-val is a string or array
  72         var target-type-addr/eax: (addr int) <- get target-val, type
  73         compare *target-type-addr, 1  # string
@@ -136,30 +136,30 @@ if ('onhashchange' in window) {
  76           # compute length
  77           var src-ah/eax: (addr handle array byte) <- get target-val, text-data
  78           var src/eax: (addr array byte) <- lookup *src-ah
- 79           var result/ebx: int <- length src
+ 79           var result/ebx: int <- length src
  80           # save result into target-val
  81           var type-addr/eax: (addr int) <- get target-val, type
  82           copy-to *type-addr, 0  # int
  83           var target-string-ah/eax: (addr handle array byte) <- get target-val, text-data
  84           clear-object target-string-ah
  85           var target/eax: (addr int) <- get target-val, int-data
- 86           copy-to *target, result
+ 86           copy-to *target, result
  87           break $evaluate:process-word
  88         }
  89         compare *target-type-addr, 2  # array of ints
  90         {
  91           break-if-!=
  92           # compute length
- 93           var src-ah/eax: (addr handle array value) <- get target-val, array-data
- 94           var src/eax: (addr array value) <- lookup *src-ah
- 95           var result/ebx: int <- length src
+ 93           var src-ah/eax: (addr handle array value) <- get target-val, array-data
+ 94           var src/eax: (addr array value) <- lookup *src-ah
+ 95           var result/ebx: int <- length src
  96           # save result into target-val
  97           var type-addr/eax: (addr int) <- get target-val, type
  98           copy-to *type-addr, 0  # int
- 99           var target-array-ah/eax: (addr handle array value) <- get target-val, array-data
+ 99           var target-array-ah/eax: (addr handle array value) <- get target-val, array-data
 100           clear-object target-array-ah
 101           var target/eax: (addr int) <- get target-val, int-data
-102           copy-to *target, result
+102           copy-to *target, result
 103           break $evaluate:process-word
 104         }
 105       }
@@ -169,16 +169,16 @@ if ('onhashchange' in window) {
 109         compare is-open?, 0
 110         break-if-=
 111         # pop target-val from out
-112         var out2/esi: (addr value-stack) <- copy out
+112         var out2/esi: (addr value-stack) <- copy out
 113         var top-addr/ecx: (addr int) <- get out2, top
 114         compare *top-addr, 0
 115         break-if-<=
-116         var data-ah/eax: (addr handle array value) <- get out2, data
-117         var data/eax: (addr array value) <- lookup *data-ah
+116         var data-ah/eax: (addr handle array value) <- get out2, data
+117         var data/eax: (addr array value) <- lookup *data-ah
 118         var top/edx: int <- copy *top-addr
 119         top <- decrement
-120         var dest-offset/edx: (offset value) <- compute-offset data, top
-121         var target-val/edx: (addr value) <- index data, dest-offset
+120         var dest-offset/edx: (offset value) <- compute-offset data, top
+121         var target-val/edx: (addr value) <- index data, dest-offset
 122         # check target-val is a string
 123         var target-type-addr/eax: (addr int) <- get target-val, type
 124         compare *target-type-addr, 1  # string
@@ -202,16 +202,16 @@ if ('onhashchange' in window) {
 142         compare is-read?, 0
 143         break-if-=
 144         # pop target-val from out
-145         var out2/esi: (addr value-stack) <- copy out
+145         var out2/esi: (addr value-stack) <- copy out
 146         var top-addr/ecx: (addr int) <- get out2, top
 147         compare *top-addr, 0
 148         break-if-<=
-149         var data-ah/eax: (addr handle array value) <- get out2, data
-150         var data/eax: (addr array value) <- lookup *data-ah
+149         var data-ah/eax: (addr handle array value) <- get out2, data
+150         var data/eax: (addr array value) <- lookup *data-ah
 151         var top/edx: int <- copy *top-addr
 152         top <- decrement
-153         var dest-offset/edx: (offset value) <- compute-offset data, top
-154         var target-val/edx: (addr value) <- index data, dest-offset
+153         var dest-offset/edx: (offset value) <- compute-offset data, top
+154         var target-val/edx: (addr value) <- index data, dest-offset
 155         # check target-val is a file
 156         var target-type-addr/eax: (addr int) <- get target-val, type
 157         compare *target-type-addr, 3  # file
@@ -237,16 +237,16 @@ if ('onhashchange' in window) {
 177         compare is-slurp?, 0
 178         break-if-=
 179         # pop target-val from out
-180         var out2/esi: (addr value-stack) <- copy out
+180         var out2/esi: (addr value-stack) <- copy out
 181         var top-addr/ecx: (addr int) <- get out2, top
 182         compare *top-addr, 0
 183         break-if-<=
-184         var data-ah/eax: (addr handle array value) <- get out2, data
-185         var data/eax: (addr array value) <- lookup *data-ah
+184         var data-ah/eax: (addr handle array value) <- get out2, data
+185         var data/eax: (addr array value) <- lookup *data-ah
 186         var top/edx: int <- copy *top-addr
 187         top <- decrement
-188         var dest-offset/edx: (offset value) <- compute-offset data, top
-189         var target-val/edx: (addr value) <- index data, dest-offset
+188         var dest-offset/edx: (offset value) <- compute-offset data, top
+189         var target-val/edx: (addr value) <- index data, dest-offset
 190         # check target-val is a file
 191         var target-type-addr/eax: (addr int) <- get target-val, type
 192         compare *target-type-addr, 3  # file
@@ -272,16 +272,16 @@ if ('onhashchange' in window) {
 212         compare is-lines?, 0
 213         break-if-=
 214         # pop target-val from out
-215         var out2/esi: (addr value-stack) <- copy out
+215         var out2/esi: (addr value-stack) <- copy out
 216         var top-addr/ecx: (addr int) <- get out2, top
 217         compare *top-addr, 0
 218         break-if-<=
-219         var data-ah/eax: (addr handle array value) <- get out2, data
-220         var data/eax: (addr array value) <- lookup *data-ah
+219         var data-ah/eax: (addr handle array value) <- get out2, data
+220         var data/eax: (addr array value) <- lookup *data-ah
 221         var top/edx: int <- copy *top-addr
 222         top <- decrement
-223         var dest-offset/edx: (offset value) <- compute-offset data, top
-224         var target-val/edx: (addr value) <- index data, dest-offset
+223         var dest-offset/edx: (offset value) <- compute-offset data, top
+224         var target-val/edx: (addr value) <- index data, dest-offset
 225         # check target-val is a file
 226         var target-type-addr/eax: (addr int) <- get target-val, type
 227         compare *target-type-addr, 3  # file
@@ -303,8 +303,8 @@ if ('onhashchange' in window) {
 243           var ah/edx: (addr handle array (handle array byte)) <- address h
 244           split-string tmp, 0xa, ah
 245         }
-246         var target/eax: (addr handle array value) <- get target-val, array-data
-247         save-lines h, target
+246         var target/eax: (addr handle array value) <- get target-val, array-data
+247         save-lines h, target
 248         # save result into target-val
 249         var type-addr/eax: (addr int) <- get target-val, type
 250         copy-to *type-addr, 2  # array
@@ -321,14 +321,14 @@ if ('onhashchange' in window) {
 261         var is-fake-screen?/eax: boolean <- stream-data-equal? curr-stream, "fake-screen"
 262         compare is-fake-screen?, 0
 263         break-if-=
-264         var out2/esi: (addr value-stack) <- copy out
+264         var out2/esi: (addr value-stack) <- copy out
 265         var top-addr/ecx: (addr int) <- get out2, top
 266         compare *top-addr, 0
 267         break-if-<=
 268         # pop width and height from out
-269         var _nrows/eax: int <- pop-int-from-value-stack out2
+269         var _nrows/eax: int <- pop-int-from-value-stack out2
 270         var nrows/edx: int <- copy _nrows
-271         var _ncols/eax: int <- pop-int-from-value-stack out2
+271         var _ncols/eax: int <- pop-int-from-value-stack out2
 272         var ncols/ebx: int <- copy _ncols
 273         # define a new screen with those dimensions
 274         var screen-h: (handle screen)
@@ -337,12 +337,12 @@ if ('onhashchange' in window) {
 277         var screen/eax: (addr screen) <- lookup screen-h
 278         initialize-screen screen, nrows, ncols
 279         # push screen to stack
-280         var data-ah/eax: (addr handle array value) <- get out2, data
-281         var data/eax: (addr array value) <- lookup *data-ah
+280         var data-ah/eax: (addr handle array value) <- get out2, data
+281         var data/eax: (addr array value) <- lookup *data-ah
 282         var top/edx: int <- copy *top-addr
 283         increment *top-addr
-284         var dest-offset/edx: (offset value) <- compute-offset data, top
-285         var target-val/edx: (addr value) <- index data, dest-offset
+284         var dest-offset/edx: (offset value) <- compute-offset data, top
+285         var target-val/edx: (addr value) <- index data, dest-offset
 286         var type/eax: (addr int) <- get target-val, type
 287         copy-to *type, 4  # screen
 288         var dest/eax: (addr handle screen) <- get target-val, screen-data
@@ -353,7 +353,7 @@ if ('onhashchange' in window) {
 293         var is-print?/eax: boolean <- stream-data-equal? curr-stream, "print"
 294         compare is-print?, 0
 295         break-if-=
-296         var out2/esi: (addr value-stack) <- copy out
+296         var out2/esi: (addr value-stack) <- copy out
 297         var top-addr/ecx: (addr int) <- get out2, top
 298         compare *top-addr, 0
 299         break-if-<=
@@ -362,19 +362,19 @@ if ('onhashchange' in window) {
 302         compare *top-addr, 0
 303         break-if-<=
 304         decrement *top-addr
-305         var data-ah/eax: (addr handle array value) <- get out2, data
-306         var _data/eax: (addr array value) <- lookup *data-ah
-307         var data/edi: (addr array value) <- copy _data
+305         var data-ah/eax: (addr handle array value) <- get out2, data
+306         var _data/eax: (addr array value) <- lookup *data-ah
+307         var data/edi: (addr array value) <- copy _data
 308         var top/eax: int <- copy *top-addr
-309         var dest-offset/edx: (offset value) <- compute-offset data, top
-310         var s/esi: (addr value) <- index data, dest-offset
+309         var dest-offset/edx: (offset value) <- compute-offset data, top
+310         var s/esi: (addr value) <- index data, dest-offset
 311         # select target screen from top of out (but don't pop it)
 312         compare *top-addr, 0
 313         break-if-<=
 314         var top/eax: int <- copy *top-addr
 315         top <- decrement
-316         var dest-offset/edx: (offset value) <- compute-offset data, top
-317         var target-val/edx: (addr value) <- index data, dest-offset
+316         var dest-offset/edx: (offset value) <- compute-offset data, top
+317         var target-val/edx: (addr value) <- index data, dest-offset
 318         var type/eax: (addr int) <- get target-val, type
 319         compare *type, 4  # screen
 320         break-if-!=
@@ -383,30 +383,30 @@ if ('onhashchange' in window) {
 323         var dest/eax: (addr screen) <- lookup *dest-ah
 324         var r/ecx: (addr int) <- get dest, cursor-row
 325         var c/edx: (addr int) <- get dest, cursor-col
-326         render-value-at dest, *r, *c, s, 0
+326         render-value-at dest, *r, *c, s, 0
 327         break $evaluate:process-word
 328       }
 329       {
 330         var is-move?/eax: boolean <- stream-data-equal? curr-stream, "move"
 331         compare is-move?, 0
 332         break-if-=
-333         var out2/esi: (addr value-stack) <- copy out
+333         var out2/esi: (addr value-stack) <- copy out
 334         # pop args
-335         var _r/eax: int <- pop-int-from-value-stack out2
+335         var _r/eax: int <- pop-int-from-value-stack out2
 336         var r/ecx: int <- copy _r
-337         var _c/eax: int <- pop-int-from-value-stack out2
+337         var _c/eax: int <- pop-int-from-value-stack out2
 338         var c/edx: int <- copy _c
 339         # select screen from top of out (but don't pop it)
 340         var top-addr/ebx: (addr int) <- get out2, top
 341         compare *top-addr, 0
 342         break-if-<=
-343         var data-ah/eax: (addr handle array value) <- get out2, data
-344         var _data/eax: (addr array value) <- lookup *data-ah
-345         var data/edi: (addr array value) <- copy _data
+343         var data-ah/eax: (addr handle array value) <- get out2, data
+344         var _data/eax: (addr array value) <- lookup *data-ah
+345         var data/edi: (addr array value) <- copy _data
 346         var top/eax: int <- copy *top-addr
 347         top <- decrement
-348         var target-offset/eax: (offset value) <- compute-offset data, top
-349         var target-val/ebx: (addr value) <- index data, target-offset
+348         var target-offset/eax: (offset value) <- compute-offset data, top
+349         var target-val/ebx: (addr value) <- index data, target-offset
 350         var type/eax: (addr int) <- get target-val, type
 351         compare *type, 4  # screen
 352         break-if-!=
@@ -419,23 +419,23 @@ if ('onhashchange' in window) {
 359         var is-up?/eax: boolean <- stream-data-equal? curr-stream, "up"
 360         compare is-up?, 0
 361         break-if-=
-362         var out2/esi: (addr value-stack) <- copy out
+362         var out2/esi: (addr value-stack) <- copy out
 363         var top-addr/ebx: (addr int) <- get out2, top
 364         compare *top-addr, 0
 365         break-if-<=
 366         # pop args
-367         var _d/eax: int <- pop-int-from-value-stack out2
+367         var _d/eax: int <- pop-int-from-value-stack out2
 368         var d/ecx: int <- copy _d
 369         # select screen from top of out (but don't pop it)
 370         compare *top-addr, 0
 371         break-if-<=
-372         var data-ah/eax: (addr handle array value) <- get out2, data
-373         var _data/eax: (addr array value) <- lookup *data-ah
-374         var data/edi: (addr array value) <- copy _data
+372         var data-ah/eax: (addr handle array value) <- get out2, data
+373         var _data/eax: (addr array value) <- lookup *data-ah
+374         var data/edi: (addr array value) <- copy _data
 375         var top/eax: int <- copy *top-addr
 376         top <- decrement
-377         var target-offset/eax: (offset value) <- compute-offset data, top
-378         var target-val/ebx: (addr value) <- index data, target-offset
+377         var target-offset/eax: (offset value) <- compute-offset data, top
+378         var target-val/ebx: (addr value) <- index data, target-offset
 379         var type/eax: (addr int) <- get target-val, type
 380         compare *type, 4  # screen
 381         break-if-!=
@@ -462,23 +462,23 @@ if ('onhashchange' in window) {
 402         var is-down?/eax: boolean <- stream-data-equal? curr-stream, "down"
 403         compare is-down?, 0
 404         break-if-=
-405         var out2/esi: (addr value-stack) <- copy out
+405         var out2/esi: (addr value-stack) <- copy out
 406         var top-addr/ebx: (addr int) <- get out2, top
 407         compare *top-addr, 0
 408         break-if-<=
 409         # pop args
-410         var _d/eax: int <- pop-int-from-value-stack out2
+410         var _d/eax: int <- pop-int-from-value-stack out2
 411         var d/ecx: int <- copy _d
 412         # select screen from top of out (but don't pop it)
 413         compare *top-addr, 0
 414         break-if-<=
-415         var data-ah/eax: (addr handle array value) <- get out2, data
-416         var _data/eax: (addr array value) <- lookup *data-ah
-417         var data/edi: (addr array value) <- copy _data
+415         var data-ah/eax: (addr handle array value) <- get out2, data
+416         var _data/eax: (addr array value) <- lookup *data-ah
+417         var data/edi: (addr array value) <- copy _data
 418         var top/eax: int <- copy *top-addr
 419         top <- decrement
-420         var target-offset/eax: (offset value) <- compute-offset data, top
-421         var target-val/ebx: (addr value) <- index data, target-offset
+420         var target-offset/eax: (offset value) <- compute-offset data, top
+421         var target-val/ebx: (addr value) <- index data, target-offset
 422         var type/eax: (addr int) <- get target-val, type
 423         compare *type, 4  # screen
 424         break-if-!=
@@ -507,23 +507,23 @@ if ('onhashchange' in window) {
 447         var is-left?/eax: boolean <- stream-data-equal? curr-stream, "left"
 448         compare is-left?, 0
 449         break-if-=
-450         var out2/esi: (addr value-stack) <- copy out
+450         var out2/esi: (addr value-stack) <- copy out
 451         var top-addr/ebx: (addr int) <- get out2, top
 452         compare *top-addr, 0
 453         break-if-<=
 454         # pop args
-455         var _d/eax: int <- pop-int-from-value-stack out2
+455         var _d/eax: int <- pop-int-from-value-stack out2
 456         var d/ecx: int <- copy _d
 457         # select screen from top of out (but don't pop it)
 458         compare *top-addr, 0
 459         break-if-<=
-460         var data-ah/eax: (addr handle array value) <- get out2, data
-461         var _data/eax: (addr array value) <- lookup *data-ah
-462         var data/edi: (addr array value) <- copy _data
+460         var data-ah/eax: (addr handle array value) <- get out2, data
+461         var _data/eax: (addr array value) <- lookup *data-ah
+462         var data/edi: (addr array value) <- copy _data
 463         var top/eax: int <- copy *top-addr
 464         top <- decrement
-465         var target-offset/eax: (offset value) <- compute-offset data, top
-466         var target-val/ebx: (addr value) <- index data, target-offset
+465         var target-offset/eax: (offset value) <- compute-offset data, top
+466         var target-val/ebx: (addr value) <- index data, target-offset
 467         var type/eax: (addr int) <- get target-val, type
 468         compare *type, 4  # screen
 469         break-if-!=
@@ -551,23 +551,23 @@ if ('onhashchange' in window) {
 491         var is-right?/eax: boolean <- stream-data-equal? curr-stream, "right"
 492         compare is-right?, 0
 493         break-if-=
-494         var out2/esi: (addr value-stack) <- copy out
+494         var out2/esi: (addr value-stack) <- copy out
 495         var top-addr/ebx: (addr int) <- get out2, top
 496         compare *top-addr, 0
 497         break-if-<=
 498         # pop args
-499         var _d/eax: int <- pop-int-from-value-stack out2
+499         var _d/eax: int <- pop-int-from-value-stack out2
 500         var d/ecx: int <- copy _d
 501         # select screen from top of out (but don't pop it)
 502         compare *top-addr, 0
 503         break-if-<=
-504         var data-ah/eax: (addr handle array value) <- get out2, data
-505         var _data/eax: (addr array value) <- lookup *data-ah
-506         var data/edi: (addr array value) <- copy _data
+504         var data-ah/eax: (addr handle array value) <- get out2, data
+505         var _data/eax: (addr array value) <- lookup *data-ah
+506         var data/edi: (addr array value) <- copy _data
 507         var top/eax: int <- copy *top-addr
 508         top <- decrement
-509         var target-offset/eax: (offset value) <- compute-offset data, top
-510         var target-val/ebx: (addr value) <- index data, target-offset
+509         var target-offset/eax: (offset value) <- compute-offset data, top
+510         var target-val/ebx: (addr value) <- index data, target-offset
 511         var type/eax: (addr int) <- get target-val, type
 512         compare *type, 4  # screen
 513         break-if-!=
@@ -598,20 +598,20 @@ if ('onhashchange' in window) {
 538         compare is-dup?, 0
 539         break-if-=
 540         # read src-val from out
-541         var out2/esi: (addr value-stack) <- copy out
+541         var out2/esi: (addr value-stack) <- copy out
 542         var top-addr/ecx: (addr int) <- get out2, top
 543         compare *top-addr, 0
 544         break-if-<=
-545         var data-ah/eax: (addr handle array value) <- get out2, data
-546         var data/eax: (addr array value) <- lookup *data-ah
+545         var data-ah/eax: (addr handle array value) <- get out2, data
+546         var data/eax: (addr array value) <- lookup *data-ah
 547         var top/ecx: int <- copy *top-addr
 548         top <- decrement
-549         var offset/edx: (offset value) <- compute-offset data, top
-550         var src-val/edx: (addr value) <- index data, offset
+549         var offset/edx: (offset value) <- compute-offset data, top
+550         var src-val/edx: (addr value) <- index data, offset
 551         # push a copy of it
 552         top <- increment
-553         var offset/ebx: (offset value) <- compute-offset data, top
-554         var target-val/ebx: (addr value) <- index data, offset
+553         var offset/ebx: (offset value) <- compute-offset data, top
+554         var target-val/ebx: (addr value) <- index data, offset
 555         copy-object src-val, target-val
 556         # commit
 557         var top-addr/ecx: (addr int) <- get out2, top
@@ -623,23 +623,23 @@ if ('onhashchange' in window) {
 563         compare is-swap?, 0
 564         break-if-=
 565         # read top-val from out
-566         var out2/esi: (addr value-stack) <- copy out
+566         var out2/esi: (addr value-stack) <- copy out
 567         var top-addr/ecx: (addr int) <- get out2, top
 568         compare *top-addr, 0
 569         break-if-<=
-570         var data-ah/eax: (addr handle array value) <- get out2, data
-571         var data/eax: (addr array value) <- lookup *data-ah
+570         var data-ah/eax: (addr handle array value) <- get out2, data
+571         var data/eax: (addr array value) <- lookup *data-ah
 572         var top/ecx: int <- copy *top-addr
 573         top <- decrement
-574         var offset/edx: (offset value) <- compute-offset data, top
-575         var top-val/edx: (addr value) <- index data, offset
+574         var offset/edx: (offset value) <- compute-offset data, top
+575         var top-val/edx: (addr value) <- index data, offset
 576         # read next val from out
 577         top <- decrement
-578         var offset/ebx: (offset value) <- compute-offset data, top
-579         var pen-top-val/ebx: (addr value) <- index data, offset
+578         var offset/ebx: (offset value) <- compute-offset data, top
+579         var pen-top-val/ebx: (addr value) <- index data, offset
 580         # swap
-581         var tmp: value
-582         var tmp-a/eax: (addr value) <- address tmp
+581         var tmp: value
+582         var tmp-a/eax: (addr value) <- address tmp
 583         copy-object top-val, tmp-a
 584         copy-object pen-top-val, top-val
 585         copy-object tmp-a, pen-top-val
@@ -654,33 +654,33 @@ if ('onhashchange' in window) {
 594         compare new-byte, 0x3d  # '='
 595         break-if-!=
 596         # pop target-val from out
-597         var out2/esi: (addr value-stack) <- copy out
+597         var out2/esi: (addr value-stack) <- copy out
 598         var top-addr/ecx: (addr int) <- get out2, top
 599         compare *top-addr, 0
 600         break-if-<=
-601         var data-ah/eax: (addr handle array value) <- get out2, data
-602         var data/eax: (addr array value) <- lookup *data-ah
+601         var data-ah/eax: (addr handle array value) <- get out2, data
+602         var data/eax: (addr array value) <- lookup *data-ah
 603         var top/edx: int <- copy *top-addr
 604         top <- decrement
-605         var dest-offset/edx: (offset value) <- compute-offset data, top
-606         var target-val/edx: (addr value) <- index data, dest-offset
+605         var dest-offset/edx: (offset value) <- compute-offset data, top
+606         var target-val/edx: (addr value) <- index data, dest-offset
 607         # create binding from curr-stream to target-val
 608         var key-h: (handle array byte)
 609         var key/ecx: (addr handle array byte) <- address key-h
 610         stream-to-array curr-stream, key
-611         bind-in-table bindings, key, target-val
+611         bind-in-table bindings, key, target-val
 612         break $evaluate:process-word
 613       }
 614       rewind-stream curr-stream
 615       ### if curr-stream is a known function name, call it appropriately
 616       {
-617         var callee-h: (handle function)
-618         var callee-ah/eax: (addr handle function) <- address callee-h
+617         var callee-h: (handle function)
+618         var callee-ah/eax: (addr handle function) <- address callee-h
 619         find-function functions, curr-stream, callee-ah
-620         var callee/eax: (addr function) <- lookup *callee-ah
-621         compare callee, 0
+620         var callee/eax: (addr function) <- lookup *callee-ah
+621         compare callee, 0
 622         break-if-=
-623         perform-call callee, out, functions
+623         perform-call callee, out, functions
 624         break $evaluate:process-word
 625       }
 626       ### if it's a name, push its value
@@ -691,13 +691,13 @@ if ('onhashchange' in window) {
 631         var curr-string-ah/edx: (addr handle array byte) <- address tmp
 632         stream-to-array curr-stream, curr-string-ah  # unfortunate leak
 633         var curr-string/eax: (addr array byte) <- lookup *curr-string-ah
-634         var val-storage: (handle value)
-635         var val-ah/edi: (addr handle value) <- address val-storage
-636         lookup-binding bindings, curr-string, val-ah
-637         var val/eax: (addr value) <- lookup *val-ah
+634         var val-storage: (handle value)
+635         var val-ah/edi: (addr handle value) <- address val-storage
+636         lookup-binding bindings, curr-string, val-ah
+637         var val/eax: (addr value) <- lookup *val-ah
 638         compare val, 0
 639         break-if-=
-640         push-value-stack out, val
+640         push-value-stack out, val
 641         break $evaluate:process-word
 642       }
 643       ### if the word starts with a quote and ends with a quote, turn it into a string
@@ -711,7 +711,7 @@ if ('onhashchange' in window) {
 651         var h: (handle array byte)
 652         var s/eax: (addr handle array byte) <- address h
 653         unquote-stream-to-array curr-stream, s  # leak
-654         push-string-to-value-stack out, *s
+654         push-string-to-value-stack out, *s
 655         break $evaluate:process-word
 656       }
 657       ### if the word starts with a '[' and ends with a ']', turn it into an array
@@ -723,7 +723,7 @@ if ('onhashchange' in window) {
 663         compare end, 0x5d  # ']'
 664         break-if-!=
 665         # wastefully create a new input string to strip quotes
-666         var h: (handle array value)
+666         var h: (handle array value)
 667         var input-ah/eax: (addr handle array byte) <- address h
 668         unquote-stream-to-array curr-stream, input-ah  # leak
 669         # wastefully parse input into int-array
@@ -736,21 +736,21 @@ if ('onhashchange' in window) {
 676         var int-array/esi: (addr array int) <- copy _int-array
 677         var len/ebx: int <- length int-array
 678         # push value-array of same size as int-array
-679         var h3: (handle array value)
-680         var value-array-ah/eax: (addr handle array value) <- address h3
+679         var h3: (handle array value)
+680         var value-array-ah/eax: (addr handle array value) <- address h3
 681         populate value-array-ah, len
-682         push-array-to-value-stack out, *value-array-ah
+682         push-array-to-value-stack out, *value-array-ah
 683         # copy int-array into value-array
-684         var _value-array/eax: (addr array value) <- lookup *value-array-ah
-685         var value-array/edi: (addr array value) <- copy _value-array
+684         var _value-array/eax: (addr array value) <- lookup *value-array-ah
+685         var value-array/edi: (addr array value) <- copy _value-array
 686         var i/eax: int <- copy 0
 687         {
 688           compare i, len
 689           break-if->=
 690           var src-addr/ecx: (addr int) <- index int-array, i
 691           var src/ecx: int <- copy *src-addr
-692           var dest-offset/edx: (offset value) <- compute-offset value-array, i
-693           var dest-val/edx: (addr value) <- index value-array, dest-offset
+692           var dest-offset/edx: (offset value) <- compute-offset value-array, i
+693           var dest-val/edx: (addr value) <- index value-array, dest-offset
 694           var dest/edx: (addr int) <- get dest-val, int-data
 695           copy-to *dest, src
 696           i <- increment
@@ -761,56 +761,56 @@ if ('onhashchange' in window) {
 701       ### otherwise assume it's a literal number and push it
 702       {
 703         var n/eax: int <- parse-decimal-int-from-stream curr-stream
-704         push-int-to-value-stack out, n
+704         push-int-to-value-stack out, n
 705       }
 706     }
 707     # termination check
 708     compare curr, end
 709     break-if-=
 710     # update
-711     var next-word-ah/edx: (addr handle word) <- get curr, next
+711     var next-word-ah/edx: (addr handle word) <- get curr, next
 712     curr <- lookup *next-word-ah
 713     #
 714     loop
 715   }
 716   # process next line if necessary
-717   var line/eax: (addr line) <- copy scratch
-718   var next-line-ah/eax: (addr handle line) <- get line, next
-719   var next-line/eax: (addr line) <- lookup *next-line-ah
+717   var line/eax: (addr line) <- copy scratch
+718   var next-line-ah/eax: (addr handle line) <- get line, next
+719   var next-line/eax: (addr line) <- lookup *next-line-ah
 720   compare next-line, 0
 721   break-if-=
 722   evaluate functions, bindings, next-line, end, out
 723 }
 724 
 725 fn test-evaluate {
-726   var line-storage: line
-727   var line/esi: (addr line) <- address line-storage
-728   var first-word-ah/eax: (addr handle word) <- get line-storage, data
-729   allocate-word-with first-word-ah, "3"
-730   append-word-with *first-word-ah, "=a"
-731   var next-line-ah/eax: (addr handle line) <- get line-storage, next
+726   var line-storage: line
+727   var line/esi: (addr line) <- address line-storage
+728   var first-word-ah/eax: (addr handle word) <- get line-storage, data
+729   allocate-word-with first-word-ah, "3"
+730   append-word-with *first-word-ah, "=a"
+731   var next-line-ah/eax: (addr handle line) <- get line-storage, next
 732   allocate next-line-ah
-733   var next-line/eax: (addr line) <- lookup *next-line-ah
-734   var first-word-ah/eax: (addr handle word) <- get next-line, data
-735   allocate-word-with first-word-ah, "a"
-736   var functions-storage: (handle function)
-737   var functions/ecx: (addr handle function) <- address functions-storage
-738   var table-storage: table
-739   var table/ebx: (addr table) <- address table-storage
-740   initialize-table table, 0x10
-741   var stack-storage: value-stack
-742   var stack/edi: (addr value-stack) <- address stack-storage
-743   initialize-value-stack stack, 0x10
-744   evaluate functions, table, line, 0, stack
-745   var x/eax: int <- pop-int-from-value-stack stack
+733   var next-line/eax: (addr line) <- lookup *next-line-ah
+734   var first-word-ah/eax: (addr handle word) <- get next-line, data
+735   allocate-word-with first-word-ah, "a"
+736   var functions-storage: (handle function)
+737   var functions/ecx: (addr handle function) <- address functions-storage
+738   var table-storage: table
+739   var table/ebx: (addr table) <- address table-storage
+740   initialize-table table, 0x10
+741   var stack-storage: value-stack
+742   var stack/edi: (addr value-stack) <- address stack-storage
+743   initialize-value-stack stack, 0x10
+744   evaluate functions, table, line, 0, stack
+745   var x/eax: int <- pop-int-from-value-stack stack
 746   check-ints-equal x, 3, "F - test-evaluate"
 747 }
 748 
-749 fn find-function first: (addr handle function), name: (addr stream byte), out: (addr handle function) {
-750   var curr/esi: (addr handle function) <- copy first
+749 fn find-function first: (addr handle function), name: (addr stream byte), out: (addr handle function) {
+750   var curr/esi: (addr handle function) <- copy first
 751   $find-function:loop: {
-752     var _f/eax: (addr function) <- lookup *curr
-753     var f/ecx: (addr function) <- copy _f
+752     var _f/eax: (addr function) <- lookup *curr
+753     var f/ecx: (addr function) <- copy _f
 754     compare f, 0
 755     break-if-=
 756     var curr-name-ah/eax: (addr handle array byte) <- get f, name
@@ -827,43 +827,43 @@ if ('onhashchange' in window) {
 767   }
 768 }
 769 
-770 fn perform-call _callee: (addr function), caller-stack: (addr value-stack), functions: (addr handle function) {
-771   var callee/ecx: (addr function) <- copy _callee
+770 fn perform-call _callee: (addr function), caller-stack: (addr value-stack), functions: (addr handle function) {
+771   var callee/ecx: (addr function) <- copy _callee
 772   # create bindings for args
-773   var table-storage: table
-774   var table/esi: (addr table) <- address table-storage
-775   initialize-table table, 0x10
-776   bind-args callee, caller-stack, table
+773   var table-storage: table
+774   var table/esi: (addr table) <- address table-storage
+775   initialize-table table, 0x10
+776   bind-args callee, caller-stack, table
 777   # obtain body
-778   var body-ah/eax: (addr handle line) <- get callee, body
-779   var body/eax: (addr line) <- lookup *body-ah
+778   var body-ah/eax: (addr handle line) <- get callee, body
+779   var body/eax: (addr line) <- lookup *body-ah
 780   # perform call
-781   var stack-storage: value-stack
-782   var stack/edi: (addr value-stack) <- address stack-storage
-783   initialize-value-stack stack, 0x10
+781   var stack-storage: value-stack
+782   var stack/edi: (addr value-stack) <- address stack-storage
+783   initialize-value-stack stack, 0x10
 784 #?   print-string-to-real-screen "about to enter recursive eval\n"
-785   evaluate functions, table, body, 0, stack
+785   evaluate functions, table, body, 0, stack
 786 #?   print-string-to-real-screen "exited recursive eval\n"
 787   # pop target-val from out
 788   var top-addr/ecx: (addr int) <- get stack, top
 789   compare *top-addr, 0
 790   break-if-<=
-791   var data-ah/eax: (addr handle array value) <- get stack, data
-792   var data/eax: (addr array value) <- lookup *data-ah
+791   var data-ah/eax: (addr handle array value) <- get stack, data
+792   var data/eax: (addr array value) <- lookup *data-ah
 793   var top/edx: int <- copy *top-addr
 794   top <- decrement
-795   var dest-offset/edx: (offset value) <- compute-offset data, top
-796   var target-val/edx: (addr value) <- index data, dest-offset
+795   var dest-offset/edx: (offset value) <- compute-offset data, top
+796   var target-val/edx: (addr value) <- index data, dest-offset
 797   # stitch target-val into caller-stack
-798   push-value-stack caller-stack, target-val
+798   push-value-stack caller-stack, target-val
 799 }
 800 
 801 # pop args from the caller-stack and bind them to successive args
 802 # implies: function args are stored in reverse order
-803 fn bind-args _callee: (addr function), _caller-stack: (addr value-stack), table: (addr table) {
-804   var callee/ecx: (addr function) <- copy _callee
-805   var curr-arg-ah/eax: (addr handle word) <- get callee, args
-806   var curr-arg/eax: (addr word) <- lookup *curr-arg-ah
+803 fn bind-args _callee: (addr function), _caller-stack: (addr value-stack), table: (addr table) {
+804   var callee/ecx: (addr function) <- copy _callee
+805   var curr-arg-ah/eax: (addr handle word) <- get callee, args
+806   var curr-arg/eax: (addr word) <- lookup *curr-arg-ah
 807   #
 808   var curr-key-storage: (handle array byte)
 809   var curr-key/edx: (addr handle array byte) <- address curr-key-storage
@@ -871,24 +871,24 @@ if ('onhashchange' in window) {
 811     compare curr-arg, 0
 812     break-if-=
 813     # create binding
-814     word-to-string curr-arg, curr-key
+814     word-to-string curr-arg, curr-key
 815     {
 816       # pop target-val from caller-stack
-817       var caller-stack/esi: (addr value-stack) <- copy _caller-stack
+817       var caller-stack/esi: (addr value-stack) <- copy _caller-stack
 818       var top-addr/ecx: (addr int) <- get caller-stack, top
 819       compare *top-addr, 0
 820       break-if-<=
 821       decrement *top-addr
-822       var data-ah/eax: (addr handle array value) <- get caller-stack, data
-823       var data/eax: (addr array value) <- lookup *data-ah
+822       var data-ah/eax: (addr handle array value) <- get caller-stack, data
+823       var data/eax: (addr array value) <- lookup *data-ah
 824       var top/ebx: int <- copy *top-addr
-825       var dest-offset/ebx: (offset value) <- compute-offset data, top
-826       var target-val/ebx: (addr value) <- index data, dest-offset
+825       var dest-offset/ebx: (offset value) <- compute-offset data, top
+826       var target-val/ebx: (addr value) <- index data, dest-offset
 827       # create binding from curr-key to target-val
-828       bind-in-table table, curr-key, target-val
+828       bind-in-table table, curr-key, target-val
 829     }
 830     #
-831     var next-arg-ah/edx: (addr handle word) <- get curr-arg, next
+831     var next-arg-ah/edx: (addr handle word) <- get curr-arg, next
 832     curr-arg <- lookup *next-arg-ah
 833     loop
 834   }
@@ -896,29 +896,29 @@ if ('onhashchange' in window) {
 836 
 837 # Copy of 'simplify' that just tracks the maximum stack depth needed
 838 # Doesn't actually need to simulate the stack, since every word has a predictable effect.
-839 fn max-stack-depth first-word: (addr word), final-word: (addr word) -> _/edi: int {
-840   var curr-word/eax: (addr word) <- copy first-word
+839 fn max-stack-depth first-word: (addr word), final-word: (addr word) -> _/edi: int {
+840   var curr-word/eax: (addr word) <- copy first-word
 841   var curr-depth/ecx: int <- copy 0
-842   var result/edi: int <- copy 0
+842   var result/edi: int <- copy 0
 843   $max-stack-depth:loop: {
 844     $max-stack-depth:process-word: {
 845       # handle operators
 846       {
-847         var is-add?/eax: boolean <- word-equal? curr-word, "+"
+847         var is-add?/eax: boolean <- word-equal? curr-word, "+"
 848         compare is-add?, 0
 849         break-if-=
 850         curr-depth <- decrement
 851         break $max-stack-depth:process-word
 852       }
 853       {
-854         var is-sub?/eax: boolean <- word-equal? curr-word, "-"
+854         var is-sub?/eax: boolean <- word-equal? curr-word, "-"
 855         compare is-sub?, 0
 856         break-if-=
 857         curr-depth <- decrement
 858         break $max-stack-depth:process-word
 859       }
 860       {
-861         var is-mul?/eax: boolean <- word-equal? curr-word, "*"
+861         var is-mul?/eax: boolean <- word-equal? curr-word, "*"
 862         compare is-mul?, 0
 863         break-if-=
 864         curr-depth <- decrement
@@ -928,21 +928,21 @@ if ('onhashchange' in window) {
 868       curr-depth <- increment
 869       # update max depth if necessary
 870       {
-871         compare curr-depth, result
+871         compare curr-depth, result
 872         break-if-<=
-873         result <- copy curr-depth
+873         result <- copy curr-depth
 874       }
 875     }
 876     # if curr-word == final-word break
-877     compare curr-word, final-word
+877     compare curr-word, final-word
 878     break-if-=
 879     # curr-word = curr-word->next
-880     var next-word-ah/edx: (addr handle word) <- get curr-word, next
+880     var next-word-ah/edx: (addr handle word) <- get curr-word, next
 881     curr-word <- lookup *next-word-ah
 882     #
 883     loop
 884   }
-885   return result
+885   return result
 886 }
 
diff --git a/html/apps/tile/surface.mu.html b/html/apps/tile/surface.mu.html index 21a13126..f1b84f8c 100644 --- a/html/apps/tile/surface.mu.html +++ b/html/apps/tile/surface.mu.html @@ -232,7 +232,7 @@ if ('onhashchange' in window) { 172 #? print-string-to-real-screen ", " 173 #? print-int32-hex-to-real-screen col 174 #? print-string-to-real-screen "\n" -175 var result/eax: int <- copy -1 +175 var result/eax: int <- copy -1 176 { 177 compare row, 1 178 break-if-< @@ -247,23 +247,23 @@ if ('onhashchange' in window) { 187 compare col, ncols 188 break-if-> 189 #? print-string-to-real-screen "!\n" -190 result <- copy row -191 result <- subtract 1 -192 result <- multiply ncols -193 result <- add col -194 result <- subtract 1 +190 result <- copy row +191 result <- subtract 1 +192 result <- multiply ncols +193 result <- add col +194 result <- subtract 1 195 } -196 return result +196 return result 197 } 198 199 fn screen-row-to-surface _self: (addr surface), screen-row: int -> _/ecx: int { 200 var self/esi: (addr surface) <- copy _self -201 var result/ecx: int <- copy screen-row +201 var result/ecx: int <- copy screen-row 202 var tmp/eax: (addr int) <- get self, pin-row -203 result <- add *tmp +203 result <- add *tmp 204 tmp <- get self, pin-screen-row -205 result <- subtract *tmp -206 return result +205 result <- subtract *tmp +206 return result 207 } 208 209 fn max _a: int, b: int -> _/eax: int { @@ -288,32 +288,32 @@ if ('onhashchange' in window) { 228 229 fn screen-col-to-surface _self: (addr surface), screen-col: int -> _/edx: int { 230 var self/esi: (addr surface) <- copy _self -231 var result/edx: int <- copy screen-col +231 var result/edx: int <- copy screen-col 232 var tmp/eax: (addr int) <- get self, pin-col -233 result <- add *tmp +233 result <- add *tmp 234 tmp <- get self, pin-screen-col -235 result <- subtract *tmp -236 return result +235 result <- subtract *tmp +236 return result 237 } 238 239 fn surface-row-to-screen _self: (addr surface), row: int -> _/ecx: int { 240 var self/esi: (addr surface) <- copy _self -241 var result/ecx: int <- copy row +241 var result/ecx: int <- copy row 242 var tmp/eax: (addr int) <- get self, pin-screen-row -243 result <- add *tmp +243 result <- add *tmp 244 tmp <- get self, pin-row -245 result <- subtract *tmp -246 return result +245 result <- subtract *tmp +246 return result 247 } 248 249 fn surface-col-to-screen _self: (addr surface), col: int -> _/edx: int { 250 var self/esi: (addr surface) <- copy _self -251 var result/edx: int <- copy col +251 var result/edx: int <- copy col 252 var tmp/eax: (addr int) <- get self, pin-screen-col -253 result <- add *tmp +253 result <- add *tmp 254 tmp <- get self, pin-col -255 result <- subtract *tmp -256 return result +255 result <- subtract *tmp +256 return result 257 } 258 259 # assumes last line doesn't end in '\n' @@ -321,7 +321,7 @@ if ('onhashchange' in window) { 261 var s: (stream byte 0x100) 262 var s-addr/esi: (addr stream byte) <- address s 263 write s-addr, in -264 var result/ecx: int <- copy 1 +264 var result/ecx: int <- copy 1 265 { 266 var done?/eax: boolean <- stream-empty? s-addr 267 compare done?, 0 # false @@ -329,17 +329,17 @@ if ('onhashchange' in window) { 269 var g/eax: grapheme <- read-grapheme s-addr 270 compare g, 0xa # newline 271 loop-if-!= -272 result <- increment +272 result <- increment 273 loop 274 } -275 return result +275 return result 276 } 277 278 fn first-line-length in: (addr array byte) -> _/edx: int { 279 var s: (stream byte 0x100) 280 var s-addr/esi: (addr stream byte) <- address s 281 write s-addr, in -282 var result/edx: int <- copy 0 +282 var result/edx: int <- copy 0 283 { 284 var done?/eax: boolean <- stream-empty? s-addr 285 compare done?, 0 # false @@ -347,10 +347,10 @@ if ('onhashchange' in window) { 287 var g/eax: grapheme <- read-grapheme s-addr 288 compare g, 0xa # newline 289 break-if-= -290 result <- increment +290 result <- increment 291 loop 292 } -293 return result +293 return result 294 } 295 296 fn fill-in _out: (addr array screen-cell), in: (addr array byte) { diff --git a/html/apps/tile/table.mu.html b/html/apps/tile/table.mu.html index 5a924e7e..41f1f542 100644 --- a/html/apps/tile/table.mu.html +++ b/html/apps/tile/table.mu.html @@ -57,33 +57,33 @@ if ('onhashchange' in window) { https://github.com/akkartik/mu/blob/master/apps/tile/table.mu
-  1 fn initialize-table _self: (addr table), n: int {
-  2   var self/esi: (addr table) <- copy _self
-  3   var data-ah/eax: (addr handle array bind) <- get self, data
+  1 fn initialize-table _self: (addr table), n: int {
+  2   var self/esi: (addr table) <- copy _self
+  3   var data-ah/eax: (addr handle array bind) <- get self, data
   4   populate data-ah, n
   5 }
   6 
-  7 fn deep-copy-table _src: (addr table), _dest: (addr table) {
+  7 fn deep-copy-table _src: (addr table), _dest: (addr table) {
   8 #?   print-string 0, "deep-copy-table\n"
-  9   var src/eax: (addr table) <- copy _src
- 10   var src-data-ah/eax: (addr handle array bind) <- get src, data
- 11   var _src-data/eax: (addr array bind) <- lookup *src-data-ah
- 12   var src-data/esi: (addr array bind) <- copy _src-data
+  9   var src/eax: (addr table) <- copy _src
+ 10   var src-data-ah/eax: (addr handle array bind) <- get src, data
+ 11   var _src-data/eax: (addr array bind) <- lookup *src-data-ah
+ 12   var src-data/esi: (addr array bind) <- copy _src-data
  13   var n/ecx: int <- length src-data
- 14   var dest/eax: (addr table) <- copy _dest
+ 14   var dest/eax: (addr table) <- copy _dest
  15   initialize-table dest, n
- 16   var dest-data-ah/eax: (addr handle array bind) <- get dest, data
- 17   var _dest-data/eax: (addr array bind) <- lookup *dest-data-ah
- 18   var dest-data/edi: (addr array bind) <- copy _dest-data
+ 16   var dest-data-ah/eax: (addr handle array bind) <- get dest, data
+ 17   var _dest-data/eax: (addr array bind) <- lookup *dest-data-ah
+ 18   var dest-data/edi: (addr array bind) <- copy _dest-data
  19   var i/eax: int <- copy 0
  20   {
  21     compare i, n
  22     break-if->=
  23 #?     print-string 0, "iter\n"
  24     $deep-copy:element: {
- 25       var offset/edx: (offset bind) <- compute-offset src-data, i
- 26       var src-bind/ecx: (addr bind) <- index src-data, offset
- 27       var dest-bind/edx: (addr bind) <- index dest-data, offset
+ 25       var offset/edx: (offset bind) <- compute-offset src-data, i
+ 26       var src-bind/ecx: (addr bind) <- index src-data, offset
+ 27       var dest-bind/edx: (addr bind) <- index dest-data, offset
  28       var src-key-ah/ebx: (addr handle array byte) <- get src-bind, key
  29       var src-key/eax: (addr array byte) <- lookup *src-key-ah
  30       compare src-key, 0
@@ -92,14 +92,14 @@ if ('onhashchange' in window) {
  33       var dest-key-ah/eax: (addr handle array byte) <- get dest-bind, key
  34       copy-object src-key-ah, dest-key-ah
  35       # deep copy value
- 36       var src-val-ah/eax: (addr handle value) <- get src-bind, value
- 37       var _src-val/eax: (addr value) <- lookup *src-val-ah
- 38       var src-val/ecx: (addr value) <- copy _src-val
- 39       var dest-val-ah/eax: (addr handle value) <- get dest-bind, value
+ 36       var src-val-ah/eax: (addr handle value) <- get src-bind, value
+ 37       var _src-val/eax: (addr value) <- lookup *src-val-ah
+ 38       var src-val/ecx: (addr value) <- copy _src-val
+ 39       var dest-val-ah/eax: (addr handle value) <- get dest-bind, value
  40       allocate dest-val-ah
- 41       var dest-val/eax: (addr value) <- lookup *dest-val-ah
+ 41       var dest-val/eax: (addr value) <- lookup *dest-val-ah
  42 #?       print-string 0, "deep copy value {\n"
- 43       deep-copy-value src-val, dest-val
+ 43       deep-copy-value src-val, dest-val
  44 #?       print-string 0, "}\n"
  45     }
  46     i <- increment
@@ -108,28 +108,28 @@ if ('onhashchange' in window) {
  49 #?   print-string 0, "end deep-copy-table\n"
  50 }
  51 
- 52 fn bind-in-table _self: (addr table), key: (addr handle array byte), val: (addr value) {
- 53   var self/esi: (addr table) <- copy _self
- 54   var data-ah/esi: (addr handle array bind) <- get self, data
- 55   var _data/eax: (addr array bind) <- lookup *data-ah
- 56   var data/esi: (addr array bind) <- copy _data
- 57   var next-empty-slot-index/eax: (offset bind) <- next-empty-slot data, key
- 58   var dest/eax: (addr bind) <- index data, next-empty-slot-index
+ 52 fn bind-in-table _self: (addr table), key: (addr handle array byte), val: (addr value) {
+ 53   var self/esi: (addr table) <- copy _self
+ 54   var data-ah/esi: (addr handle array bind) <- get self, data
+ 55   var _data/eax: (addr array bind) <- lookup *data-ah
+ 56   var data/esi: (addr array bind) <- copy _data
+ 57   var next-empty-slot-index/eax: (offset bind) <- next-empty-slot data, key
+ 58   var dest/eax: (addr bind) <- index data, next-empty-slot-index
  59   make-binding dest, key, val
  60 }
  61 
  62 # manual test: full array of binds
- 63 fn next-empty-slot _data: (addr array bind), key: (addr handle array byte) -> _/eax: (offset bind) {
- 64   var data/esi: (addr array bind) <- copy _data
+ 63 fn next-empty-slot _data: (addr array bind), key: (addr handle array byte) -> _/eax: (offset bind) {
+ 64   var data/esi: (addr array bind) <- copy _data
  65   var len/ecx: int <- length data
  66   var i/edx: int <- copy 0
- 67   var result/eax: (offset bind) <- copy 0
+ 67   var result/eax: (offset bind) <- copy 0
  68   $next-empty-slot:loop: {
- 69     result <- compute-offset data, i
+ 69     result <- compute-offset data, i
  70     compare i, len
  71     break-if->=
  72     {
- 73       var target/esi: (addr bind) <- index data, result
+ 73       var target/esi: (addr bind) <- index data, result
  74       var target2/esi: (addr handle array byte) <- get target, key
  75       var target3/eax: (addr array byte) <- lookup *target2
  76       compare target3, 0
@@ -139,44 +139,44 @@ if ('onhashchange' in window) {
  80     i <- increment
  81     loop
  82   }
- 83   return result
+ 83   return result
  84 }
  85 
- 86 fn make-int-binding _self: (addr bind), key: (addr handle array byte), _val: int {
- 87   var self/esi: (addr bind) <- copy _self
+ 86 fn make-int-binding _self: (addr bind), key: (addr handle array byte), _val: int {
+ 87   var self/esi: (addr bind) <- copy _self
  88   var dest/eax: (addr handle array byte) <- get self, key
  89   copy-object key, dest
- 90   var dest2/eax: (addr handle value) <- get self, value
+ 90   var dest2/eax: (addr handle value) <- get self, value
  91   allocate dest2
- 92   var dest3/eax: (addr value) <- lookup *dest2
+ 92   var dest3/eax: (addr value) <- lookup *dest2
  93   var dest4/eax: (addr int) <- get dest3, int-data
  94   var val/ecx: int <- copy _val
  95   copy-to *dest4, val
  96 }
  97 
- 98 fn make-binding _self: (addr bind), key: (addr handle array byte), val: (addr value) {
- 99   var self/esi: (addr bind) <- copy _self
+ 98 fn make-binding _self: (addr bind), key: (addr handle array byte), val: (addr value) {
+ 99   var self/esi: (addr bind) <- copy _self
 100   var dest/eax: (addr handle array byte) <- get self, key
 101   copy-object key, dest
-102   var dest2/eax: (addr handle value) <- get self, value
+102   var dest2/eax: (addr handle value) <- get self, value
 103   allocate dest2
-104   var dest3/eax: (addr value) <- lookup *dest2
+104   var dest3/eax: (addr value) <- lookup *dest2
 105   copy-object val, dest3
 106 }
 107 
-108 fn lookup-binding _self: (addr table), key: (addr array byte), out: (addr handle value) {
-109   var self/esi: (addr table) <- copy _self
-110   var data-ah/esi: (addr handle array bind) <- get self, data
-111   var _data/eax: (addr array bind) <- lookup *data-ah
-112   var data/esi: (addr array bind) <- copy _data
+108 fn lookup-binding _self: (addr table), key: (addr array byte), out: (addr handle value) {
+109   var self/esi: (addr table) <- copy _self
+110   var data-ah/esi: (addr handle array bind) <- get self, data
+111   var _data/eax: (addr array bind) <- lookup *data-ah
+112   var data/esi: (addr array bind) <- copy _data
 113   var len/edx: int <- length data
 114   var i/ebx: int <- copy 0
 115   $lookup-binding:loop: {
 116     compare i, len
 117     break-if->=
 118     {
-119       var offset/edx: (offset bind) <- compute-offset data, i
-120       var target-bind/esi: (addr bind) <- index data, offset
+119       var offset/edx: (offset bind) <- compute-offset data, i
+120       var target-bind/esi: (addr bind) <- index data, offset
 121       var target2/edx: (addr handle array byte) <- get target-bind, key
 122       var target3/eax: (addr array byte) <- lookup *target2
 123       compare target3, 0
@@ -185,7 +185,7 @@ if ('onhashchange' in window) {
 126       compare is-match?, 0  # false
 127       break-if-=
 128       # found
-129       var target/eax: (addr handle value) <- get target-bind, value
+129       var target/eax: (addr handle value) <- get target-bind, value
 130       copy-object target, out
 131       break $lookup-binding:loop
 132     }
@@ -194,26 +194,26 @@ if ('onhashchange' in window) {
 135   }
 136 }
 137 
-138 fn dump-table _self: (addr table) {
-139   var self/esi: (addr table) <- copy _self
-140   var data-ah/esi: (addr handle array bind) <- get self, data
-141   var _data/eax: (addr array bind) <- lookup *data-ah
-142   var data/esi: (addr array bind) <- copy _data
+138 fn dump-table _self: (addr table) {
+139   var self/esi: (addr table) <- copy _self
+140   var data-ah/esi: (addr handle array bind) <- get self, data
+141   var _data/eax: (addr array bind) <- lookup *data-ah
+142   var data/esi: (addr array bind) <- copy _data
 143   var len/edx: int <- length data
 144   var i/ebx: int <- copy 0
 145   {
 146     compare i, len
 147     break-if->=
-148     var offset/edx: (offset bind) <- compute-offset data, i
-149     var target-bind/esi: (addr bind) <- index data, offset
+148     var offset/edx: (offset bind) <- compute-offset data, i
+149     var target-bind/esi: (addr bind) <- index data, offset
 150     var key-ah/edx: (addr handle array byte) <- get target-bind, key
 151     var key/eax: (addr array byte) <- lookup *key-ah
 152     compare key, 0
 153     break-if-=
 154     print-string 0, key
 155     print-string 0, ": "
-156     var val-ah/eax: (addr handle value) <- get target-bind, value
-157     var val/eax: (addr value) <- lookup *val-ah
+156     var val-ah/eax: (addr handle value) <- get target-bind, value
+157     var val/eax: (addr value) <- lookup *val-ah
 158     var type/eax: (addr int) <- get val, type
 159     print-int32-hex 0, *type
 160     print-string 0, "\n"
diff --git a/html/apps/tile/value-stack.mu.html b/html/apps/tile/value-stack.mu.html
index 532df190..e8c15026 100644
--- a/html/apps/tile/value-stack.mu.html
+++ b/html/apps/tile/value-stack.mu.html
@@ -60,13 +60,13 @@ if ('onhashchange' in window) {
   1 # support for non-int values is untested
   2 
   3 type value-stack {
-  4   data: (handle array value)
+  4   data: (handle array value)
   5   top: int
   6 }
   7 
   8 fn initialize-value-stack _self: (addr value-stack), n: int {
   9   var self/esi: (addr value-stack) <- copy _self
- 10   var d/edi: (addr handle array value) <- get self, data
+ 10   var d/edi: (addr handle array value) <- get self, data
  11   populate d, n
  12   var top/eax: (addr int) <- get self, top
  13   copy-to *top, 0
@@ -81,11 +81,11 @@ if ('onhashchange' in window) {
  22 fn push-int-to-value-stack _self: (addr value-stack), _val: int {
  23   var self/esi: (addr value-stack) <- copy _self
  24   var top-addr/ecx: (addr int) <- get self, top
- 25   var data-ah/edx: (addr handle array value) <- get self, data
- 26   var data/eax: (addr array value) <- lookup *data-ah
+ 25   var data-ah/edx: (addr handle array value) <- get self, data
+ 26   var data/eax: (addr array value) <- lookup *data-ah
  27   var top/edx: int <- copy *top-addr
- 28   var dest-offset/edx: (offset value) <- compute-offset data, top
- 29   var dest-addr/edx: (addr value) <- index data, dest-offset
+ 28   var dest-offset/edx: (offset value) <- compute-offset data, top
+ 29   var dest-addr/edx: (addr value) <- index data, dest-offset
  30   var dest-addr2/eax: (addr int) <- get dest-addr, int-data
  31   var val/esi: int <- copy _val
  32 #?   print-int32-hex-to-real-screen val
@@ -98,11 +98,11 @@ if ('onhashchange' in window) {
  39 fn push-string-to-value-stack _self: (addr value-stack), val: (handle array byte) {
  40   var self/esi: (addr value-stack) <- copy _self
  41   var top-addr/ecx: (addr int) <- get self, top
- 42   var data-ah/edx: (addr handle array value) <- get self, data
- 43   var data/eax: (addr array value) <- lookup *data-ah
+ 42   var data-ah/edx: (addr handle array value) <- get self, data
+ 43   var data/eax: (addr array value) <- lookup *data-ah
  44   var top/edx: int <- copy *top-addr
- 45   var dest-offset/edx: (offset value) <- compute-offset data, top
- 46   var dest-addr/edx: (addr value) <- index data, dest-offset
+ 45   var dest-offset/edx: (offset value) <- compute-offset data, top
+ 46   var dest-addr/edx: (addr value) <- index data, dest-offset
  47   var dest-addr2/eax: (addr handle array byte) <- get dest-addr, text-data
  48   copy-handle val, dest-addr2
  49   var dest-addr3/eax: (addr int) <- get dest-addr, type
@@ -116,15 +116,15 @@ if ('onhashchange' in window) {
  57   increment *top-addr
  58 }
  59 
- 60 fn push-array-to-value-stack _self: (addr value-stack), val: (handle array value) {
+ 60 fn push-array-to-value-stack _self: (addr value-stack), val: (handle array value) {
  61   var self/esi: (addr value-stack) <- copy _self
  62   var top-addr/ecx: (addr int) <- get self, top
- 63   var data-ah/edx: (addr handle array value) <- get self, data
- 64   var data/eax: (addr array value) <- lookup *data-ah
+ 63   var data-ah/edx: (addr handle array value) <- get self, data
+ 64   var data/eax: (addr array value) <- lookup *data-ah
  65   var top/edx: int <- copy *top-addr
- 66   var dest-offset/edx: (offset value) <- compute-offset data, top
- 67   var dest-addr/edx: (addr value) <- index data, dest-offset
- 68   var dest-addr2/eax: (addr handle array value) <- get dest-addr, array-data
+ 66   var dest-offset/edx: (offset value) <- compute-offset data, top
+ 67   var dest-addr/edx: (addr value) <- index data, dest-offset
+ 68   var dest-addr2/eax: (addr handle array value) <- get dest-addr, array-data
  69   copy-handle val, dest-addr2
  70   # update type
  71   var dest-addr3/eax: (addr int) <- get dest-addr, type
@@ -132,14 +132,14 @@ if ('onhashchange' in window) {
  73   increment *top-addr
  74 }
  75 
- 76 fn push-value-stack _self: (addr value-stack), val: (addr value) {
+ 76 fn push-value-stack _self: (addr value-stack), val: (addr value) {
  77   var self/esi: (addr value-stack) <- copy _self
  78   var top-addr/ecx: (addr int) <- get self, top
- 79   var data-ah/edx: (addr handle array value) <- get self, data
- 80   var data/eax: (addr array value) <- lookup *data-ah
+ 79   var data-ah/edx: (addr handle array value) <- get self, data
+ 80   var data/eax: (addr array value) <- lookup *data-ah
  81   var top/edx: int <- copy *top-addr
- 82   var dest-offset/edx: (offset value) <- compute-offset data, top
- 83   var dest-addr/edx: (addr value) <- index data, dest-offset
+ 82   var dest-offset/edx: (offset value) <- compute-offset data, top
+ 83   var dest-addr/edx: (addr value) <- index data, dest-offset
  84   copy-object val, dest-addr
  85   increment *top-addr
  86 }
@@ -153,11 +153,11 @@ if ('onhashchange' in window) {
  94     return -1
  95   }
  96   decrement *top-addr
- 97   var data-ah/edx: (addr handle array value) <- get self, data
- 98   var data/eax: (addr array value) <- lookup *data-ah
+ 97   var data-ah/edx: (addr handle array value) <- get self, data
+ 98   var data/eax: (addr array value) <- lookup *data-ah
  99   var top/edx: int <- copy *top-addr
-100   var dest-offset/edx: (offset value) <- compute-offset data, top
-101   var result-addr/eax: (addr value) <- index data, dest-offset
+100   var dest-offset/edx: (offset value) <- compute-offset data, top
+101   var result-addr/eax: (addr value) <- index data, dest-offset
 102   var result-addr2/eax: (addr int) <- get result-addr, int-data
 103   return *result-addr2
 104 }
@@ -181,37 +181,37 @@ if ('onhashchange' in window) {
 122 
 123 fn value-stack-max-width _self: (addr value-stack) -> _/eax: int {
 124   var self/esi: (addr value-stack) <- copy _self
-125   var data-ah/edi: (addr handle array value) <- get self, data
-126   var _data/eax: (addr array value) <- lookup *data-ah
-127   var data/edi: (addr array value) <- copy _data
+125   var data-ah/edi: (addr handle array value) <- get self, data
+126   var _data/eax: (addr array value) <- lookup *data-ah
+127   var data/edi: (addr array value) <- copy _data
 128   var top-addr/ecx: (addr int) <- get self, top
 129   var i/ebx: int <- copy 0
-130   var result: int
+130   var result: int
 131   {
 132     compare i, *top-addr
 133     break-if->=
-134     var o/edx: (offset value) <- compute-offset data, i
-135     var v/edx: (addr value) <- index data, o
-136     var w/eax: int <- value-width v, 1  # top-level=true
+134     var o/edx: (offset value) <- compute-offset data, i
+135     var v/edx: (addr value) <- index data, o
+136     var w/eax: int <- value-width v, 1  # top-level=true
 137     # if (w > result) w = result
 138     {
-139       compare w, result
+139       compare w, result
 140       break-if-<=
-141       copy-to result, w
+141       copy-to result, w
 142     }
 143     i <- increment
 144     loop
 145   }
-146   return result
+146   return result
 147 }
 148 
-149 fn save-lines in-h: (handle array (handle array byte)), _out-ah: (addr handle array value) {
+149 fn save-lines in-h: (handle array (handle array byte)), _out-ah: (addr handle array value) {
 150   var _in/eax: (addr array (handle array byte)) <- lookup in-h
 151   var in/esi: (addr array (handle array byte)) <- copy _in
 152   var len/ecx: int <- length in
-153   var out-ah/edi: (addr handle array value) <- copy _out-ah
+153   var out-ah/edi: (addr handle array value) <- copy _out-ah
 154   populate out-ah, len
-155   var out/eax: (addr array value) <- lookup *out-ah
+155   var out/eax: (addr array value) <- lookup *out-ah
 156   # copy in into out
 157   var i/ebx: int <- copy 0
 158   {
@@ -220,8 +220,8 @@ if ('onhashchange' in window) {
 161 #?     print-int32-hex 0, i
 162 #?     print-string 0, "\n"
 163     var src/ecx: (addr handle array byte) <- index in, i
-164     var dest-offset/edx: (offset value) <- compute-offset out, i
-165     var dest-val/edx: (addr value) <- index out, dest-offset
+164     var dest-offset/edx: (offset value) <- compute-offset out, i
+165     var dest-val/edx: (addr value) <- index out, dest-offset
 166     var dest/eax: (addr handle array byte) <- get dest-val, text-data
 167     copy-object src, dest
 168     var type/edx: (addr int) <- get dest-val, type
diff --git a/html/apps/tile/value.mu.html b/html/apps/tile/value.mu.html
index e982b2bd..6a14baf9 100644
--- a/html/apps/tile/value.mu.html
+++ b/html/apps/tile/value.mu.html
@@ -57,9 +57,9 @@ if ('onhashchange' in window) {
 
 https://github.com/akkartik/mu/blob/master/apps/tile/value.mu
 
-  1 fn render-value-at screen: (addr screen), row: int, col: int, _val: (addr value), max-width: int {
+  1 fn render-value-at screen: (addr screen), row: int, col: int, _val: (addr value), max-width: int {
   2   move-cursor screen, row, col
-  3   var val/esi: (addr value) <- copy _val
+  3   var val/esi: (addr value) <- copy _val
   4   var val-type/ecx: (addr int) <- get val, type
   5   # per-type rendering logic goes here
   6   compare *val-type, 1  # string
@@ -90,8 +90,8 @@ if ('onhashchange' in window) {
  31   compare *val-type, 2  # array
  32   {
  33     break-if-!=
- 34     var val-ah/eax: (addr handle array value) <- get val, array-data
- 35     var val-array/eax: (addr array value) <- lookup *val-ah
+ 34     var val-ah/eax: (addr handle array value) <- get val, array-data
+ 35     var val-array/eax: (addr array value) <- lookup *val-ah
  36     render-array-at screen, row, col, val-array
  37     return
  38   }
@@ -154,24 +154,24 @@ if ('onhashchange' in window) {
  95 }
  96 }
  97 
- 98 fn render-array-at screen: (addr screen), row: int, col: int, _a: (addr array value) {
+ 98 fn render-array-at screen: (addr screen), row: int, col: int, _a: (addr array value) {
  99   start-color screen, 0xf2, 7
 100   # don't surround in spaces
 101   print-grapheme screen, 0x5b  # '['
 102   increment col
-103   var a/esi: (addr array value) <- copy _a
-104   var max/ecx: int <- length a
+103   var a/esi: (addr array value) <- copy _a
+104   var max/ecx: int <- length a
 105   var i/eax: int <- copy 0
 106   {
-107     compare i, max
+107     compare i, max
 108     break-if->=
 109     {
 110       compare i, 0
 111       break-if-=
 112       print-string screen, " "
 113     }
-114     var off/ecx: (offset value) <- compute-offset a, i
-115     var x/ecx: (addr value) <- index a, off
+114     var off/ecx: (offset value) <- compute-offset a, i
+115     var x/ecx: (addr value) <- index a, off
 116     render-value-at screen, row, col, x, 0
 117     {
 118       var w/eax: int <- value-width x, 0
@@ -216,8 +216,8 @@ if ('onhashchange' in window) {
 157 }
 158 
 159 fn hash-color val: int -> _/eax: int {
-160   var result/eax: int <- try-modulo val, 7  # assumes that 7 is always the background color
-161   return result
+160   var result/eax: int <- try-modulo val, 7  # assumes that 7 is always the background color
+161   return result
 162 }
 163 
 164 fn print-screen-cell-of-fake-screen screen: (addr screen), _target: (addr screen), _row: int, _col: int {
@@ -272,15 +272,15 @@ if ('onhashchange' in window) {
 213   print-code-point screen, 0x2518  # bottom-right corner
 214 }
 215 
-216 fn value-width _v: (addr value), top-level: boolean -> _/eax: int {
-217   var v/esi: (addr value) <- copy _v
+216 fn value-width _v: (addr value), top-level: boolean -> _/eax: int {
+217   var v/esi: (addr value) <- copy _v
 218   var type/eax: (addr int) <- get v, type
 219   {
 220     compare *type, 0  # int
 221     break-if-!=
 222     var v-int/edx: (addr int) <- get v, int-data
-223     var result/eax: int <- decimal-size *v-int
-224     return result
+223     var result/eax: int <- decimal-size *v-int
+224     return result
 225   }
 226   {
 227     compare *type, 1  # string
@@ -289,11 +289,11 @@ if ('onhashchange' in window) {
 230     var s/eax: (addr array byte) <- lookup *s-ah
 231     compare s, 0
 232     break-if-=
-233     var result/eax: int <- length s
-234     compare result, 0xd  # max string size
+233     var result/eax: int <- length s
+234     compare result, 0xd  # max string size
 235     {
 236       break-if-<=
-237       result <- copy 0xd
+237       result <- copy 0xd
 238     }
 239     # if it's a nested string, include space for quotes
 240     # we don't do this for the top-level, where the quotes will overflow
@@ -301,19 +301,19 @@ if ('onhashchange' in window) {
 242     compare top-level, 0  # false
 243     {
 244       break-if-!=
-245       result <- add 2
+245       result <- add 2
 246     }
-247     return result
+247     return result
 248   }
 249   {
 250     compare *type, 2  # array
 251     break-if-!=
-252     var a-ah/eax: (addr handle array value) <- get v, array-data
-253     var a/eax: (addr array value) <- lookup *a-ah
+252     var a-ah/eax: (addr handle array value) <- get v, array-data
+253     var a/eax: (addr array value) <- lookup *a-ah
 254     compare a, 0
 255     break-if-=
-256     var result/eax: int <- array-width a
-257     return result
+256     var result/eax: int <- array-width a
+257     return result
 258   }
 259   {
 260     compare *type, 3  # file handle
@@ -333,43 +333,43 @@ if ('onhashchange' in window) {
 274     compare screen, 0
 275     break-if-=
 276     var ncols/ecx: (addr int) <- get screen, num-cols
-277     var result/eax: int <- copy *ncols
-278     result <- add 2  # left/right margins
+277     var result/eax: int <- copy *ncols
+278     result <- add 2  # left/right margins
 279     return *ncols
 280   }
 281   return 0
 282 }
 283 
 284 # keep sync'd with render-array-at
-285 fn array-width _a: (addr array value) -> _/eax: int {
-286   var a/esi: (addr array value) <- copy _a
-287   var max/ecx: int <- length a
+285 fn array-width _a: (addr array value) -> _/eax: int {
+286   var a/esi: (addr array value) <- copy _a
+287   var max/ecx: int <- length a
 288   var i/eax: int <- copy 0
-289   var result/edi: int <- copy 0
+289   var result/edi: int <- copy 0
 290   {
-291     compare i, max
+291     compare i, max
 292     break-if->=
 293     {
 294       compare i, 0
 295       break-if-=
-296       result <- increment  # for space
+296       result <- increment  # for space
 297     }
-298     var off/ecx: (offset value) <- compute-offset a, i
-299     var x/ecx: (addr value) <- index a, off
+298     var off/ecx: (offset value) <- compute-offset a, i
+299     var x/ecx: (addr value) <- index a, off
 300     {
 301       var w/eax: int <- value-width x, 0
-302       result <- add w
+302       result <- add w
 303     }
 304     i <- increment
 305     loop
 306   }
 307   # we won't add 2 for surrounding brackets since we don't surround arrays in
 308   # spaces like other value types
-309   return result
+309   return result
 310 }
 311 
-312 fn value-height _v: (addr value) -> _/eax: int {
-313   var v/esi: (addr value) <- copy _v
+312 fn value-height _v: (addr value) -> _/eax: int {
+313   var v/esi: (addr value) <- copy _v
 314   var type/eax: (addr int) <- get v, type
 315   {
 316     compare *type, 3  # file handle
@@ -385,17 +385,17 @@ if ('onhashchange' in window) {
 326     compare screen, 0
 327     break-if-=
 328     var nrows/ecx: (addr int) <- get screen, num-rows
-329     var result/eax: int <- copy *nrows
-330     result <- add 2  # top and bottom border
-331     return result
+329     var result/eax: int <- copy *nrows
+330     result <- add 2  # top and bottom border
+331     return result
 332   }
 333   return 1
 334 }
 335 
-336 fn deep-copy-value _src: (addr value), _dest: (addr value) {
+336 fn deep-copy-value _src: (addr value), _dest: (addr value) {
 337 #?   print-string 0, "deep-copy-value\n"
-338   var src/esi: (addr value) <- copy _src
-339   var dest/edi: (addr value) <- copy _dest
+338   var src/esi: (addr value) <- copy _src
+339   var dest/edi: (addr value) <- copy _dest
 340   var type/ebx: (addr int) <- get src, type
 341   var y/ecx: (addr int) <- get dest, type
 342   copy-object type, y
@@ -422,22 +422,22 @@ if ('onhashchange' in window) {
 363   {
 364     break-if-!=
 365 #?     print-string 0, "array value\n"
-366     var src-ah/eax: (addr handle array value) <- get src, array-data
-367     var _src/eax: (addr array value) <- lookup *src-ah
-368     var src/esi: (addr array value) <- copy _src
+366     var src-ah/eax: (addr handle array value) <- get src, array-data
+367     var _src/eax: (addr array value) <- lookup *src-ah
+368     var src/esi: (addr array value) <- copy _src
 369     var n/ecx: int <- length src
-370     var dest-ah/edx: (addr handle array value) <- get dest, array-data
+370     var dest-ah/edx: (addr handle array value) <- get dest, array-data
 371     populate dest-ah, n
-372     var _dest/eax: (addr array value) <- lookup *dest-ah
-373     var dest/edi: (addr array value) <- copy _dest
+372     var _dest/eax: (addr array value) <- lookup *dest-ah
+373     var dest/edi: (addr array value) <- copy _dest
 374     var i/eax: int <- copy 0
 375     {
 376       compare i, n
 377       break-if->=
 378       {
-379         var offset/edx: (offset value) <- compute-offset src, i
-380         var src-element/eax: (addr value) <- index src, offset
-381         var dest-element/ecx: (addr value) <- index dest, offset
+379         var offset/edx: (offset value) <- compute-offset src, i
+380         var src-element/eax: (addr value) <- index src, offset
+381         var dest-element/ecx: (addr value) <- index dest, offset
 382         deep-copy-value src-element, dest-element
 383       }
 384       i <- increment
diff --git a/html/apps/tile/word.mu.html b/html/apps/tile/word.mu.html
index 89adc88b..2a54bb74 100644
--- a/html/apps/tile/word.mu.html
+++ b/html/apps/tile/word.mu.html
@@ -57,73 +57,73 @@ if ('onhashchange' in window) {
 
 https://github.com/akkartik/mu/blob/master/apps/tile/word.mu
 
-  1 fn initialize-word _self: (addr word) {
-  2   var self/esi: (addr word) <- copy _self
-  3   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
+  1 fn initialize-word _self: (addr word) {
+  2   var self/esi: (addr word) <- copy _self
+  3   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
   4   allocate data-ah
-  5   var data/eax: (addr gap-buffer) <- lookup *data-ah
-  6   initialize-gap-buffer data
+  5   var data/eax: (addr gap-buffer) <- lookup *data-ah
+  6   initialize-gap-buffer data
   7   # TODO: sometimes initialize box-data rather than scalar-data
   8 }
   9 
  10 ## some helpers for creating words. mostly for tests
  11 
- 12 fn initialize-word-with _self: (addr word), s: (addr array byte) {
- 13   var self/esi: (addr word) <- copy _self
- 14   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
+ 12 fn initialize-word-with _self: (addr word), s: (addr array byte) {
+ 13   var self/esi: (addr word) <- copy _self
+ 14   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
  15   allocate data-ah
- 16   var data/eax: (addr gap-buffer) <- lookup *data-ah
- 17   initialize-gap-buffer-with data, s
+ 16   var data/eax: (addr gap-buffer) <- lookup *data-ah
+ 17   initialize-gap-buffer-with data, s
  18 }
  19 
- 20 fn allocate-word-with _out: (addr handle word), s: (addr array byte) {
- 21   var out/eax: (addr handle word) <- copy _out
+ 20 fn allocate-word-with _out: (addr handle word), s: (addr array byte) {
+ 21   var out/eax: (addr handle word) <- copy _out
  22   allocate out
- 23   var out-addr/eax: (addr word) <- lookup *out
+ 23   var out-addr/eax: (addr word) <- lookup *out
  24   initialize-word-with out-addr, s
  25 }
  26 
  27 # just for tests for now
  28 # TODO: handle existing next
  29 # one implication of handles: append must take a handle
- 30 fn append-word-with self-h: (handle word), s: (addr array byte) {
- 31   var self/eax: (addr word) <- lookup self-h
- 32   var next-ah/eax: (addr handle word) <- get self, next
+ 30 fn append-word-with self-h: (handle word), s: (addr array byte) {
+ 31   var self/eax: (addr word) <- lookup self-h
+ 32   var next-ah/eax: (addr handle word) <- get self, next
  33   allocate-word-with next-ah, s
- 34   var next/eax: (addr word) <- lookup *next-ah
- 35   var prev-ah/eax: (addr handle word) <- get next, prev
+ 34   var next/eax: (addr word) <- lookup *next-ah
+ 35   var prev-ah/eax: (addr handle word) <- get next, prev
  36   copy-handle self-h, prev-ah
  37 }
  38 
  39 # just for tests for now
  40 # TODO: handle existing prev
- 41 fn prepend-word-with self-h: (handle word), s: (addr array byte) {
- 42   var self/eax: (addr word) <- lookup self-h
- 43   var prev-ah/eax: (addr handle word) <- get self, prev
+ 41 fn prepend-word-with self-h: (handle word), s: (addr array byte) {
+ 42   var self/eax: (addr word) <- lookup self-h
+ 43   var prev-ah/eax: (addr handle word) <- get self, prev
  44   allocate-word-with prev-ah, s
- 45   var prev/eax: (addr word) <- lookup *prev-ah
- 46   var next-ah/eax: (addr handle word) <- get prev, next
+ 45   var prev/eax: (addr word) <- lookup *prev-ah
+ 46   var next-ah/eax: (addr handle word) <- get prev, next
  47   copy-handle self-h, next-ah
  48 }
  49 
  50 ## real primitives
  51 
- 52 fn move-word-contents _src-ah: (addr handle word), _dest-ah: (addr handle word) {
- 53   var dest-ah/eax: (addr handle word) <- copy _dest-ah
- 54   var _dest/eax: (addr word) <- lookup *dest-ah
- 55   var dest/edi: (addr word) <- copy _dest
- 56   var src-ah/eax: (addr handle word) <- copy _src-ah
- 57   var _src/eax: (addr word) <- lookup *src-ah
- 58   var src/esi: (addr word) <- copy _src
+ 52 fn move-word-contents _src-ah: (addr handle word), _dest-ah: (addr handle word) {
+ 53   var dest-ah/eax: (addr handle word) <- copy _dest-ah
+ 54   var _dest/eax: (addr word) <- lookup *dest-ah
+ 55   var dest/edi: (addr word) <- copy _dest
+ 56   var src-ah/eax: (addr handle word) <- copy _src-ah
+ 57   var _src/eax: (addr word) <- lookup *src-ah
+ 58   var src/esi: (addr word) <- copy _src
  59   cursor-to-start src
- 60   var src-data-ah/eax: (addr handle gap-buffer) <- get src, scalar-data
- 61   var src-data/eax: (addr gap-buffer) <- lookup *src-data-ah
- 62   var src-stack/ecx: (addr grapheme-stack) <- get src-data, right
+ 60   var src-data-ah/eax: (addr handle gap-buffer) <- get src, scalar-data
+ 61   var src-data/eax: (addr gap-buffer) <- lookup *src-data-ah
+ 62   var src-stack/ecx: (addr grapheme-stack) <- get src-data, right
  63   {
- 64     var done?/eax: boolean <- grapheme-stack-empty? src-stack
+ 64     var done?/eax: boolean <- grapheme-stack-empty? src-stack
  65     compare done?, 0  # false
  66     break-if-!=
- 67     var g/eax: grapheme <- pop-grapheme-stack src-stack
+ 67     var g/eax: grapheme <- pop-grapheme-stack src-stack
  68 #?     print-grapheme 0, g
  69 #?     print-string 0, "\n"
  70     add-grapheme-to-word dest, g
@@ -131,15 +131,15 @@ if ('onhashchange' in window) {
  72   }
  73 }
  74 
- 75 fn copy-word-contents-before-cursor _src-ah: (addr handle word), _dest-ah: (addr handle word) {
- 76   var dest-ah/eax: (addr handle word) <- copy _dest-ah
- 77   var _dest/eax: (addr word) <- lookup *dest-ah
- 78   var dest/edi: (addr word) <- copy _dest
- 79   var src-ah/eax: (addr handle word) <- copy _src-ah
- 80   var src/eax: (addr word) <- lookup *src-ah
- 81   var src-data-ah/eax: (addr handle gap-buffer) <- get src, scalar-data
- 82   var src-data/eax: (addr gap-buffer) <- lookup *src-data-ah
- 83   var src-stack/ecx: (addr grapheme-stack) <- get src-data, left
+ 75 fn copy-word-contents-before-cursor _src-ah: (addr handle word), _dest-ah: (addr handle word) {
+ 76   var dest-ah/eax: (addr handle word) <- copy _dest-ah
+ 77   var _dest/eax: (addr word) <- lookup *dest-ah
+ 78   var dest/edi: (addr word) <- copy _dest
+ 79   var src-ah/eax: (addr handle word) <- copy _src-ah
+ 80   var src/eax: (addr word) <- lookup *src-ah
+ 81   var src-data-ah/eax: (addr handle gap-buffer) <- get src, scalar-data
+ 82   var src-data/eax: (addr gap-buffer) <- lookup *src-data-ah
+ 83   var src-stack/ecx: (addr grapheme-stack) <- get src-data, left
  84   var src-stack-data-ah/eax: (addr handle array grapheme) <- get src-stack, data
  85   var _src-stack-data/eax: (addr array grapheme) <- lookup *src-stack-data-ah
  86   var src-stack-data/edx: (addr array grapheme) <- copy _src-stack-data
@@ -155,29 +155,29 @@ if ('onhashchange' in window) {
  96   }
  97 }
  98 
- 99 fn word-equal? _self: (addr word), s: (addr array byte) -> _/eax: boolean {
-100   var self/esi: (addr word) <- copy _self
-101   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
-102   var data/eax: (addr gap-buffer) <- lookup *data-ah
-103   var result/eax: boolean <- gap-buffer-equal? data, s
-104   return result
+ 99 fn word-equal? _self: (addr word), s: (addr array byte) -> _/eax: boolean {
+100   var self/esi: (addr word) <- copy _self
+101   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
+102   var data/eax: (addr gap-buffer) <- lookup *data-ah
+103   var result/eax: boolean <- gap-buffer-equal? data, s
+104   return result
 105 }
 106 
-107 fn word-length _self: (addr word) -> _/eax: int {
-108   var self/esi: (addr word) <- copy _self
-109   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
-110   var data/eax: (addr gap-buffer) <- lookup *data-ah
-111   var result/eax: int <- gap-buffer-length data
-112   return result
+107 fn word-length _self: (addr word) -> _/eax: int {
+108   var self/esi: (addr word) <- copy _self
+109   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
+110   var data/eax: (addr gap-buffer) <- lookup *data-ah
+111   var result/eax: int <- gap-buffer-length data
+112   return result
 113 }
 114 
-115 fn first-word _in: (addr handle word), out: (addr handle word) {
-116   var curr-ah/esi: (addr handle word) <- copy _in
-117   var curr/eax: (addr word) <- lookup *curr-ah
-118   var prev/edi: (addr handle word) <- copy 0
+115 fn first-word _in: (addr handle word), out: (addr handle word) {
+116   var curr-ah/esi: (addr handle word) <- copy _in
+117   var curr/eax: (addr word) <- lookup *curr-ah
+118   var prev/edi: (addr handle word) <- copy 0
 119   {
 120     prev <- get curr, prev
-121     var curr/eax: (addr word) <- lookup *prev
+121     var curr/eax: (addr word) <- lookup *prev
 122     compare curr, 0
 123     break-if-=
 124     copy-object prev, curr-ah
@@ -186,12 +186,12 @@ if ('onhashchange' in window) {
 127   copy-object curr-ah, out
 128 }
 129 
-130 fn final-word _in: (addr handle word), out: (addr handle word) {
-131   var curr-h: (handle word)
-132   var curr-ah/esi: (addr handle word) <- address curr-h
+130 fn final-word _in: (addr handle word), out: (addr handle word) {
+131   var curr-h: (handle word)
+132   var curr-ah/esi: (addr handle word) <- address curr-h
 133   copy-object _in, curr-ah
-134   var curr/eax: (addr word) <- copy 0
-135   var next/edi: (addr handle word) <- copy 0
+134   var curr/eax: (addr word) <- copy 0
+135   var next/edi: (addr handle word) <- copy 0
 136   {
 137     curr <- lookup *curr-ah
 138     next <- get curr, next
@@ -204,139 +204,139 @@ if ('onhashchange' in window) {
 145   copy-object curr-ah, out
 146 }
 147 
-148 fn first-grapheme _self: (addr word) -> _/eax: grapheme {
-149   var self/esi: (addr word) <- copy _self
-150   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
-151   var data/eax: (addr gap-buffer) <- lookup *data-ah
-152   var result/eax: grapheme <- first-grapheme-in-gap-buffer data
-153   return result
+148 fn first-grapheme _self: (addr word) -> _/eax: grapheme {
+149   var self/esi: (addr word) <- copy _self
+150   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
+151   var data/eax: (addr gap-buffer) <- lookup *data-ah
+152   var result/eax: grapheme <- first-grapheme-in-gap-buffer data
+153   return result
 154 }
 155 
-156 fn grapheme-before-cursor _self: (addr word) -> _/eax: grapheme {
-157   var self/esi: (addr word) <- copy _self
-158   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
-159   var data/eax: (addr gap-buffer) <- lookup *data-ah
-160   var result/eax: grapheme <- grapheme-before-cursor-in-gap-buffer data
-161   return result
+156 fn grapheme-before-cursor _self: (addr word) -> _/eax: grapheme {
+157   var self/esi: (addr word) <- copy _self
+158   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
+159   var data/eax: (addr gap-buffer) <- lookup *data-ah
+160   var result/eax: grapheme <- grapheme-before-cursor-in-gap-buffer data
+161   return result
 162 }
 163 
-164 fn add-grapheme-to-word _self: (addr word), c: grapheme {
-165   var self/esi: (addr word) <- copy _self
-166   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
-167   var data/eax: (addr gap-buffer) <- lookup *data-ah
-168   add-grapheme-at-gap data, c
+164 fn add-grapheme-to-word _self: (addr word), c: grapheme {
+165   var self/esi: (addr word) <- copy _self
+166   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
+167   var data/eax: (addr gap-buffer) <- lookup *data-ah
+168   add-grapheme-at-gap data, c
 169 }
 170 
-171 fn cursor-at-start? _self: (addr word) -> _/eax: boolean {
-172   var self/esi: (addr word) <- copy _self
-173   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
-174   var data/eax: (addr gap-buffer) <- lookup *data-ah
-175   var result/eax: boolean <- gap-at-start? data
-176   return result
+171 fn cursor-at-start? _self: (addr word) -> _/eax: boolean {
+172   var self/esi: (addr word) <- copy _self
+173   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
+174   var data/eax: (addr gap-buffer) <- lookup *data-ah
+175   var result/eax: boolean <- gap-at-start? data
+176   return result
 177 }
 178 
-179 fn cursor-at-end? _self: (addr word) -> _/eax: boolean {
-180   var self/esi: (addr word) <- copy _self
-181   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
-182   var data/eax: (addr gap-buffer) <- lookup *data-ah
-183   var result/eax: boolean <- gap-at-end? data
-184   return result
+179 fn cursor-at-end? _self: (addr word) -> _/eax: boolean {
+180   var self/esi: (addr word) <- copy _self
+181   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
+182   var data/eax: (addr gap-buffer) <- lookup *data-ah
+183   var result/eax: boolean <- gap-at-end? data
+184   return result
 185 }
 186 
-187 fn cursor-left _self: (addr word) {
-188   var self/esi: (addr word) <- copy _self
-189   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
-190   var data/eax: (addr gap-buffer) <- lookup *data-ah
-191   var dummy/eax: grapheme <- gap-left data
+187 fn cursor-left _self: (addr word) {
+188   var self/esi: (addr word) <- copy _self
+189   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
+190   var data/eax: (addr gap-buffer) <- lookup *data-ah
+191   var dummy/eax: grapheme <- gap-left data
 192 }
 193 
-194 fn cursor-right _self: (addr word) {
-195   var self/esi: (addr word) <- copy _self
-196   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
-197   var data/eax: (addr gap-buffer) <- lookup *data-ah
-198   var dummy/eax: grapheme <- gap-right data
+194 fn cursor-right _self: (addr word) {
+195   var self/esi: (addr word) <- copy _self
+196   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
+197   var data/eax: (addr gap-buffer) <- lookup *data-ah
+198   var dummy/eax: grapheme <- gap-right data
 199 }
 200 
-201 fn cursor-to-start _self: (addr word) {
-202   var self/esi: (addr word) <- copy _self
-203   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
-204   var data/eax: (addr gap-buffer) <- lookup *data-ah
-205   gap-to-start data
+201 fn cursor-to-start _self: (addr word) {
+202   var self/esi: (addr word) <- copy _self
+203   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
+204   var data/eax: (addr gap-buffer) <- lookup *data-ah
+205   gap-to-start data
 206 }
 207 
-208 fn cursor-to-end _self: (addr word) {
-209   var self/esi: (addr word) <- copy _self
-210   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
-211   var data/eax: (addr gap-buffer) <- lookup *data-ah
-212   gap-to-end data
+208 fn cursor-to-end _self: (addr word) {
+209   var self/esi: (addr word) <- copy _self
+210   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
+211   var data/eax: (addr gap-buffer) <- lookup *data-ah
+212   gap-to-end data
 213 }
 214 
-215 fn cursor-index _self: (addr word) -> _/eax: int {
-216   var self/esi: (addr word) <- copy _self
-217   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
-218   var data/eax: (addr gap-buffer) <- lookup *data-ah
-219   var result/eax: int <- gap-index data
-220   return result
+215 fn cursor-index _self: (addr word) -> _/eax: int {
+216   var self/esi: (addr word) <- copy _self
+217   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
+218   var data/eax: (addr gap-buffer) <- lookup *data-ah
+219   var result/eax: int <- gap-index data
+220   return result
 221 }
 222 
-223 fn delete-before-cursor _self: (addr word) {
-224   var self/esi: (addr word) <- copy _self
-225   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
-226   var data/eax: (addr gap-buffer) <- lookup *data-ah
-227   delete-before-gap data
+223 fn delete-before-cursor _self: (addr word) {
+224   var self/esi: (addr word) <- copy _self
+225   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
+226   var data/eax: (addr gap-buffer) <- lookup *data-ah
+227   delete-before-gap data
 228 }
 229 
-230 fn pop-after-cursor _self: (addr word) -> _/eax: grapheme {
-231   var self/esi: (addr word) <- copy _self
-232   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
-233   var data/eax: (addr gap-buffer) <- lookup *data-ah
-234   var result/eax: grapheme <- pop-after-gap data
-235   return result
+230 fn pop-after-cursor _self: (addr word) -> _/eax: grapheme {
+231   var self/esi: (addr word) <- copy _self
+232   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
+233   var data/eax: (addr gap-buffer) <- lookup *data-ah
+234   var result/eax: grapheme <- pop-after-gap data
+235   return result
 236 }
 237 
-238 fn delete-next _self: (addr word) {
-239   var self/esi: (addr word) <- copy _self
-240   var next-ah/edi: (addr handle word) <- get self, next
-241   var next/eax: (addr word) <- lookup *next-ah
+238 fn delete-next _self: (addr word) {
+239   var self/esi: (addr word) <- copy _self
+240   var next-ah/edi: (addr handle word) <- get self, next
+241   var next/eax: (addr word) <- lookup *next-ah
 242   compare next, 0
 243   break-if-=
-244   var next-next-ah/ecx: (addr handle word) <- get next, next
-245   var self-ah/esi: (addr handle word) <- get next, prev
+244   var next-next-ah/ecx: (addr handle word) <- get next, next
+245   var self-ah/esi: (addr handle word) <- get next, prev
 246   copy-object next-next-ah, next-ah
-247   var new-next/eax: (addr word) <- lookup *next-next-ah
+247   var new-next/eax: (addr word) <- lookup *next-next-ah
 248   compare new-next, 0
 249   break-if-=
-250   var dest/eax: (addr handle word) <- get new-next, prev
+250   var dest/eax: (addr handle word) <- get new-next, prev
 251   copy-object self-ah, dest
 252 }
 253 
-254 fn print-word screen: (addr screen), _self: (addr word) {
-255   var self/esi: (addr word) <- copy _self
-256   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
-257   var data/eax: (addr gap-buffer) <- lookup *data-ah
-258   render-gap-buffer screen, data
+254 fn print-word screen: (addr screen), _self: (addr word) {
+255   var self/esi: (addr word) <- copy _self
+256   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
+257   var data/eax: (addr gap-buffer) <- lookup *data-ah
+258   render-gap-buffer screen, data
 259 }
 260 
-261 fn print-words screen: (addr screen), _words-ah: (addr handle word) {
-262   var words-ah/eax: (addr handle word) <- copy _words-ah
-263   var words-a/eax: (addr word) <- lookup *words-ah
+261 fn print-words screen: (addr screen), _words-ah: (addr handle word) {
+262   var words-ah/eax: (addr handle word) <- copy _words-ah
+263   var words-a/eax: (addr word) <- lookup *words-ah
 264   compare words-a, 0
 265   break-if-=
 266   # print
 267   print-word screen, words-a
 268   print-string screen, " "
 269   # recurse
-270   var next-ah/eax: (addr handle word) <- get words-a, next
+270   var next-ah/eax: (addr handle word) <- get words-a, next
 271   print-words screen, next-ah
 272 }
 273 
-274 fn print-words-in-reverse screen: (addr screen), _words-ah: (addr handle word) {
-275   var words-ah/eax: (addr handle word) <- copy _words-ah
-276   var words-a/eax: (addr word) <- lookup *words-ah
+274 fn print-words-in-reverse screen: (addr screen), _words-ah: (addr handle word) {
+275   var words-ah/eax: (addr handle word) <- copy _words-ah
+276   var words-a/eax: (addr word) <- lookup *words-ah
 277   compare words-a, 0
 278   break-if-=
 279   # recurse
-280   var next-ah/ecx: (addr handle word) <- get words-a, next
+280   var next-ah/ecx: (addr handle word) <- get words-a, next
 281   print-words-in-reverse screen, next-ah
 282   # print
 283   print-word screen, words-a
@@ -346,40 +346,40 @@ if ('onhashchange' in window) {
 287 # Gotcha with some word operations: ensure dest-ah isn't in the middle of some
 288 # existing chain of words. There are two pointers to patch, and you'll forget
 289 # to do the other one.
-290 fn copy-words _src-ah: (addr handle word), _dest-ah: (addr handle word) {
-291   var src-ah/eax: (addr handle word) <- copy _src-ah
-292   var src-a/eax: (addr word) <- lookup *src-ah
+290 fn copy-words _src-ah: (addr handle word), _dest-ah: (addr handle word) {
+291   var src-ah/eax: (addr handle word) <- copy _src-ah
+292   var src-a/eax: (addr word) <- lookup *src-ah
 293   compare src-a, 0
 294   break-if-=
 295   # copy
-296   var dest-ah/edi: (addr handle word) <- copy _dest-ah
+296   var dest-ah/edi: (addr handle word) <- copy _dest-ah
 297   copy-word src-a, dest-ah
 298   # recurse
-299   var rest: (handle word)
-300   var rest-ah/ecx: (addr handle word) <- address rest
-301   var next-src-ah/esi: (addr handle word) <- get src-a, next
+299   var rest: (handle word)
+300   var rest-ah/ecx: (addr handle word) <- address rest
+301   var next-src-ah/esi: (addr handle word) <- get src-a, next
 302   copy-words next-src-ah, rest-ah
 303   chain-words dest-ah, rest-ah
 304 }
 305 
-306 fn copy-words-in-reverse _src-ah: (addr handle word), _dest-ah: (addr handle word) {
-307   var src-ah/eax: (addr handle word) <- copy _src-ah
-308   var _src-a/eax: (addr word) <- lookup *src-ah
-309   var src-a/esi: (addr word) <- copy _src-a
+306 fn copy-words-in-reverse _src-ah: (addr handle word), _dest-ah: (addr handle word) {
+307   var src-ah/eax: (addr handle word) <- copy _src-ah
+308   var _src-a/eax: (addr word) <- lookup *src-ah
+309   var src-a/esi: (addr word) <- copy _src-a
 310   compare src-a, 0
 311   break-if-=
 312   # recurse
-313   var next-src-ah/ecx: (addr handle word) <- get src-a, next
-314   var dest-ah/edi: (addr handle word) <- copy _dest-ah
+313   var next-src-ah/ecx: (addr handle word) <- get src-a, next
+314   var dest-ah/edi: (addr handle word) <- copy _dest-ah
 315   copy-words-in-reverse next-src-ah, dest-ah
 316   #
 317   copy-word-at-end src-a, dest-ah
 318 }
 319 
-320 fn copy-word-at-end src: (addr word), _dest-ah: (addr handle word) {
-321   var dest-ah/edi: (addr handle word) <- copy _dest-ah
+320 fn copy-word-at-end src: (addr word), _dest-ah: (addr handle word) {
+321   var dest-ah/edi: (addr handle word) <- copy _dest-ah
 322   # if dest is null, copy and return
-323   var dest-a/eax: (addr word) <- lookup *dest-ah
+323   var dest-a/eax: (addr word) <- lookup *dest-ah
 324   compare dest-a, 0
 325   {
 326     break-if-!=
@@ -387,15 +387,15 @@ if ('onhashchange' in window) {
 328     return
 329   }
 330   # copy current word
-331   var new: (handle word)
-332   var new-ah/ecx: (addr handle word) <- address new
+331   var new: (handle word)
+332   var new-ah/ecx: (addr handle word) <- address new
 333   copy-word src, new-ah
 334   # append it at the end
-335   var curr-ah/edi: (addr handle word) <- copy dest-ah
+335   var curr-ah/edi: (addr handle word) <- copy dest-ah
 336   {
-337     var curr-a/eax: (addr word) <- lookup *curr-ah  # curr-a guaranteed not to be null
-338     var next-ah/ecx: (addr handle word) <- get curr-a, next
-339     var next-a/eax: (addr word) <- lookup *next-ah
+337     var curr-a/eax: (addr word) <- lookup *curr-ah  # curr-a guaranteed not to be null
+338     var next-ah/ecx: (addr handle word) <- get curr-a, next
+339     var next-a/eax: (addr word) <- lookup *next-ah
 340     compare next-a, 0
 341     break-if-=
 342     curr-ah <- copy next-ah
@@ -404,10 +404,10 @@ if ('onhashchange' in window) {
 345   chain-words curr-ah, new-ah
 346 }
 347 
-348 fn append-word-at-end-with _dest-ah: (addr handle word), s: (addr array byte) {
-349   var dest-ah/edi: (addr handle word) <- copy _dest-ah
+348 fn append-word-at-end-with _dest-ah: (addr handle word), s: (addr array byte) {
+349   var dest-ah/edi: (addr handle word) <- copy _dest-ah
 350   # if dest is null, copy and return
-351   var dest-a/eax: (addr word) <- lookup *dest-ah
+351   var dest-a/eax: (addr word) <- lookup *dest-ah
 352   compare dest-a, 0
 353   {
 354     break-if-!=
@@ -415,11 +415,11 @@ if ('onhashchange' in window) {
 356     return
 357   }
 358   # otherwise append at end
-359   var curr-ah/edi: (addr handle word) <- copy dest-ah
+359   var curr-ah/edi: (addr handle word) <- copy dest-ah
 360   {
-361     var curr-a/eax: (addr word) <- lookup *curr-ah  # curr-a guaranteed not to be null
-362     var next-ah/ecx: (addr handle word) <- get curr-a, next
-363     var next-a/eax: (addr word) <- lookup *next-ah
+361     var curr-a/eax: (addr word) <- lookup *curr-ah  # curr-a guaranteed not to be null
+362     var next-ah/ecx: (addr handle word) <- get curr-a, next
+363     var next-a/eax: (addr word) <- lookup *next-ah
 364     compare next-a, 0
 365     break-if-=
 366     curr-ah <- copy next-ah
@@ -428,22 +428,22 @@ if ('onhashchange' in window) {
 369   append-word-with *curr-ah, s
 370 }
 371 
-372 fn copy-word _src-a: (addr word), _dest-ah: (addr handle word) {
-373   var dest-ah/eax: (addr handle word) <- copy _dest-ah
+372 fn copy-word _src-a: (addr word), _dest-ah: (addr handle word) {
+373   var dest-ah/eax: (addr handle word) <- copy _dest-ah
 374   allocate dest-ah
-375   var _dest-a/eax: (addr word) <- lookup *dest-ah
-376   var dest-a/eax: (addr word) <- copy _dest-a
+375   var _dest-a/eax: (addr word) <- lookup *dest-ah
+376   var dest-a/eax: (addr word) <- copy _dest-a
 377   initialize-word dest-a
-378   var dest/edi: (addr handle gap-buffer) <- get dest-a, scalar-data
-379   var src-a/eax: (addr word) <- copy _src-a
-380   var src/eax: (addr handle gap-buffer) <- get src-a, scalar-data
-381   copy-gap-buffer src, dest
+378   var dest/edi: (addr handle gap-buffer) <- get dest-a, scalar-data
+379   var src-a/eax: (addr word) <- copy _src-a
+380   var src/eax: (addr handle gap-buffer) <- get src-a, scalar-data
+381   copy-gap-buffer src, dest
 382 }
 383 
 384 # one implication of handles: append must take a handle
-385 fn append-word _self-ah: (addr handle word) {
-386   var saved-self-storage: (handle word)
-387   var saved-self/eax: (addr handle word) <- address saved-self-storage
+385 fn append-word _self-ah: (addr handle word) {
+386   var saved-self-storage: (handle word)
+387   var saved-self/eax: (addr handle word) <- address saved-self-storage
 388   copy-object _self-ah, saved-self
 389 #?   {
 390 #?     print-string 0, "self-ah is "
@@ -451,9 +451,9 @@ if ('onhashchange' in window) {
 392 #?     print-int32-hex 0, foo
 393 #?     print-string 0, "\n"
 394 #?   }
-395   var self-ah/esi: (addr handle word) <- copy _self-ah
-396   var _self/eax: (addr word) <- lookup *self-ah
-397   var self/ebx: (addr word) <- copy _self
+395   var self-ah/esi: (addr handle word) <- copy _self-ah
+396   var _self/eax: (addr word) <- lookup *self-ah
+397   var self/ebx: (addr word) <- copy _self
 398 #?   {
 399 #?     print-string 0, "0: self is "
 400 #?     var self-ah/eax: (addr handle word) <- copy _self-ah
@@ -463,10 +463,10 @@ if ('onhashchange' in window) {
 404 #?     print-string 0, "\n"
 405 #?   }
 406   # allocate new handle
-407   var new: (handle word)
-408   var new-ah/ecx: (addr handle word) <- address new
+407   var new: (handle word)
+408   var new-ah/ecx: (addr handle word) <- address new
 409   allocate new-ah
-410   var new-addr/eax: (addr word) <- lookup new
+410   var new-addr/eax: (addr word) <- lookup new
 411   initialize-word new-addr
 412 #?   {
 413 #?     print-string 0, "new is "
@@ -475,18 +475,18 @@ if ('onhashchange' in window) {
 416 #?     print-string 0, "\n"
 417 #?   }
 418   # new->next = self->next
-419   var src/esi: (addr handle word) <- get self, next
+419   var src/esi: (addr handle word) <- get self, next
 420 #?   {
 421 #?     print-string 0, "src is "
 422 #?     var foo/eax: int <- copy src
 423 #?     print-int32-hex 0, foo
 424 #?     print-string 0, "\n"
 425 #?   }
-426   var dest/edi: (addr handle word) <- get new-addr, next
+426   var dest/edi: (addr handle word) <- get new-addr, next
 427   copy-object src, dest
 428   # new->next->prev = new
 429   {
-430     var next-addr/eax: (addr word) <- lookup *src
+430     var next-addr/eax: (addr word) <- lookup *src
 431     compare next-addr, 0
 432     break-if-=
 433 #?     {
@@ -537,59 +537,59 @@ if ('onhashchange' in window) {
 478 #?     print-int32-hex 0, foo
 479 #?     print-string 0, "\n"
 480 #?   }
-481   var saved-self-ah/eax: (addr handle word) <- address saved-self-storage
+481   var saved-self-ah/eax: (addr handle word) <- address saved-self-storage
 482   copy-object saved-self-ah, dest
 483   # self->next = new
 484   dest <- get self, next
 485   copy-object new-ah, dest
 486 }
 487 
-488 fn chain-words _self-ah: (addr handle word), _next: (addr handle word) {
-489   var self-ah/esi: (addr handle word) <- copy _self-ah
-490   var _self/eax: (addr word) <- lookup *self-ah
-491   var self/ecx: (addr word) <- copy _self
-492   var dest/edx: (addr handle word) <- get self, next
-493   var next-ah/edi: (addr handle word) <- copy _next
+488 fn chain-words _self-ah: (addr handle word), _next: (addr handle word) {
+489   var self-ah/esi: (addr handle word) <- copy _self-ah
+490   var _self/eax: (addr word) <- lookup *self-ah
+491   var self/ecx: (addr word) <- copy _self
+492   var dest/edx: (addr handle word) <- get self, next
+493   var next-ah/edi: (addr handle word) <- copy _next
 494   copy-object next-ah, dest
-495   var next/eax: (addr word) <- lookup *next-ah
+495   var next/eax: (addr word) <- lookup *next-ah
 496   compare next, 0
 497   break-if-=
 498   dest <- get next, prev
 499   copy-object self-ah, dest
 500 }
 501 
-502 fn emit-word _self: (addr word), out: (addr stream byte) {
-503   var self/esi: (addr word) <- copy _self
-504   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
-505   var data/eax: (addr gap-buffer) <- lookup *data-ah
-506   emit-gap-buffer data, out
+502 fn emit-word _self: (addr word), out: (addr stream byte) {
+503   var self/esi: (addr word) <- copy _self
+504   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
+505   var data/eax: (addr gap-buffer) <- lookup *data-ah
+506   emit-gap-buffer data, out
 507 }
 508 
-509 fn word-to-string _self: (addr word), out: (addr handle array byte) {
-510   var self/esi: (addr word) <- copy _self
-511   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
-512   var data/eax: (addr gap-buffer) <- lookup *data-ah
-513   gap-buffer-to-string data, out
+509 fn word-to-string _self: (addr word), out: (addr handle array byte) {
+510   var self/esi: (addr word) <- copy _self
+511   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
+512   var data/eax: (addr gap-buffer) <- lookup *data-ah
+513   gap-buffer-to-string data, out
 514 }
 515 
-516 fn word-is-decimal-integer? _self: (addr word) -> _/eax: boolean {
-517   var self/eax: (addr word) <- copy _self
-518   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
-519   var data/eax: (addr gap-buffer) <- lookup *data-ah
-520   var result/eax: boolean <- gap-buffer-is-decimal-integer? data
-521   return result
+516 fn word-is-decimal-integer? _self: (addr word) -> _/eax: boolean {
+517   var self/eax: (addr word) <- copy _self
+518   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
+519   var data/eax: (addr gap-buffer) <- lookup *data-ah
+520   var result/eax: boolean <- gap-buffer-is-decimal-integer? data
+521   return result
 522 }
 523 
 524 # ABSOLUTELY GHASTLY
-525 fn word-exists? _haystack-ah: (addr handle word), _needle: (addr word) -> _/ebx: boolean {
+525 fn word-exists? _haystack-ah: (addr handle word), _needle: (addr word) -> _/ebx: boolean {
 526   var needle-name-storage: (handle array byte)
 527   var needle-name-ah/eax: (addr handle array byte) <- address needle-name-storage
 528   word-to-string _needle, needle-name-ah  # profligate leak
 529   var _needle-name/eax: (addr array byte) <- lookup *needle-name-ah
 530   var needle-name/edi: (addr array byte) <- copy _needle-name
 531   # base case
-532   var haystack-ah/esi: (addr handle word) <- copy _haystack-ah
-533   var curr/eax: (addr word) <- lookup *haystack-ah
+532   var haystack-ah/esi: (addr handle word) <- copy _haystack-ah
+533   var curr/eax: (addr word) <- lookup *haystack-ah
 534   compare curr, 0
 535   {
 536     break-if-!=
@@ -607,28 +607,28 @@ if ('onhashchange' in window) {
 548     return 1  # true
 549   }
 550   # recurse
-551   var curr/eax: (addr word) <- lookup *haystack-ah
-552   var next-haystack-ah/eax: (addr handle word) <- get curr, next
-553   var result/ebx: boolean <- word-exists? next-haystack-ah, _needle
-554   return result
+551   var curr/eax: (addr word) <- lookup *haystack-ah
+552   var next-haystack-ah/eax: (addr handle word) <- get curr, next
+553   var result/ebx: boolean <- word-exists? next-haystack-ah, _needle
+554   return result
 555 }
 556 
-557 fn word-list-length words: (addr handle word) -> _/eax: int {
-558   var curr-ah/esi: (addr handle word) <- copy words
-559   var result/edi: int <- copy 0
+557 fn word-list-length words: (addr handle word) -> _/eax: int {
+558   var curr-ah/esi: (addr handle word) <- copy words
+559   var result/edi: int <- copy 0
 560   {
-561     var curr/eax: (addr word) <- lookup *curr-ah
+561     var curr/eax: (addr word) <- lookup *curr-ah
 562     compare curr, 0
 563     break-if-=
 564     {
 565       var word-len/eax: int <- word-length curr
-566       result <- add word-len
-567       result <- add 1  # inter-word-margin
+566       result <- add word-len
+567       result <- add 1  # inter-word-margin
 568     }
 569     curr-ah <- get curr, next
 570     loop
 571   }
-572   return result
+572   return result
 573 }
 
-- cgit 1.4.1-2-gfad0