User:Potatoswatter/oisc

Here is a sequence implementing subleq( a, b, c ) as above. The address c must be positive and the machine must increment the program counter at address 0 after committing the store to memory.

c2 # Clear acc, c2 c2 c2 d # Load o c2 # c2 = -o, skip @d: (o = @branch_point - c + 1) # use skipped insn as a register t # Clear acc, t t t a  # Load a b  # b = b - a t  # if ab, acc = -o + a-b, may skip t # t = (a=b: o - a+b) @branch_point: 0 # pc = @branch_point - (@branch_point - c + 1), branch to c  # else continue...