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.
User:CodePentuplets48/Draft 1
TetraBit is an esolang I designed which uses a slightly 4 Bits, 4 Bytes aesthetic, however with different instructions and unlimited program size. 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. |
| 1 X | LDA. Loads the value at the address X. |
| 2 X Y | STA. Stores the value X at address Y. |
| 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 BNEs). |
| 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 valid TetraBit code:
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 1 3 3 3 1 4 2 1 D 1 0 2 2 1 1 2 3 1 2 B 2 0 E 0 F
Or, without spaces:
C013331421D1022112312B20E0F