summaryrefslogtreecommitdiff
path: root/tetris/blocks.prn
blob: 021a9b5b99e66c028e4ea7ec5f485230ae66174a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
@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
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_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
}