esolang

Tonnyi

An assembly language with the mnemonics taken away. Every instruction is its 7-bit opcode, written out in binary.

Hasin Israk Toaha, 2025 · Turing complete: yes · ●●○ moderate · esolangs.org

Tested with 3 known programs · Test method

Run it

Expected: Hi

The idea

Hasin Israk Toaha made Tonnyi in 2025 as an educational interpreter in Java. It has 44 instructions for memory, arithmetic, bitwise logic, jumps, a call stack, input and output, as an ordinary assembly language does, but none of them has a name in the source. ADD is 0b0001010 and HALT is 0b0000000, so a reader has to know the table by heart. 84 of the 128 possible opcodes are not used.

Read the story

Memory is 65,536 cells, addressed 0x0000 to 0xFFFF. Each cell holds a decimal of any size, which the reference keeps in Java's BigDecimal, so 0.1 plus 0.2 is exactly 0.3.

The machine

OpcodesDo
0b0000000 to 0b0000010Halt, nothing, dump memory
0b0000011Print a number
0b0000100 to 0b0001001Load an immediate, copy (three opcodes), swap, clear
0b0001010 to 0b0010011Add, subtract, multiply, divide, modulo, increment, decrement, power, negate, absolute
0b0010100 to 0b0011001And, or, xor, not, shift left, shift right
0b0011010Compare two values
0b0011011 to 0b0100001Jump, and jump if the comparison was zero, not zero, equal, not equal, greater or less
0b0100010 to 0b0100101Call, return, push, pop
0b0100110 to 0b0101000Read a number, print a character, print a string up to a 0
0b0101001A random number from 0 to 100
0b0101010 0b0101011Debug mode on and off

Operands are addresses like 0x002A, immediates like #-42 or #3.14159, or labels, which stand on a line of their own and end in a colon. // starts a comment. Arithmetic puts its result in the first address.

The specification does not show the reference's debug output, so in this implementation debug mode and the memory dump print nothing. Nothing prints a line break unless the program prints one, and division stops at 34 decimal places. Random numbers come from a fixed seed, so every run is the same.

Example

The first program stores the codes of H and i and prints them as a string, which ends at the first cell…
Expected: -2.5
Expected: 321

The first program stores the codes of H and i and prints them as a string, which ends at the first cell that holds 0. The second is the addition program without its comments. The third prints 3, counts down, and jumps back while the count is greater than 0.

Further

Educational

Cell-based

Write your own in Run Convert a program from Tonnyi

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: tonnyi.

Command line

shib run tonnyi -e '// Read two numbers and print their sum
0b0100110 0x2000       // INPUT first number
0b0100110 0x2001       // INPUT second number
0b0000101 0x2002 0x2000 // COPY first number
0b0001010 0x2002 0x2001 // ADD second number
0b0000011 0x2002       // PRINT result
0b0000000              // HALT' --input '2
3'
shib manual tonnyi

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/tonnyi.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org