Thursday, April 7, 2022

Esolang OISC:4

Here is my esoteric language (esolang), Obfuscated Indirect Subleq with Coprocessor: 4 words per instruction (OISC:4).  {The joke is that OISC stands for One Instruction Set Computer.}

Instruction format:  A B C D are a 4 word instruction.
IP is the Instruction Pointer.  RET is the return pointer.
Positive memory:  Instructions and data, assumed to be signed integers.
Negative memory:  Coprocessor and data, may be integers or floats.

D>0:  Mem[C] = Mem[B] - Mem[A]; 
    if Mem[C]<=0, RET=NEXT, IP=D; else IP=NEXT

D=0:  Mem[C] = Mem[B] - A; (A is Literal)
    IP=NEXT

D<0:  Mem[Mem[C]] = Mem[Mem[B]] - Mem[Mem[A]]; (Indirect)
    if Mem[Mem[C]]<=0, RET=NEXT, IP=Mem[|D|]; else IP=NEXT

Low Memory

3        Z (initialized to 0)
2        RET (initialized to 4)
1        NEXT (always IP+4)
0        IP (if <0, HALT) initialized to 4
-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)
-9...    Data

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

IM       Effect

0        No Op
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.