about summary refs log tree commit diff stats
path: root/mu.arc.t
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2014-07-11 21:29:43 -0700
committerKartik K. Agaram <vc@akkartik.com>2014-07-11 21:29:43 -0700
commitb83c85c8a41dd0e6042e2e3a07e8550cd2eca59b (patch)
tree5bb55779e5c24e1d704fbf80ed6e03035ae6b974 /mu.arc.t
parent77f8e6cd2534fb7c63b0021b7adcd1a2b8348402 (diff)
downloadmu-b83c85c8a41dd0e6042e2e3a07e8550cd2eca59b.tar.gz
16 - conditional and unconditional jumps
Diffstat (limited to 'mu.arc.t')
-rw-r--r--mu.arc.t36
1 files changed, 36 insertions, 0 deletions
diff --git a/mu.arc.t b/mu.arc.t
index f657bf6b..3825c4b9 100644
--- a/mu.arc.t
+++ b/mu.arc.t
@@ -151,3 +151,39 @@
 ;? (prn memory*)
 (if (~iso memory* (obj 1 8))
   (prn "F - jmp works"))
+
+(clear)
+(add-fns
+  '((main
+      ((integer 1) <- loadi 8)
+      (jmp (location 3))
+      ((integer 2) <- loadi 3)
+      (reply))))
+(run function*!main)
+;? (prn memory*)
+(if (~iso memory* (obj 1 8))
+  (prn "F - jmp works"))
+
+(clear)
+(add-fns
+  '((main
+      ((integer 1) <- loadi 0)
+      (jifz (integer 1) (location 3))
+      ((integer 2) <- loadi 3)
+      (reply))))
+(run function*!main)
+;? (prn memory*)
+(if (~iso memory* (obj 1 0))
+  (prn "F - jifz works"))
+
+(clear)
+(add-fns
+  '((main
+      ((integer 1) <- loadi 1)
+      (jifz (integer 1) (location 3))
+      ((integer 2) <- loadi 3)
+      (reply))))
+(run function*!main)
+;? (prn memory*)
+(if (~iso memory* (obj 1 1  2 3))
+  (prn "F - jifz works - 2"))