about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-11-29 12:45:23 -0800
committerKartik Agaram <vc@akkartik.com>2020-11-29 12:45:23 -0800
commit614b132b2e00178f67e3e5dee38d14b9eee806cb (patch)
tree1a9390db587ec3f02ad468d180550d6e3bca8423
parent61cfedceef0042dae08e7d4347be4c8c525b4ba2 (diff)
downloadmu-614b132b2e00178f67e3e5dee38d14b9eee806cb.tar.gz
7301 - tile: float computations now working
-rw-r--r--apps/tile/float-stack.mu3
-rw-r--r--apps/tile/value-stack.mu6
2 files changed, 6 insertions, 3 deletions
diff --git a/apps/tile/float-stack.mu b/apps/tile/float-stack.mu
index b6585192..58a13ef4 100644
--- a/apps/tile/float-stack.mu
+++ b/apps/tile/float-stack.mu
@@ -35,7 +35,8 @@ fn pop-float-stack _self: (addr float-stack) -> _/xmm0: float {
   {
     compare *top-addr, 0
     break-if->
-    return 0
+    var zero: float
+    return zero
   }
   subtract-from *top-addr, 1
   var data-ah/edx: (addr handle array float) <- get self, data
diff --git a/apps/tile/value-stack.mu b/apps/tile/value-stack.mu
index 64f33fa2..d2209b16 100644
--- a/apps/tile/value-stack.mu
+++ b/apps/tile/value-stack.mu
@@ -29,7 +29,7 @@ fn push-number-to-value-stack _self: (addr value-stack), _val: float {
   var dest-addr/edx: (addr value) <- index data, dest-offset
   var dest-addr2/eax: (addr float) <- get dest-addr, number-data
   var val/xmm0: float <- copy _val
-#?   print-int32-hex-to-real-screen val
+#?   print-float-decimal-approximate 0, val, 3
   copy-to *dest-addr2, val
   increment *top-addr
   var type-addr/eax: (addr int) <- get dest-addr, type
@@ -91,7 +91,9 @@ fn pop-number-from-value-stack _self: (addr value-stack) -> _/xmm0: float {
   {
     compare *top-addr, 0
     break-if->
-    return -1
+    var minus-one/eax: int <- copy -1
+    var minus-one-f/xmm0: float <- convert minus-one
+    return minus-one-f
   }
   decrement *top-addr
   var data-ah/edx: (addr handle array value) <- get self, data