about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--304screen.subx5
-rw-r--r--400.mu2
-rw-r--r--404screen.mu11
-rw-r--r--apps/browse.mu6
-rwxr-xr-xapps/mubin368997 -> 369023 bytes
-rw-r--r--apps/mu.subx4
-rw-r--r--apps/print-file.mu2
-rwxr-xr-xapps/randombin23597 -> 23601 bytes
-rw-r--r--prototypes/browse/1-print-file.mu3
-rw-r--r--prototypes/browse/10.mu6
-rw-r--r--prototypes/browse/11.mu6
-rw-r--r--prototypes/browse/12.mu12
-rw-r--r--prototypes/browse/13.mu12
-rw-r--r--prototypes/browse/14.mu12
-rw-r--r--prototypes/browse/15-headers-broken.mu12
-rw-r--r--prototypes/browse/16-screen-state-broken.mu3
-rw-r--r--prototypes/browse/17-file-state-broken/file-state.mu3
-rw-r--r--prototypes/browse/18/file-state.mu3
-rw-r--r--prototypes/browse/18/main.mu3
-rw-r--r--prototypes/browse/19/file-state.mu3
-rw-r--r--prototypes/browse/19/screen-position-state.mu3
-rw-r--r--prototypes/browse/2.mu3
-rw-r--r--prototypes/browse/20/file-state.mu3
-rw-r--r--prototypes/browse/20/screen-position-state.mu3
-rw-r--r--prototypes/browse/21/file-state.mu3
-rw-r--r--prototypes/browse/21/screen-position-state.mu3
-rw-r--r--prototypes/browse/22/file-state.mu3
-rw-r--r--prototypes/browse/22/screen-position-state.mu3
-rw-r--r--prototypes/browse/23-multiple-pages/file-state.mu3
-rw-r--r--prototypes/browse/23-multiple-pages/screen-position-state.mu3
-rw-r--r--prototypes/browse/24-bold/file-state.mu3
-rw-r--r--prototypes/browse/24-bold/screen-position-state.mu3
-rw-r--r--prototypes/browse/25-soft-newlines/file-state.mu3
-rw-r--r--prototypes/browse/25-soft-newlines/screen-position-state.mu3
-rw-r--r--prototypes/browse/26-headers/file-state.mu3
-rw-r--r--prototypes/browse/26-headers/screen-position-state.mu3
-rw-r--r--prototypes/browse/27/file-state.mu3
-rw-r--r--prototypes/browse/27/screen-position-state.mu3
-rw-r--r--prototypes/browse/28/file-state.mu3
-rw-r--r--prototypes/browse/28/screen-position-state.mu3
-rw-r--r--prototypes/browse/29/file-state.mu3
-rw-r--r--prototypes/browse/29/screen-position-state.mu3
-rw-r--r--prototypes/browse/3.mu3
-rw-r--r--prototypes/browse/4-render-page.mu6
-rw-r--r--prototypes/browse/5.mu6
-rw-r--r--prototypes/browse/6.mu6
-rw-r--r--prototypes/browse/7.mu6
-rw-r--r--prototypes/browse/8-multiple-pages.mu6
-rw-r--r--prototypes/browse/9-bold.mu6
-rw-r--r--prototypes/tile/2.mu3
-rw-r--r--prototypes/tile/3.mu3
51 files changed, 144 insertions, 75 deletions
diff --git a/304screen.subx b/304screen.subx
index 340f3623..f77b0da5 100644
--- a/304screen.subx
+++ b/304screen.subx
@@ -131,7 +131,8 @@ $print-string-to-real-screen:end:
     5d/pop-to-ebp
     c3/return
 
-print-byte-to-real-screen:  # c: byte
+# currently only supports ascii
+print-grapheme-to-real-screen:  # c: grapheme
     # . prologue
     55/push-ebp
     89/<- %ebp 4/r32/esp
@@ -142,7 +143,7 @@ print-byte-to-real-screen:  # c: byte
     68/push 4/imm32/size
     89/<- %ecx 4/r32/esp
     (write 2 %ecx)
-$print-byte-to-real-screen:end:
+$print-grapheme-to-real-screen:end:
     # . reclaim locals
     81 0/subop/add %esp 8/imm32
     # . restore registers
diff --git a/400.mu b/400.mu
index 9e8c4bc7..8e42eabc 100644
--- a/400.mu
+++ b/400.mu
@@ -142,7 +142,7 @@ sig real-screen-size -> nrows/eax: int, ncols/ecx: int
 sig clear-real-screen
 sig move-cursor-on-real-screen row: int, column: int
 sig print-string-to-real-screen s: (addr array byte)
-sig print-byte-to-real-screen c: byte
+sig print-grapheme-to-real-screen c: grapheme
 sig print-int32-hex-to-real-screen n: int
 sig reset-formatting-on-real-screen
 sig start-color-on-real-screen fg: int, bg: int
diff --git a/404screen.mu b/404screen.mu
index 4a972d79..8165e50f 100644
--- a/404screen.mu
+++ b/404screen.mu
@@ -82,6 +82,7 @@ $clear-screen:body: {
   {
     break-if-=
     # fake screen
+    var space/edi: grapheme <- copy 0x20
     move-cursor screen, 1, 1
     var screen-addr/esi: (addr screen) <- copy screen
     var i/eax: int <- copy 1
@@ -94,7 +95,7 @@ $clear-screen:body: {
       {
         compare j, *ncols
         break-if->
-        print-byte screen, 0x20  # space
+        print-grapheme screen, space
         j <- increment
         loop
       }
@@ -136,13 +137,13 @@ $print-string:body: {
 }
 }
 
-fn print-byte screen: (addr screen), c: byte {
-$print-byte:body: {
+fn print-grapheme screen: (addr screen), c: grapheme {
+$print-grapheme:body: {
   compare screen, 0
   {
     break-if-!=
-    print-byte-to-real-screen c
-    break $print-byte:body
+    print-grapheme-to-real-screen c
+    break $print-grapheme:body
   }
   {
     break-if-=
diff --git a/apps/browse.mu b/apps/browse.mu
index 77ff999c..5681060f 100644
--- a/apps/browse.mu
+++ b/apps/browse.mu
@@ -96,7 +96,8 @@ $line-loop: {
       update-attributes c, r
       compare c, 0xa  # newline
       break-if-=  # no need to print newlines
-      print-byte 0, c
+      var g/eax: grapheme <- copy c
+      print-grapheme 0, g
       col <- increment
       loop
     }
@@ -176,6 +177,7 @@ fn dump in: (addr buffered-file) {
   var c/eax: byte <- read-byte-buffered in
   compare c, 0xffffffff  # EOF marker
   break-if-=
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   loop
 }
diff --git a/apps/mu b/apps/mu
index 0d808397..fbacd783 100755
--- a/apps/mu
+++ b/apps/mu
Binary files differdiff --git a/apps/mu.subx b/apps/mu.subx
index cb2d6d71..20f59336 100644
--- a/apps/mu.subx
+++ b/apps/mu.subx
@@ -412,8 +412,10 @@ Type-id:  # (stream (addr array byte))
   # some SubX types deliberately left undefined in Mu; they can only be operated on using SubX primitives
   "stream"/imm32  # 11
   "slice"/imm32  # 12
+  "code-point"/imm32  # 13; smallest scannable unit from a text stream
+  "grapheme"/imm32  # 14; smallest printable unit; will eventually be composed of multiple code-points, but currently corresponds 1:1
   # Keep Primitive-type-ids in sync if you add types here.
-                                          0/imm32 0/imm32 0/imm32
+                                                          0/imm32
   0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
   0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
   0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
diff --git a/apps/print-file.mu b/apps/print-file.mu
index aed4579d..7cd51bdc 100644
--- a/apps/print-file.mu
+++ b/apps/print-file.mu
@@ -31,7 +31,7 @@ $main-body: {
         var c/eax: byte <- read-byte-buffered in-addr
         compare c, 0xffffffff  # EOF marker
         break-if-=
-        print-byte 0, c
+        print-grapheme 0, c
         loop
       }
     }
diff --git a/apps/random b/apps/random
index 5c828306..4123332e 100755
--- a/apps/random
+++ b/apps/random
Binary files differdiff --git a/prototypes/browse/1-print-file.mu b/prototypes/browse/1-print-file.mu
index e89f1cec..8310fc0f 100644
--- a/prototypes/browse/1-print-file.mu
+++ b/prototypes/browse/1-print-file.mu
@@ -26,7 +26,8 @@ fn dump in: (addr buffered-file) {
     var c/eax: byte <- read-byte-buffered in
     compare c, 0xffffffff  # EOF marker
     break-if-=
-    print-byte 0, c
+    var g/eax: grapheme <- copy c
+    print-grapheme 0, g
     loop
   }
 }
diff --git a/prototypes/browse/10.mu b/prototypes/browse/10.mu
index 834fec90..5025cb7d 100644
--- a/prototypes/browse/10.mu
+++ b/prototypes/browse/10.mu
@@ -75,7 +75,8 @@ $line-loop: {
       compare c, 0xa  # newline
       break-if-=  # no need to print newlines
       # print c
-      print-byte 0, c
+      var g/eax: grapheme <- copy c
+      print-grapheme 0, g
       col <- increment
       loop
     }  # $char-loop
@@ -171,6 +172,7 @@ fn dump in: (addr buffered-file) {
   var c/eax: byte <- read-byte-buffered in
   compare c, 0xffffffff  # EOF marker
   break-if-=
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   loop
 }
diff --git a/prototypes/browse/11.mu b/prototypes/browse/11.mu
index 73e1b21e..af1ee45a 100644
--- a/prototypes/browse/11.mu
+++ b/prototypes/browse/11.mu
@@ -119,7 +119,8 @@ $update-attributes:check-state: {
       compare c, 0xa  # newline
       break-if-=  # no need to print newlines
       # print c
-      print-byte 0, c
+      var g/eax: grapheme <- copy c
+      print-grapheme 0, g
       col <- increment
       loop
     }  # $char-loop
@@ -167,6 +168,7 @@ fn dump in: (addr buffered-file) {
   var c/eax: byte <- read-byte-buffered in
   compare c, 0xffffffff  # EOF marker
   break-if-=
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   loop
 }
diff --git a/prototypes/browse/12.mu b/prototypes/browse/12.mu
index ec93564c..6b2780ec 100644
--- a/prototypes/browse/12.mu
+++ b/prototypes/browse/12.mu
@@ -98,7 +98,8 @@ $update-attributes:check-state: {
           {
             break-if-!=
             # r->current-state == 1 && c == '*' => print c, then normal text
-            print-byte 0, c
+            var g/eax: grapheme <- copy c
+            print-grapheme 0, g
             col <- increment
             reset-formatting 0
             start-color 0, 0xec, 7  # 236 = darkish gray
@@ -109,7 +110,8 @@ $update-attributes:check-state: {
           {
             break-if-!=
             # r->current-state == 1 && c == '_' => print c, then normal text
-            print-byte 0, c
+            var g/eax: grapheme <- copy c
+            print-grapheme 0, g
             col <- increment
             reset-formatting 0
             start-color 0, 0xec, 7  # 236 = darkish gray
@@ -122,7 +124,8 @@ $update-attributes:check-state: {
       compare c, 0xa  # newline
       break-if-=  # no need to print newlines
       # print c
-      print-byte 0, c
+      var g/eax: grapheme <- copy c
+      print-grapheme 0, g
       col <- increment
       loop
     }  # $char-loop
@@ -170,6 +173,7 @@ fn dump in: (addr buffered-file) {
   var c/eax: byte <- read-byte-buffered in
   compare c, 0xffffffff  # EOF marker
   break-if-=
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   loop
 }
diff --git a/prototypes/browse/13.mu b/prototypes/browse/13.mu
index c0371954..0dac8a4d 100644
--- a/prototypes/browse/13.mu
+++ b/prototypes/browse/13.mu
@@ -99,7 +99,8 @@ $update-attributes:check-state: {
           {
             break-if-!=
             # r->current-state == 1 && c == '*' => print c, then normal text
-            print-byte 0, c
+            var g/eax: grapheme <- copy c
+            print-grapheme 0, g
             col <- increment
             reset-formatting 0
             start-color 0, 0xec, 7  # 236 = darkish gray
@@ -110,7 +111,8 @@ $update-attributes:check-state: {
           {
             break-if-!=
             # r->current-state == 1 && c == '_' => print c, then normal text
-            print-byte 0, c
+            var g/eax: grapheme <- copy c
+            print-grapheme 0, g
             col <- increment
             reset-formatting 0
             start-color 0, 0xec, 7  # 236 = darkish gray
@@ -123,7 +125,8 @@ $update-attributes:check-state: {
       compare c, 0xa  # newline
       break-if-=  # no need to print newlines
       # print c
-      print-byte 0, c
+      var g/eax: grapheme <- copy c
+      print-grapheme 0, g
       col <- increment
       loop
     }  # $char-loop
@@ -171,6 +174,7 @@ fn dump in: (addr buffered-file) {
   var c/eax: byte <- read-byte-buffered in
   compare c, 0xffffffff  # EOF marker
   break-if-=
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   loop
 }
diff --git a/prototypes/browse/14.mu b/prototypes/browse/14.mu
index 0ad5d5c3..bccb9767 100644
--- a/prototypes/browse/14.mu
+++ b/prototypes/browse/14.mu
@@ -97,7 +97,8 @@ $change-state: {
           {
             break-if-!=
             # r->current-state == 1 && c == '*' => print c, then normal text
-            print-byte 0, c
+            var g/eax: grapheme <- copy c
+            print-grapheme 0, g
             col <- increment
             reset-formatting 0
             start-color 0, 0xec, 7  # 236 = darkish gray
@@ -108,7 +109,8 @@ $change-state: {
           {
             break-if-!=
             # r->current-state == 1 && c == '_' => print c, then normal text
-            print-byte 0, c
+            var g/eax: grapheme <- copy c
+            print-grapheme 0, g
             col <- increment
             reset-formatting 0
             start-color 0, 0xec, 7  # 236 = darkish gray
@@ -121,7 +123,8 @@ $change-state: {
       compare c, 0xa  # newline
       break-if-=  # no need to print newlines
       # print c
-      print-byte 0, c
+      var g/eax: grapheme <- copy c
+      print-grapheme 0, g
       col <- increment
       loop
     }  # $char-loop
@@ -169,6 +172,7 @@ fn dump in: (addr buffered-file) {
   var c/eax: byte <- read-byte-buffered in
   compare c, 0xffffffff  # EOF marker
   break-if-=
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   loop
 }
diff --git a/prototypes/browse/15-headers-broken.mu b/prototypes/browse/15-headers-broken.mu
index c9c722e4..73062bfc 100644
--- a/prototypes/browse/15-headers-broken.mu
+++ b/prototypes/browse/15-headers-broken.mu
@@ -121,7 +121,8 @@ $change-state: {
           {
             break-if-!=
             # r->current-state == 1 && c == '*' => print c, then normal text
-            print-byte 0, c
+            var g/eax: grapheme <- copy c
+            print-grapheme 0, g
             col <- increment
             reset-formatting 0
             start-color 0, 0xec, 7  # 236 = darkish gray
@@ -132,7 +133,8 @@ $change-state: {
           {
             break-if-!=
             # r->current-state == 1 && c == '_' => print c, then normal text
-            print-byte 0, c
+            var g/eax: grapheme <- copy c
+            print-grapheme 0, g
             col <- increment
             reset-formatting 0
             start-color 0, 0xec, 7  # 236 = darkish gray
@@ -163,7 +165,8 @@ $change-state: {
         copy-to *s, 0  # false
       }
       # print c
-      print-byte 0, c
+      var g/eax: grapheme <- copy c
+      print-grapheme 0, g
       col <- increment
       loop
     }
@@ -211,6 +214,7 @@ fn dump in: (addr buffered-file) {
   var c/eax: byte <- read-byte-buffered in
   compare c, 0xffffffff  # EOF marker
   break-if-=
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   loop
 }
diff --git a/prototypes/browse/16-screen-state-broken.mu b/prototypes/browse/16-screen-state-broken.mu
index 3ea359f2..9324244a 100644
--- a/prototypes/browse/16-screen-state-broken.mu
+++ b/prototypes/browse/16-screen-state-broken.mu
@@ -183,6 +183,7 @@ fn dump in: (addr buffered-file) {
   var c/eax: byte <- read-byte-buffered in
   compare c, 0xffffffff  # EOF marker
   break-if-=
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   loop
 }
diff --git a/prototypes/browse/17-file-state-broken/file-state.mu b/prototypes/browse/17-file-state-broken/file-state.mu
index cf39e9d8..c4339cef 100644
--- a/prototypes/browse/17-file-state-broken/file-state.mu
+++ b/prototypes/browse/17-file-state-broken/file-state.mu
@@ -28,6 +28,7 @@ fn dump in: (addr buffered-file) {
   var c/eax: byte <- read-byte-buffered in
   compare c, 0xffffffff  # EOF marker
   break-if-=
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   loop
 }
diff --git a/prototypes/browse/18/file-state.mu b/prototypes/browse/18/file-state.mu
index 544c7832..d42bf8bf 100644
--- a/prototypes/browse/18/file-state.mu
+++ b/prototypes/browse/18/file-state.mu
@@ -39,6 +39,7 @@ fn dump in: (addr buffered-file) {
   var c/eax: byte <- read-byte-buffered in
   compare c, 0xffffffff  # EOF marker
   break-if-=
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   loop
 }
diff --git a/prototypes/browse/18/main.mu b/prototypes/browse/18/main.mu
index 4320a460..7a551e6c 100644
--- a/prototypes/browse/18/main.mu
+++ b/prototypes/browse/18/main.mu
@@ -19,7 +19,8 @@ fn render-normal fs: (addr file-state) {
     compare c, 0xffffffff  # EOF marker
     break-if-=
     #
-    print-byte 0, c
+    var g/eax: grapheme <- copy c
+    print-grapheme 0, g
     #
     loop
   }
diff --git a/prototypes/browse/19/file-state.mu b/prototypes/browse/19/file-state.mu
index 544c7832..d42bf8bf 100644
--- a/prototypes/browse/19/file-state.mu
+++ b/prototypes/browse/19/file-state.mu
@@ -39,6 +39,7 @@ fn dump in: (addr buffered-file) {
   var c/eax: byte <- read-byte-buffered in
   compare c, 0xffffffff  # EOF marker
   break-if-=
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   loop
 }
diff --git a/prototypes/browse/19/screen-position-state.mu b/prototypes/browse/19/screen-position-state.mu
index 543f1871..06efa4ba 100644
--- a/prototypes/browse/19/screen-position-state.mu
+++ b/prototypes/browse/19/screen-position-state.mu
@@ -63,7 +63,8 @@ fn start-drawing _self: (addr screen-position-state) {
 fn add-char _self: (addr screen-position-state), c: byte {
   var self/esi: (addr screen-position-state) <- copy _self
   # print c
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   # self->col++
   var tmp/eax: (addr int) <- get self, col
   increment *tmp
diff --git a/prototypes/browse/2.mu b/prototypes/browse/2.mu
index 52245b6c..119e063a 100644
--- a/prototypes/browse/2.mu
+++ b/prototypes/browse/2.mu
@@ -25,7 +25,8 @@ fn dump in: (addr buffered-file) {
     var c/eax: byte <- read-byte-buffered in
     compare c, 0xffffffff  # EOF marker
     break-if-=
-    print-byte 0, c
+    var g/eax: grapheme <- copy c
+    print-grapheme 0, g
     loop
   }
 }
diff --git a/prototypes/browse/20/file-state.mu b/prototypes/browse/20/file-state.mu
index 544c7832..d42bf8bf 100644
--- a/prototypes/browse/20/file-state.mu
+++ b/prototypes/browse/20/file-state.mu
@@ -39,6 +39,7 @@ fn dump in: (addr buffered-file) {
   var c/eax: byte <- read-byte-buffered in
   compare c, 0xffffffff  # EOF marker
   break-if-=
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   loop
 }
diff --git a/prototypes/browse/20/screen-position-state.mu b/prototypes/browse/20/screen-position-state.mu
index 41ad2705..2f61f3e7 100644
--- a/prototypes/browse/20/screen-position-state.mu
+++ b/prototypes/browse/20/screen-position-state.mu
@@ -71,7 +71,8 @@ $add-char:body: {
     break $add-char:body
   }
   # print c
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   # self->col++
   var tmp/eax: (addr int) <- get self, col
   increment *tmp
diff --git a/prototypes/browse/21/file-state.mu b/prototypes/browse/21/file-state.mu
index 544c7832..d42bf8bf 100644
--- a/prototypes/browse/21/file-state.mu
+++ b/prototypes/browse/21/file-state.mu
@@ -39,6 +39,7 @@ fn dump in: (addr buffered-file) {
   var c/eax: byte <- read-byte-buffered in
   compare c, 0xffffffff  # EOF marker
   break-if-=
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   loop
 }
diff --git a/prototypes/browse/21/screen-position-state.mu b/prototypes/browse/21/screen-position-state.mu
index 2316d3ae..e740a141 100644
--- a/prototypes/browse/21/screen-position-state.mu
+++ b/prototypes/browse/21/screen-position-state.mu
@@ -70,7 +70,8 @@ $add-char:body: {
     break $add-char:body
   }
   # print c
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   # self->col++
   var tmp/eax: (addr int) <- get self, col
   increment *tmp
diff --git a/prototypes/browse/22/file-state.mu b/prototypes/browse/22/file-state.mu
index 544c7832..d42bf8bf 100644
--- a/prototypes/browse/22/file-state.mu
+++ b/prototypes/browse/22/file-state.mu
@@ -39,6 +39,7 @@ fn dump in: (addr buffered-file) {
   var c/eax: byte <- read-byte-buffered in
   compare c, 0xffffffff  # EOF marker
   break-if-=
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   loop
 }
diff --git a/prototypes/browse/22/screen-position-state.mu b/prototypes/browse/22/screen-position-state.mu
index 245f834e..72b8e5b5 100644
--- a/prototypes/browse/22/screen-position-state.mu
+++ b/prototypes/browse/22/screen-position-state.mu
@@ -70,7 +70,8 @@ $add-char:body: {
     break $add-char:body
   }
   # print c
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   # self->col++
   var tmp/eax: (addr int) <- get self, col
   increment *tmp
diff --git a/prototypes/browse/23-multiple-pages/file-state.mu b/prototypes/browse/23-multiple-pages/file-state.mu
index 544c7832..d42bf8bf 100644
--- a/prototypes/browse/23-multiple-pages/file-state.mu
+++ b/prototypes/browse/23-multiple-pages/file-state.mu
@@ -39,6 +39,7 @@ fn dump in: (addr buffered-file) {
   var c/eax: byte <- read-byte-buffered in
   compare c, 0xffffffff  # EOF marker
   break-if-=
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   loop
 }
diff --git a/prototypes/browse/23-multiple-pages/screen-position-state.mu b/prototypes/browse/23-multiple-pages/screen-position-state.mu
index 6fe1ad93..9fb410f8 100644
--- a/prototypes/browse/23-multiple-pages/screen-position-state.mu
+++ b/prototypes/browse/23-multiple-pages/screen-position-state.mu
@@ -71,7 +71,8 @@ $add-char:body: {
     break $add-char:body
   }
   # print c
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   # self->col++
   var tmp/eax: (addr int) <- get self, col
   increment *tmp
diff --git a/prototypes/browse/24-bold/file-state.mu b/prototypes/browse/24-bold/file-state.mu
index 544c7832..d42bf8bf 100644
--- a/prototypes/browse/24-bold/file-state.mu
+++ b/prototypes/browse/24-bold/file-state.mu
@@ -39,6 +39,7 @@ fn dump in: (addr buffered-file) {
   var c/eax: byte <- read-byte-buffered in
   compare c, 0xffffffff  # EOF marker
   break-if-=
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   loop
 }
diff --git a/prototypes/browse/24-bold/screen-position-state.mu b/prototypes/browse/24-bold/screen-position-state.mu
index 6fe1ad93..9fb410f8 100644
--- a/prototypes/browse/24-bold/screen-position-state.mu
+++ b/prototypes/browse/24-bold/screen-position-state.mu
@@ -71,7 +71,8 @@ $add-char:body: {
     break $add-char:body
   }
   # print c
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   # self->col++
   var tmp/eax: (addr int) <- get self, col
   increment *tmp
diff --git a/prototypes/browse/25-soft-newlines/file-state.mu b/prototypes/browse/25-soft-newlines/file-state.mu
index 544c7832..d42bf8bf 100644
--- a/prototypes/browse/25-soft-newlines/file-state.mu
+++ b/prototypes/browse/25-soft-newlines/file-state.mu
@@ -39,6 +39,7 @@ fn dump in: (addr buffered-file) {
   var c/eax: byte <- read-byte-buffered in
   compare c, 0xffffffff  # EOF marker
   break-if-=
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   loop
 }
diff --git a/prototypes/browse/25-soft-newlines/screen-position-state.mu b/prototypes/browse/25-soft-newlines/screen-position-state.mu
index dec8b502..7b53ae07 100644
--- a/prototypes/browse/25-soft-newlines/screen-position-state.mu
+++ b/prototypes/browse/25-soft-newlines/screen-position-state.mu
@@ -72,7 +72,8 @@ $add-char:body: {
     break $add-char:body
   }
   # print c
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   # self->col++
   var tmp/eax: (addr int) <- get self, col
   increment *tmp
diff --git a/prototypes/browse/26-headers/file-state.mu b/prototypes/browse/26-headers/file-state.mu
index 544c7832..d42bf8bf 100644
--- a/prototypes/browse/26-headers/file-state.mu
+++ b/prototypes/browse/26-headers/file-state.mu
@@ -39,6 +39,7 @@ fn dump in: (addr buffered-file) {
   var c/eax: byte <- read-byte-buffered in
   compare c, 0xffffffff  # EOF marker
   break-if-=
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   loop
 }
diff --git a/prototypes/browse/26-headers/screen-position-state.mu b/prototypes/browse/26-headers/screen-position-state.mu
index dec8b502..7b53ae07 100644
--- a/prototypes/browse/26-headers/screen-position-state.mu
+++ b/prototypes/browse/26-headers/screen-position-state.mu
@@ -72,7 +72,8 @@ $add-char:body: {
     break $add-char:body
   }
   # print c
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   # self->col++
   var tmp/eax: (addr int) <- get self, col
   increment *tmp
diff --git a/prototypes/browse/27/file-state.mu b/prototypes/browse/27/file-state.mu
index 544c7832..d42bf8bf 100644
--- a/prototypes/browse/27/file-state.mu
+++ b/prototypes/browse/27/file-state.mu
@@ -39,6 +39,7 @@ fn dump in: (addr buffered-file) {
   var c/eax: byte <- read-byte-buffered in
   compare c, 0xffffffff  # EOF marker
   break-if-=
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   loop
 }
diff --git a/prototypes/browse/27/screen-position-state.mu b/prototypes/browse/27/screen-position-state.mu
index dec8b502..7b53ae07 100644
--- a/prototypes/browse/27/screen-position-state.mu
+++ b/prototypes/browse/27/screen-position-state.mu
@@ -72,7 +72,8 @@ $add-char:body: {
     break $add-char:body
   }
   # print c
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   # self->col++
   var tmp/eax: (addr int) <- get self, col
   increment *tmp
diff --git a/prototypes/browse/28/file-state.mu b/prototypes/browse/28/file-state.mu
index 544c7832..d42bf8bf 100644
--- a/prototypes/browse/28/file-state.mu
+++ b/prototypes/browse/28/file-state.mu
@@ -39,6 +39,7 @@ fn dump in: (addr buffered-file) {
   var c/eax: byte <- read-byte-buffered in
   compare c, 0xffffffff  # EOF marker
   break-if-=
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   loop
 }
diff --git a/prototypes/browse/28/screen-position-state.mu b/prototypes/browse/28/screen-position-state.mu
index dec8b502..7b53ae07 100644
--- a/prototypes/browse/28/screen-position-state.mu
+++ b/prototypes/browse/28/screen-position-state.mu
@@ -72,7 +72,8 @@ $add-char:body: {
     break $add-char:body
   }
   # print c
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   # self->col++
   var tmp/eax: (addr int) <- get self, col
   increment *tmp
diff --git a/prototypes/browse/29/file-state.mu b/prototypes/browse/29/file-state.mu
index 544c7832..d42bf8bf 100644
--- a/prototypes/browse/29/file-state.mu
+++ b/prototypes/browse/29/file-state.mu
@@ -39,6 +39,7 @@ fn dump in: (addr buffered-file) {
   var c/eax: byte <- read-byte-buffered in
   compare c, 0xffffffff  # EOF marker
   break-if-=
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   loop
 }
diff --git a/prototypes/browse/29/screen-position-state.mu b/prototypes/browse/29/screen-position-state.mu
index dec8b502..7b53ae07 100644
--- a/prototypes/browse/29/screen-position-state.mu
+++ b/prototypes/browse/29/screen-position-state.mu
@@ -72,7 +72,8 @@ $add-char:body: {
     break $add-char:body
   }
   # print c
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   # self->col++
   var tmp/eax: (addr int) <- get self, col
   increment *tmp
diff --git a/prototypes/browse/3.mu b/prototypes/browse/3.mu
index 297ce470..2938e9b1 100644
--- a/prototypes/browse/3.mu
+++ b/prototypes/browse/3.mu
@@ -24,6 +24,7 @@ fn dump in: (addr buffered-file) {
   var c/eax: byte <- read-byte-buffered in
   compare c, 0xffffffff  # EOF marker
   break-if-=
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   loop
 }
diff --git a/prototypes/browse/4-render-page.mu b/prototypes/browse/4-render-page.mu
index 130f17e5..f0473387 100644
--- a/prototypes/browse/4-render-page.mu
+++ b/prototypes/browse/4-render-page.mu
@@ -29,7 +29,8 @@ $line-loop: {
       compare c, 0xffffffff  # EOF marker
       break-if-= $line-loop
       # print c
-      print-byte 0, c
+      var g/eax: grapheme <- copy c
+      print-grapheme 0, g
       col <- increment
       loop
     }  # $char-loop
@@ -76,6 +77,7 @@ fn dump in: (addr buffered-file) {
   var c/eax: byte <- read-byte-buffered in
   compare c, 0xffffffff  # EOF marker
   break-if-=
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   loop
 }
diff --git a/prototypes/browse/5.mu b/prototypes/browse/5.mu
index 24a323a8..17a6e240 100644
--- a/prototypes/browse/5.mu
+++ b/prototypes/browse/5.mu
@@ -31,7 +31,8 @@ $line-loop: {
       compare c, 0xa  # newline
       break-if-=  # no need to print newlines
       # print c
-      print-byte 0, c
+      var g/eax: grapheme <- copy c
+      print-grapheme 0, g
       col <- increment
       loop
     }  # $char-loop
@@ -78,6 +79,7 @@ fn dump in: (addr buffered-file) {
   var c/eax: byte <- read-byte-buffered in
   compare c, 0xffffffff  # EOF marker
   break-if-=
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   loop
 }
diff --git a/prototypes/browse/6.mu b/prototypes/browse/6.mu
index cb7e55ee..bd51182b 100644
--- a/prototypes/browse/6.mu
+++ b/prototypes/browse/6.mu
@@ -42,7 +42,8 @@ $line-loop: {
       compare c, 0xa  # newline
       break-if-=  # no need to print newlines
       # print c
-      print-byte 0, c
+      var g/eax: grapheme <- copy c
+      print-grapheme 0, g
       col <- increment
       loop
     }  # $char-loop
@@ -89,6 +90,7 @@ fn dump in: (addr buffered-file) {
   var c/eax: byte <- read-byte-buffered in
   compare c, 0xffffffff  # EOF marker
   break-if-=
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   loop
 }
diff --git a/prototypes/browse/7.mu b/prototypes/browse/7.mu
index 0ea581a4..df89cd15 100644
--- a/prototypes/browse/7.mu
+++ b/prototypes/browse/7.mu
@@ -46,7 +46,8 @@ $line-loop: {
       compare c, 0xa  # newline
       break-if-=  # no need to print newlines
       # print c
-      print-byte 0, c
+      var g/eax: grapheme <- copy c
+      print-grapheme 0, g
       col <- increment
       loop
     }  # $char-loop
@@ -94,6 +95,7 @@ fn dump in: (addr buffered-file) {
   var c/eax: byte <- read-byte-buffered in
   compare c, 0xffffffff  # EOF marker
   break-if-=
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   loop
 }
diff --git a/prototypes/browse/8-multiple-pages.mu b/prototypes/browse/8-multiple-pages.mu
index e049fd37..78aba2f9 100644
--- a/prototypes/browse/8-multiple-pages.mu
+++ b/prototypes/browse/8-multiple-pages.mu
@@ -62,7 +62,8 @@ $line-loop: {
       compare c, 0xa  # newline
       break-if-=  # no need to print newlines
       # print c
-      print-byte 0, c
+      var g/eax: grapheme <- copy c
+      print-grapheme 0, g
       col <- increment
       loop
     }  # $char-loop
@@ -110,6 +111,7 @@ fn dump in: (addr buffered-file) {
   var c/eax: byte <- read-byte-buffered in
   compare c, 0xffffffff  # EOF marker
   break-if-=
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   loop
 }
diff --git a/prototypes/browse/9-bold.mu b/prototypes/browse/9-bold.mu
index 2d7312aa..dec8e581 100644
--- a/prototypes/browse/9-bold.mu
+++ b/prototypes/browse/9-bold.mu
@@ -70,7 +70,8 @@ $line-loop: {
       compare c, 0xa  # newline
       break-if-=  # no need to print newlines
       # print c
-      print-byte 0, c
+      var g/eax: grapheme <- copy c
+      print-grapheme 0, g
       col <- increment
       loop
     }  # $char-loop
@@ -147,6 +148,7 @@ fn dump in: (addr buffered-file) {
   var c/eax: byte <- read-byte-buffered in
   compare c, 0xffffffff  # EOF marker
   break-if-=
-  print-byte 0, c
+  var g/eax: grapheme <- copy c
+  print-grapheme 0, g
   loop
 }
diff --git a/prototypes/tile/2.mu b/prototypes/tile/2.mu
index c6daa971..79b9ed99 100644
--- a/prototypes/tile/2.mu
+++ b/prototypes/tile/2.mu
@@ -76,7 +76,8 @@ $render:render-loop: {
       move-cursor 0, row, col
       loop $render:render-loop
     }
-    print-byte 0, c
+    var g/eax: grapheme <- copy c
+    print-grapheme 0, g
     col <- increment
     loop
   }
diff --git a/prototypes/tile/3.mu b/prototypes/tile/3.mu
index 8f234f21..94c9cc8c 100644
--- a/prototypes/tile/3.mu
+++ b/prototypes/tile/3.mu
@@ -68,7 +68,8 @@ $render:render-loop: {
       move-cursor 0, row, col
       loop $render:render-loop
     }
-    print-byte 0, c
+    var g/eax: grapheme <- copy c
+    print-grapheme 0, g
     col <- increment
     loop
   }