﻿//
// NOTE: All lines starting with // are ignored.
//
// All listings are in the following format:
//   code <TAB> variables <TAB> description
//
//   variables:
//     may use from a -> f, but any declared must be in order and declared once only
//       good examples: abc  a   abcdef
//       bad  examples: acf  cde abac
//
//   description:
//     may be multiple lines if seperated by a newline escape sequence (\n)
//     anything outside quotes ("") is taken as a variable or math expression
//     quotes can follow each other; no appending of strings using '+' is allowed
//     i is used to retrieve the value of the instruction pointer (current OpCode position)
//     t is used for reading the triangle offset variable
//     To update the triangle offset, use square brackets with the value of the varaible.
//      (No value will be displayed by update)
//        ex:   [a+6]
//              [t+a-2]
//
0x01	abc		"0x01 unknown test"
0x02	abc		"0x02 unknown test"
0x03	abc		"0x03 unknown test"
0x04	abc		"0x04 unknown test"
0x05	a		"GOTO " a 
0x06	ab		"GOTO " a << 8 + b
0x09	a		"Triangle offset = " t " + " a " = " [t + a]  t
0x0A	ab		"Triangle offset = " t " + " a * 256 + b " = " [t + a * 256 + b] t
0x0B	abcd	"Set triangle offset to " [c*256 + d] t ". a = " a ",  b = " b
0x10	abc		"if (x > " a ")"
                "\n         GOTO " (i + c)
                "\n        else if (x <= " a " and x >= " b ")"
                "\n         GOTO " i
                "\n         GOTO " (i + c)
                "\n        else if (x < " b ")"
                "\n         GOTO " i
0x11	abc		"if (y > " a ")"
                "\n         GOTO " (i + c)
                "\n        else if (y <= " a " and y >= " b ")"
                "\n         GOTO " i
                "\n         GOTO " (i + c)
                "\n        else if (y < " b ")"
                "\n         GOTO " i
0x12	abc		"if (z > " a ")"
                "\n         GOTO " (i + c)
                "\n        else if (z <= " a " and z >= " b ")"
                "\n         GOTO " i
                "\n         GOTO " (i + c)
                "\n        else if (z < " b ")"
                "\n         GOTO " i
0x13	abc		"if ((y + z) > " a ")"
                "\n         GOTO " (i + c)
                "\n        else if ((y + z) <= " a " and (y + z) >= " b ")"
                "\n         GOTO " i
                "\n         GOTO " (i + c)
                "\n        else if ((y + z) < " b ")"
                "\n         GOTO " i
0x14	abc		"if ((y - z) > " a ")"
                "\n         GOTO " (i + c)
                "\n        else if ((y - z) <= " a " and (y - z) >= " b ")"
                "\n         GOTO " i
                "\n         GOTO " (i + c)
                "\n        else if ((y - z) < " b ")"
                "\n         GOTO " i
0x15	abc		"if ((x + z) > " a ")"
                "\n         GOTO " (i + c)
                "\n        else if ((x + z) <= " a " and (x + z) >= " b ")"
                "\n         GOTO " i
                "\n         GOTO " (i + c)
                "\n        else if ((x + z) < " b ")"
                "\n         GOTO " i
0x16	abc		"if ((x - z) > " a ")"
                "\n         GOTO " (i + c)
                "\n        else if ((x - z) <= " a " and (x - z) >= " b ")"
                "\n         GOTO " i
                "\n         GOTO " (i + c)
                "\n        else if ((x - z) < " b ")"
                "\n         GOTO " i
0x17	abc		"if ((x + y) > " a ")"
                "\n         GOTO " (i + c)
                "\n        else if ((x + y) <= " a " and (x + y) >= " b ")"
                "\n         GOTO " i
                "\n         GOTO " (i + c)
                "\n        else if ((x + y) < " b ")"
                "\n         GOTO " i
0x18	abc		"if ((x - y) > " a ")"
                "\n         GOTO " (i + c)
                "\n        else if ((x - y) <= " a " and (x - y) >= " b ")"
                "\n         GOTO " i
                "\n         GOTO " (i + c)
                "\n        else if ((x - y) < " b ")"
                "\n         GOTO " i
0x19	abc		"if ((x + y + z) > " a ")"
                "\n         GOTO " (i + c)
                "\n        else if ((x + y + z) <= " a " and (x + y + z) >= " b ")"
                "\n         GOTO " i
                "\n         GOTO " (i + c)
                "\n        else if ((x + y + z) < " b ")"
                "\n         GOTO " i
0x1A	abc		"if ((x + y - z) > " a ")"
                "\n         GOTO " (i + c)
                "\n        else if ((x + y - z) <= " a " and (x + y - z) >= " b ")"
                "\n         GOTO " i
                "\n         GOTO " (i + c)
                "\n        else if ((x + y - z) < " b ")"
                "\n         GOTO " i
0x1B	abc		"if ((x - y + z) > " a ")"
                "\n         GOTO " (i + c)
                "\n        else if ((x - y + z) <= " a " and (x - y + z) >= " b ")"
                "\n         GOTO " i
                "\n         GOTO " (i + c)
                "\n        else if ((x - y + z) < " b ")"
                "\n         GOTO " i
0x1C	abc		"if ((x - y - z) > " a ")"
                "\n         GOTO " (i + c)
                "\n        else if ((x - y - z) <= " a " and (x - y - z) >= " b ")"
                "\n         GOTO " i
                "\n         GOTO " (i + c)
                "\n        else if ((x - y - z) < " b ")"
                "\n         GOTO " i
0x20	ab		"if (" a " ?[x20]? )"
                "\n         GOTO " (i + b) " and/or"
                "\n         GOTO " i
0x21	ab		"if (" a " ?[x21]? )"
                "\n         GOTO " (i + b) " and/or"
                "\n         GOTO " i
0x22	ab		"if (" a " ?[x22]? )"
                "\n         GOTO " (i + b) " and/or"
                "\n         GOTO " i
0x23	abcdef	"if " a " ?unknown test? " b 
				"\n GOTO " c*256 + d " and/or "
				"\n GOTO " e*256 + f
0x26	ab		"if (x < " a " or x > " b ") exit"
0x27	ab		"if (y < " a " or y > " b ") exit"
0x28	ab		"if (z < " a " or z > " b ") exit"
0x29	abcd	"OpCode: 0x29  a=" a " b=" b " c=" c " d=" d
0x2A	abcd	"OpCode: 0x2A  a=" a " b=" b " c=" c " d=" d
0x2B	abcd	"OpCode: 0x2B  a=" a " b=" b " c=" c " d=" d
0x30..
0x4F			"select triangle " o - 48 + t " and exit"
0x50	a		"select triangle " a + t " and exit"
0x51	ab		"select triangle " a*256 + b + t " and exit"
0x53	abcd	"select triangle " c*256 + d + t " and exit (a = " a ",  b = " b ")"
0xCD			"nop"
