about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--mu.arc5
-rw-r--r--new.mu14
2 files changed, 19 insertions, 0 deletions
diff --git a/mu.arc b/mu.arc
index 1c58fd8c..ac1cceb6 100644
--- a/mu.arc
+++ b/mu.arc
@@ -99,6 +99,11 @@
 ;?                   (prn "jumping to " arg.1.1)
                   (= pc (+ pc arg.1.1))  ; relies on continue still incrementing (bug)
                   (continue))
+              copy
+                (= (memory* oarg.0.1) (memory* arg.0.1))
+              deref
+                (= (memory* oarg.0.1)
+                   (memory* (memory* arg.0.1)))
               reply
                 (do (= result arg)
                     (break))
diff --git a/new.mu b/new.mu
new file mode 100644
index 00000000..0f86f378
--- /dev/null
+++ b/new.mu
@@ -0,0 +1,14 @@
+; memory map: 1-1000 reserved for the (currently non-reentrant) allocator
+(main
+  ((integer 1) <- literal 1000)  ; location 1 contains the high-water mark for the memory allocator
+  ((integer-pointer 4) <- new)
+  ((integer 5) <- deref (integer-pointer 4))
+)
+
+(new
+  ((integer-pointer 2) <- copy (integer 1))
+  ((integer 3) <- literal 1)
+  ((integer 1) <- add (integer 1) (integer 3))
+  (reply (integer-pointer 2)))
+
+;; vim:ft=scheme