summaryrefslogtreecommitdiff
path: root/tetris/blocks.prn
blob: bc37cb9e96cbd5dad5cd897b95892c8cc9d8339e (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
@includeonce "io.prn"

7 "b_nblocks" store

15 "b_block1" store  6 "b_block1c" store  #I: cyan
23 "b_block2" store  3 "b_block2c" store  #L: orange
71 "b_block3" store  4 "b_block3c" store  #J: blue
51 "b_block4" store  7 "b_block4c" store  #O: yellow (ish)
54 "b_block5" store  2 "b_block5c" store  #S: lime
99 "b_block6" store  1 "b_block6c" store  #Z: red
114 "b_block7" store  5 "b_block7c" store  #T: purple

@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
}