RGB4D

RGB4D is a 4d esoteric programming language created by ProtoByter.
=Commands=
Colour (RGBA) 	Action
Anything with alpha != 255	Ends the program
Directional 	
(255, 127, 0, 255) 	Changes the code execution direction to +X
(255, 127, 127, 255) 	Changes the code execution direction to -X
(255, 191, 0, 255) 	Changes the code execution direction to +Y
(255, 191, 127, 255) 	Changes the code execution direction to -Y
(255, 63, 0, 255) 	Changes the code execution direction to +Z
(255, 63, 127, 255) 	Changes the code execution direction to -Z
(255, 255, 0, 255) 	Changes the code execution direction to +W
(255, 255, 127, 255) 	Changes the code execution direction to -W
Maths 	(Resultant value stored in A)
(127, 127, 0, 255) 	Add the current cell value to A
(127, 127, 31, 255) 	Subtract the current cell value from A
(127, 127, 63, 255) 	Multiply A by current cell value
(127, 127, 127, 255) 	Divide A by current cell value
(127, 127, 158, 255) 	Increment A
(127, 127, 191, 255) 	Decrement A
Storage 	See storage notes below
(63, 127, 0, 255) 	Increment the cell pointer
(63, 127, 127, 255) 	Decrement the cell pointer
(63, 255, 0, 255) 	Store A to current cell
(63, 255, 255, 255) 	Load A from current cell
(63, 255, 63, 255) 	Store random value into A - from MT19937
Conditionals 	When true, direction is set to +X, otherwise it is set to -X
(191, 63, 127, 255) 	Current cell value == A
(191, 127, 127, 255) 	Current cell value > A
(191, 191, 127, 255) 	Current cell value < A
(191, 127, 0, 255) 	Current cell value >= A
(191, 191, 0, 255) 	Current cell value =< A
(191, 255, 0, 255) 	Current cell value != A
Functions 	See function notes below
(255, 255, 255, 255) 	Run function A
(0, 0, 0, 255) 	Define function A
(255, 0, 0, 255) 	End function definition
I/O 	
(255, 127, 255, 255) 	Take one character as input and store in A
(255, 0, 255, 255) 	Print ASCII Character for A
== Storage notes ==
RGB4D uses a cell based storage system (with a cell pointer and 256 uint16_t cells). It also has an Accumulator (A) which is uint16_t and is used by most instructions which operate on a value
== Function notes ==
Functions are specified by a number, which is usually passed as A. The parameters for a function should be in the cells including and after the cell denoted by the cell pointer. Functions may also be loaded from an ELF or DLL library (NOTE: This feature isn't required and thus won't be in all interpreters that are made). If a function is loaded from a library then it is numbered as the function's number in that library but with 10000 (This number isn't meaningful in any way, it's just arbritary) added to it.
=Rules=
For storage, see storage notes above
X, Y and Z are all limited to having a max value of 16. W is limited by the maximum unsigned byte that the target can support (so for a 64bit CPU it'd be 2^64 whilst for an 8bit CPU it'd be limited to 256)
=Programs=
Truth Machine program by ProtoByter
 W2
 I 127 127 158 255 0 0 0 0 ; Get 4 into A
 I 127 127 158 255 1 0 0 0
 I 127 127 158 255 2 0 0 0
 I 127 127 158 255 3 0 0 0
 I 63 255 0 255 4 0 0 0 ; Store A to the current cell
 I 255 191 0 255 5 0 0 0 ; Change to +Y
 I 127 127 158 255 5 1 0 0 ; Add 8 onto that to get 12
 I 127 127 158 255 5 2 0 0 
 I 127 127 158 255 5 3 0 0
 I 127 127 158 255 5 4 0 0
 I 127 127 158 255 5 5 0 0
 I 127 127 158 255 5 6 0 0
 I 127 127 158 255 5 7 0 0
 I 127 127 158 255 5 8 0 0
 I 127 127 63 255 5 9 0 0 ; Multiply!
 I 63 255 0 255 5 10 0 0 ; Store 48 to the cell
 I 255 127 255 255 5 11 0 0 ; Get input
 I 255 255 0 255 5 12 0 0 ; Move to next W plane
 I 255 127 127 255 5 12 0 1 ; Set direction to -X
 I 255 0 255 255 4 12 0 1 ; Print character
 I 191 255 0 255 3 12 0 1 ; Check if A != cell
Category:Languages Category:Cell-based Category:Unimplemented