about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-05-29 16:38:16 -0700
committerKartik Agaram <vc@akkartik.com>2020-05-29 16:39:53 -0700
commitd4a7c53519fb8373b7ec71a47084a4c64900c64d (patch)
tree4dda10bec795a9659d598fd4353a013309c31073
parent1a147cc040460c1555572bf203639039379f0ece (diff)
downloadmu-d4a7c53519fb8373b7ec71a47084a4c64900c64d.tar.gz
6439
Make print-byte less error-prone to use. Now none of our screen primitives
are buffered.
-rw-r--r--103screen.subx13
-rw-r--r--apps/browse.mu2
2 files changed, 11 insertions, 4 deletions
diff --git a/103screen.subx b/103screen.subx
index 419292c7..2c8f733f 100644
--- a/103screen.subx
+++ b/103screen.subx
@@ -136,9 +136,18 @@ print-byte:  # c: byte
     # . prologue
     55/push-ebp
     89/<- %ebp 4/r32/esp
-    #
-    (write-byte-buffered Stdout *(ebp+8))
+    # . save registers
+    51/push-ecx
+    # var s/ecx: (addr array byte)
+    ff 6/subop/push *(ebp+8)
+    68/push 4/imm32/size
+    89/<- %ecx 4/r32/esp
+    (write 2 %ecx)
 $print-byte:end:
+    # . reclaim locals
+    81 0/subop/add %esp 8/imm32
+    # . restore registers
+    59/pop-to-ecx
     # . epilogue
     89/<- %esp 5/r32/ebp
     5d/pop-to-ebp
diff --git a/apps/browse.mu b/apps/browse.mu
index 00cae04f..0f90aa13 100644
--- a/apps/browse.mu
+++ b/apps/browse.mu
@@ -73,11 +73,9 @@ $line-loop:  {
       col <- increment
       loop
     }
-    flush-stdout
     row <- increment
     loop
   }
-  flush-stdout
 }
 
 fn clear toprow: int, leftcol: int, botrow: int, rightcol: int {