diff options
author | Yuchen Pei <me@ypei.me> | 2017-11-29 12:30:41 +0100 |
---|---|---|
committer | Yuchen Pei <me@ypei.me> | 2017-11-29 12:30:41 +0100 |
commit | a000308104aab27c2dde9a306f1bc654b2db4806 (patch) | |
tree | aecc628e14c1628b5714281437aba18680cdc27b /tools/OS/Array.vm |
first commit
Diffstat (limited to 'tools/OS/Array.vm')
-rw-r--r-- | tools/OS/Array.vm | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/OS/Array.vm b/tools/OS/Array.vm new file mode 100644 index 0000000..aa4c9e8 --- /dev/null +++ b/tools/OS/Array.vm @@ -0,0 +1,23 @@ +function Array.new 0
+push argument 0
+push constant 0
+gt
+not
+if-goto IF_TRUE0
+goto IF_FALSE0
+label IF_TRUE0
+push constant 2
+call Sys.error 1
+pop temp 0
+label IF_FALSE0
+push argument 0
+call Memory.alloc 1
+return
+function Array.dispose 0
+push argument 0
+pop pointer 0
+push pointer 0
+call Memory.deAlloc 1
+pop temp 0
+push constant 0
+return
|