summaryrefslogtreecommitdiff
path: root/tetris/blocks.prn
diff options
context:
space:
mode:
Diffstat (limited to 'tetris/blocks.prn')
-rw-r--r--tetris/blocks.prn22
1 files changed, 7 insertions, 15 deletions
diff --git a/tetris/blocks.prn b/tetris/blocks.prn
index 021a9b5..0eb91f5 100644
--- a/tetris/blocks.prn
+++ b/tetris/blocks.prn
@@ -1,26 +1,18 @@
-@includeonce "io.prn"
-
7 "b_nblocks" store
15 23 71 51 54 99 114
b_nblocks mkarrayp "b_blocks" store
-6 3 4 7 2 1 5
+ 6 3 4 7 2 1 5
b_nblocks mkarrayp "b_blockclrs" store
-@defun "b_getblock" { #arg: block idx [1..7]
- "b_blocks"
- swapoutvar
- swap
- arridx
- swap
- "b_blocks"
- gstore
+@defun "b_getblock" { #arg: block idx [0..(b_nblocks-1)]
+ "b_blocks" swapoutvar swap arridx swap "b_blocks" gstore
}
@defun "b_drawblock" { #args: x y blockidx
- b_getblock
- "blockbits" store
+ dup "blockidx" store
+ b_getblock "blockbits" store
"y" store
"x" store
@@ -30,7 +22,7 @@ b_nblocks mkarrayp "b_blockclrs" store
x "xx" store
row1 while
row1 2 % if
- xx y io_gsquare
+ xx y blockidx io_gsquare
end
xx 1 + "xx" store
row1 2 / "row1" store
@@ -41,7 +33,7 @@ b_nblocks mkarrayp "b_blockclrs" store
x "xx" store
row2 while
row2 2 % if
- xx y io_gsquare
+ xx y blockidx io_gsquare
end
xx 1 + "xx" store
row2 2 / "row2" store