summaryrefslogtreecommitdiff
path: root/tetris/blocks.prn
diff options
context:
space:
mode:
Diffstat (limited to 'tetris/blocks.prn')
-rw-r--r--tetris/blocks.prn45
1 files changed, 45 insertions, 0 deletions
diff --git a/tetris/blocks.prn b/tetris/blocks.prn
new file mode 100644
index 0000000..3147b41
--- /dev/null
+++ b/tetris/blocks.prn
@@ -0,0 +1,45 @@
+@includeonce "io.prn"
+
+7 "b_nblocks" store
+
+15 "b_block1" store #I
+23 "b_block2" store #L
+71 "b_block3" store #J
+51 "b_block4" store #O
+54 "b_block5" store #S
+99 "b_block6" store #Z
+114 "b_block7" store #T
+
+@defun "b_getblock" { #arg: block idx [1..7]
+ "b_block" swap + get
+}
+
+@defun "b_drawblock" { #args: x y blockidx
+ b_getblock
+ "blockbits" store
+ "y" store
+ "x" store
+
+ blockbits 16 % "row1" store
+ blockbits 16 / "row2" store
+
+ x "xx" store
+ row1 while
+ row1 2 % if
+ xx y io_gsquare
+ end
+ xx 1 + "xx" store
+ row1 2 / "row1" store
+ row1 end
+
+ y 1 + "y" store
+
+ x "xx" store
+ row2 while
+ row2 2 % if
+ xx y io_gsquare
+ end
+ xx 1 + "xx" store
+ row2 2 / "row2" store
+ row2 end
+}