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.
Malbolge20
Malbolge20 is a variant of Malbolge with twenty-trit words and addresses. It has 320 = 3,486,784,401 memory cells, each holding a value from 0 to 320−1.[1]
Motivation
The 2013 report introducing Malbolge20 describes a practical limit of the existing low-level assembler: generated programs could exceed original Malbolge's 59,049-word memory. The proposed extension widened words and addresses from ten to twenty trits. Its programming environment adapted memory management, the assembler and the debugger to the larger machine.[2]
Machine model
Code and data share memory. Registers A (accumulator), C (code
pointer) and D (data pointer) start at zero; [x] denotes
the contents of cell x. The reference loader skips whitespace, stores
source character codes from address zero, and initializes later cells by
[i] = crazy([i−1], [i−2]). Source characters must be printable
ASCII and decode to one of the eight named instructions at their
positions.[3]
Instruction selection depends on ([C] + C) mod 94:[3]
| Residue | Decoded character | Effect before the common update |
|---|---|---|
| 4 | i |
C := [D] |
| 5 | < |
Output A |
| 23 | / |
Read input into A |
| 39 | * |
A := [D] := rotate([D]) |
| 40 | j |
D := [D] |
| 62 | p |
A := [D] := crazy(A, [D]) |
| 68 | o |
No operation |
| 81 | v |
Halt |
Other decoded characters are no-operations at runtime; only o
is accepted for a no-operation source cell. After a non-halting instruction,
Malbolge's replacement table modifies the cell at the current C;
then C and D increment modulo 320. A jump therefore modifies the
cell at the newly assigned C before execution continues at C+1.[3]
The Malbolge operations retain their trit-wise definitions, but rotation and crazy operate on twenty trits. Original programs are not generally compatible: rotating 1 produces 1,162,261,467 rather than the ten-trit result 19,683.[3]
On byte-oriented ASCII systems, the reference C interpreter reads bytes and outputs A modulo 256. Its EOF behavior assigns A = 59049, rather than the twenty-trit all-twos value 320−1.[3]
The address space remains finite, unlike the unbounded-memory design of Malbolge Unshackled.
Programming tools
The project's C-like frontend targets pseudo-instruction sequences with
control (.mg), then low-level assembly language (LAL,
.mc), a memory image (.data), and executable
Malbolge20 source (.mb).[4]
These intermediate languages and frontends, including the Python-subset
compiler linked below, are tools targeting Malbolge20; their constructs do
not extend its machine instruction set.
See also
References
- ↑ Malbolge and Malbolge20, official project page.
- ↑ Tatsuki Kato, Masahiko Sakai, Toshiki Sakabe, Keiichirou Kusakari and Naoki Nishida. Malbolgeのワード長の拡大とそのプログラミング支援ツール (Malbolge with 20trits word length and its programming support tool). IEICE Technical Report 113(160), 73–78, July 2013. Institutional record and abstract.
- ↑ 3.0 3.1 3.2 3.3 3.4 Reference C interpreter, revision 2b42f4817afecca6b4c4f7374e21a399b6488e31.
- ↑ malbolge20_creator README, pipeline description.
External resources
- Malbolge20 project website and tools
- pyMalbolge — compiler from a subset of Python to Malbolge20, with an interpreter and debugger