about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2014-07-31 02:18:00 -0700
committerKartik K. Agaram <vc@akkartik.com>2014-07-31 02:19:38 -0700
commit52c3822e0870942112a7d180d81d2caedd6aea4e (patch)
treede86e1c54868bbe0038e76bf7d5c3773eb9ed5f5
parentfa234f9a861e15e439f649d8f0c9284e1bb46cfb (diff)
downloadmu-52c3822e0870942112a7d180d81d2caedd6aea4e.tar.gz
43 - tests for 'deref' and 'copy'
-rw-r--r--mu.arc.t21
-rw-r--r--new.mu8
2 files changed, 25 insertions, 4 deletions
diff --git a/mu.arc.t b/mu.arc.t
index a054a48e..4d2efd3c 100644
--- a/mu.arc.t
+++ b/mu.arc.t
@@ -297,6 +297,27 @@
 
 (clear)
 (add-fns
+  '((main
+      ((1 integer) <- literal 34)
+      ((2 integer) <- copy (1 integer)))))
+(run function*!main)
+;? (prn memory*)
+(if (~iso memory* (obj 1 34  2 34))
+  (prn "F - 'copy' performs direct addressing"))
+
+(clear)
+(add-fns
+  '((main
+      ((1 integer-address) <- literal 2)
+      ((2 integer) <- literal 34)
+      ((3 integer) <- deref (1 integer-address)))))
+(run function*!main)
+;? (prn memory*)
+(if (~iso memory* (obj 1 2  2 34  3 34))
+  (prn "F - 'deref' performs indirect addressing"))
+
+(clear)
+(add-fns
   '((test1
       ((4 type) <- otype 0)
       ((5 type) <- literal integer)
diff --git a/new.mu b/new.mu
index 0ec7a440..aa0f28c4 100644
--- a/new.mu
+++ b/new.mu
@@ -1,14 +1,14 @@
 ; memory map: 1-1000 reserved for the (currently non-reentrant) allocator
 (main
   ((1 integer) <- literal 1000)  ; location 1 contains the high-water mark for the memory allocator
-  ((4 integer-pointer) <- new)
-  ((5 integer) <- deref (4 integer-pointer))
+  ((4 integer-address) <- new)
+  ((5 integer) <- deref (4 integer-address))
 )
 
 (new
-  ((2 integer-pointer) <- copy (1 integer))
+  ((2 integer-address) <- copy (1 integer))
   ((3 integer) <- literal 1)
   ((1 integer) <- add (1 integer) (3 integer))
-  (reply (2 integer-pointer)))
+  (reply (2 integer-address)))
 
 ;; vim:ft=scheme