Monday, April 11, 2022

Esolang: OISC 3b

In a (vain, I know) attempt to standardize things, here is OISC:3b, based on OISC:2.  I really do like this format better.  And there are 27 distinct combinations of +/0/- leading to obfuscatory effects!

Obfuscated Indirect Subleq with Coprocessor

Three word instruction:  A B C   

General form: C=B-A 
        Why not A-B=C?  Obfuscation is in the name!

Negative words are indirect addressing, which can be mixed: 
        [C]/[[|-C|]] = [B]/[[|-B|]] - [A]/[[|-A|]]

Instructions are only in positive memory.

If B=0 & C>0:  Output [A]/[[|-A|]] to I/O indicated by C. 

        1= STDOUT, 2= STDERR, 3...= File.
If A=0 & C>0:  Input [B]/[[|-B|]] from I/O indicated by C. 
        1= STDIN, 2= STDERR, 3...= File.

If B=0 & C<0:  Copy [A]/[[|-A|]] to [C]  (to negative memory)
If A=0 & C<0:  Copy [C] to [B]/[[|-B|]] (from negative memory)

If C=0:  If [A]/[[|-A|]] <=0, Jump B/[|-B|]
If A,C=0:  Jump [B]/[[|-B|]]
If B,C=0:  Relative Jump A

If A,B=0:  If [C]/[[|-C|]]<=0, HALT
If A,B,C=0:  HALT


Mem    Function

-1        IP (initialized to 0)
-2        NEXT (always IP+3)
-3        RETURN (set to NEXT before Jump]
-4        Register a
-5        Register b
-6        Register c
-7        Instruction Mode (activates on a,b,c; then resets to 0=NOP)
-8...     Data


Instruction Mode :  Takes immediate action on a,b,c, then resets to 0.

Mode       Effect

0        NOP
1        c = NOT a
2        c = b AND a
3        c = b OR a
4        c = b XOR a
5        c = b << a bits
6        c = b >> a bits
7        c = b*a
8        c = b/a (floored integer division) (HALT on /0)
9        c = b%a (Mod) (floored) (HALT on %0)
10        c = Sign of Int b (+1, 0, -1)
11        c = Sign of Float b (+1, 0, -1)
12        Int c --> Float c
13        Float c --> Int c
14        Int a,b --> Float a,b
15        Float a,b --> Int a,b
16        Float: c = b-a
17        Float: c = b+a
18        Float: c = b*a
19        Float: c = b/a (HALT on /0)
20        Float: c = power a of b
21        Float: c = root a of b (HALT on root 0)
22        Float: c = Log base b of a (HALT on base 0)
23        Float: c = SIN b
24        Float: c = COS b
25        Float: c = TAN b
26        Float: c = CSC b
27        Float: c = SEC b
28        Float: c = COT b
29        Float: c = ASIN b
30        Float: c = ACOS b
31        Float: c = ATAN b
32        Float: c = ACSC b
33        Float: c = ASEC b
34        Float: c = ACOT b
35        Float: a = pi, b = e, c = phi
36        Float: a = 1.0, b = 0.0, c = -1.0

Extensions to Mode are left to the user.

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.