about summary refs log tree commit diff stats
path: root/103glyph.subx
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-09-02 15:38:45 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-09-02 15:38:45 -0700
commit60a50c92456fed87c4eaceee7a4649098238a2eb (patch)
tree4b388ddfdd0d901a07db0fce7f4880560ea96cde /103glyph.subx
parent3f953ea5c861706f4996e9d4a9133d3806ad7a93 (diff)
downloadmu-60a50c92456fed87c4eaceee7a4649098238a2eb.tar.gz
support combining characters in streams of text
Fake screens can't handle them yet.
Diffstat (limited to '103glyph.subx')
-rw-r--r--103glyph.subx26
1 files changed, 20 insertions, 6 deletions
diff --git a/103glyph.subx b/103glyph.subx
index 4a3f7267..3fef28b4 100644
--- a/103glyph.subx
+++ b/103glyph.subx
@@ -130,9 +130,9 @@ wide-code-point?:  # c: code-point -> _/eax: boolean
     89/<- %ebp 4/r32/esp
     # eax = c
     8b/-> *(ebp+8) 0/r32/eax
-    # if (c >= 128) return  # characters beyond ASCII currently not supported
-    3d/compare-eax-and 0x80/imm32
-    0f 8d/jump-if->= $wide-code-point?:end/disp32
+    # if (c >= 4352) return false
+    3d/compare-eax-and 0x1100/imm32
+    0f 8d/jump-if->= $wide-code-point?:return-false/disp32
     # var letter-bitmap/eax = font[c]
     69/multiply %eax 0x22/imm32/glyph-size 0/r32/eax
     05/add-to-eax 0x0010000c/imm32/Font  # see boot.subx
@@ -147,15 +147,22 @@ $wide-code-point?:end:
     5d/pop-to-ebp
     c3/return
 
+$wide-code-point?:return-false:
+    b8/copy-to-eax 0/imm32/false
+    # . epilogue
+    89/<- %esp 5/r32/ebp
+    5d/pop-to-ebp
+    c3/return
+
 combining-code-point?:  # c: code-point -> _/eax: boolean
     # . prologue
     55/push-ebp
     89/<- %ebp 4/r32/esp
     # eax = c
     8b/-> *(ebp+8) 0/r32/eax
-    # if (c >= 128) return  # characters beyond ASCII currently not supported
-    3d/compare-eax-and 0x80/imm32
-    0f 8d/jump-if->= $combining-code-point?:end/disp32
+    # if (c >= 4352) return false
+    3d/compare-eax-and 0x1100/imm32
+    0f 8d/jump-if->= $combining-code-point?:return-false/disp32
     # var letter-bitmap/eax = font[c]
     69/multiply %eax 0x22/imm32/glyph-size 0/r32/eax
     05/add-to-eax 0x0010000c/imm32/Font  # see boot.subx
@@ -168,6 +175,13 @@ $combining-code-point?:end:
     5d/pop-to-ebp
     c3/return
 
+$combining-code-point?:return-false:
+    b8/copy-to-eax 0/imm32/false
+    # . epilogue
+    89/<- %esp 5/r32/ebp
+    5d/pop-to-ebp
+    c3/return
+
 # buffer: naked address to raw screen RAM without a length
 # letter-bitmap: naked address to 8-pixel wide font glyph
 draw-narrow-code-point-on-screen-buffer:  # buffer: (addr byte), letter-bitmap: (addr byte), x: int, y: int, color: int, background-color: int, overlay?: boolean, screen-width: int, screen-height: int