summaryrefslogtreecommitdiff
path: root/tetris/utility.prn
diff options
context:
space:
mode:
authortomsmeding <hallo@tomsmeding.nl>2015-09-12 09:52:00 +0200
committertomsmeding <hallo@tomsmeding.nl>2015-09-12 09:52:00 +0200
commit92c104d8a2ba69db1f59890d2f62019186aece05 (patch)
tree0054658c2f26a55e1872c32150c9ad09ecf46c7f /tetris/utility.prn
parentcff41b52e0f801eede5428d97686661b95b9756a (diff)
almost-working engine! :tada:
Diffstat (limited to 'tetris/utility.prn')
-rw-r--r--tetris/utility.prn29
1 files changed, 29 insertions, 0 deletions
diff --git a/tetris/utility.prn b/tetris/utility.prn
index ca68dfe..3a4b912 100644
--- a/tetris/utility.prn
+++ b/tetris/utility.prn
@@ -1,3 +1,12 @@
+@defun "add2" {
+ "y2" store
+ "x2" store
+ "y1" store
+ "x1" store
+ x1 x2 +
+ y1 y2 +
+}
+
@defun "diff2" {
"y2" store
"x2" store
@@ -13,6 +22,14 @@
a b a b
}
+@defun "dup4" {
+ "d" store
+ "c" store
+ "b" store
+ "a" store
+ a b c d a b c d
+}
+
@defun "swap2" {
"b2" store
"b1" store
@@ -20,3 +37,15 @@
"a1" store
b1 b2 a1 a2
}
+
+@defun "replicate" { #args: value times
+ dup 1 < if
+ pop pop
+ else
+ 1 - "t" store
+ t 0 > while
+ dup
+ t 1 - "t" store
+ t 0 > end
+ end
+}