7 "b_nblocks" store 15 4369 15 4369 4 mkarrayp #I 23 547 116 785 4 mkarrayp #L 71 802 113 275 4 mkarrayp #J 51 51 51 51 4 mkarrayp #O 54 561 54 561 4 mkarrayp #S 99 306 99 306 4 mkarrayp #Z 114 610 624 562 4 mkarrayp #T b_nblocks mkarrayp "b_blocks" store 6 3 4 7 2 1 5 #the tetris standard colours -- sort of b_nblocks mkarrayp "b_blockclrs" store #returns the bits for the specified block @defun "b_getblock" { #args: blockidx blockrot (idx in [0..(b_nblocks-1)], rot in [0..3]) "r" store "i" store #"b_blocks" swapoutvar swap arridx swap "b_blocks" gstore "b_blocks" swapoutvar i arridx swap "b_blocks" gstore r arridx swap pop } @defun "b_drawblock" { #args: x y blockidx blockrot "blockrot" store "blockidx" store blockidx blockrot b_getblock "blockbits" store "y" store "x" store blockbits while 0 "i" store i 4 < while blockbits 1 & if x i + y blockidx io_gsquare end i 1 + "i" store blockbits 2 / "blockbits" store i 4 < end y 1 + "y" store blockbits end } @defun "b_undrawblock" { #args: x y blockidx blockrot io_blockchar "temp" store " " "io_blockchar" gstore b_drawblock temp "io_blockchar" gstore }