From dd60caa3f51c5117c0193f8f3272e1c7f5230eb7 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Tue, 15 Jun 2021 21:50:13 -0700 Subject: . --- html/403unicode.mu.html | 49 +++++++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 22 deletions(-) (limited to 'html/403unicode.mu.html') diff --git a/html/403unicode.mu.html b/html/403unicode.mu.html index 81f5c9c0..3e6704f0 100644 --- a/html/403unicode.mu.html +++ b/html/403unicode.mu.html @@ -15,10 +15,15 @@ body { font-size:12pt; font-family: monospace; color: #000000; background-color: a { color:inherit; } * { font-size:12pt; font-size: 1em; } .PreProc { color: #c000c0; } +.muRegEdi { color: #87ffd7; } .Special { color: #ff6060; } .LineNr { } -.Delimiter { color: #c000c0; } .Constant { color: #008787; } +.muRegEdx { color: #878700; } +.muRegEcx { color: #af875f; } +.muRegEsi { color: #87d787; } +.muRegEax { color: #875f00; } +.Delimiter { color: #c000c0; } .muFunction { color: #af5f00; text-decoration: underline; } .muComment { color: #005faf; } --> @@ -77,16 +82,16 @@ if ('onhashchange' in window) { 19 # 20 # The day we want to support combining characters, this function will need to 21 # take multiple code points. Or something. - 22 fn to-grapheme in: code-point -> _/eax: grapheme { - 23 var c/eax: int <- copy in - 24 var num-trailers/ecx: int <- copy 0 - 25 var first/edx: int <- copy 0 + 22 fn to-grapheme in: code-point -> _/eax: grapheme { + 23 var c/eax: int <- copy in + 24 var num-trailers/ecx: int <- copy 0 + 25 var first/edx: int <- copy 0 26 $to-grapheme:compute-length: { 27 # single byte: just return it 28 compare c, 0x7f 29 { 30 break-if-> - 31 var g/eax: grapheme <- copy c + 31 var g/eax: grapheme <- copy c 32 return g 33 } 34 # 2 bytes @@ -122,11 +127,11 @@ if ('onhashchange' in window) { 64 } 65 } 66 # emit trailer bytes, 6 bits from 'in', first two bits '10' - 67 var result/edi: grapheme <- copy 0 + 67 var result/edi: grapheme <- copy 0 68 { 69 compare num-trailers, 0 70 break-if-<= - 71 var tmp/esi: int <- copy c + 71 var tmp/esi: int <- copy c 72 tmp <- and 0x3f 73 tmp <- or 0x80 74 result <- shift-left 8 @@ -147,28 +152,28 @@ if ('onhashchange' in window) { 89 # TODO: bring in tests once we have check-ints-equal 90 91 # read the next grapheme from a stream of bytes - 92 fn read-grapheme in: (addr stream byte) -> _/eax: grapheme { + 92 fn read-grapheme in: (addr stream byte) -> _/eax: grapheme { 93 # if at eof, return EOF 94 { - 95 var eof?/eax: boolean <- stream-empty? in + 95 var eof?/eax: boolean <- stream-empty? in 96 compare eof?, 0/false 97 break-if-= 98 return 0xffffffff 99 } -100 var c/eax: byte <- read-byte in -101 var num-trailers/ecx: int <- copy 0 +100 var c/eax: byte <- read-byte in +101 var num-trailers/ecx: int <- copy 0 102 $read-grapheme:compute-length: { 103 # single byte: just return it 104 compare c, 0xc0 105 { 106 break-if->= -107 var g/eax: grapheme <- copy c +107 var g/eax: grapheme <- copy c 108 return g 109 } 110 compare c, 0xfe 111 { 112 break-if-< -113 var g/eax: grapheme <- copy c +113 var g/eax: grapheme <- copy c 114 return g 115 } 116 # 2 bytes @@ -196,13 +201,13 @@ if ('onhashchange' in window) { 138 return 0 139 } 140 # prepend trailer bytes -141 var result/edi: grapheme <- copy c -142 var num-byte-shifts/edx: int <- copy 1 +141 var result/edi: grapheme <- copy c +142 var num-byte-shifts/edx: int <- copy 1 143 { 144 compare num-trailers, 0 145 break-if-<= -146 var tmp/eax: byte <- read-byte in -147 var tmp2/eax: int <- copy tmp +146 var tmp/eax: byte <- read-byte in +147 var tmp2/eax: int <- copy tmp 148 tmp2 <- shift-left-bytes tmp2, num-byte-shifts 149 result <- or tmp2 150 # update loop state @@ -214,9 +219,9 @@ if ('onhashchange' in window) { 156 } 157 158 # needed because available primitives only shift by a literal/constant number of bits -159 fn shift-left-bytes n: int, k: int -> _/eax: int { -160 var i/ecx: int <- copy 0 -161 var result/eax: int <- copy n +159 fn shift-left-bytes n: int, k: int -> _/eax: int { +160 var i/ecx: int <- copy 0 +161 var result/eax: int <- copy n 162 { 163 compare i, k 164 break-if->= @@ -233,7 +238,7 @@ if ('onhashchange' in window) { 175 # this is like write-to-stream, except we skip leading 0 bytes 176 fn write-grapheme out: (addr stream byte), g: grapheme { 177 $write-grapheme:body: { -178 var c/eax: int <- copy g +178 var c/eax: int <- copy g 179 append-byte out, c # first byte is always written 180 c <- shift-right 8 181 compare c, 0 -- cgit 1.4.1-2-gfad0