about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--103grapheme.subx39
-rw-r--r--apps/ex4.mu2
2 files changed, 36 insertions, 5 deletions
diff --git a/103grapheme.subx b/103grapheme.subx
index ef7cf538..2ed65643 100644
--- a/103grapheme.subx
+++ b/103grapheme.subx
@@ -134,8 +134,6 @@ draw-narrow-grapheme-on-screen-buffer:  # buffer: (addr byte), letter-bitmap: (a
     55/push-ebp
     89/<- %ebp 4/r32/esp
     # . save registers
-    50/push-eax
-    51/push-ecx
     52/push-edx
     53/push-ebx
     56/push-esi
@@ -170,8 +168,6 @@ $draw-narrow-grapheme-on-screen-buffer:end:
     5e/pop-to-esi
     5b/pop-to-ebx
     5a/pop-to-edx
-    59/pop-to-ecx
-    58/pop-to-eax
     # . epilogue
     89/<- %esp 5/r32/ebp
     5d/pop-to-ebp
@@ -189,9 +185,42 @@ draw-wide-grapheme-on-screen-buffer:  # buffer: (addr byte), letter-bitmap: (add
     52/push-edx
     53/push-ebx
     56/push-esi
-    # HERE
+    57/push-edi
+    # esi = letter-bitmap
+    8b/-> *(ebp+0xc) 6/r32/esi
+    #
+    bb/copy-to-ebx 0/imm32
+    # var ycurr/edx: int = y*16
+    8b/-> *(ebp+0x14) 2/r32/edx
+    c1 4/subop/shift-left %edx 4/imm8
+    # var ymax/edi: int = ycurr + 16
+    8b/-> *(ebp+0x14) 7/r32/edi
+    c1 4/subop/shift-left %edi 4/imm8
+    81 0/subop/add %edi 0x10/imm32
+    {
+      # if (ycurr >= ymax) break
+      39/compare %edx 7/r32/edi
+      0f 8d/jump-if->= break/disp32
+      # var row-bitmap/ebx: byte = *letter-bitmap
+      8a/byte-> *(esi+1) 3/r32/BL
+      # ecx = x
+      8b/-> *(ebp+0x10) 1/r32/ecx
+      # first half-row
+      (draw-run-of-pixels-from-glyph *(ebp+8) %ebx %ecx %edx *(ebp+0x18) *(ebp+0x1c) *(ebp+0x20) *(ebp+0x24))
+      # second half-row
+      8a/byte-> *esi 3/r32/BL
+      49/increment-ecx
+      (draw-run-of-pixels-from-glyph *(ebp+8) %ebx %ecx %edx *(ebp+0x18) *(ebp+0x1c) *(ebp+0x20) *(ebp+0x24))
+      # ++y
+      42/increment-edx
+      # next bitmap row
+      81 0/subop/add %esi 2/imm32
+      #
+      e9/jump loop/disp32
+    }
 $draw-wide-grapheme-on-screen-buffer:end:
     # . restore registers
+    5f/pop-to-edi
     5e/pop-to-esi
     5b/pop-to-ebx
     5a/pop-to-edx
diff --git a/apps/ex4.mu b/apps/ex4.mu
index f6c0bf8a..f5df8706 100644
--- a/apps/ex4.mu
+++ b/apps/ex4.mu
@@ -11,4 +11,6 @@
 
 fn main screen: (addr screen), keyboard: (addr keyboard), data-disk: (addr disk) {
   var dummy/eax: int <- draw-code-point screen, 0x41/A, 2/row, 1/col, 0xa/fg, 0/bg
+  # wide glyph
+#?   var dummy/eax: int <- draw-code-point screen, 0x1b/esc, 2/row, 1/col, 0xa/fg, 0/bg
 }