We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

simple-octal

From Esolang
Jump to navigation Jump to search

simple-octal is a simple assembly-like language made to be easy to simulate and use, and it is currently at v1

goals

  • easy to code a simulator for
  • easy to write in
  • use octal

character set (00xx)

  01234567
0x01234567
1x89abcdef
2xghijklmn
3xopqrstuv
4xwxyzABCD
5xEFGHIJKL
6xMNOPQRST
7xUVWXYZ \n

instructions

there are 64 registers and 64 instructions

the shorthand for referencing a register in the command definition is "r "

instructions are zeropadded

registers cap out at 4095, or (8^4)-1

registers start at 0

this is the v1 instruction set, more versions will add more instructions and they will be marked with (v2), (v3), etc.

0 - no operation
0AAAAA - comment
1 - control flow
10 AAAA - jump to instruction AAAA
11 AA BB - jump to the instruction r AA if r BB is equal to 0
12 AA BB - skip the next instruction if r AA and r BB are equal
13 AA BB - skip the next instruction if r AA is less than r BB
14 AA BB - skip the next instruction if r AA is more than r BB
2 - math
20 AA BB - store r AA + r BB in r AA
21 AA BB - store r AA - r BB in r AA
22 AA BB - store r AA * r BB in r AA
23 AA BB - store floor of r AA / r BB in r AA
24 AA BB - store r AA % r BB in r AA
25 AA BB - set r AA to BB
26 AA BB - set r AA to r BB
3 and 4 - screen
30 AAAA - clear screen
40 AA BB - write character AA and character BB
41 AA BB - write character r AA and character r BB
42 AA BB - write character AA only
43 AA BB - write character r AA only
44 AA BB - write the content of r AA
7 - misc
70 AA BB - wait for a character as user input. put it in r aa. leave r aa as is if the user input is invalid or cancelled
77 AAAA - halt program

example programs

hello world (108 bits)

405316
402525
403076
407230
403325
425100

fibonacci (162 bits)

250000
250101
260200
200201
440200
260001
260102
427700
100003

truth machine (144 bits)

700000
250101
120001
420000
120001
777777
400101
100006

linear bounded automata proof

i will prove that this assembly is equivalent to a bounded version of the WDR paper computer, which is normally turing complete:

inc x - 257701 20 x 77
dec x - 257701 21 x 77
jmp x - 10 x
isz x - 257700 12 x 77
stp - 777777