TetriScript

TetriScript is an assembly-like esolang based on a stack-machine that uses different permutations of the 7 Tetris pieces (Tetrominoes) to encode instructions and data.
== Introduction ==
In TetriScript, every single instruction and operand has to be written on 2 consecutive lines (called a T-line), and every 7 adjacent Tetrominoes on a T-line are considered a T-byte, each T-byte is required to contain all 7 Tetrominoes (I, J, L, O, S, T and Z), thus forming a permutation of Tetrominoes.
Since each T-byte is a permutation of 7 distinct items, a T-byte can represent up to 7! = 5040 different values. However, many instructions of TetriScript consider these T-bytes as conventional bytes, therefore it is not recommended to use a T-byte to represent a value bigger than 255.
== Syntax and Examples ==
=== TetriScript α.1 ===
The syntax of TetriScript α.1 is very simple but unhuman, there are no scopes, functions and labels in the α.1 version.
* Every instruction must be written on its own T-line (no instruction can be stacked), and depending on the instruction used, the next few T-lines might be interpreted as operands rather than instructions.
* You can leave as many empty lines as you want between each T-line, and use the # character at the beginning of a line to start a single-line comment.
* Every non-whitespace character that is also not a special character can be used to represent an individual part of a Tetromino.
* There can be any number of whitespace characters between each Tetromino, given that the 2 lines are properly aligned.
And here's an example program written in TetriScript α.1:
 # An example program in TetriScript α.1 that prints "Hello"!
 
 # PUSHNB (10: IJLSZOT)
 * * ** ** ** * 
 **** *** *** ** ** ** *** 
 # operand $n for PUSHNB (5: IJLOZTS)
 * * ** ** * ** 
 **** *** *** ** ** *** ** 
 # operand $val for PUSHNB (72 101 108 108 111: IJTLOSZ IJZLTSO IJZSLOT IJZSLOT IJZSOTL)
 * * * ** ** ** * ** * * ** ** * ** ** * ** * * ** ** * ** * * ** ** ** * *
 **** *** *** *** ** ** ** **** *** ** *** *** ** ** **** *** ** ** *** ** *** **** *** ** ** *** ** *** **** *** ** ** ** *** ***
 # PRTSTCK (5: IJLOZTS)
 * * ** ** * ** 
 **** *** *** ** ** *** ** 
== Instruction Listings == 
=== TetriScript α.1 ===
TetriScript α.1 only has some basic byte-level instructions. This version of the TetriScript has no branching or input instructions, and running any unrecognized instruction may result in the computer being forcefully shutdown.
ID 	Permutation	Instruction Name	Meaning
0 	IJLOSTZ 	ADDB 	Push the sum of the top 2 bytes onto the stack
1 	IJLOSZT 	SUBB 	Push the difference of the top 2 bytes onto the stack
2 	IJLOTSZ 	INCB 	Increment the top byte by 1
3 	IJLOTZS 	DECB 	Decrement the top byte by 1
4 	IJLOZST 	PRTSTCK 	Print the stack starting from byte 0 to the top byte
5 	IJLOZTS 	PRTSTCKNB 	Print the top $n bytes (with the next T-line representing $n (1 byte))
6 	IJLSOTZ 	CLRSTCK 	Pop every item on the stack
7 	IJLSOZT 	POPB 	Pop the top byte
8 	IJLSTOZ 	POPNB 	Pop the top $n bytes (with the next T-line representing $n (1 byte))
9 	IJLSTZO 	PUSHB 	Push a 1-byte $val onto the stack (with the next T-line representing $val (1 byte))
10 	IJLSZOT 	PUSHNB 	Push a $n-byte $val onto the stack (with the next 2 T-lines representing $n and $val)
... 	... 	... 	...
5039 	ZTSOLJI 	HCF 	Halt and Catch Fire
Invalid	N/A 	HCF 	Halt and Catch Fire
Category:Languages Category:Two-dimensional languages Category:Stack-based