GPRX 3000 is an esoteric programming language invented by xfix in 2016 implemented on non-existent GPRX 3000 CPU with three arbitrary precision registers and no external memory support.
GPRX 3000 programs are ran from beginning to end. All three general purposes registers and program counter are initialized to zero at program start. CPU implements the following commands.
||Adds contents of register B to register A.|
||Subtracts contents of register B from A, and assigns the result to A. Throws an exception if a result is negative, as GPRX 3000 CPU doesn't support negative integers.|
||Multiplies contents of register A and B, and sets the result to A.|
||Divides contents of register A by B, and sets the result to A.|
||Performs modulo operation of register A using B, and assigns the result to A.|
||Sets the program counter to contents of register A. This instruction doesn't cause program counter to increment after a jump. Throws an exception if program counter would be outside of program.|
||Sends a current byte from register A to I/O port, which on emulator means standard output.|
||Reads a byte from I/O port, increments it by 1, and sets it to register A. On error, 0 is returned. On emulator reading means reading from standard input.|
||Sets register A to be register C, register B to be register A, register C to be register B.|
Additionally, you can type in decimals in order to assign them to register A.
All other characters including whitespace throw an exception when executed, due to programs being supposed to be ran on CPU (subject to change).
Those programs assume themselves ending with a newline, as language throws an exception when GOTO instruction goes beyond the end of a program.
For a function given by
f(mx+i) = aix + bi, i=0..m-1,
at program position
X, put the code
and at program positions
for a remainder that continues or
for a remainder that halts.
X is the entry point of the loop,
Z where it should jump when halting, and
Y may be chosen as whatever makes the parts fit into the program.