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.
TetraBit
TetraBit is an esoteric assembly language I designed which uses a slightly 4 Bits, 8 Bytes aesthetic, however with different instructions and unlimited program size. You can write it in either assembly- or machine-code style. There are 16 memory addresses, 0-15 (or F) and they are split up like this:
- Addresses 0-6 are the 7 free variables.
- Addresses 7-E make up a 4x2 screen.
- Address F is a read-only which holds one random value, 0-F, changing every instruction.
| Instruction | 6502-esque description |
|---|---|
| 0 | NOP instruction. Mainly there to fill lines, however it also updates the screen. |
| 1 X Y | STA. Stores the value X at address Y. |
| 2 X | LDA. Loads the value at address X. |
| 3 X Y | INC. Increments the value at address X by Y. |
| 4 X Y | DEC. Decrements the value at address X by Y. |
| 5 X Y | MOD. Turns the value at address X into itself modulo Y. |
| 6 X | ACT. Turns the value at address X into 9*X + 1, modulo 16. |
| 7 X Y | AND. Logical-ANDs the value at address X with value Y. |
| 8 X Y | ORA. Logical-ORs the value at address X with value Y. |
| 9 X Y | XOR. Logical-XORs the value at address X with value Y. |
| 10 (or A) X | NOT. Bitwise NOTs the value at address X. |
| B X Y | BEQ. Branches if the value at address X and value Y are equal. |
| C X | "DSR". Defines a subroutine with label value X. |
| D | "ENS". Ends the current subroutine being defined or used (subroutines are implicit when inside BEQs). |
| E X | "CSR". Calls the subroutine with label value X. |
| F | HLT/END. Halts the program. |
An example of using BEQ correctly (linebreaks added for readability):
B 5 0 3 5 1 ; if true D ; end true subroutine 3 5 2 ; if false D ; end false subroutine D ; merge branches by ending branch subroutine F ; end program (must go at end of full program)
Here it is without linebreaks, as machine code in TetraBit:
B 5 0 3 5 1 D 3 5 2 D D F
The memory is visualized like this:
0 1 2 3 4 5 6
/ \
789A | F |
BCDE \ /
Now how must 0-F look as colors on the screen? Like this.
| Value | RGB color (3-bit when possible) |
|---|---|
| 0 | #000 |
| 1 | #808080 |
| 2 | #00f |
| 3 | #8080ff |
| 4 | #0f0 |
| 5 | #80ff80 |
| 6 | #0ff |
| 7 | #80ffff |
| 8 | #f00 |
| 9 | #ff8080 |
| A | #f0f |
| B | #ff80ff |
| C | #ff0 |
| D | #ffff80 |
| E | #fff |
F is transparent, so on some interfaces it will be white, on others black, depending on how it is handled. It may also be a light-gray/white checkerboard, a common pattern to show transparency.
Example programs
Multiplies two values together:
C 0 2 3 3 3 1 4 2 1 D 2 0 2 2 1 1 2 3 1 2 E 0 F
Or, more readably:
C 0 ; define subroutine 0 as: 2 3 ; load address 3 3 3 1 ; increment address 3 by 1 4 2 1 ; decrement address 2 by 1 D ; end subroutine ;; (definition's end) 2 0 ; load address 0 2 2 1 ; store 2 at address 1 1 2 ; load address 2 3 1 2 ; increment address 1 by 2 E 0 ; call subroutine 0 F ; end
Paints a hard-coded checkerboard of blue and cyan pixels:
1 2 7 1 2 9 1 2 C 1 2 E 1 6 8 1 6 A 1 6 B 1 6 D F
Or:
1 2 7 1 2 9 1 2 C 1 2 E 1 6 8 1 6 A 1 6 B 1 6 D F