From 372367f59a897162912d0646158bdea1e07d6e66 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Sat, 26 Jun 2021 20:55:36 -0700 Subject: html: better highlighting for int registers --- html/life.mu.html | 51 +++++++++++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 26 deletions(-) (limited to 'html/life.mu.html') diff --git a/html/life.mu.html b/html/life.mu.html index 147fccd1..e08e9f9f 100644 --- a/html/life.mu.html +++ b/html/life.mu.html @@ -14,20 +14,19 @@ pre { white-space: pre-wrap; font-family: monospace; color: #000000; background- body { font-size:12pt; font-family: monospace; color: #000000; background-color: #ffffd7; } a { color:inherit; } * { font-size:12pt; font-size: 1em; } +.PreProc { color: #c000c0; } +.muRegEdx { color: #af5f00; } +.Special { color: #ff6060; } .LineNr { } -.Delimiter { color: #c000c0; } -.CommentedCode { color: #8a8a8a; } -.muRegEsi { color: #87d787; } -.muRegEdi { color: #87ffd7; } +.muRegEsi { color: #005faf; } +.muRegEbx { color: #5f00ff; } .Constant { color: #008787; } -.Special { color: #ff6060; } -.PreProc { color: #c000c0; } +.muRegEdi { color: #00af00; } +.muRegEcx { color: #870000; } +.Delimiter { color: #c000c0; } .muFunction { color: #af5f00; text-decoration: underline; } +.CommentedCode { color: #8a8a8a; } .muComment { color: #005faf; } -.muRegEax { color: #875f00; } -.muRegEcx { color: #af875f; } -.muRegEdx { color: #878700; } -.muRegEbx { color: #8787af; } --> @@ -70,7 +69,7 @@ if ('onhashchange' in window) { 5 # To run: 6 # $ qemu-system-i386 code.img 7 - 8 fn state _grid: (addr array boolean), x: int, y: int -> _/eax: boolean { + 8 fn state _grid: (addr array boolean), x: int, y: int -> _/eax: boolean { 9 # clip at the edge 10 compare x, 0 11 { @@ -92,31 +91,31 @@ if ('onhashchange' in window) { 27 break-if-< 28 return 0/false 29 } - 30 var idx/eax: int <- copy y + 30 var idx/eax: int <- copy y 31 idx <- shift-left 8/log2width 32 idx <- add x 33 var grid/esi: (addr array boolean) <- copy _grid - 34 var result/eax: (addr boolean) <- index grid, idx + 34 var result/eax: (addr boolean) <- index grid, idx 35 return *result 36 } 37 38 fn set-state _grid: (addr array boolean), x: int, y: int, val: boolean { 39 # don't bother checking bounds - 40 var idx/eax: int <- copy y + 40 var idx/eax: int <- copy y 41 idx <- shift-left 8/log2width 42 idx <- add x 43 var grid/esi: (addr array boolean) <- copy _grid - 44 var result/eax: (addr boolean) <- index grid, idx + 44 var result/eax: (addr boolean) <- index grid, idx 45 var src/ecx: boolean <- copy val 46 copy-to *result, src 47 } 48 - 49 fn num-live-neighbors grid: (addr array boolean), x: int, y: int -> _/eax: int { + 49 fn num-live-neighbors grid: (addr array boolean), x: int, y: int -> _/eax: int { 50 var result/edi: int <- copy 0 51 # row above: zig 52 decrement y 53 decrement x - 54 var s/eax: boolean <- state grid, x, y + 54 var s/eax: boolean <- state grid, x, y 55 { 56 compare s, 0/false 57 break-if-= @@ -185,7 +184,7 @@ if ('onhashchange' in window) { 120 { 121 compare x, 0x100/width 122 break-if->= -123 var n/eax: int <- num-live-neighbors old-grid, x, y +123 var n/eax: int <- num-live-neighbors old-grid, x, y 124 # if neighbors < 2, die of loneliness 125 { 126 compare n, 2 @@ -202,7 +201,7 @@ if ('onhashchange' in window) { 137 { 138 compare n, 2 139 break-if-!= -140 var old-state/eax: boolean <- state old-grid, x, y +140 var old-state/eax: boolean <- state old-grid, x, y 141 set-state new-grid, x, y, old-state 142 } 143 # if neighbors = 3, cell quickens to life @@ -231,7 +230,7 @@ if ('onhashchange' in window) { 166 compare y, ymax 167 break-if->= 168 { -169 var x/eax: int <- copy _x +169 var x/eax: int <- copy _x 170 x <- shift-left 2/log2side 171 var xmax/ecx: int <- copy x 172 xmax <- add side @@ -257,7 +256,7 @@ if ('onhashchange' in window) { 192 { 193 compare x, 0x100/width 194 break-if->= -195 var state/eax: boolean <- state grid, x, y +195 var state/eax: boolean <- state grid, x, y 196 compare state, 0/false 197 { 198 break-if-= @@ -284,14 +283,14 @@ if ('onhashchange' in window) { 219 #? var grid2/edi: (addr array boolean) <- address grid2-storage 220 # allocate on the heap 221 var grid1-storage: (handle array boolean) -222 var grid1-ah/eax: (addr handle array boolean) <- address grid1-storage +222 var grid1-ah/eax: (addr handle array boolean) <- address grid1-storage 223 populate grid1-ah, 0xc000 # width * height -224 var _grid1/eax: (addr array boolean) <- lookup *grid1-ah +224 var _grid1/eax: (addr array boolean) <- lookup *grid1-ah 225 var grid1/esi: (addr array boolean) <- copy _grid1 226 var grid2-storage: (handle array boolean) -227 var grid2-ah/eax: (addr handle array boolean) <- address grid2-storage +227 var grid2-ah/eax: (addr handle array boolean) <- address grid2-storage 228 populate grid2-ah, 0xc000 # width * height -229 var _grid2/eax: (addr array boolean) <- lookup *grid2-ah +229 var _grid2/eax: (addr array boolean) <- lookup *grid2-ah 230 var grid2/edi: (addr array boolean) <- copy _grid2 231 # initialize grid1 232 set-state grid1, 0x80, 0x5f, 1/live @@ -302,7 +301,7 @@ if ('onhashchange' in window) { 237 # render grid1 238 render grid1 239 { -240 var key/eax: byte <- read-key keyboard +240 var key/eax: byte <- read-key keyboard 241 compare key, 0 242 #? loop-if-= # press key to step 243 break-if-!= # press key to quit # comment this out to run under bochs; I'm not sure why there's a newline in the keyboard buffer -- cgit 1.4.1-2-gfad0