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/linux/advent2020/4b.mu.html | 103 +++++++++++++++++++-------------------- 1 file changed, 51 insertions(+), 52 deletions(-) (limited to 'html/linux/advent2020/4b.mu.html') diff --git a/html/linux/advent2020/4b.mu.html b/html/linux/advent2020/4b.mu.html index 1c2ac0e0..b6fdafe5 100644 --- a/html/linux/advent2020/4b.mu.html +++ b/html/linux/advent2020/4b.mu.html @@ -14,19 +14,18 @@ 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; } -.muRegEcx { color: #af875f; } -.muComment { color: #005faf; } -.LineNr { } -.muRegEdx { color: #878700; } +.PreProc { color: #c000c0; } +.muRegEdx { color: #af5f00; } .Special { color: #ff6060; } -.muRegEsi { color: #87d787; } -.muRegEdi { color: #87ffd7; } +.LineNr { } +.Constant { color: #008787; } +.muRegEbx { color: #5f00ff; } +.muRegEsi { color: #005faf; } +.muRegEdi { color: #00af00; } +.muRegEcx { color: #870000; } .Delimiter { color: #c000c0; } .muFunction { color: #af5f00; text-decoration: underline; } -.muRegEbx { color: #8787af; } -.Constant { color: #008787; } -.PreProc { color: #c000c0; } -.muRegEax { color: #875f00; } +.muComment { color: #005faf; } --> @@ -86,13 +85,13 @@ if ('onhashchange' in window) { 22 clear-stream line 23 read-line-from-real-keyboard line 24 # if line is empty (not even a newline), quit - 25 var done?/eax: boolean <- stream-empty? line + 25 var done?/eax: boolean <- stream-empty? line 26 compare done?, 0/false 27 break-if-!= 28 print-stream-to-real-screen line 29 # if line has just a newline, process passport 30 skip-chars-matching-whitespace line - 31 var new-passport?/eax: boolean <- stream-empty? line + 31 var new-passport?/eax: boolean <- stream-empty? line 32 { 33 compare new-passport?, 0/false 34 break-if-= @@ -109,18 +108,18 @@ if ('onhashchange' in window) { 45 } 46 $main:word-loop: { 47 skip-chars-matching-whitespace line - 48 var done?/eax: boolean <- stream-empty? line + 48 var done?/eax: boolean <- stream-empty? line 49 compare done?, 0/false 50 break-if-!= 51 next-token line, 0x3a, key-slice # ':' - 52 var dummy/eax: byte <- read-byte line # skip ':' + 52 var dummy/eax: byte <- read-byte line # skip ':' 53 next-raw-word line, val-slice 54 print-slice-to-real-screen key-slice 55 print-string 0, " : " 56 print-slice-to-real-screen val-slice 57 print-string 0, "\n" 58 # treat cid as optional - 59 var cid?/eax: boolean <- slice-equal? key-slice, "cid" + 59 var cid?/eax: boolean <- slice-equal? key-slice, "cid" 60 compare cid?, 0/false 61 loop-if-!= 62 # increment field count @@ -128,11 +127,11 @@ if ('onhashchange' in window) { 64 # - validate fields one by one, setting curr-passport-field-count to impossibly high value to signal invalid 65 # byr 66 { - 67 var byr?/eax: boolean <- slice-equal? key-slice, "byr" + 67 var byr?/eax: boolean <- slice-equal? key-slice, "byr" 68 compare byr?, 0/false 69 break-if-= 70 # 1920 <= byr <= 2002 - 71 var byr/eax: int <- parse-decimal-int-from-slice val-slice + 71 var byr/eax: int <- parse-decimal-int-from-slice val-slice 72 compare byr, 0x780 # 1920 73 { 74 break-if->= @@ -148,11 +147,11 @@ if ('onhashchange' in window) { 84 } 85 # iyr 86 { - 87 var iyr?/eax: boolean <- slice-equal? key-slice, "iyr" + 87 var iyr?/eax: boolean <- slice-equal? key-slice, "iyr" 88 compare iyr?, 0/false 89 break-if-= 90 # 2010 <= iyr <= 2020 - 91 var iyr/eax: int <- parse-decimal-int-from-slice val-slice + 91 var iyr/eax: int <- parse-decimal-int-from-slice val-slice 92 compare iyr, 0x7da # 2010 93 { 94 break-if->= @@ -168,11 +167,11 @@ if ('onhashchange' in window) { 104 } 105 # eyr 106 { -107 var eyr?/eax: boolean <- slice-equal? key-slice, "eyr" +107 var eyr?/eax: boolean <- slice-equal? key-slice, "eyr" 108 compare eyr?, 0/false 109 break-if-= 110 # 2020 <= eyr <= 2030 -111 var eyr/eax: int <- parse-decimal-int-from-slice val-slice +111 var eyr/eax: int <- parse-decimal-int-from-slice val-slice 112 compare eyr, 0x7e4 # 2020 113 { 114 break-if->= @@ -188,14 +187,14 @@ if ('onhashchange' in window) { 124 } 125 # hgt 126 { -127 var hgt?/eax: boolean <- slice-equal? key-slice, "hgt" +127 var hgt?/eax: boolean <- slice-equal? key-slice, "hgt" 128 compare hgt?, 0/false 129 break-if-= 130 # convert val 131 var s: (handle array byte) -132 var s2/eax: (addr handle array byte) <- address s +132 var s2/eax: (addr handle array byte) <- address s 133 _slice-to-string val-slice, s2 -134 var s3/eax: (addr array byte) <- lookup *s2 +134 var s3/eax: (addr array byte) <- lookup *s2 135 var s4/ebx: (addr array byte) <- copy s3 136 # check suffix 137 var start/edx: int <- length s4 @@ -204,17 +203,17 @@ if ('onhashchange' in window) { 140 var suffix-h: (handle array byte) 141 var suffix-ah/ecx: (addr handle array byte) <- address suffix-h 142 substring s4, start, 2, suffix-ah -143 var suffix/eax: (addr array byte) <- lookup *suffix-ah +143 var suffix/eax: (addr array byte) <- lookup *suffix-ah 144 { -145 var match?/eax: boolean <- string-equal? suffix, "in" +145 var match?/eax: boolean <- string-equal? suffix, "in" 146 compare match?, 0/false 147 break-if-= 148 # if suffix is "in", 59 <= val <= 96 149 var num-h: (handle array byte) 150 var num-ah/ecx: (addr handle array byte) <- address num-h 151 substring s4, 0, start, num-ah -152 var num/eax: (addr array byte) <- lookup *num-ah -153 var val/eax: int <- parse-decimal-int num +152 var num/eax: (addr array byte) <- lookup *num-ah +153 var val/eax: int <- parse-decimal-int num 154 compare val, 0x3b # 59 155 { 156 break-if->= @@ -230,15 +229,15 @@ if ('onhashchange' in window) { 166 loop $main:word-loop 167 } 168 { -169 var match?/eax: boolean <- string-equal? suffix, "cm" +169 var match?/eax: boolean <- string-equal? suffix, "cm" 170 compare match?, 0/false 171 break-if-= 172 # if suffix is "cm", 150 <= val <= 193 173 var num-h: (handle array byte) 174 var num-ah/ecx: (addr handle array byte) <- address num-h 175 substring s4, 0, start, num-ah -176 var num/eax: (addr array byte) <- lookup *num-ah -177 var val/eax: int <- parse-decimal-int num +176 var num/eax: (addr array byte) <- lookup *num-ah +177 var val/eax: int <- parse-decimal-int num 178 compare val, 0x96 # 150 179 { 180 break-if->= @@ -260,14 +259,14 @@ if ('onhashchange' in window) { 196 } 197 # hcl 198 { -199 var hcl?/eax: boolean <- slice-equal? key-slice, "hcl" +199 var hcl?/eax: boolean <- slice-equal? key-slice, "hcl" 200 compare hcl?, 0/false 201 break-if-= 202 # convert val 203 var s: (handle array byte) -204 var s2/eax: (addr handle array byte) <- address s +204 var s2/eax: (addr handle array byte) <- address s 205 _slice-to-string val-slice, s2 -206 var s3/eax: (addr array byte) <- lookup *s2 +206 var s3/eax: (addr array byte) <- lookup *s2 207 # check length 208 var len/ebx: int <- length s3 209 compare len, 7 @@ -279,8 +278,8 @@ if ('onhashchange' in window) { 215 } 216 # check first byte 217 { -218 var c/eax: (addr byte) <- index s3, 0 -219 var c2/eax: byte <- copy-byte *c +218 var c/eax: (addr byte) <- index s3, 0 +219 var c2/eax: byte <- copy-byte *c 220 compare c2, 0x23/hash 221 break-if-= 222 print-string 0, "invalid2\n" @@ -292,10 +291,10 @@ if ('onhashchange' in window) { 228 { 229 compare i, 7 230 break-if->= -231 var c/eax: (addr byte) <- index s3, i +231 var c/eax: (addr byte) <- index s3, i 232 { -233 var c2/eax: byte <- copy-byte *c -234 var valid?/eax: boolean <- hex-digit? c2 +233 var c2/eax: byte <- copy-byte *c +234 var valid?/eax: boolean <- hex-digit? c2 235 compare valid?, 0 236 loop-if-= $main:word-loop 237 } @@ -305,28 +304,28 @@ if ('onhashchange' in window) { 241 } 242 # ecl 243 { -244 var ecl?/eax: boolean <- slice-equal? key-slice, "ecl" +244 var ecl?/eax: boolean <- slice-equal? key-slice, "ecl" 245 compare ecl?, 0/false 246 break-if-= -247 var amb?/eax: boolean <- slice-equal? val-slice, "amb" +247 var amb?/eax: boolean <- slice-equal? val-slice, "amb" 248 compare amb?, 0/false 249 loop-if-!= $main:word-loop -250 var blu?/eax: boolean <- slice-equal? val-slice, "blu" +250 var blu?/eax: boolean <- slice-equal? val-slice, "blu" 251 compare blu?, 0/false 252 loop-if-!= $main:word-loop -253 var brn?/eax: boolean <- slice-equal? val-slice, "brn" +253 var brn?/eax: boolean <- slice-equal? val-slice, "brn" 254 compare brn?, 0/false 255 loop-if-!= $main:word-loop -256 var gry?/eax: boolean <- slice-equal? val-slice, "gry" +256 var gry?/eax: boolean <- slice-equal? val-slice, "gry" 257 compare gry?, 0/false 258 loop-if-!= $main:word-loop -259 var grn?/eax: boolean <- slice-equal? val-slice, "grn" +259 var grn?/eax: boolean <- slice-equal? val-slice, "grn" 260 compare grn?, 0/false 261 loop-if-!= $main:word-loop -262 var hzl?/eax: boolean <- slice-equal? val-slice, "hzl" +262 var hzl?/eax: boolean <- slice-equal? val-slice, "hzl" 263 compare hzl?, 0/false 264 loop-if-!= $main:word-loop -265 var oth?/eax: boolean <- slice-equal? val-slice, "oth" +265 var oth?/eax: boolean <- slice-equal? val-slice, "oth" 266 compare oth?, 0/false 267 loop-if-!= $main:word-loop 268 print-string 0, "invalid\n" @@ -334,16 +333,16 @@ if ('onhashchange' in window) { 270 } 271 # pid 272 { -273 var pid?/eax: boolean <- slice-equal? key-slice, "pid" +273 var pid?/eax: boolean <- slice-equal? key-slice, "pid" 274 compare pid?, 0/false 275 break-if-= 276 # convert val 277 var s: (handle array byte) -278 var s2/eax: (addr handle array byte) <- address s +278 var s2/eax: (addr handle array byte) <- address s 279 _slice-to-string val-slice, s2 -280 var s3/eax: (addr array byte) <- lookup *s2 +280 var s3/eax: (addr array byte) <- lookup *s2 281 # check length -282 var len/eax: int <- length s3 +282 var len/eax: int <- length s3 283 compare len, 9 284 { 285 break-if-= @@ -354,7 +353,7 @@ if ('onhashchange' in window) { 290 # check valid decimal int 291 # parse-decimal-int-from-slice currently returns 0 on invalid parse, 292 # which isn't ideal but suffices for our purposes -293 var val/eax: int <- parse-decimal-int-from-slice val-slice +293 var val/eax: int <- parse-decimal-int-from-slice val-slice 294 compare val, 0 295 { 296 break-if-> -- cgit 1.4.1-2-gfad0