From 792451d1be576dfd35c2473cb4ede75ccca63782 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Tue, 30 Jun 2020 14:59:45 -0700 Subject: 6603 --- html/apps/arith.mu.html | 68 ++++++++++++++++++++++++------------------------- html/apps/tui.mu.html | 6 ++--- 2 files changed, 37 insertions(+), 37 deletions(-) (limited to 'html') diff --git a/html/apps/arith.mu.html b/html/apps/arith.mu.html index 7d2e2234..78f4f026 100644 --- a/html/apps/arith.mu.html +++ b/html/apps/arith.mu.html @@ -100,12 +100,12 @@ if ('onhashchange' in window) { 41 # print prompt 42 print-string-to-screen "> " 43 # read and eval - 44 n, look <- simplify # we explicitly thread 'look' everywhere + 44 n, look <- simplify # we explicitly thread 'look' everywhere 45 # if (look == 0) break 46 compare look, 0 47 break-if-= 48 # print - 49 print-int32-to-screen n + 49 print-int32-hex-to-screen n 50 print-string-to-screen "\n" 51 # 52 loop @@ -113,22 +113,22 @@ if ('onhashchange' in window) { 54 exit-status <- copy 0 55 } 56 - 57 fn simplify -> result/eax: int, look/esi: byte { + 57 fn simplify -> result/eax: int, look/esi: byte { 58 # prime the pump - 59 look <- get-char + 59 look <- get-char 60 # do it - 61 result, look <- expression look + 61 result, look <- expression look 62 } 63 - 64 fn expression _look: byte -> result/eax: int, look/esi: byte { + 64 fn expression _look: byte -> result/eax: int, look/esi: byte { 65 look <- copy _look # should be a no-op 66 # read arg - 67 result, look <- term look + 67 result, look <- term look 68 $expression:loop: { 69 # while next non-space char in ['+', '-'] - 70 look <- skip-spaces look + 70 look <- skip-spaces look 71 { - 72 var continue?/eax: boolean <- is-add-or-sub? look + 72 var continue?/eax: boolean <- is-add-or-sub? look 73 compare continue?, 0 # false 74 break-if-= $expression:loop 75 } @@ -137,10 +137,10 @@ if ('onhashchange' in window) { 78 op, look <- operator look 79 # read next arg 80 var second/edx: int <- copy 0 - 81 look <- skip-spaces look + 81 look <- skip-spaces look 82 { 83 var tmp/eax: int <- copy 0 - 84 tmp, look <- term look + 84 tmp, look <- term look 85 second <- copy tmp 86 } 87 # reduce @@ -160,19 +160,19 @@ if ('onhashchange' in window) { 101 } 102 loop 103 } -104 look <- skip-spaces look +104 look <- skip-spaces look 105 } 106 -107 fn term _look: byte -> result/eax: int, look/esi: byte { +107 fn term _look: byte -> result/eax: int, look/esi: byte { 108 look <- copy _look # should be a no-op 109 # read arg -110 look <- skip-spaces look -111 result, look <- factor look +110 look <- skip-spaces look +111 result, look <- factor look 112 $term:loop: { 113 # while next non-space char in ['*', '/'] -114 look <- skip-spaces look +114 look <- skip-spaces look 115 { -116 var continue?/eax: boolean <- is-mul-or-div? look +116 var continue?/eax: boolean <- is-mul-or-div? look 117 compare continue?, 0 # false 118 break-if-= $term:loop 119 } @@ -181,10 +181,10 @@ if ('onhashchange' in window) { 122 op, look <- operator look 123 # read next arg 124 var second/edx: int <- copy 0 -125 look <- skip-spaces look +125 look <- skip-spaces look 126 { 127 var tmp/eax: int <- copy 0 -128 tmp, look <- factor look +128 tmp, look <- factor look 129 second <- copy tmp 130 } 131 # reduce @@ -206,26 +206,26 @@ if ('onhashchange' in window) { 147 } 148 } 149 -150 fn factor _look: byte -> result/eax: int, look/esi: byte { +150 fn factor _look: byte -> result/eax: int, look/esi: byte { 151 $factor:body: { 152 look <- copy _look # should be a no-op -153 look <- skip-spaces look +153 look <- skip-spaces look 154 # if next char is not '(', parse a number 155 compare look, 0x28 # '(' 156 { 157 break-if-= -158 result, look <- num look +158 result, look <- num look 159 break $factor:body 160 } 161 # otherwise recurse -162 look <- get-char # '(' -163 result, look <- expression look -164 look <- skip-spaces look -165 look <- get-char # ')' +162 look <- get-char # '(' +163 result, look <- expression look +164 look <- skip-spaces look +165 look <- get-char # ')' 166 } # $factor:body 167 } 168 -169 fn is-mul-or-div? c: byte -> result/eax: boolean { +169 fn is-mul-or-div? c: byte -> result/eax: boolean { 170 $is-mul-or-div?:body: { 171 compare c, 0x2a # '*' 172 { @@ -243,7 +243,7 @@ if ('onhashchange' in window) { 184 } # $is-mul-or-div?:body 185 } 186 -187 fn is-add-or-sub? c: byte -> result/eax: boolean { +187 fn is-add-or-sub? c: byte -> result/eax: boolean { 188 $is-add-or-sub?:body: { 189 compare c, 0x2b # '+' 190 { @@ -263,10 +263,10 @@ if ('onhashchange' in window) { 204 205 fn operator _look: byte -> op/ecx: byte, look/esi: byte { 206 op <- copy _look -207 look <- get-char +207 look <- get-char 208 } 209 -210 fn num _look: byte -> result/eax: int, look/esi: byte { +210 fn num _look: byte -> result/eax: int, look/esi: byte { 211 look <- copy _look # should be a no-op 212 var out/edi: int <- copy 0 213 { @@ -274,7 +274,7 @@ if ('onhashchange' in window) { 215 out <- copy first-digit 216 } 217 { -218 look <- get-char +218 look <- get-char 219 # done? 220 var digit?/eax: boolean <- is-decimal-digit? look 221 compare digit?, 0 # false @@ -292,17 +292,17 @@ if ('onhashchange' in window) { 233 result <- copy out 234 } 235 -236 fn skip-spaces _look: byte -> look/esi: byte { +236 fn skip-spaces _look: byte -> look/esi: byte { 237 look <- copy _look # should be a no-op 238 { 239 compare look, 0x20 240 break-if-!= -241 look <- get-char +241 look <- get-char 242 loop 243 } 244 } 245 -246 fn get-char -> look/esi: byte { +246 fn get-char -> look/esi: byte { 247 var tmp/eax: byte <- read-key 248 look <- copy tmp 249 compare look, 0 diff --git a/html/apps/tui.mu.html b/html/apps/tui.mu.html index ac24ee9a..feec1be9 100644 --- a/html/apps/tui.mu.html +++ b/html/apps/tui.mu.html @@ -74,9 +74,9 @@ if ('onhashchange' in window) { 16 reset-formatting-on-screen 17 move-cursor-on-screen 6, 35 18 print-string-to-screen "tty dimensions: " -19 print-int32-to-screen nrows +19 print-int32-hex-to-screen nrows 20 print-string-to-screen " rows, " -21 print-int32-to-screen ncols +21 print-int32-hex-to-screen ncols 22 print-string-to-screen " rows\n" 23 24 print-string-to-screen "press a key to see its code: " @@ -85,7 +85,7 @@ if ('onhashchange' in window) { 27 enable-keyboard-type-mode 28 enable-screen-type-mode 29 print-string-to-screen "You pressed " -30 print-int32-to-screen x +30 print-int32-hex-to-screen x 31 print-string-to-screen "\n" 32 exit-status <- copy 0 33 } -- cgit 1.4.1-2-gfad0