XXIIVV

SUBLEQ is a type of 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 then, if the result is not positive, jumps to address c. If the result is positive, execution proceeds to the next instruction in sequence.

if (mem[B] -= mem[A]) <= 0 
	goto C

Each subleq instruction has 3 operands which are memory addresses:

A B C

For example, in the following example, the first instruction subtracts 7 (address 3) from 7 (address 4). The result in address 4 is 0, so goto 6. On address 6 is the instruction 3 4 0 which again subtracts 7 from now 0 and jumps back to 0.

3 4 6
7 7 7
3 4 0

Instructions

JMP c
Z Z c
ADD a, b
a, Z
Z, b
Z, Z
MOV a, b
b, b
a, Z
Z, b
Z, Z
BEQ b, c
b, Z, L1
  Z, Z, OUT
L1:
  Z, Z
  Z, b, c
OUT:
  ...