OISC:3 is a three word variant of OISC:4. Naturally, we have to cut down on options. It dispenses with the "if <=0, Jump" from every instruction. Which, frankly, is no great loss. I guess that makes this not technically a Subleq, but it keeps to the spirit of the thing.
Instruction A B C
If A>0: Mem[C]=Mem[B]-Mem[A]
If A=0: If Mem[B]<=0: Jump to C (Mem[|C|] if negative)
Negative addresses are indirect: Mem[Mem[|A|]].
We can still use negative memory for data, but it has to be addressed indirectly.
Memory Function
2 RET (set to NEXT before Jump)
1 NEXT (always IP+3)
0 IP (Initialized to 3) (HALT if negative)
-1 Input (replaces whichever A or B addressed it, -1 if none)
-2 Input Source and format
(0 = wait for STDIN, 1 = immediate STDIN, 2... are Files)
-3 Output (outputs when a value is sent to it)
-4 Output Target and format
(0 is STDOUT, 1 is STDERR, 2... are Files)
-5 Register a
-6 Register b
-7 Register c
-8 Instruction Mode (IM) (activates Registers, then resets itself to 0)
-9... Data
No comments:
Post a Comment
I reserve the right to remove egregiously profane or abusive comments, spam, and anything else that really annoys me. Feel free to agree or disagree, but let's keep this reasonably civil.