2 undigits, 121 undigytes
A base-11 computer with seven registers and 121 words. The program is the memory it starts with.
Mutasimos, 2026 · Turing complete: no · ●●○ moderate · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
Mutasimos made this in 2026, after the base-5 3 pentits, 25 pentytes and a base-7 machine seen after it. A composite base would be easier, so the specification picks the next prime, 11. An undigit is one digit from 0 to X, and an undigyte is two of them, so a word holds 0 to 120. There are 121 words, and code and data share them.
The machine
A program lists the memory's first words, each as 0u and undigits or in decimal, with ; comments. The rest of the memory is 0, which is nop. The pointer starts at word 0 and wraps after 0uXX, and the run goes on until hlt. The seven registers are ra to re, sp and bp; all start at 0 but sp, which starts at 0uXX.
| Opcode | Does |
|---|---|
0u00 0u01 | nop; halt |
0u02 0u03 | mov from a register; mov a number |
0u04 to 0u08 | add, sub, mul, div, mod with a register |
0u09 to 0u12 | The same with a number |
0u14 | Jump |
0u15 to 0u18 | Load and store, at an address or at a register's address |
0u19 0u1X 0u20 0u21 | push, pop, call, ret |
0u22 to 0u29 | Jump if zero, not zero, equal, not equal, below, above, then below and above signed |
0u2X 0u30 | Print a register in undecimal or in decimal |
0u31 0u32 | Print words as text |
Two register operands share one word, the first as its high undigit, so mov ra, rb is 0u02 0u01. Arithmetic wraps at 121. The text encoding has 121 characters; 0u47 is H and 0u01 a line feed.
Example
The Hello, World! program puts the address of the message, word 7, in ra and prints 14 words from there.
The Hello, World! program puts the address of the message, word 7, in ra and prints 14 words from there.
The truth machine loads its last word, 0 in this program, prints it and loops while it is not 0; with a 1 there it prints 1 forever. The Fibonacci stops when a sum wraps past 120 and comes out smaller, so 89 is the last number it prints.
The specification leaves the stack's direction open. In this implementation a push writes where sp points and then lowers it, so the first push fills 0uXX.
Patterns it teaches
- Self-modifying code: stores write into the words the program runs from.
See also
Self-modifying
Write your own in Run Convert a program from 2 undigits, 121 undigytes
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: 2-undigits-121-undigytes.
Command line
shib run 2-undigits-121-undigytes -e '0u03 0u00 0u07 ; mov ra, msg (0u07)
0u32 0u00 14 ; outs ra, 14
0u01 ; hlt
0u47 0u74 0u80 ; msg: du "Hello, World!\n"
0u80 0u83 0u21
0u10 0u60 0u83
0u86 0u80 0u73
0u11 0u01'shib manual 2-undigits-121-undigytesSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/2-undigits-121-undigytes.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org