about summary refs log tree commit diff stats
path: root/304screen.subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-09-14 21:14:04 -0700
committerKartik Agaram <vc@akkartik.com>2020-09-14 21:14:04 -0700
commit6b41ca6d95bf6dbafab3fdc85d7355ac8b365931 (patch)
treeffab6daf3af380a661185d9b072d64640194c65c /304screen.subx
parent40d40b83decac3d4f9a3da2dc222d19d1ab704f1 (diff)
downloadmu-6b41ca6d95bf6dbafab3fdc85d7355ac8b365931.tar.gz
6777
Print answers in decimal in apps/arith.mu
Diffstat (limited to '304screen.subx')
-rw-r--r--304screen.subx31
1 files changed, 31 insertions, 0 deletions
diff --git a/304screen.subx b/304screen.subx
index afed9775..1537a9b1 100644
--- a/304screen.subx
+++ b/304screen.subx
@@ -223,6 +223,37 @@ $print-int32-hex-to-real-screen:end:
     5d/pop-to-ebp
     c3/return
 
+print-int32-decimal-to-real-screen:  # n: int
+    # . prologue
+    55/push-ebp
+    89/<- %ebp 4/r32/esp
+    #
+    (write-int32-decimal-buffered Stdout *(ebp+8))
+    (flush Stdout)
+$print-int32-decimal-to-real-screen:end:
+    # . epilogue
+    89/<- %esp 5/r32/ebp
+    5d/pop-to-ebp
+    c3/return
+
+write-int32-decimal-buffered:  # f: (addr buffered-file), n: int
+    # . prologue
+    55/push-ebp
+    89/<- %ebp 4/r32/esp
+    # var ecx: (stream byte 16)
+    81 5/subop/subtract %esp 0x10/imm32
+    68/push 0x10/imm32/size
+    68/push 0/imm32/read
+    68/push 0/imm32/write
+    89/<- %ecx 4/r32/esp
+    (write-int32-decimal %ecx *(ebp+0xc))
+    (write-stream-data *(ebp+8) %ecx)
+$write-int32-decimal-buffered:end:
+    # . epilogue
+    89/<- %esp 5/r32/ebp
+    5d/pop-to-ebp
+    c3/return
+
 reset-formatting-on-real-screen:
     # . prologue
     55/push-ebp