Subleq is a One Instruction Set Computer(OISC) architecture.
The Subleq instruction subtracts the contents at address a from the contents at address b, stores the result at address b, and if the result is negative or zero, jumps to address in c. If the result is positive, execution proceeds to the next instruction.
if (mem[B] -= mem[A]) <= 0 goto C
Each Subleq instruction is stored in 3 cells, each cell holds a number. For example, to add two numbers, 3 and 4, stored in cells 0x9 and 0xa.
0 0 0 3 m[0] - m[0], m[0] = 0, jump to 3. 3 9 0 6 m[0] - m[9], m[0] = -3, jump to 6. 6 0 a 0 m[a] - m[0], m[a] = 7.. 9 3 4 0
Interpreter
Subleq programs can be encoded in Uxntal and evaluated. Here is an example program that adds to numbers and copies the result into a specific cell:
Jump(Q)
&0 -&0 -&0 -/Q &Q
Adding(x,y)
&0 -&0 -&0 -/1 &1 -&x -&0 -/2 &2 -&0 -&y -/Q &x 12 &y 34 &Q
Move(x,y)
&0 -&0 -&0 -/1 &1 -&y -&y -/2 &2 -&x -&0 -/3 &3 -&0 -&y -/4 &4 -&0 -&0 -/Q &a 12 &Q
BranchOnEqual(b,c)
&0 -&0 -&0 -/1 &1 -&b -&0 -/L1 &2 -&0 -&0 -/OUT &L1 -&0 -&0 -/4 &4 -&0 -&b -/c &OUT .. &b &c &Q
incoming: uxn devlog 2021 stack